Hi,
can you clarify, please, this statement from
docs:
Quote:
If your query returns multiple result sets, for example, a procedure call on MySQL that returns results, you must lock both the query and the entire fetch operation. SourceMod is only able to fetch one result set at a time, and all result sets must be cleared before a new query is started.
|
Can you show / explain example of such multiple result set?
Sample from docs:
PHP Code:
bool GetByAge_Query(Database db, int age)
{
char query[100];
FormatEx(query, sizeof(query), "SELECT name FROM users WHERE age = %d", age);
SQL_LockDatabase(db);
DBResultSet hQuery = SQL_Query(db, query);
if (hQuery == null)
{
SQL_UnlockDatabase(db);
return false;
}
SQL_UnlockDatabase(db);
PrintResults(hQuery);
delete hQuery;
return true;
}
void PrintResults(Handle query)
{
/* Even if we have just one row, you must call SQL_FetchRow() first */
char name[MAX_NAME_LENGTH];
while (SQL_FetchRow(query))
{
SQL_FetchString(query, 0, name, sizeof(name));
PrintToServer("Name \"%s\" was found.", name);
}
}
Do I correctly understand, if
SQL_Query returns more than one row (such a way several calls to
SQL_FetchRow will be required), in such case I should also move
SQL_UnlockDatabase below the
PrintResults?
__________________