diff options
author | Adam <Adam@anope.org> | 2017-02-07 20:30:23 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-02-07 20:30:23 -0500 |
commit | f5cf26cee10612ac46acb7c8c6d2317ef33425c5 (patch) | |
tree | a21ca28eb14edd5684a45897f38164d95217057e | |
parent | 09dca29c8898916772c2a2a6b86b625c812007ed (diff) |
sqlite: fix sqlite3_last_insert_rowid() call
-rw-r--r-- | modules/sqlite.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/sqlite.cpp b/modules/sqlite.cpp index b9bc063c5..95af6e39a 100644 --- a/modules/sqlite.cpp +++ b/modules/sqlite.cpp @@ -30,7 +30,7 @@ using namespace SQL; class SQLiteResult : public Result { public: - SQLiteResult(sqlite3 *sql, unsigned int id, const Query &q, const Anope::string &fq, sqlite3_stmt *stmt) : Result(id, q, fq) + SQLiteResult(sqlite3 *sql, const Query &q, const Anope::string &fq, sqlite3_stmt *stmt) : Result(0, q, fq) { int cols = sqlite3_column_count(stmt); for (int i = 0; i < cols; ++i) @@ -58,6 +58,8 @@ class SQLiteResult : public Result { error = sqlite3_errmsg(sql); } + + id = sqlite3_last_insert_rowid(sql); } SQLiteResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err) @@ -221,8 +223,7 @@ Result SQLiteService::RunQuery(const Query &query) return SQLiteResult(query, real_query, msg); } - int id = sqlite3_last_insert_rowid(this->sql); - SQLiteResult result(this->sql, id, query, real_query, stmt); + SQLiteResult result(this->sql, query, real_query, stmt); sqlite3_finalize(stmt); |