forked from github/server
fix binding faction.no to sqlite statement.
This commit is contained in:
parent
71090d0091
commit
cffcac8af7
|
@ -100,13 +100,20 @@ int db_driver_faction_save(dbrow_id * p_id, int no, const char *email, const cha
|
|||
{
|
||||
dbrow_id id = *p_id;
|
||||
int err;
|
||||
char dbno[4];
|
||||
size_t len;
|
||||
const char *str;
|
||||
sqlite3_stmt *stmt = (id > 0) ? g_stmt_update_faction : g_stmt_insert_faction;
|
||||
|
||||
assert(g_game_db);
|
||||
|
||||
err = sqlite3_reset(stmt);
|
||||
if (err != SQLITE_OK) return err;
|
||||
err = sqlite3_bind_text(stmt, 1, itoa36(no), -1, SQLITE_STATIC);
|
||||
str = itoa36(no);
|
||||
len = strlen(str);
|
||||
assert(len <= 4);
|
||||
memcpy(dbno, str, len);
|
||||
err = sqlite3_bind_text(stmt, 1, dbno, len, SQLITE_STATIC);
|
||||
if (err != SQLITE_OK) return err;
|
||||
err = sqlite3_bind_text(stmt, 2, email, -1, SQLITE_STATIC);
|
||||
if (err != SQLITE_OK) return err;
|
||||
|
|
Loading…
Reference in New Issue