mirror of
https://gitea.invidious.io/iv-org/shard-crystal-sqlite3.git
synced 2024-08-15 00:53:26 +00:00
update to last db design
This commit is contained in:
parent
15417b7c38
commit
503868f434
7 changed files with 104 additions and 97 deletions
|
@ -1,10 +1,14 @@
|
|||
require "db"
|
||||
require "../src/sqlite3"
|
||||
|
||||
DB.open "sqlite3", ":memory:" do |db|
|
||||
DB.open "sqlite3://%3Amemory%3A" do |db|
|
||||
db.exec "create table contacts (name string, age integer)"
|
||||
db.exec "insert into contacts values (?, ?)", "John Doe", 30
|
||||
db.exec "insert into contacts values (:name, :age)", {name: "Sarah", age: 33}
|
||||
|
||||
args = [] of DB::Any
|
||||
args << "Sarah"
|
||||
args << 33
|
||||
db.exec "insert into contacts values (?, ?)", args
|
||||
|
||||
puts "max age:"
|
||||
puts db.scalar "select max(age) from contacts" # => 33
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue