[SQLite] Invalid Result Given
#1

Hello there, i started using SQLite recently, so many questions and problems will arise, one of them is just below, when calling a function to delete a row from my table, it prints in the prompt the error below:

pawn Code:
[05:19:36] SQLitei Notice: (db_free_result_hook) Invalid result given.
[05:19:36] [debug] AMX backtrace:
[05:19:36] [debug] #0 native PrintBacktrace () from crashdetect.DLL
[05:19:36] [debug] #1 00019984 in ?? (0) from Survive.amx
[05:19:36] [debug] #2 00093a20 in ?? (0) from Survive.amx
[05:19:36] [debug] #3 000938e0 in ?? (0, 5235, 1, 0, 366666296) from Survive.amx
[05:19:36] [debug] #4 000110ec in public OnDialogResponse (0, 5235, 1, 0, 366666296) from Survive.amx
My code:
PHP Code:
stock ApagarPlayerClan(playerid)
{
    new 
Query[256], DBResult:Result;
    
format(Querysizeof(Query), "DELETE FROM `ServerClan` WHERE `clanNome` = %s"GetPClan(playerid));
    
Result db_query(gAccountsQuery);
    return 
db_free_result(Result);

Reply
#2

I'm guessing because the query doesn't contain any resulting information and doesn't need to be freed.
Reply
#3

big of a long shot but i'm sure
clanNome
should be
clanName
Reply
#4

Quote:
Originally Posted by Joe Staff
View Post
I'm guessing because the query doesn't contain any resulting information and doesn't need to be freed.
Okay, but how can a delete a row?

Quote:
Originally Posted by Danbo7
View Post
big of a long shot but i'm sure
clanNome
should be
clanName
No, its clanNome, it is in portuguese.
Reply
#5

Code:
stock ApagarPlayerClan(playerid)
{
    new Query[100];
    format(Query, sizeof(Query), "DELETE FROM `ServerClan` WHERE `clanNome` = %s", GetPClan(playerid));
    db_query(gAccounts, Query);
}
Reply
#6

Quote:
Originally Posted by Joe Staff
View Post
Code:
stock ApagarPlayerClan(playerid)
{
    new Query[100];
    format(Query, sizeof(Query), "DELETE FROM `ServerClan` WHERE `clanNome` = %s", GetPClan(playerid));
    db_query(gAccounts, Query);
}
I tried it, nothing happens the row still there and the data has not been deleted
Reply
#7

Print the string to console and check the log, see that the SQL code being ran is correct.
Reply
#8

I print the string in the console, it appeared right the name of the clan, still did not delete the row.
I changed and used a SQLite Improved Statement, and for some reason I can't explain worked.

PHP Code:
stmt_apagarPlayerClan db_prepare(gAccounts"DELETE FROM 'ServerClan' WHERE 'clanNome'=? COLLATE NOCASE");
stock ApagarPlayerClan(playerid)
{
    
stmt_bind_value(stmt_apagarPlayerClan0DB::TYPE_STRINGGetPClan(playerid));
    
stmt_execute(stmt_apagarPlayerClan);

Thanks to everyone who helped me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)