SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/12/2019, 03:36 PM   #1
ApolloScripter
Huge Clucker
 
ApolloScripter's Avatar
 
Join Date: Sep 2018
Posts: 235
Reputation: 7
Default [SQLite] Invalid Result Given

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);

__________________
ApolloScripter is offline   Reply With Quote
Old 14/12/2019, 08:39 PM   #2
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: [SQLite] Invalid Result Given

I'm guessing because the query doesn't contain any resulting information and doesn't need to be freed.
Joe Staff is offline   Reply With Quote
Old 14/12/2019, 08:56 PM   #3
Danbo7
Little Clucker
 
Join Date: Nov 2019
Posts: 21
Reputation: 0
Default Re: [SQLite] Invalid Result Given

big of a long shot but i'm sure
clanNome
should be
clanName
Danbo7 is offline   Reply With Quote
Old 14/12/2019, 10:15 PM   #4
ApolloScripter
Huge Clucker
 
ApolloScripter's Avatar
 
Join Date: Sep 2018
Posts: 235
Reputation: 7
Default Re: [SQLite] Invalid Result Given

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.
__________________
ApolloScripter is offline   Reply With Quote
Old 14/12/2019, 11:14 PM   #5
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: [SQLite] Invalid Result Given

Code:
stock ApagarPlayerClan(playerid)
{
    new Query[100];
    format(Query, sizeof(Query), "DELETE FROM `ServerClan` WHERE `clanNome` = %s", GetPClan(playerid));
    db_query(gAccounts, Query);
}
Joe Staff is offline   Reply With Quote
Old 14/12/2019, 11:39 PM   #6
ApolloScripter
Huge Clucker
 
ApolloScripter's Avatar
 
Join Date: Sep 2018
Posts: 235
Reputation: 7
Default Re: [SQLite] Invalid Result Given

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
__________________
ApolloScripter is offline   Reply With Quote
Old 14/12/2019, 11:42 PM   #7
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: [SQLite] Invalid Result Given

Print the string to console and check the log, see that the SQL code being ran is correct.
Joe Staff is offline   Reply With Quote
Old 15/12/2019, 12:21 AM   #8
ApolloScripter
Huge Clucker
 
ApolloScripter's Avatar
 
Join Date: Sep 2018
Posts: 235
Reputation: 7
Default Re: [SQLite] Invalid Result Given

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
__________________
ApolloScripter is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Easy SQLite: Simplyfing the usage of SQLite queries! ThePhenix Includes 8 16/03/2019 03:22 AM
Assigning SQLite result into two separate variables. DarkLored Scripting Help 4 07/05/2016 03:26 PM
DeleteSavedResult | WARNING | invalid result id CaioTJF Scripting Help 0 16/06/2015 03:58 AM
Weird error: invalid symbol name and invalid function or declaration Reboma Scripting Help 1 04/02/2014 10:58 AM


All times are GMT. The time now is 04:43 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.