mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v orm: select
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user