mirror of
https://gitea.invidious.io/iv-org/shard-crystal-sqlite3.git
synced 2024-08-15 00:53:26 +00:00
Added alternative example
This commit is contained in:
parent
a95182be08
commit
eea13c922c
1 changed files with 8 additions and 0 deletions
|
@ -44,6 +44,14 @@ DB.open "sqlite3://./data.db" do |db|
|
|||
end
|
||||
```
|
||||
|
||||
Example 2
|
||||
```
|
||||
db = DB.open "sqlite3://./data.db"
|
||||
db.exec "CREATE TABLE IF NOT EXISTS contacts (name text, age integer)"
|
||||
db.exec "INSERT INTO contacts VALUES (?, ?)", "John Doe", 30
|
||||
contacts = db.query_all "SELECT name, age FROM contacts", as: {name: String, age: Int64}
|
||||
```
|
||||
|
||||
### DB::Any
|
||||
|
||||
* `Time` is implemented as `TEXT` column using `SQLite3::DATE_FORMAT` format.
|
||||
|
|
Loading…
Reference in a new issue