There is already a forked implementation for [sqlite](https://github.com/bcardiff/crystal-sqlite3/tree/db) and [mysql](https://github.com/bcardiff/crystal-mysql/tree/db) that (partially) implements mysql's binary protocol (no dependency!)
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
db:
github: bcardiff/crystal-db
```
## Usage
Since this is an abstract db api, it's usage is through a concrete database driver.
```crystal
require "db"
require "sqlite3"
DB.open "sqlite3:./file.db" do |db|
db.exec "create table contacts (name string, age integer)"
db.exec "insert into contacts values (?, ?)", "John Doe", 30
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
puts "contacts:"
db.query "select name, age from contacts order by age desc" do |rs|