• tmysql4 - A multi-connection version of tmysql3 (Now with mysqloo wrapper!)
    384 replies, posted
[QUOTE=Giraffen93;48031916]Can i keep track of semicolon separated queries (multiple) somehow? I want to get the last insert id but also know which row it belongs to (identified by a lua variable)..[/QUOTE] Use a [url=http://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-stored-procedures.html]Stored Procedure[/url]. You can return whatever you want with this, and any amount of variables.
Hey, is anyone else experiencing crashes when the server changes the level? I've noticed this happens if there's a query running at the time.
[QUOTE=EdwardRich;48189100]Hey, is anyone else experiencing crashes when the server changes the level? I've noticed this happens if there's a query running at the time.[/QUOTE] I'm fairly sure it was an older version that did that and not the latest.
[QUOTE=StonedPenguin;48192297]I'm fairly sure it was an older version that did that and not the latest.[/QUOTE] I downloaded the version in the OP. Is that the latest or should I build from source?
[QUOTE=EdwardRich;48196049]I downloaded the version in the OP. Is that the latest or should I build from source?[/QUOTE] That's the latest version, but I haven't experienced that bug since using the old tmysql
Yeah, I verified all the files and made sure srcds was clean. Still experiencing crashes in the same cases. It also seems to crash if the level changes during a database connection.
On the 9 July I changed everything in my server to tmysql4. (Everything from mysqloo) 5 addons were using mysqloo and had to rewrite them. before I used tmysql4 my server was crashing randomly about 20-40 times a week. With tmysql4 my server had been up for 5 days now without crashing. This module has to be the best thing that I got so far. Thank you so much.
[QUOTE=EdwardRich;48198012]Yeah, I verified all the files and made sure srcds was clean. Still experiencing crashes in the same cases. It also seems to crash if the level changes during a database connection.[/QUOTE] I guess just halt the connection before you change maps then; I haven't seen that problem occur since the old version.
[QUOTE=code_gs;48198545]I guess just halt the connection before you change maps then; I haven't seen that problem occur since the old version.[/QUOTE] Yeah, I disconnect the database in the shutdown hook now. Seems to work fine. [editline]14th July 2015[/editline] Ok, this is getting pretty stupid. If I select more than 6 columns in a query, the server crashes. Am I doing something hugely wrong?
[QUOTE=EdwardRich;48199233]Yeah, I disconnect the database in the shutdown hook now. Seems to work fine. [editline]14th July 2015[/editline] Ok, this is getting pretty stupid. If I select more than 6 columns in a query, the server crashes. Am I doing something hugely wrong?[/QUOTE] Are you sure it's the module and not something else causing the issues? I regularly use it heavily and experience 0 crashes.
[QUOTE=darkjacky;48198241]20-40 times a week[/QUOTE] jesus, that's insane i wouldn't stand it crashing just a few times
[QUOTE=Teddi Orange;48203134]Are you sure it's the module and not something else causing the issues? I regularly use it heavily and experience 0 crashes.[/QUOTE] Yeah, it's a completely clean install of srcds, base gamemode, no other addons.
I switched to TMYSQL today after using MySQLOO for some months, and after we switched, the server started crashing at random intervals, could be 10 minutes apart, could be 1 hour apart, everything was fine before. Is there anything I can do? TMYSQL is generally more stable for me but these crashes are annoying.
I really like the way this module handles lastInsert IDs, specially how it returns them. Thanks! I've switched all my code from mysqloo to tmysql aswell. Luckily I've used a sql plugin wrapper function, so this was only one file to replace and fix up.
[QUOTE=mib999;48425923]I switched to TMYSQL today after using MySQLOO for some months, and after we switched, the server started crashing at random intervals, could be 10 minutes apart, could be 1 hour apart, everything was fine before. Is there anything I can do? TMYSQL is generally more stable for me but these crashes are annoying.[/QUOTE] Send me a crash dump
[QUOTE=BlackAwps;48439541]Send me a crash dump[/QUOTE] Haven't crashed in about a day now - will send you one when I next see a crash.
The AS statement doesn't work like in a normal sql library. E.g.: SELECT COUNT(ID) AS count FROM test; Lists COUNT(ID) as result(index) but it should be count instead.
Try [code]SELECT COUNT(ID) AS `count` FROM test;[/code] It worked fine for me a few months back, and I see no changes regarding in the name of the fields in the repo.
[QUOTE=MDave;48488585]Try [code]SELECT COUNT(ID) AS `count` FROM test;[/code] It worked fine for me a few months back, and I see no changes regarding in the name of the fields in the repo.[/QUOTE] Yeah, thanks for the fast reply. With ` it worked, like it was a reserved keyword in my db...
[QUOTE=Sapd;48488650]Yeah, thanks for the fast reply. With ` it worked, like it was a reserved keyword in my db...[/QUOTE] Of course it's a reserved keyword, you're using it in the same query!
Why does this only fetch an associative array? Can it not also fetch a numbered array as well, or give an option of one or the other or both? While associative is more human-friendly, numbered arrays are more Lua friendly as you can iterate on them in a predictable fashion.
Having used tmysql for like 3 years, I was using associative results like 100% of the time so I just ended up scrapping it when porting and overhauling everything. If you like [I]really[/I] need it for some weird reason I could probably add it back in as an option at some point. I currently don't have the setup required to compile and test it as I quit gmod, so who knows how long it would take me to get everything setup again.
Don't [i]need[/i] it as I'm not using this version, as I don't really need the multiple connections, but was testing it out and not having a numbered array is a deal breaker. I'm sure I'm not the only one out there who prefers to put SELECT columns in order and expect them out in that same order, and as said it helps with Lua because pairs() does not give you a predictable order vs. a min,max for loop. Also, an even better, more global, suggestion would be to have the dbConn itself have a :Connected() function that's threaded (won't lock the server process) so we can test in whatever sort of timer whether or not the server has disconnected randomly and attempt to reconnect, unless the module already does this built-in.
Why would you ever iterate trough columns in an ipairs in the first place? Associative results make your code less error prone, because if you change your SQL command, you would have to reorder the column values aswell, it is just generally bad practice I think. The only thing next to numbered column results is performance, but that is quite negligible I think.
[QUOTE=Puzzle;48507960]Don't [i]need[/i] it as I'm not using this version, as I don't really need the multiple connections, but was testing it out and not having a numbered array is a deal breaker. I'm sure I'm not the only one out there who prefers to put SELECT columns in order and expect them out in that same order, and as said it helps with Lua because pairs() does not give you a predictable order vs. a min,max for loop.[/quote] That's just a bad way to handle your data honestly. [QUOTE=Puzzle;48507960]Also, an even better, more global, suggestion would be to have the dbConn itself have a :Connected() function that's threaded (won't lock the server process) so we can test in whatever sort of timer whether or not the server has disconnected randomly and attempt to reconnect, unless the module already does this built-in.[/QUOTE] That's not really possible. Each database object has 3 connections and when you submit a query it uses an unused one from the pool. It should automatically try to reconnect itself if a connection goes down.
Does this have a callback for when it has successfully connected?
Blastech, no, but if there's no error you can set a variable on the connection object saying it's connected. Thus also why I mentioned about will it auto re-connect otherwise provide a check.
[QUOTE=FPtje;48491952]Of course it's a reserved keyword, you're using it in the same query![/QUOTE] Just for Info: Actually functions aren't reserved keywords (as its the DBMS can differentiate by the () ). I tried it again, it works without the `. Somehow it didn't read the updated file (but I even restarted the Server oO). However the module seems to work normally now for me.
[QUOTE]I might be doing something wrong, but I can't seem to get that [i]database[/i] table returned by tmysql.initialize()... It either returns true or false (depending whether the connection is initialised or there's an error), or when an auto-reload fires, nil. Should [URL=https://bitbucket.org/breakpointservers/bkacjios-glua-modules/src/aedcbbb8ab05f54df96d140c0806a0756ab05806/gm_tmysql4/src/gm_tmysql.cpp?at=default#gm_tmysql.cpp-63]this[/URL] really be there?[/QUOTE] [b]Edit:[/b] Snip this. I was using a WAAAAY old library, forgot to update lua/bin.
Link provided is down (16:52 26/09) uploaded a mirror here [url]http://www.richardbamford.io/dmp/gmsv_tmysql4_win32.zip[/url]
Sorry, you need to Log In to post a reply to this thread.