Hello, this seems to be an issue on my end versus the module itself, but I cannot figure out what I am doing wrong.
Here is my sv_db.lua
require("mysqloo")
DB_HOST = "credentials"
DB_USER = "credentials"
DB_PASS = "credentials"
DB_NAME = "credentials"
db = mysqloo.connect(DB_HOST, DB_USER, DB_PASS, DB_NAME)
function db:onConnected()
print ("Database has connected!")
end
function db:onConnectionFailed(err)
print( "Connection to database failed!" )
print( "Error:", err )
end
db:connect()
local query = db:query("SELECT 1, 2, 3")
function query:onSuccess(data)
local row = data[1]
for k,v in pairs(row) do
print(v) -- should print 1, 2, 3
end
end
function query:onError(err)
print("An error occured while executing the query: " .. err)
end
query:start()
I have confirmed that db is returning a Database, so it seems to be loading the module properly. What am I doing wrong? The server is 32-bit Linux.
ETA: I have also confirmed that db:status() returns 1.
I'm going to close this. I looked through some other issues and found that a bot or player needs to be spawned in for the callbacks to be called. Thanks!
Hello, this seems to be an issue on my end versus the module itself, but I cannot figure out what I am doing wrong.
Here is my sv_db.lua
I have confirmed that
db
is returning aDatabase
, so it seems to be loading the module properly. What am I doing wrong? The server is 32-bit Linux.ETA: I have also confirmed that
db:status()
returns 1.