crystal-sqlite3 v0.10.0

SQLite3 bindings for Crystal

Releases:

  • v0.10.0 - June 18, 2018
  • v0.9.0 - December 31, 2017
  • v0.8.3 - November 8, 2017
  • v0.8.2 - March 30, 2017
  • v0.8.1 - December 15, 2016

Dependencies:

Owner:

crystal-sqlite3 Build Status

SQLite3 bindings for Crystal.

Check crystal-db for general db driver documentation. crystal-sqlite3 driver is registered under sqlite3:// uri.

Installation

Add this to your application's shard.yml:

dependencies:
  sqlite3:
    github: crystal-lang/crystal-sqlite3

Usage

require "sqlite3"

DB.open "sqlite3://./data.db" do |db|
  db.exec "create table contacts (name text, 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|
    puts "#{rs.column_name(0)} (#{rs.column_name(1)})"
    # => name (age)
    rs.each do
      puts "#{rs.read(String)} (#{rs.read(Int32)})"
      # => Sarah (33)
      # => John Doe (30)
    end
  end
end

DB::Any

  • Time is implemented as TEXT column using SQLite3::DATE_FORMAT format.
  • Bool is implemented as INT column mapping 0/1 values.

v0.10.0 (2018-06-18)

  • Fix compatibility issues for crystal 0.25.0 (#34)
    • All the time instances are translated to UTC before saving them in the db

v0.9.0 (2017-12-31)

  • Update to crystal-db ~> 0.5.0

v0.8.3 (2017-11-07)

  • Update to crystal-db ~> 0.4.1
  • Add SQLite3::VERSION constant with shard version.
  • Add support for multi-steps statements execution. (see #27, thanks @t-richards)
  • Fix how resources are released. (see #23, thanks @benoist)
  • Fix blob c bindings. (see #28, thanks @rufusroflpunch)

v0.8.2 (2017-03-21)

Github statistic:
  • 65
  • 22
  • 11
  • 7
  • 24 days ago

License:

MIT License

Links: