GDatabase v1.1- A threaded mysql lib

Below is a copy of what is in the readme. Please read that before posting questions!

GDATABASE Version 1.21
By Tomato3017


This addon provides access to making database connections that are monitored and controlled by this addon. This allows the programmer to not worry about the connection and focus on the heart of his/her addon. This addon automatically checks the connection to make sure it is still accessable and runs a “keep alive” routine on it to make sure the MYSQL server doesn’t kill the connection due to inactivity. If for some reason the connection goes down, this script will attempt at a regular interval to establish a connection. During this time all queries to the database in question will be returned as false.

This addon also provides an easy way to handle threaded queries(all you gotta do is provide a callback function). This allows the programmer to not worry if the thread is done and to focus elsewhere. The threaded queries are handled like a FIFO stack. This means if you send a bunch of threaded queries at once, the script will automatically queue them all up and process them in a manageable fashion and prevent a connection overload.
The addon also allows you to visually reconnect or kill any connection via the console. It also will display the status of the connection.


A brain
LUA skills
MYSQL server(duh!)
gm_mysql V1.8(Included), While 1.8 is what I support, this addon will work with gm_mysql v1.6 and above.


[li] Copy GDatabase into the addon’s folder.
[/li] [li] Run install modules.bat


v1.0:initial release

[li] Numerous bug fixes.
[/li] [li] Fixed having more then 1 concurrent thread making the MYSQL server disconnect(gm_mysql seems to not like multiple threads in 1 frame)
[/li] [li] Added my ptimer module. This module wraps around the basic timer module and allows you to group timers and mass stop and start them in this manner.
[/li] [li] Added gdatabase.AddTimer and gdatabase.RemoveTimer see function list in documentation for uses.
[/li] [li] Added pcall’s to the hook run function so any bad hooks won’t mess up GDatabase.[/ul]
[li]Fixed bug where the threads for multiple connections weren’t running
[/li][li]Fixed an error where gdatabase.threadedquery returned nil instead of true

[li]Changed the function gdatabase.threadedquery to gdatabase.ThreadedQuery(I added backwards compatability for the old one)
[/li] [li] Added example file to release
[/li] [li]Corrected version numbering(oops!)
Addons Created that use this:
[li]GCommunicate- Server to Server talk Look at this addon for examples.


[li]Spacetech: Lots of help and testing.
[/li][li]ULIB TEAM: Gave me a bunch of ideas, also gave me permission to use their module loading code. Thanks!
[/li][li]Andy Vincent: Thanks for writing a threaded mysql dll for us to use!
[/li][li]Musex Team: I copied their batch file for module installation. I was too lazy to write my own :s[/ul]

Alternate Link:


[li]A new version of GCommunicate is being held off till GDatabase 2.0
[/li][li]This Update is backwards compatible with 1.0
[/li][li]Version 2 will be OOP based

Woah SWEET! :dance: I could use this. Thank you very much :smiley:

Ah, just been looking for something like this. Thanks.

Most well documented addon I’ve seen. Fantastic job.

Now I’m going to ask the GMod tower team if I can borrow a tiny bit of one of the servers to run the MYSQL server.

Brilliant! I loved the first one, I’m glad you updated.

Link is down

Ya, It seems the site is down. I’ll post a new version somewhere else if if doesn’t come back up soon.

It has been down for a few days, I tried a few days ago.

Sorry about the downtime, is currently moving to a dedicated webserver.

This sounds great but the link is broken, if you need someone to host the file I can do that. If you where questioning, I own a web hosting company…

Updated download location. UberMensch, Let me know when the site is back up. For some damn reason my file was already reported in God I hate that site.

Thanks man, been needing this for a while

Thanks for the updated link, I hope this works!

Someone reported it.

I have looked through all of the code because of that and there is nothing that suggests that there is a security flaw.

Because some jerk reported it. I posted it and before I could even get to the page to look at it, it was already reported.

Maybe it checks the zip automatically and marks it for the dll?


There is no reason for a report button anymore.