/sqlite3-ruby-static

SQLite3 bindings with embedded SQLite library.

Primary LanguageCOtherNOASSERTION

SQLite3/Ruby Interface with embedded SQLite3 library

DESCRIPTION

This module allows Ruby programs to interface with the SQLite3 database engine (www.sqlite.org). This module embeds its own SQLite3 library built from the SQLite amalgamation, so it doesn’t have any external dependencies

SYNOPSIS

require "sqlite3"

# Open a database
db = SQLite3::Database.new "test.db"

# Create a table
rows = db.execute <<-SQL
  create table numbers (
    name varchar(30),
    val int
  );
SQL

# Execute a few inserts
{
  "one" => 1,
  "two" => 2,
}.each do |pair|
  db.execute "insert into numbers values ( ?, ? )", pair
end

# Find a few rows
db.execute( "select * from numbers" ) do |row|
  p row
end

# Create another table with multiple columns

db.execute <<-SQL
  create table students (
    name varchar(50),
    email varchar(50),
    grade varchar(5),
    blog varchar(50)
  );
SQL

# Execute inserts with parameter markers
db.execute("INSERT INTO students (name, email, grade, blog) 
            VALUES (?, ?, ?, ?)", ["Jane", "me@janedoe.com", "A", "http://blog.janedoe.com"])

db.execute( "select * from students" ) do |row|
  p row
end

Compilation and Installation

To build the gem do the following:

gem build sqlite3-ruby-static.gemspec
gem install sqlite3-ruby-static-*.gem

Or to build the gem under the sqlite3 name:

gem build sqlite3.gemspec
gem install sqlite3-*.gem

To install with commandline:

gem install sqlite3-ruby-static --version "[Type version number here]" --source "https://rubygems.pkg.github.com/rangeroob"

To install with Gemfile:

source "https://rubygems.pkg.github.com/rangeroob" do
gem "sqlite3-ruby-static", "[Type version number here]"
end

Use with Rails

To use this library with Ruby on Rails put this in the Gemfile:

gem 'sqlite3', git: 'https://github.com/rangeroob/sqlite3-ruby-static', tag: 'v1.4.2.20200412165500.3.22'
# You can use branch (ie: master), ref, tag (ie: like the example above).

This should make Ruby on Rails think it is using the sqlite3 gem (which Ruby on Rails has a hard dependency on).

SUPPORT

OMG! Something has gone wrong! Where do I get help?

If you ran into any issue please open an issue here (github.com/rangeroob/sqlite3-ruby-static/issues) and I with try my best to help you out. If we determine that the issue is in upstream then the best place to get help is from the sqlite3-ruby mailing list which can be found here:

* http://groups.google.com/group/sqlite3-ruby

I’ve found a bug! Where do I file it?

If you found a bug and it is determined to be just affect this fork please file a bug report under the github issues (github.com/rangeroob/sqlite3-ruby-static/issues).

Usage

For help figuring out the SQLite3/Ruby interface, check out the SYNOPSIS as well as the RDoc. It includes examples of usage.

Source Code

The source repository is accessible via git:

git clone git@github.com:rangeroob/sqlite3-ruby-static.git