Advertisement
Guest User

Untitled

a guest
Dec 24th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. local connection = nil
  2. addEventHandler("onResourceStart", resourceRoot,
  3. function(resource)
  4. connection = dbConnect("mysql", "dbname=ig_gaming;host=localhost;port=3306;","root","martinka02")
  5. if connection then
  6. outputDebugString(getResourceName(resource).." : Csatlakozott az adatbázishoz!")
  7. return true
  8. else
  9. outputDebugString(getResourceName(resource).." : Nem tudodd csatlakozni az adatbázishoz!")
  10. return false
  11. end
  12. end
  13. )
  14.  
  15. function _Query( ... )
  16. if connection then
  17. local query = dbQuery(connection, ... )
  18. local result = dbPoll(query, -1)
  19. return result
  20. else
  21. return false
  22. end
  23. end
  24.  
  25. function _QuerySingle(str,...)
  26. if connection then
  27. local result = _Query(str,...)
  28. if type(result) == 'table' then
  29. return result[1]
  30. end
  31. else
  32. return false
  33. end
  34. end
  35.  
  36. function _Exec(str,...)
  37. if connection then
  38. local query = dbExec(connection, str,...)
  39. return query
  40. else
  41. return false
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement