07.02.2012, 08:27
Whoop whoop! Minor, yet awesome update: db_get_field/db_get_field_assoc will no longer crash on NULL values!
new uid = db_insert(db, "INSERT INTO blabla VALUES blabla");
if (uid) {
// uid is now the index for whatever we just inserted
}
printf("%d", db_query_int(db, "SELECT COUNT(*) FROM something"));
Your script should behave exactly the same way when you include SQLite, and there won't be any significant performance changes.
What are the reasons you need this? |
new uid, DBStatement:stmt = db_prepare(trpdb, "SELECT uid FROM users WHERE name=? LIMIT 1");
db_last_insert_rowid(DB:db)
"INSERT INTO staticphones (x,y,z,rz,int,vw,type) VALUES(?,?,?,?,?,?,1)"
[07:24:18] [debug] Server crashed while executing timertest.amx [07:24:18] [debug] AMX backtrace: [07:24:18] [debug] #0 00005530 in booltmt_fetch_row (&DBStatementtStatement=@0x00056c90) at [...]\include\sqlitei.inc:1724 [07:24:18] [debug] #1 0000a29c in public OnGameModeInit () at [...]\timertest.pwn:88 [07:24:18] [debug] System backtrace: [07:24:18] [debug] #0 f71dbecb in _ZN10StackTraceC1EPv () from plugins/crashdetect.so [07:24:18] [debug] #1 f71d3c69 in _ZN11CrashDetect20PrintSystemBacktraceEPv () from plugins/crashdetect.so [07:24:18] [debug] #2 f71d5c99 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so [07:24:18] [debug] #3 f71db9d8 in ?? () from plugins/crashdetect.so [07:24:18] [debug] #4 ffffe600 in ?? () [07:24:18] [debug] #5 f71df3b6 in amx_Exec () from plugins/crashdetect.so [07:24:18] [debug] #6 f71d5e1e in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so [07:24:18] [debug] #7 f71d82de in ?? () from plugins/crashdetect.so [07:24:18] [debug] #8 080acc4b in ?? () from ./samp03svr [07:24:18] [debug] #9 080b2b3d in ?? () from ./samp03svr [07:24:18] [debug] #10 080b1407 in ?? () from ./samp03svr [07:24:18] [debug] #11 004d6ebc in __libc_start_main () from /lib/libc.so.6 [07:24:18] [debug] #12 0804b521 in ?? () from ./samp03svr |