View Single Post
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 05-03-2020 , 08:24   Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
Reply With Quote #36

Quote:
Originally Posted by aleeexxx View Post
you could add the multithread functions recommendation for SQL
There are actually no so-called multi-threaded functions.

There are only:
  • non-threaded (executed in the same thread as sm plugins, so each query to db cause waiting the response and pausing other plugin's operations during this time).
  • threaded (this one executes db queries in other second thread; when you execute one more query in parallel, no more threads created, it queues to the same second thread).

Quote:
Originally Posted by aleeexxx View Post
I until recently knew that the old functions could block the main thread, the new syntax already does it in multithread

correct me if I'm wrong!
Not all of them.
Some of Database methodmap functions still point to the old non-threded functions at the moment.

Example: Database.SetCharset() - it is just an alias to SQL_SetCharset, see source code.

There are also some exclusions.
Example: Database.Escape() - even if according to source code, it access the db handle, no external query is processed. Instead, client makes escaping itself based on pre-cached codepage of connection.

Most of above info is provided by Kruzya (CrazyHackGUT).
Thanks to him.

Additional info can be obtained in this article (in Russian) by R1KO.
Reading comments would be also useful.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline