View Single Post
sdz
Senior Member
Join Date: Feb 2012
Old 10-21-2017 , 21:57   Re: A short Threaded SQL guide
Reply With Quote #6

Quote:
Originally Posted by Peace-Maker View Post
Nice tutorial! Some notes:
Right now you're connecting to the sqilte database twice - a second time in the T_Connect callback using the non-threaded SQLite_UseDatabase while leaking the first database handle.
You don't really need to check the database driver unless you want to run some driver specific queries (like AUTO_INCREMENT in mysql vs. AUTOINCREMENT in sqlite)
didn't even realize that TConnect would work with sqlite and mysql, thanks a ton! also thought the threaded callback disposed of handles automatically in a similar fashion to some other callback

Quote:
Originally Posted by Peace-Maker View Post
You should never try to get the steamid of a player in OnClientPutInServer. Always use OnClientAuthorized to avoid STEAM_ID_STOP_IGNORING_RETVALS in your database AND always check the return value of GetClientAuthId.
was waiting for that one, get that error very rarely and wasn't sure if that was the reason, explains a lot.

Quote:
Originally Posted by Peace-Maker View Post
There is a superceding Database methodmap interface you could take a look at. Especially the new Database.Connect function and the new callback prototype. This will save you some of the retagging when saving the database handle.
that database.connect methodmap gave me anxiety because i wasn't sure if it was threaded or not, I actually rewrote the entire tutorial in purely new syntax but wasn't sure of what all worked.


Thanks for the advice, rewrote the code of the tutorial to incorporate what you've suggested

Last edited by sdz; 10-21-2017 at 22:30.
sdz is offline