1
0
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:
Alexander Medvednikov 2019-10-28 11:45:27 +03:00
parent 373873d71f
commit a7568ea54b
3 changed files with 21 additions and 21 deletions

View File

@ -34,7 +34,7 @@ jobs:
with: with:
node-version: 12.x node-version: 12.x
- name: Install dependencies - 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 - name: Build v
run: make && ./v -cc gcc -o v v.v run: make && ./v -cc gcc -o v v.v
- name: Test v->c - name: Test v->c

View File

@ -13,6 +13,8 @@ matrix:
- libglfw3-dev - libglfw3-dev
- libfreetype6-dev - libfreetype6-dev
- libssl-dev - libssl-dev
- sqlite3
- libsqlite3-dev
- os: windows - os: windows
name: "windows_gcc" name: "windows_gcc"
language: bash language: bash

View File

@ -1,24 +1,22 @@
import sqlite import sqlite
fn test_sqlite() { fn test_sqlite() {
$if mac { db := sqlite.connect('users.db')
db := sqlite.connect('users.db') db.exec("create table users (id integer primary key, name text default '');")
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 ('Sam')") db.exec("insert into users (name) values ('Peter')")
db.exec("insert into users (name) values ('Peter')") db.exec("insert into users (name) values ('Kate')")
db.exec("insert into users (name) values ('Kate')")
nr_users := db.q_int('select count(*) from users')
nr_users := db.q_int('select count(*) from users') println('nr users = $nr_users')
println('nr users = $nr_users')
name := db.q_string('select name from users where id = 1')
name := db.q_string('select name from users where id = 1') assert name == 'Sam'
assert name == 'Sam'
users := db.exec('select * from users')
users := db.exec('select * from users') assert users.len == 3
assert users.len == 3 for row in users {
for row in users { println(row.vals)
println(row.vals) }
}
}
} }