1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

sqlite: improve exec_none behaviour (#14955)

This commit is contained in:
CC
2022-07-06 01:44:36 -06:00
committed by GitHub
parent bb2223c8b0
commit 6a567a0dd6
2 changed files with 15 additions and 2 deletions

View File

@@ -222,7 +222,10 @@ pub fn (db DB) error_message(code int, query string) IError {
// In case you don't expect any result, but still want an error code
// e.g. INSERT INTO ... VALUES (...)
pub fn (db DB) exec_none(query string) int {
_, code := db.exec(query)
stmt := &C.sqlite3_stmt(0)
C.sqlite3_prepare_v2(db.conn, &char(query.str), query.len, &stmt, 0)
code := C.sqlite3_step(stmt)
C.sqlite3_finalize(stmt)
return code
}