1. Post #281
    Terminal Shell Founder
    mr.wolf's Avatar
    July 2010
    820 Posts
    http://www.facepunch.com/threads/933...1#post25138989

    Also, rename the binaries to gmsv_mysqloo_linux.dll and gmcl_mysqloo_linux.dll
    Reply With Quote Edit / Delete United States Show Events

  2. Post #282
    infinitywrai's Avatar
    December 2007
    539 Posts
    Is this threaded? I'm getting some major lag when people initially join the server, and I'm wondering if it could be caused by my MySQL queries.
    Reply With Quote Edit / Delete United States Show Events

  3. Post #283

    August 2007
    152 Posts
    LUA is not threaded. This runs everything in background instead of making you wait for a return
    Reply With Quote Edit / Delete United States Show Events

  4. Post #284
    Terminal Shell Founder
    mr.wolf's Avatar
    July 2010
    820 Posts
    LUA is not threaded. This runs everything in background instead of making you wait for a return
    While it is true that LUA isn't threaded, this module is. So the call to the module is not threaded, however the actual mysql queries themselves, as handled by the module, are.

    It is possible that the additional networking is causing your server to be sluggish, as happens for me if I try to run a bunch of queries at the same time (10+)
    Reply With Quote Edit / Delete United States Show Events

  5. Post #285
    zzaacckk's Avatar
    June 2009
    2,153 Posts
    snip
    Reply With Quote Edit / Delete United States Show Events Dumb Dumb x 2 (list)

  6. Post #286

    August 2009
    17 Posts
    Ubuntu - Linux
    I made this work one but now when I had to do it again I failed!
    I renamed the dll's. I downloaded the libmysql and renamed it.
    I'm trying to run the test lua file that's included in the Linux version but I'm getting this error (look for the comment):
    Code:
    Starting GMOD Server
    Auto detecting CPU
    Using default binary: ./srcds_linux
    Enabling debug mode
    Server will auto-restart if there is a crash.
    INFO: Located steam: ../steam
    Updating server using Steam.
    Checking bootstrapper version ...
    Updating Installation
    Checking/Installing 'Base Source Shared Materials' version 8
    
    Failed to set file attributes
    CAsyncIOManager: 0 threads terminating.  0 reads, 0 writes, 0 deferrals.
    CAsyncIOManager: 97 single object sleeps, 0 multi object sleeps
    CAsyncIOManager: 0 single object alertable sleeps, 0 multi object alertable sleeps
    Sun Feb 27 01:55:58 MSK 2011: Steam Update failed, ignoring.
    Using breakpad minidump system
    Using breakpad crash handler
    
    Console initialized.
    ConVarRef mat_dxlevel doesn't point to an existing ConVar
    Game.dll loaded for "Garry's Mod"
    Setting breakpad minidump AppID = 4000
    Forcing breakpad minidump interfaces to load
    Looking up breakpad interfaces from steamclient
    Calling BreakpadMiniDumpSystemInit
    Installing breakpad exception handler for appid(4000)/version(4489)
    Mounting hl2.. OK
    Mounting cstrike.. OK
    Mounting dod.. Failed
    Mounting ep2.. Failed
    Mounting tf.. OK
    Mounting episodic.. Failed
    Mounting hl2mp.. OK
    Mounting portal.. OK
    Mounting lostcoast.. Failed
    Mounting hl1.. Failed
    Mounting hl1mp.. Failed
    Mounting zeno_clash.. OK
    Garry's Mod server.dll Build #112 - Linux
    [Feb  8 2011 14:16:28]
    maxplayers set to 16
    Unknown command "sv_allow_wait_command"
    Unknown command "cl_cmdrate"
    Unknown command "cl_updaterate"
    Unknown command "rate"
    maxplayers set to 16
    Unknown command "port"
    Network: IP 173.0.51.3, mode MP, dedicated Yes, ports 27015 SV / 27005 CL
    Lua initialized (Lua 5.1)
    Registering gamemode 'sandbox' derived from 'base'
    ScriptEnforce is disabled
    Compressing lua files into data pack..
    Skipped. Datapack exists.
    ConVarRef room_type doesn't point to an existing ConVar
    Executing dedicated server config file
    [S_API FAIL] SteamAPI_Init() failed; unable to update local steamclient.dll. Continuing with current version anyway.
    Looking up breakpad interfaces from steamclient
    Calling BreakpadMiniDumpSystemInit
    Failed to load Steam ServiceServiceStart: failed to startexec: couldn't exec server.cfg
    ==[ Version Info ]==============================
    MySQLoo Version:        7
    Client Version: 60000
    Client Info:    6.0.0
     *** SUCCESS ***
    ==[ Connect ]==============================
    [Database:0A168230] // HERE's THE PROBLEM! It's the test when it tries to connect to the database.
    Connection to Steam servers successful.
       VAC secure mode is activated.
    exit
    CAsyncIOManager: 0 threads terminating.  0 reads, 0 writes, 0 deferrals.
    CAsyncIOManager: 0 single object sleeps, 0 multi object sleeps
    CAsyncIOManager: 0 single object alertable sleeps, 0 multi object alertable sleeps
    Reference Count for Material ___error (10) != 0
    Reference Count for Material __depthwrite00 (1) != 0
    Reference Count for Material __depthwrite01 (1) != 0
    Reference Count for Material __depthwrite10 (1) != 0
    Reference Count for Material __depthwrite11 (1) != 0
    Reference Count for Material ___glintbuildmaterial (1) != 0
    Reference Count for Material __particlesdepthwrite (1) != 0
    Sun Feb 27 01:56:07 MSK 2011: Server restart in 10 seconds
    Sun Feb 27 01:56:09 MSK 2011: Server Quit
    The error:
    Code:
    ==[ Version Info ]==============================
    MySQLoo Version:        7
    Client Version: 60000
    Client Info:    6.0.0
     *** SUCCESS ***
    ==[ Connect ]==============================
    [Database:0A168230] // Error? It's not an error code!
    I triple checked that lua file. The database settings are correct.
    Reply With Quote Edit / Delete United States Show Events

  7. Post #287
    Buggzie's Avatar
    December 2009
    965 Posts
    I can't seem to include the module, it'll give me an error:

    Code:
    15:23:58 lua_run require("mysqloo")
    15:23:58 > require("mysqloo")...
    15:23:58 L 02/27/2011 - 15:26:05: Lua Error: error loading module 'mysqloo' from file 'c:\userfiles\admin\gameservers\tc12208281388846518230827\orangebox\garrysmod\addons\mysqloo\lua\includes\modules\gmsv_mysqloo.dll':
    15:23:58 system error 14001
    everything is in proper place, i even tried it WITHOUT the addon and it failed.
    Reply With Quote Edit / Delete Australia Show Events

  8. Post #288
    Terminal Shell Founder
    mr.wolf's Avatar
    July 2010
    820 Posts
    @EmilHem, are you trying to use the libmysql.dll? Cuz that is for windows. Put this in your orangebox/bin folder: http://www.mediafire.com/?y6fs0rw1ruzam7c

    @Buggzie, windows or linux? Windows, be sure you have the libmysql.dll file in your orangebox folder. Linux, see above
    Reply With Quote Edit / Delete United States Show Events

  9. Post #289
    Buggzie's Avatar
    December 2009
    965 Posts
    @EmilHem, are you trying to use the libmysql.dll? Cuz that is for windows. Put this in your orangebox/bin folder: http://www.mediafire.com/?y6fs0rw1ruzam7c

    @Buggzie, windows or linux? Windows, be sure you have the libmysql.dll file in your orangebox folder. Linux, see above
    Windows and IS in orangebox and garrysmod, I tested it on my computer and it worked fine, looks like theres a problem with my dedi.
    Reply With Quote Edit / Delete Australia Show Events

  10. Post #290

    December 2010
    47 Posts
    I think this dll is crashing my server, When I run a SQL database this starts to happen.

    Code:
    Missing shutdown function for Sys_InitAuthentication() : Sys_ShutdownAuthentication()
    Missing shutdown function for S_Init() : S_Shutdown()
    Missing shutdown function for Decal_Init() : Decal_Shutdown()
    Missing shutdown function for InitStudioRender() : ShutdownStudioRender()
    Missing shutdown function for StaticPropMgr()->Init() : StaticPropMgr()->Shutdown()
    Missing shutdown function for modelloader->Init() : modelloader->Shutdown()
    Missing shutdown function for InitMaterialSystem() : ShutdownMaterialSystem()
    Missing shutdown function for HLTV_Init() : HLTV_Shutdown()
    Missing shutdown function for g_Log.Init() : g_Log.Shutdown()
    Missing shutdown function for master->Init() : master->Shutdown()
    Missing shutdown function for sv.Init( bDedicated ) : sv.Shutdown()
    Missing shutdown function for g_GameEventManager.Init() : g_GameEventManager.Shutdown()
    Missing shutdown function for NET_Init( bDedicated ) : NET_Shutdown()
    Missing shutdown function for Key_Init() : Key_Shutdown()
    Missing shutdown function for Filter_Init() : Filter_Shutdown()
    Missing shutdown function for saverestore->Init() : saverestore->Shutdown()
    Missing shutdown function for COM_Init() : COM_Shutdown()
    Missing shutdown function for V_Init() : V_Shutdown()
    Missing shutdown function for g_pCVar->Init() : g_pCVar->Shutdown()
    Missing shutdown function for Cmd_Init() : Cmd_Shutdown()
    Missing shutdown function for Cbuf_Init() : Cbuf_Shutdown()
    Missing shutdown function for Con_Init() : Con_Shutdown()
    Missing shutdown function for Memory_Init() : Memory_Shutdown()
    Missing shutdown function for Host_Init( s_bIsDedicated ) : Host_Shutdown()
    Missing shutdown function for Sys_InitMemory() : Sys_ShutdownMemory()
    Missing shutdown function for Sys_Init() : Sys_Shutdown()
    Missing shutdown function for COM_InitFilesystem( info.m_pInitialMod ) : COM_ShutdownFileSystem()
    Reply With Quote Edit / Delete United Kingdom Show Events

  11. Post #291

    August 2007
    152 Posts
    Tell us where you put the files and show us an example of how you were using it (with your username/password/host ip removed of course)
    Reply With Quote Edit / Delete United States Show Events

  12. Post #292
    ali3n92's Avatar
    April 2008
    716 Posts
    I also think mysqloo crashes my server. It happens randomly on map change. Here's a crash dump: http://dumps.garrysmod.com/?view=2134805007
    Reply With Quote Edit / Delete Romania Show Events

  13. Post #293
    andrem90's Avatar
    July 2007
    36 Posts
    After a lot of trial and error, I got the libmysql.so to run and the gmsv and gmcl file. (Running Debian 64 Bit)

    But now, I got another problem:

    error loading module 'mysqloo' from file <basefolder>/orangebox/garrysmod/lua/includes/modules/gmsv_mysqloo_linux.dll':
    libstdc++.so.6: wrong ELF class: ELFCLASS64

    I don't know what to do, It allways says 'wrong ELF class: ELFCLASS64' regardless of what libstdc++ I use. Also it doesn't use the files from my /usr/lib(64)/ it uses them when I copy them into the orangebox folder. What's going on?

    Edit: Okay, well. I think the problem is, my system does not have any 32-bit libstdc++ files, because they're not neccesary for a 64-bit system. So I think, I have to get the 32-bit files, and copy them right over into my orangebox folder. Not sure tho?
    Reply With Quote Edit / Delete Germany Show Events

  14. Post #294
    taste the salty dong
    Remscar's Avatar
    September 2009
    1,822 Posts
    ive learned not to use this module.

    For people who dont understand, this module uses threads to execute database commands. While this is better for performance there are technical problems, for example the data you want will not necessarily be ON-DEMAND, which for many RP GameModes, that is required. There cannot be a delay between the data being asked for and recieved, the data needs to be there, right then and there, not in another thread.


    I know there are work arounds, but they require lots of time to prefect.
    Reply With Quote Edit / Delete United States Show Events Dumb Dumb x 4 (list)

  15. Post #295
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts
    ive learned not to use this module.

    For people who dont understand, this module uses threads to execute database commands. While this is better for performance there are technical problems, for example the data you want will not necessarily be ON-DEMAND, which for many RP GameModes, that is required. There cannot be a delay between the data being asked for and recieved, the data needs to be there, right then and there, not in another thread.


    I know there are work arounds, but they require lots of time to prefect.
    While I don't agree with the threading strategy used in this module, it is not necessary to have SQL queries return synchronously, as it means stalling the server. It is acceptable on the web because latency isn't an issue, but waiting 500ms in the main thread of a real-time game server means every player is going to be affected. Any code that requires the result immediately can be refactored to run asynchronously. If you're worried about creating a thread for every query, you might want to check out tmysql instead.
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 2Lua King Lua King x 1 (list)

  16. Post #296
    taste the salty dong
    Remscar's Avatar
    September 2009
    1,822 Posts
    While I don't agree with the threading strategy used in this module, it is not necessary to have SQL queries return synchronously, as it means stalling the server. It is acceptable on the web because latency isn't an issue, but waiting 500ms in the main thread of a real-time game server means every player is going to be affected. Any code that requires the result immediately can be refactored to run asynchronously. If you're worried about creating a thread for every query, you might want to check out tmysql instead.
    Thats why you dont run it on the main thread...
    Also Tmysql is broken in GMOD and no longer works correctly, the old SQL binds by the creator of this however do.
    Reply With Quote Edit / Delete United States Show Events Dumb Dumb x 2 (list)

  17. Post #297
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts
    Thats why you dont run it on the main thread...
    That statement violates the previous requirement you suggested which was that
    There cannot be a delay between the data being asked for and recieved, the data needs to be there, right then and there, not in another thread.
    which means you are expecting it to execute synchronously. Executing the actual query on another thread and blocking the main thread for the result only ends up in serializing the flow, which wasted all the time to create a thread, call the function, and return a result, all while the main thread is blocking execution.

    Also Tmysql is broken in GMOD and no longer works correctly, the old SQL binds by the creator of this however do.
    I just checked the module and it "works correctly" on my end. As there are plenty of other gamemodes that use it, I suspect it works just fine.
    Reply With Quote Edit / Delete United States Show Events Zing Zing x 2 (list)

  18. Post #298
    taste the salty dong
    Remscar's Avatar
    September 2009
    1,822 Posts
    Weird, cause ive tested the tmysql module and it seems to have problems passing data back. It can write but reading does not work. Also, TmySQL doesnt allow multiple databases which can be a pain.
    Reply With Quote Edit / Delete United States Show Events

  19. Post #299
    Gold Member
    VoiDeD's Avatar
    August 2005
    860 Posts
    Weird, cause ive tested the tmysql module and it seems to have problems passing data back. It can write but reading does not work.
    Otherwise known as user error.

    Works fine for me, and works fine for countless other people that rely on it.
    Reply With Quote Edit / Delete United States Show Events

  20. Post #300
    taste the salty dong
    Remscar's Avatar
    September 2009
    1,822 Posts
    Weird cause ive tried it on many different servers, properly configured, and even with the test code, every time, it doesnt work properly.
    Reply With Quote Edit / Delete United States Show Events

  21. Post #301
    Buggzie's Avatar
    December 2009
    965 Posts
    Weird cause ive tried it on many different servers, properly configured, and even with the test code, every time, it doesnt work properly.
    Maybe you should learn MySQL before you use it, you goose.
    Reply With Quote Edit / Delete Australia Show Events Dumb Dumb x 5 (list)

  22. Post #302
    Lolololololooooooooooo! La la la-laaaaaaaaaaah, la la laaaaaah, lol, haha.
    ^seth's Avatar
    January 2011
    294 Posts
    Maybe you should learn MySQL before you use it, you goose.
    He's already stated that the old gm_mysql module works for him, so it's not a problem with his SQL code. He's likely just using the module incorrectly.
    Reply With Quote Edit / Delete United Kingdom Show Events Agree Agree x 1Disagree Disagree x 1 (list)

  23. Post #303
    Steins;Gate SUCKS
    Dave_Parker's Avatar
    October 2008
    5,065 Posts
    Maybe you should learn MySQL before you use it, you goose.
    I like how I've never seen you before and now you're suddenly in every thread bitching at everyone.
    Reply With Quote Edit / Delete Netherlands Show Events Agree Agree x 2Funny Funny x 1Winner Winner x 1 (list)

  24. Post #304

    August 2007
    152 Posts
    which means you are expecting it to execute synchronously. Executing the actual query on another thread and blocking the main thread for the result only ends up in serializing the flow, which wasted all the time to create a thread, call the function, and return a result, all while the main thread is blocking execution.
    Additionally the second statement doesn't make any sense since it pretty much takes just as long to do it synchronously as asynchronously. The difference in the context of the module is the method in which the result is served to your script
    Reply With Quote Edit / Delete United States Show Events

  25. Post #305
    Terminal Shell Founder
    mr.wolf's Avatar
    July 2010
    820 Posts
    Additionally the second statement doesn't make any sense since it pretty much takes just as long to do it synchronously as asynchronously. The difference in the context of the module is the method in which the result is served to your script
    Indeed. The only difference is that you need to have things executing from a callback after the data is returned, rather than just waiting an continuing on. As far as "getting the data immediately" goes, the time difference is the same.

    The only difference is how you handle the data being returned. For example, if you had the following code
    function FindNotClueless()
        local SQL = "SELECT * FROM `users` WHERE `clue` > 0"
        local q = DatabaseConnectionObject:query(SQL)
        q.onError = function(Q,E)
            ErrorNoHalt("SQL Error: "..E.."\n")
        end
        local users = q:getData()
        PrintTable(users)
    end

    You'd just have to do this instead
    function FindNotClueless()
        local SQL = "SELECT * FROM `users` WHERE `clue` > 0"
        local q = DatabaseConnectionObject:query(SQL)
        local users = {}
        q.ondata = function(Q,D)
            table.insert(users,D)
        end
        q.onSuccess = function()
            PrintTable(users)
        end
        q.onError = function(Q,E)
            ErrorNoHalt("SQL Error: "..E.."\n")
        end
        q:start()
    end

    The disadvantage being that you can't actually return results from a function, you have to work with them in the function itself, or call up a handler. However, if that query were to take 2 minutes to execute, you would still have clients on the server when it finished, and can continue on. Otherwise, everyone gets disconnected due to a seemingly lost connection. The amount of time spent on the query is the same, but the outcome is a lot more useful.

    TLDR; Threading is the way to go. However, I am curious azui,

    While I don't agree with the threading strategy used in this module...
    How would you have it not threaded and still not stall the server. Seems like any nonthreaded version would suspend the main thread until it was completed no?
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 1 (list)

  26. Post #306

    August 2007
    152 Posts
    How would you have it not threaded and still not stall the server. Seems like any nonthreaded version would suspend the main thread until it was completed no?
    Pretty sure he is saying he does not agree with the method of threading used and if he had made the module would have threaded it in a different way
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 2 (list)

  27. Post #307
    Terminal Shell Founder
    mr.wolf's Avatar
    July 2010
    820 Posts
    Pretty sure he is saying he does not agree with the method of threading used and if he had made the module would have threaded it in a different way
    Gotcha, I interpreted it as azui not liking the fact that it was threaded, not the way the threading was implemented. My mistake
    Reply With Quote Edit / Delete United States Show Events

  28. Post #308
    PAL-18's Avatar
    July 2010
    15 Posts
    The linux version doesnt contain any linux binaries (it just contains windows binaries). Can you fix it?
    Reply With Quote Edit / Delete Canada Show Events Funny Funny x 2 (list)

  29. Post #309

    August 2007
    152 Posts
    The linux version doesnt contain any linux binaries (it just contains windows binaries). Can you fix it?
    http://dev.mysql.com/downloads/connector/c/
    Reply With Quote Edit / Delete United States Show Events

  30. Post #310
    TGiFallen's Avatar
    January 2010
    1,440 Posts
    The linux version doesnt contain any linux binaries (it just contains windows binaries). Can you fix it?
    That's the way it works gm_mysqloo_linux.dll is the proper Linux dll.
    Reply With Quote Edit / Delete Canada Show Events

  31. Post #311
    Gold Member
    LuaMilkshake2's Avatar
    June 2010
    145 Posts
    ive learned not to use this module.

    For people who dont understand, this module uses threads to execute database commands. While this is better for performance there are technical problems, for example the data you want will not necessarily be ON-DEMAND, which for many RP GameModes, that is required. There cannot be a delay between the data being asked for and recieved, the data needs to be there, right then and there, not in another thread.


    I know there are work arounds, but they require lots of time to prefect.
    I only had one instance where I needed to do a query and it had to be synchronous, this was getting data to return inside of Gatekeeper's PlayerPasswordAuth hook.

    You can do this:
    local db = mysqloo.connect(hostname, user, pass, db, port)
    db.onConnected = function() end
    db.onConnectionFailed = function(err) error("[SQL] Database connection failed") end
    db:connect()
    
    function sqlWaitQuery(queryString)
    	local results = {}
    	if db:status() ~= mysqloo.DATABASE_CONNECTED then
    		db:connect()
    		db:wait()
    		if db:status() ~= mysqloo.DATABASE_CONNECTED then
    			return {}
    		end
    	end
    	local q = db:query(queryString)
    	q.onSuccess = function()
    		results = q:getData()
    	end
    	q.onError = function(q, e)
    		ErrorNoHalt("[SQL] "..e)
    	end
    	q:start()
    	q:wait() --This is the super-special line
    	return results
    end

    Which allows you to get the data from the call of your function, instead of using a callback. This does interrupt the main thread until the data is returned though, so I would avoid it as much as possible.

    Example:
    local data = sqlWaitQuery("SELECT * FROM `table`")
    print(data[1].field) --Printing 'field' from the first row returned
    Reply With Quote Edit / Delete United States Show Events Informative Informative x 1 (list)

  32. Post #312
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts
    I only had one instance where I needed to do a query and it had to be synchronous, this was getting data to return inside of Gatekeeper's PlayerPasswordAuth hook.

    You can do this:
    synchronous db query
    

    Which allows you to get the data from the call of your function, instead of using a callback. This does interrupt the main thread until the data is returned though, so I would avoid it as much as possible.
    That's not a very elegant solution. In that particular case PlayerPasswordAuth happens in the OOB protocol before any ticket checks. Any script kiddy can spam a couple hundred connect request and bring your server to a grinding halt.
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 1Optimistic Optimistic x 1 (list)

  33. Post #313
    For some reason as of late (maybe I've never noticed it before) I've been crashing (usually after mapchange) with the onConnected action. It doesn't matter if I print something or point it to a function, it just crashes. Has anyone else experienced this?
    Reply With Quote Edit / Delete United Kingdom Show Events Agree Agree x 2 (list)

  34. Post #314
    themaw's Avatar
    March 2008
    1,326 Posts
    For some reason as of late (maybe I've never noticed it before) I've been crashing (usually after mapchange) with the onConnected action. It doesn't matter if I print something or point it to a function, it just crashes. Has anyone else experienced this?
    It happens to me aswell. Not always but sometimes.
    Reply With Quote Edit / Delete Denmark Show Events

  35. Post #315
    It happens to me aswell. Not always but sometimes.
    -Snip- Resolved, see next page.
    Reply With Quote Edit / Delete United Kingdom Show Events

  36. Post #316
    Lolololololooooooooooo! La la la-laaaaaaaaaaah, la la laaaaaah, lol, haha.
    ^seth's Avatar
    January 2011
    294 Posts
    Any idea what's going on?

    local db = mysqloo.connect(HOST, USER, PASS, DTBA, PORT);
    print("db obj:", db);
    print("db stat:", db:status());
    
    function db.onConnected(self)
    	print("db stat:", db:status());
    
    	local qy = db:query("SELECT 5 + 5");
    
    	print("db stat:", db:status());
    
    	function qy.onSuccess(self)
    		PrintTable(self:GetData());
    		print("success");
    	end
    
    	function qy.onError(self, error)
    		print("error", error);
    	end
    	
    	qy:start();
    end
    
    function db.onConnectionFailed(self, error)
    	print("err:", error);
    end
    
    db:connect();
    

    Code:
    db obj: [Database:18C3EE38]
    db stat:        2
    Neither onConnected or onConnectionFailed are being called.
    MySQL info is definitely correct.

    Edited:

    Additional information:

    Code:
    MySQLoo Version:        7
    Client Version: 60000
    Client Info:    6.0.0
    Reply With Quote Edit / Delete United Kingdom Show Events Agree Agree x 2 (list)

  37. Post #317
    Try this instead -

    -snipped, rate dumb-
    Reply With Quote Edit / Delete United Kingdom Show Events Dumb Dumb x 1 (list)

  38. Post #318
    Lolololololooooooooooo! La la la-laaaaaaaaaaah, la la laaaaaah, lol, haha.
    ^seth's Avatar
    January 2011
    294 Posts
    Try this instead -

    local db = mysqloo.connect(HOST, USER, PASS, DTBA, PORT);
    print("db obj:", db);
    print("db stat:", db:status());
    
    function db.onConnected(self)
    print("db stat:", db:status());
    
        local qy = db:query("SELECT 5 + 5");
        print("db stat:", db:status());
        qy.onSuccess = function(self) PrintTable(self:GetData()) print("success") end
        qy.onError = function(Q,error) print("error: ".. error) end
        db.onConnectionFailed = function(Q,error) print("error: ".. error) end
        qy:start();
    end
    
    
    Code:
    db obj: [Database:199FEE38]
    db stat:        2
    This is also doing nothing:

    local db = mysqloo.connect(HOST, USER, PASS, DTBA, PORT);
    
    db.onConnected = function(self)
    	print("connected hi");
    end
    
    db.onConnectionFailed = function(self, err)
    	print("error :(");
    end
    
    db:connect();
    
    Reply With Quote Edit / Delete United Kingdom Show Events

  39. Post #319
    I just realised I screwed up what I posted pretty bad

    local function PerfCon()
        local db = mysqloo.connect(IP,User,PW, Schema / Table ,Port)  
        db.onConnected = function() print("Connected")  end
        db.onConnectionFailed = function(D,E) print("DATABASE FAILED TO CONNECT: "..E) end
        db:connect()
    end
    concommand.Add("dbconn",PerfCon)
    

    Should work. You should get one of the two pop up, depending on your servers timeout settings.
    Reply With Quote Edit / Delete United Kingdom Show Events

  40. Post #320
    Lolololololooooooooooo! La la la-laaaaaaaaaaah, la la laaaaaah, lol, haha.
    ^seth's Avatar
    January 2011
    294 Posts
    I didn't realize I had to be in the server, that fixed it thanks.
    I'm going to be using this for global bans, doesn't this mean that the first person to join will be allowed in (if they're meant to be banned)?
    Reply With Quote Edit / Delete United Kingdom Show Events