db.sqlite: fix get_text to trim data after (including) first 0 character

This commit is contained in:
D4MI4NX 2025-08-04 21:59:28 +02:00
parent 8cd7a4f136
commit b93dd8c5ad
2 changed files with 4 additions and 1 deletions

View file

@ -122,6 +122,8 @@ fn C.sqlite3_column_count(&C.sqlite3_stmt) int
fn C.sqlite3_column_type(&C.sqlite3_stmt, int) int fn C.sqlite3_column_type(&C.sqlite3_stmt, int) int
fn C.sqlite3_column_bytes(&C.sqlite3_stmt, int) int
// //
fn C.sqlite3_errstr(int) &char fn C.sqlite3_errstr(int) &char

View file

@ -74,7 +74,8 @@ fn (stmt &Stmt) get_text(idx int) ?string {
if b == &char(unsafe { nil }) { if b == &char(unsafe { nil }) {
return '' return ''
} }
return unsafe { b.vstring() } l := C.sqlite3_column_bytes(stmt.stmt, idx)
return unsafe { b.vstring_with_len(l) }
} }
} }