mirror of
https://github.com/vlang/v.git
synced 2025-09-14 15:02:33 +03:00
sqlite: add close
method, and an is_open
field (#7382)
This commit is contained in:
parent
6c341a77f5
commit
c831711a0e
2 changed files with 24 additions and 3 deletions
|
@ -4,9 +4,10 @@ fn test_sqlite() {
|
|||
$if !linux {
|
||||
return
|
||||
}
|
||||
db := sqlite.connect(':memory:') or {
|
||||
mut db := sqlite.connect(':memory:') or {
|
||||
panic(err)
|
||||
}
|
||||
assert db.is_open
|
||||
db.exec('drop table if exists users')
|
||||
db.exec("create table users (id integer primary key, name text default '');")
|
||||
db.exec("insert into users (name) values ('Sam')")
|
||||
|
@ -25,4 +26,8 @@ fn test_sqlite() {
|
|||
panic(err)
|
||||
}
|
||||
assert user.vals.len == 2
|
||||
db.close() or {
|
||||
panic(err)
|
||||
}
|
||||
assert !db.is_open
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue