mirror of
https://github.com/vlang/v.git
synced 2025-09-16 07:52:32 +03:00
v orm: select
This commit is contained in:
parent
23993d2264
commit
ed58192e4c
10 changed files with 304 additions and 44 deletions
|
@ -37,6 +37,21 @@ pub fn connect(path string) ?DB {
|
|||
}
|
||||
}
|
||||
|
||||
// Only for V ORM
|
||||
fn (db DB) init_stmt(query string) &C.sqlite3_stmt {
|
||||
stmt := &C.sqlite3_stmt(0)
|
||||
C.sqlite3_prepare_v2(db.conn, query.str, -1, &stmt, 0)
|
||||
return stmt
|
||||
}
|
||||
|
||||
// Only for V ORM
|
||||
fn get_int_from_stmt(stmt &C.sqlite3_stmt) int {
|
||||
C.sqlite3_step(stmt)
|
||||
res := C.sqlite3_column_int(stmt, 0)
|
||||
C.sqlite3_finalize(stmt)
|
||||
return res
|
||||
}
|
||||
|
||||
// Returns a single cell with value int.
|
||||
pub fn (db DB) q_int(query string) int {
|
||||
stmt := &C.sqlite3_stmt(0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue