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

db.pg: add support for -d trace_pg_error

This commit is contained in:
Delyan Angelov 2023-04-17 21:49:05 +03:00
parent 3b2e58eace
commit 8275dc5a73
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -279,6 +279,9 @@ fn (db DB) handle_error_or_result(res voidptr, elabel string) ![]Row {
e := unsafe { C.PQerrorMessage(db.conn).vstring() }
if e != '' {
C.PQclear(res)
$if trace_pg_error ? {
eprintln('pg error: ${e}')
}
return error('pg ${elabel} error:\n${e}')
}
return res_to_rows(res)