sqlite3 1.4.4 → 1.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{API_CHANGES.rdoc → API_CHANGES.md} +3 -4
- data/CHANGELOG.md +419 -0
- data/CONTRIBUTING.md +24 -0
- data/Gemfile +2 -19
- data/LICENSE-DEPENDENCIES +20 -0
- data/README.md +233 -0
- data/ext/sqlite3/database.c +7 -8
- data/ext/sqlite3/extconf.rb +153 -94
- data/ext/sqlite3/sqlite3.c +2 -0
- data/faq/faq.md +431 -0
- data/lib/sqlite3/version.rb +4 -4
- data/ports/archives/sqlite-autoconf-3380500.tar.gz +0 -0
- data/test/helper.rb +5 -3
- data/test/test_database.rb +13 -6
- data/test/test_sqlite3.rb +4 -0
- metadata +40 -84
- data/CHANGELOG.rdoc +0 -333
- data/Manifest.txt +0 -59
- data/README.rdoc +0 -118
- data/Rakefile +0 -8
- data/appveyor.yml +0 -36
- data/rakelib/faq.rake +0 -9
- data/rakelib/gem.rake +0 -40
- data/rakelib/native.rake +0 -59
- data/rakelib/vendor_sqlite3.rake +0 -108
- data/setup.rb +0 -1333
data/README.rdoc
DELETED
@@ -1,118 +0,0 @@
|
|
1
|
-
= SQLite3/Ruby Interface
|
2
|
-
|
3
|
-
* https://github.com/sparklemotion/sqlite3-ruby
|
4
|
-
* http://groups.google.com/group/sqlite3-ruby
|
5
|
-
* http://rubygems.org/gems/sqlite3
|
6
|
-
* http://www.rubydoc.info/gems/sqlite3/frames
|
7
|
-
|
8
|
-
{<img src="https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/sqlite3-ruby.yml/badge.svg" alt="Build Status" />}[https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/sqlite3-ruby.yml]
|
9
|
-
|
10
|
-
== DESCRIPTION
|
11
|
-
|
12
|
-
This module allows Ruby programs to interface with the SQLite3
|
13
|
-
database engine (http://www.sqlite.org). You must have the
|
14
|
-
SQLite engine installed in order to build this module.
|
15
|
-
|
16
|
-
Note that this module is only compatible with SQLite 3.6.16 or newer.
|
17
|
-
|
18
|
-
== SYNOPSIS
|
19
|
-
|
20
|
-
require "sqlite3"
|
21
|
-
|
22
|
-
# Open a database
|
23
|
-
db = SQLite3::Database.new "test.db"
|
24
|
-
|
25
|
-
# Create a table
|
26
|
-
rows = db.execute <<-SQL
|
27
|
-
create table numbers (
|
28
|
-
name varchar(30),
|
29
|
-
val int
|
30
|
-
);
|
31
|
-
SQL
|
32
|
-
|
33
|
-
# Execute a few inserts
|
34
|
-
{
|
35
|
-
"one" => 1,
|
36
|
-
"two" => 2,
|
37
|
-
}.each do |pair|
|
38
|
-
db.execute "insert into numbers values ( ?, ? )", pair
|
39
|
-
end
|
40
|
-
|
41
|
-
# Find a few rows
|
42
|
-
db.execute( "select * from numbers" ) do |row|
|
43
|
-
p row
|
44
|
-
end
|
45
|
-
|
46
|
-
# Create another table with multiple columns
|
47
|
-
|
48
|
-
db.execute <<-SQL
|
49
|
-
create table students (
|
50
|
-
name varchar(50),
|
51
|
-
email varchar(50),
|
52
|
-
grade varchar(5),
|
53
|
-
blog varchar(50)
|
54
|
-
);
|
55
|
-
SQL
|
56
|
-
|
57
|
-
# Execute inserts with parameter markers
|
58
|
-
db.execute("INSERT INTO students (name, email, grade, blog)
|
59
|
-
VALUES (?, ?, ?, ?)", ["Jane", "me@janedoe.com", "A", "http://blog.janedoe.com"])
|
60
|
-
|
61
|
-
db.execute( "select * from students" ) do |row|
|
62
|
-
p row
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
== Compilation and Installation
|
67
|
-
|
68
|
-
Install SQLite3, enabling the option SQLITE_ENABLE_COLUMN_METADATA (see
|
69
|
-
{www.sqlite.org/compile.html}[https://www.sqlite.org/compile.html] for details).
|
70
|
-
|
71
|
-
Then do the following:
|
72
|
-
|
73
|
-
ruby setup.rb config
|
74
|
-
ruby setup.rb setup
|
75
|
-
ruby setup.rb install
|
76
|
-
|
77
|
-
Alternatively, you can download and install the RubyGem package for
|
78
|
-
SQLite3/Ruby (you must have RubyGems and SQLite3 installed, first):
|
79
|
-
|
80
|
-
gem install sqlite3
|
81
|
-
|
82
|
-
If you have sqlite3 installed in a non-standard location, you can specify the location of the include and lib files by doing:
|
83
|
-
|
84
|
-
gem install sqlite3 -- --with-sqlite3-include=/opt/local/include \
|
85
|
-
--with-sqlite3-lib=/opt/local/lib
|
86
|
-
|
87
|
-
= SUPPORT!!!
|
88
|
-
|
89
|
-
== OMG! Something has gone wrong! Where do I get help?
|
90
|
-
|
91
|
-
The best place to get help is from the
|
92
|
-
{sqlite3-ruby mailing list}[http://groups.google.com/group/sqlite3-ruby] which
|
93
|
-
can be found here:
|
94
|
-
|
95
|
-
* http://groups.google.com/group/sqlite3-ruby
|
96
|
-
|
97
|
-
== I've found a bug! Where do I file it?
|
98
|
-
|
99
|
-
Uh oh. After contacting the mailing list, you've found that you've actually
|
100
|
-
discovered a bug. You can file the bug at the
|
101
|
-
{github issues page}[https://github.com/sparklemotion/sqlite3-ruby/issues]
|
102
|
-
which can be found here:
|
103
|
-
|
104
|
-
* https://github.com/sparklemotion/sqlite3-ruby/issues
|
105
|
-
|
106
|
-
== Usage
|
107
|
-
|
108
|
-
For help figuring out the SQLite3/Ruby interface, check out the
|
109
|
-
SYNOPSIS as well as the RDoc. It includes examples of
|
110
|
-
usage. If you have any questions that you feel should be addressed in the
|
111
|
-
FAQ, please send them to {the mailing list}[http://groups.google.com/group/sqlite3-ruby]
|
112
|
-
|
113
|
-
== Source Code
|
114
|
-
|
115
|
-
The source repository is accessible via git:
|
116
|
-
|
117
|
-
git clone git://github.com/sparklemotion/sqlite3-ruby.git
|
118
|
-
|
data/Rakefile
DELETED
data/appveyor.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
---
|
2
|
-
version: "{build}"
|
3
|
-
branches:
|
4
|
-
only:
|
5
|
-
- master
|
6
|
-
- 1-3-stable
|
7
|
-
clone_depth: 10
|
8
|
-
install:
|
9
|
-
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
10
|
-
- ruby --version
|
11
|
-
- gem --version
|
12
|
-
- gem install bundler --quiet --no-ri --no-rdoc
|
13
|
-
- bundler --version
|
14
|
-
- bundle install
|
15
|
-
build_script:
|
16
|
-
- rake native gem
|
17
|
-
test_script:
|
18
|
-
- rake test
|
19
|
-
artifacts:
|
20
|
-
- path: pkg\*.gem
|
21
|
-
|
22
|
-
environment:
|
23
|
-
matrix:
|
24
|
-
- ruby_version: "193"
|
25
|
-
- ruby_version: "200"
|
26
|
-
- ruby_version: "200-x64"
|
27
|
-
- ruby_version: "21"
|
28
|
-
- ruby_version: "21-x64"
|
29
|
-
- ruby_version: "22"
|
30
|
-
- ruby_version: "22-x64"
|
31
|
-
- ruby_version: "23"
|
32
|
-
- ruby_version: "23-x64"
|
33
|
-
- ruby_version: "24"
|
34
|
-
- ruby_version: "24-x64"
|
35
|
-
- ruby_version: "25"
|
36
|
-
- ruby_version: "25-x64"
|
data/rakelib/faq.rake
DELETED
data/rakelib/gem.rake
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'hoe'
|
3
|
-
rescue LoadError
|
4
|
-
# try with rubygems?
|
5
|
-
require 'rubygems'
|
6
|
-
require 'hoe'
|
7
|
-
end
|
8
|
-
|
9
|
-
Hoe.plugin :debugging, :doofus, :git, :minitest, :bundler, :gemspec
|
10
|
-
|
11
|
-
HOE = Hoe.spec 'sqlite3' do
|
12
|
-
developer 'Jamis Buck', 'jamis@37signals.com'
|
13
|
-
developer 'Luis Lavena', 'luislavena@gmail.com'
|
14
|
-
developer 'Aaron Patterson', 'aaron@tenderlovemaking.com'
|
15
|
-
|
16
|
-
license "BSD-3-Clause"
|
17
|
-
|
18
|
-
self.readme_file = 'README.rdoc'
|
19
|
-
self.history_file = 'CHANGELOG.rdoc'
|
20
|
-
self.extra_rdoc_files = FileList['*.rdoc', 'ext/**/*.c']
|
21
|
-
|
22
|
-
require_ruby_version ">= 1.8.7"
|
23
|
-
require_rubygems_version ">= 1.3.5"
|
24
|
-
|
25
|
-
spec_extras[:extensions] = ["ext/sqlite3/extconf.rb"]
|
26
|
-
spec_extras[:metadata] = {'msys2_mingw_dependencies' => 'sqlite3'}
|
27
|
-
|
28
|
-
extra_dev_deps << ['rake-compiler', "~> 1.0"]
|
29
|
-
extra_dev_deps << ['rake-compiler-dock', "~> 0.6.0"]
|
30
|
-
extra_dev_deps << ["mini_portile2", "~> 2.0"]
|
31
|
-
extra_dev_deps << ["minitest", "~> 5.0"]
|
32
|
-
extra_dev_deps << ["hoe-bundler", "~> 1.0"]
|
33
|
-
extra_dev_deps << ["hoe-gemspec", "~> 1.0"]
|
34
|
-
|
35
|
-
clean_globs.push('**/test.db')
|
36
|
-
end
|
37
|
-
|
38
|
-
Hoe.add_include_dirs '.'
|
39
|
-
|
40
|
-
# vim: syntax=ruby
|
data/rakelib/native.rake
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# use rake-compiler for building the extension
|
2
|
-
require 'rake/extensiontask'
|
3
|
-
require 'rake/extensioncompiler'
|
4
|
-
|
5
|
-
# NOTE: version used by cross compilation of Windows native extension
|
6
|
-
# It do not affect compilation under other operating systems
|
7
|
-
# The version indicated is the minimum DLL suggested for correct functionality
|
8
|
-
BINARY_VERSION = "3.8.11.1"
|
9
|
-
URL_VERSION = "3081101"
|
10
|
-
URL_PATH = "/2015"
|
11
|
-
|
12
|
-
task :devkit do
|
13
|
-
begin
|
14
|
-
require "devkit"
|
15
|
-
rescue LoadError => e
|
16
|
-
abort "Failed to activate RubyInstaller's DevKit required for compilation."
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# build sqlite3_native C extension
|
21
|
-
RUBY_EXTENSION = Rake::ExtensionTask.new('sqlite3_native', HOE.spec) do |ext|
|
22
|
-
# where to locate the extension
|
23
|
-
ext.ext_dir = 'ext/sqlite3'
|
24
|
-
|
25
|
-
# where native extension will be copied (matches makefile)
|
26
|
-
ext.lib_dir = "lib/sqlite3"
|
27
|
-
|
28
|
-
# clean binary folders always
|
29
|
-
CLEAN.include("#{ext.lib_dir}/?.?")
|
30
|
-
|
31
|
-
# automatically add build options to avoid need of manual input
|
32
|
-
if RUBY_PLATFORM =~ /mswin|mingw/ then
|
33
|
-
# define target for extension (supporting fat binaries)
|
34
|
-
RUBY_VERSION =~ /(\d+\.\d+)/
|
35
|
-
ext.lib_dir = "lib/sqlite3/#{$1}"
|
36
|
-
else
|
37
|
-
|
38
|
-
# detect cross-compiler available
|
39
|
-
begin
|
40
|
-
Rake::ExtensionCompiler.mingw_host
|
41
|
-
ext.cross_compile = true
|
42
|
-
ext.cross_platform = ['i386-mswin32-60', 'i386-mingw32', 'x64-mingw32']
|
43
|
-
ext.cross_compiling do |spec|
|
44
|
-
# The fat binary gem doesn't depend on the sqlite3 package, since it bundles the library.
|
45
|
-
spec.metadata.delete('msys2_mingw_dependencies')
|
46
|
-
end
|
47
|
-
rescue RuntimeError
|
48
|
-
# noop
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# ensure things are compiled prior testing
|
54
|
-
if RUBY_PLATFORM =~ /mingw/ then
|
55
|
-
task :test => ["compile:msys2"]
|
56
|
-
else
|
57
|
-
task :test => [:compile]
|
58
|
-
end
|
59
|
-
# vim: syntax=ruby
|
data/rakelib/vendor_sqlite3.rake
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
require "rake/clean"
|
2
|
-
require "rake/extensioncompiler"
|
3
|
-
require "mini_portile2"
|
4
|
-
|
5
|
-
CLOBBER.include("ports")
|
6
|
-
|
7
|
-
directory "ports"
|
8
|
-
|
9
|
-
def define_sqlite_task(platform, host)
|
10
|
-
recipe = MiniPortile.new "sqlite3", BINARY_VERSION
|
11
|
-
recipe.files = ["http://sqlite.org#{URL_PATH}/sqlite-autoconf-#{URL_VERSION}.tar.gz"]
|
12
|
-
recipe.host = host
|
13
|
-
|
14
|
-
desc "Compile sqlite3 for #{platform} (#{host})"
|
15
|
-
task "ports:sqlite3:#{platform}" => ["ports"] do |t|
|
16
|
-
checkpoint = "ports/.#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
17
|
-
|
18
|
-
unless File.exist?(checkpoint)
|
19
|
-
cflags = "-O2 -DSQLITE_ENABLE_COLUMN_METADATA"
|
20
|
-
cflags << " -fPIC" if recipe.host && recipe.host.include?("x86_64")
|
21
|
-
recipe.configure_options << "CFLAGS='#{cflags}'"
|
22
|
-
recipe.cook
|
23
|
-
touch checkpoint
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
recipe
|
28
|
-
end
|
29
|
-
|
30
|
-
# native sqlite3 compilation
|
31
|
-
recipe = define_sqlite_task(RUBY_PLATFORM, RbConfig::CONFIG["host"])
|
32
|
-
|
33
|
-
# force compilation of sqlite3 when working natively under MinGW
|
34
|
-
if RUBY_PLATFORM =~ /mingw/
|
35
|
-
RUBY_EXTENSION.config_options << "--with-opt-dir=#{recipe.path}"
|
36
|
-
|
37
|
-
# also prepend DevKit into compilation phase
|
38
|
-
Rake::Task["compile"].prerequisites.unshift "devkit", "ports:sqlite3:#{RUBY_PLATFORM}"
|
39
|
-
Rake::Task["native"].prerequisites.unshift "devkit", "ports:sqlite3:#{RUBY_PLATFORM}"
|
40
|
-
|
41
|
-
namespace "compile" do
|
42
|
-
desc "Build using MSYS2 sqlite package"
|
43
|
-
task :msys2 do
|
44
|
-
RUBY_EXTENSION.config_options.pop
|
45
|
-
t = Rake::Task["compile"]
|
46
|
-
t.prerequisites.clear
|
47
|
-
t.prerequisites << "devkit" << "compile:#{RUBY_PLATFORM}"
|
48
|
-
t.invoke
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# trick to test local compilation of sqlite3
|
54
|
-
if ENV["USE_MINI_PORTILE"] == "true"
|
55
|
-
# fake recipe so we can build a directory to it
|
56
|
-
recipe = MiniPortile.new "sqlite3", BINARY_VERSION
|
57
|
-
recipe.host = RbConfig::CONFIG["host"]
|
58
|
-
|
59
|
-
RUBY_EXTENSION.config_options << "--with-opt-dir=#{recipe.path}"
|
60
|
-
|
61
|
-
# compile sqlite3 first
|
62
|
-
Rake::Task["compile"].prerequisites.unshift "ports:sqlite3:#{RUBY_PLATFORM}"
|
63
|
-
end
|
64
|
-
|
65
|
-
# iterate over all cross-compilation platforms and define the proper
|
66
|
-
# sqlite3 recipe for it.
|
67
|
-
if RUBY_EXTENSION.cross_compile
|
68
|
-
config_path = File.expand_path("~/.rake-compiler/config.yml")
|
69
|
-
if File.exist?(config_path)
|
70
|
-
# obtains platforms from rake-compiler's config.yml
|
71
|
-
config_file = YAML.load_file(config_path)
|
72
|
-
|
73
|
-
Array(RUBY_EXTENSION.cross_platform).each do |platform|
|
74
|
-
# obtain platform from rbconfig file
|
75
|
-
config_key = config_file.keys.sort.find { |key|
|
76
|
-
key.start_with?("rbconfig-#{platform}-")
|
77
|
-
}
|
78
|
-
rbfile = config_file[config_key]
|
79
|
-
|
80
|
-
# skip if rbconfig cannot be read
|
81
|
-
next unless File.exist?(rbfile)
|
82
|
-
|
83
|
-
host = IO.read(rbfile).match(/CONFIG\["CC"\] = "(.*)"/)[1].sub(/\-gcc/, '')
|
84
|
-
recipe = define_sqlite_task(platform, host)
|
85
|
-
|
86
|
-
RUBY_EXTENSION.cross_config_options << {
|
87
|
-
platform => "--with-opt-dir=#{recipe.path}"
|
88
|
-
}
|
89
|
-
|
90
|
-
# pre-compile sqlite3 port when cross-compiling
|
91
|
-
task :cross => "ports:sqlite3:#{platform}"
|
92
|
-
end
|
93
|
-
else
|
94
|
-
warn "rake-compiler configuration doesn't exist, but is required for ports"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
task :cross do
|
99
|
-
["CC", "CXX", "LDFLAGS", "CPPFLAGS", "RUBYOPT"].each do |var|
|
100
|
-
ENV.delete(var)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
desc "Build windows binary gems per rake-compiler-dock."
|
105
|
-
task "gem:windows" do
|
106
|
-
require "rake_compiler_dock"
|
107
|
-
RakeCompilerDock.sh "bundle && rake cross native gem MAKE='nice make -j`nproc`'"
|
108
|
-
end
|