mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ci: install libsqlite package
This commit is contained in:
parent
373873d71f
commit
a7568ea54b
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -34,7 +34,7 @@ jobs:
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get update; sudo apt-get install --quiet -y libglfw3 libglfw3-dev libfreetype6-dev libssl-dev
|
||||
run: sudo apt-get update; sudo apt-get install --quiet -y libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev
|
||||
- name: Build v
|
||||
run: make && ./v -cc gcc -o v v.v
|
||||
- name: Test v->c
|
||||
|
@ -13,6 +13,8 @@ matrix:
|
||||
- libglfw3-dev
|
||||
- libfreetype6-dev
|
||||
- libssl-dev
|
||||
- sqlite3
|
||||
- libsqlite3-dev
|
||||
- os: windows
|
||||
name: "windows_gcc"
|
||||
language: bash
|
||||
|
@ -1,24 +1,22 @@
|
||||
import sqlite
|
||||
|
||||
fn test_sqlite() {
|
||||
$if mac {
|
||||
db := sqlite.connect('users.db')
|
||||
db.exec("create table users (id integer primary key, name text default '');")
|
||||
|
||||
db.exec("insert into users (name) values ('Sam')")
|
||||
db.exec("insert into users (name) values ('Peter')")
|
||||
db.exec("insert into users (name) values ('Kate')")
|
||||
|
||||
nr_users := db.q_int('select count(*) from users')
|
||||
println('nr users = $nr_users')
|
||||
|
||||
name := db.q_string('select name from users where id = 1')
|
||||
assert name == 'Sam'
|
||||
|
||||
users := db.exec('select * from users')
|
||||
assert users.len == 3
|
||||
for row in users {
|
||||
println(row.vals)
|
||||
}
|
||||
}
|
||||
db := sqlite.connect('users.db')
|
||||
db.exec("create table users (id integer primary key, name text default '');")
|
||||
|
||||
db.exec("insert into users (name) values ('Sam')")
|
||||
db.exec("insert into users (name) values ('Peter')")
|
||||
db.exec("insert into users (name) values ('Kate')")
|
||||
|
||||
nr_users := db.q_int('select count(*) from users')
|
||||
println('nr users = $nr_users')
|
||||
|
||||
name := db.q_string('select name from users where id = 1')
|
||||
assert name == 'Sam'
|
||||
|
||||
users := db.exec('select * from users')
|
||||
assert users.len == 3
|
||||
for row in users {
|
||||
println(row.vals)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user