mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
db.sqlite: fix get_text to trim data after (including) first 0 character
This commit is contained in:
parent
8cd7a4f136
commit
b93dd8c5ad
2 changed files with 4 additions and 1 deletions
|
@ -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_bytes(&C.sqlite3_stmt, int) int
|
||||
|
||||
//
|
||||
fn C.sqlite3_errstr(int) &char
|
||||
|
||||
|
|
|
@ -74,7 +74,8 @@ fn (stmt &Stmt) get_text(idx int) ?string {
|
|||
if b == &char(unsafe { nil }) {
|
||||
return ''
|
||||
}
|
||||
return unsafe { b.vstring() }
|
||||
l := C.sqlite3_column_bytes(stmt.stmt, idx)
|
||||
return unsafe { b.vstring_with_len(l) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue