High-level API for the SA-MP SQLite functions.
oscar-broman / sqlitei Goto Github PK
View Code? Open in Web Editor NEWHigh-level API for the SA-MP SQLite functions.
High-level API for the SA-MP SQLite functions.
atement=@0d47f940 0, iParam=0, DBDataType:iType=5, ... <2 arguments>) at C:\Documents and Settings\Administrador\Desktop\1655\pawno\include\sqlitei.inc:1323
[12:59:38] [debug] #2 00121998 in LoadAccount (playerid=0) at sss/core/player/accounts.pwn:209
[12:59:38] [debug] #3 000bf498 in LoadAccountDelay (playerid=0) at sss/core/player/core.pwn:162
[12:59:38] [debug] #4 000bf330 in public @yj:LoadAccountDelay@_yT (__r=0, playerid=0) at sss/core/player/core.pwn:148
[12:59:38] [LoadAccount] fetching statement result 'stmt_AccountExists'.
[12:59:38] [debug] AMX backtrace:
[12:59:38] [debug] #0 native PrintAmxBacktrace () from crashdetect.so
[12:59:38] [debug] #1 0009ee20 in err (text[]=@0d481624 "[LoadAccount] fetching statement result 'stmt_AccountExists'.") at sss/utils/logging.pwn:108
[12:59:38] [debug] #2 00121aa8 in LoadAccount (playerid=0) at sss/core/player/accounts.pwn:221
[12:59:38] [debug] #3 000bf498 in LoadAccountDelay (playerid=0) at sss/core/player/core.pwn:162
[12:59:38] [debug] #4 000bf330 in public @yj:LoadAccountDelay@_yT (__r=0, playerid=0) at sss/core/player/core.pwn:148
[12:59:38] [PART] [MsA]Kolor4dO (kick: Account load failed)
[12:59:39] INFO: [OnPlayerDisconnect] Removing session data file for [MsA]Kolor4dO
[12:59:39] [LOGOUT] [MsA]Kolor4dO not logged in.
Here, have a dump:
[09/10/2014 00:14:00] [debug] #0 00020c4c in bool:stmt_fetch_row (&DBStatement:stStatement=@0x0cbab3d8) at E:\Games\Projects\SA-MP\pawno\include\sqlitei.inc:1780
[09/10/2014 00:14:00] [debug] #1 00143c4c in CreateNewSprayTag (Float:x=1118.51099, Float:y=-1540.14001, Float:z=23.66000, Float:rx=0.00000, Float:ry=0.00000, Float:rz=178.46001) at E:\Games\Projects\SA-MP\ScavengeSurvive\gamemodes\SS/Core/World/SprayTag.pwn:148
[09/10/2014 00:14:00] [debug] #2 001a3294 in ?? () at E:\Games\Projects\SA-MP\ScavengeSurvive\gamemodes\ss/World/Zones/LS.pwn:39
[09/10/2014 00:14:00] [debug] #3 0000f21c in public Itter_OnGameModeInit () at E:\Games\Projects\SA-MP\pawno\include\YSI\y_hooks/impl.inc:484
[09/10/2014 00:14:00] [debug] #4 native CallLocalFunction () from samp03svr
[09/10/2014 00:14:00] [debug] #5 0000b338 in public ScriptInit_OnGameModeInit () at E:\Games\Projects\SA-MP\pawno\include\YSI\y_iterate.inc:791
[09/10/2014 00:14:00] [debug] #6 0000735c in public SSCANF_OnGameModeInit () at E:\Games\Projects\SA-MP\pawno\include\YSI\internal..\y_scriptinit.inc:171
[09/10/2014 00:14:00] [debug] #7 00000a08 in public main_OnGameModeInit () at E:\Games\Projects\SA-MP\pawno\include\sscanf2.inc:174
[09/10/2014 00:14:00] [debug] #8 000008dc in public OnGameModeInit () at E:\Games\Projects\SA-MP\ScavengeSurvive\gamemodes\ScavengeSurvive.pwn:76
[09/10/2014 00:14:00] [debug] Native backtrace:
[09/10/2014 00:14:00] [debug] #0 b74b693b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[09/10/2014 00:14:00] [debug] #1 b74af68f in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[09/10/2014 00:14:00] [debug] #2 b74b085c in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[09/10/2014 00:14:00] [debug] #3 b74b0ca6 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[09/10/2014 00:14:00] [debug] #4 b74b658c in ?? () from plugins/crashdetect.so
[09/10/2014 00:14:00] [debug] #5 b77de600 in ?? ()
[09/10/2014 00:14:00] [debug] #6 b74b816c in amx_Exec () from plugins/crashdetect.so
[09/10/2014 00:14:00] [debug] #7 b74b1656 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[09/10/2014 00:14:00] [debug] #8 b74b50f9 in ?? () from plugins/crashdetect.so
[09/10/2014 00:14:00] [debug] #9 b73ff173 in ?? () from plugins/streamer.so
[09/10/2014 00:14:00] [debug] #10 080dc202 in ?? () from ./samp03svr
[09/10/2014 00:14:00] [debug] #11 08093d84 in ?? () from ./samp03svr
[09/10/2014 00:14:00] [debug] #12 b73ff0b5 in ?? () from plugins/streamer.so
[09/10/2014 00:14:00] [debug] #13 b74b239e in ZN11CrashDetect13DoAmxCallbackEiPiS0 () from plugins/crashdetect.so
[09/10/2014 00:14:00] [debug] #14 b74b5398 in ?? () from plugins/crashdetect.so
[09/10/2014 00:14:00] [debug] #15 b74b8cb5 in amx_Exec () from plugins/crashdetect.so
Hi. I can not understand why the update request is not running.
Code:
new DBStatement:stmt = db_prepare(connection_db, "UPDATE
users
SET ``ip_last_entery= ? \ WHERE
user_name` = ?");`
`
stmt_bind_value(stmt, 0, DB::TYPE_STRING, player_info[playerid][pIP]);
stmt_bind_value(stmt, 1, DB::TYPE_STRING, player_info[playerid][pName]);
stmt_execute(stmt);
stmt_close(stmt); `
`
Debug:
`[21:45:42] SQLitei Debug: (db_prepare=0) Preparing statement with 2 params: UPDATE `users` SET `ip_last_entery` = ?, WHERE `user_name` = ?
[21:45:42] SQLitei Debug: (stmt_bind_value:0) Inserted new value for parameter 0 at 38: '127.0.0.1'
[21:45:42] SQLitei Debug: (stmt_bind_value:0) Inserted new value for parameter 1 at 71: 'continue'
[21:45:42] SQLitei Debug: (stmt_execute:0) Executing statement.
[21:45:42] SQLitei Debug: (db_query) Running query: UPDATE `users` SET `ip_last_entery` = '127.0.0.1', WHERE `user_name` = 'continue'
[21:45:42] SQLitei Debug: (stmt_close:0) Closed statement. `
The request is correct. Without syntax errors (it is executed in SQLite). But through SA-MP (SQLitei) does not work. I will be very happy if you tell me what the problem is
I decided to do this on my copy to trace errors and warnings to files/lines. I can pull-req that code later today if you want.
I use a filterscript to call rcon commands such as whitelisting, which uses sqlitei. Whenever I use the command, a crash report appears on the log:
[debug] Run time error 4: "Array index out of bounds"
[debug] Accessing element at negative index -4
[debug] AMX backtrace:
[debug] #0 00000008 in public OnRconCommand (cmd[]=@0x00000065 "") at E:\Games\Projects\SA-MP\Blank\filterscripts\test.pwn:5
It doesn't appear to cause any issue, but there's a possibility it might do.
Test gamemode:
#include <a_samp>
#include <sqlitei>
new
DB: gDatabase,
DBStatement: gStatement;
main()
{
gDatabase = db_open_persistent("test.db");
db_query(gDatabase, "CREATE TABLE IF NOT EXISTS list ( name TEXT )");
gStatement = db_prepare(gDatabase, "INSERT INTO list VALUES(?)");
}
forward insert(string[]);
public insert(string[])
{
stmt_bind_value(gStatement, 0, DB::TYPE_STRING, string, 24);
if(stmt_execute(gStatement, true, false))
{
stmt_free_result(gStatement);
return 1;
}
return 0;
}
Test Filterscript:
#define FILTERSCRIPT
#include <a_samp>
public OnRconCommand(cmd[])
{
new ret = CallRemoteFunction("insert", "s", cmd);
printf("Return: %d", ret);
}
After using this, all other database select+fetch operations seem to fail and return this:
SQLitei Warning: (stmt_fetch_row) Statement has no result.
if (iTagOf3 == tagof(DBDataType:)) { // this line crashing pawn
iStaticArgs = 3;
} else {
`bAutoRelease = _bAutoRelease;`
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.