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

sqlite: add busy_timeout() (#13053)

This commit is contained in:
kahsa 2022-01-06 18:47:20 +09:00 committed by GitHub
parent c97f0c59d1
commit 075cd29c14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,6 +59,8 @@ fn C.sqlite3_open(&char, &&C.sqlite3) int
fn C.sqlite3_close(&C.sqlite3) int
fn C.sqlite3_busy_timeout(db &C.sqlite3, ms int) int
fn C.sqlite3_last_insert_rowid(&C.sqlite3) i64
//
@ -234,3 +236,8 @@ pub fn (db DB) exec_param(query string, param string) []Row {
pub fn (db DB) create_table(table_name string, columns []string) {
db.exec('create table if not exists $table_name (' + columns.join(',\n') + ')')
}
// Set a busy timeout in milliseconds https://www.sqlite.org/c3ref/busy_timeout.html
pub fn (db DB) busy_timeout(ms int) int {
return C.sqlite3_busy_timeout(db.conn, ms)
}