aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2020-11-13 17:00:32 +0100
committerregnat <rg@regnat.ovh>2020-11-17 10:05:45 +0100
commit7de21f6664ffd4a66e5ef70058a4c450985a1981 (patch)
tree9dc66fe6e23499d048276e6e4874924931382184 /src
parentef84c780bb901011e090b9f12d293d136193a428 (diff)
Make the sql debug statements more useful
Print the expanded sql query (with the variables bound to their value) rather than the original one in case of error
Diffstat (limited to 'src')
-rw-r--r--src/libstore/sqlite.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstore/sqlite.cc b/src/libstore/sqlite.cc
index 31a1f0cac..f5935ee5c 100644
--- a/src/libstore/sqlite.cc
+++ b/src/libstore/sqlite.cc
@@ -147,14 +147,14 @@ void SQLiteStmt::Use::exec()
int r = step();
assert(r != SQLITE_ROW);
if (r != SQLITE_DONE)
- throwSQLiteError(stmt.db, fmt("executing SQLite statement '%s'", stmt.sql));
+ throwSQLiteError(stmt.db, fmt("executing SQLite statement '%s'", sqlite3_expanded_sql(stmt.stmt)));
}
bool SQLiteStmt::Use::next()
{
int r = step();
if (r != SQLITE_DONE && r != SQLITE_ROW)
- throwSQLiteError(stmt.db, fmt("executing SQLite query '%s'", stmt.sql));
+ throwSQLiteError(stmt.db, fmt("executing SQLite query '%s'", sqlite3_expanded_sql(stmt.stmt)));
return r == SQLITE_ROW;
}