This commit is contained in:
Indribell 2023-12-12 21:28:43 -07:00 committed by GitHub
commit 0876a7b4f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -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_SUBSECOND` format (or `SQLite3::DATE_FORMAT_SECOND` if the text does not contain a dot).