View Single Post
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 10-16-2017 , 11:48   Re: A short Threaded SQL guide
Reply With Quote #3

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)

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.

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.
__________________
Peace-Maker is offline