do_sqlite3 0.10.0-x86-mingw32 → 0.10.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog.markdown +32 -0
- data/LICENSE +1 -1
- data/README.markdown +101 -3
- data/Rakefile +56 -9
- data/ext/do_sqlite3/compat.h +55 -0
- data/ext/{do_sqlite3_ext/do_sqlite3_ext.c → do_sqlite3/do_sqlite3.c} +46 -34
- data/ext/{do_sqlite3_ext → do_sqlite3}/error.h +0 -0
- data/ext/{do_sqlite3_ext → do_sqlite3}/extconf.rb +3 -3
- data/lib/do_sqlite3.rb +19 -11
- data/lib/do_sqlite3/1.8/do_sqlite3.so +0 -0
- data/lib/do_sqlite3/1.9/do_sqlite3.so +0 -0
- data/lib/do_sqlite3/version.rb +1 -1
- data/spec/command_spec.rb +1 -1
- data/spec/connection_spec.rb +8 -6
- data/spec/reader_spec.rb +1 -1
- data/spec/result_spec.rb +3 -3
- data/spec/spec_helper.rb +19 -32
- data/spec/typecast/array_spec.rb +1 -1
- data/spec/typecast/bigdecimal_spec.rb +1 -1
- data/spec/typecast/boolean_spec.rb +1 -1
- data/spec/typecast/byte_array_spec.rb +1 -2
- data/spec/typecast/class_spec.rb +1 -1
- data/spec/typecast/date_spec.rb +1 -1
- data/spec/typecast/datetime_spec.rb +1 -1
- data/spec/typecast/float_spec.rb +2 -2
- data/spec/typecast/integer_spec.rb +1 -1
- data/spec/typecast/nil_spec.rb +4 -4
- data/spec/typecast/other_spec.rb +8 -0
- data/spec/typecast/range_spec.rb +1 -1
- data/spec/typecast/string_spec.rb +1 -1
- data/spec/typecast/time_spec.rb +1 -1
- data/tasks/compile.rake +64 -0
- data/tasks/release.rake +12 -71
- data/tasks/retrieve.rake +1 -1
- data/tasks/spec.rake +19 -15
- metadata +64 -38
- data/HISTORY.markdown +0 -22
- data/Manifest.txt +0 -31
- data/lib/do_sqlite3_ext.so +0 -0
- data/spec/lib/rspec_immediate_feedback_formatter.rb +0 -3
- data/tasks/gem.rake +0 -8
- data/tasks/install.rake +0 -15
- data/tasks/native.rake +0 -35
File without changes
|
@@ -3,8 +3,8 @@ ENV["RC_ARCHS"] = "" if RUBY_PLATFORM =~ /darwin/
|
|
3
3
|
# Loads mkmf which is used to make makefiles for Ruby extensions
|
4
4
|
require 'mkmf'
|
5
5
|
|
6
|
-
#
|
7
|
-
|
6
|
+
# Allow for custom compiler to be specified.
|
7
|
+
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
8
8
|
|
9
9
|
# Use some default search paths
|
10
10
|
dir_config("sqlite3", ["/usr/local", "/opt/local", "/usr"])
|
@@ -22,5 +22,5 @@ if have_header( "sqlite3.h" ) && have_library( "sqlite3", "sqlite3_open" )
|
|
22
22
|
have_func("sqlite3_prepare_v2")
|
23
23
|
have_func("sqlite3_open_v2")
|
24
24
|
|
25
|
-
create_makefile(
|
25
|
+
create_makefile('do_sqlite3/do_sqlite3')
|
26
26
|
end
|
data/lib/do_sqlite3.rb
CHANGED
@@ -18,22 +18,30 @@ if RUBY_PLATFORM =~ /java/
|
|
18
18
|
java_import driver
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
begin
|
22
|
+
require 'do_sqlite3/do_sqlite3'
|
23
|
+
rescue LoadError
|
24
|
+
if RUBY_PLATFORM =~ /mingw|mswin/ then
|
25
|
+
RUBY_VERSION =~ /(\d+.\d+)/
|
26
|
+
require "do_sqlite3/#{$1}/do_sqlite3"
|
27
|
+
else
|
28
|
+
raise
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
require 'do_sqlite3/version'
|
23
|
-
require 'do_sqlite3/transaction'
|
33
|
+
require 'do_sqlite3/transaction' if RUBY_PLATFORM !~ /java/
|
24
34
|
|
25
35
|
if RUBY_PLATFORM =~ /java/
|
26
36
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
1
|
34
|
-
end
|
35
|
-
end
|
37
|
+
DataObjects::Sqlite3::Connection.class_eval do
|
38
|
+
|
39
|
+
def self.pool_size
|
40
|
+
# sqlite3 can have only one write access at a time, with this
|
41
|
+
# concurrent write access will result in "Database locked" errors
|
42
|
+
1
|
36
43
|
end
|
44
|
+
|
37
45
|
end
|
38
46
|
|
39
47
|
end
|
Binary file
|
Binary file
|
data/lib/do_sqlite3/version.rb
CHANGED
data/spec/command_spec.rb
CHANGED
data/spec/connection_spec.rb
CHANGED
@@ -5,14 +5,16 @@ require 'data_objects/spec/connection_spec'
|
|
5
5
|
|
6
6
|
describe DataObjects::Sqlite3::Connection do
|
7
7
|
|
8
|
-
before
|
9
|
-
@driver
|
10
|
-
@user
|
8
|
+
before do
|
9
|
+
@driver = CONFIG.scheme
|
10
|
+
@user = CONFIG.user
|
11
11
|
@password = CONFIG.pass
|
12
|
-
@host
|
13
|
-
@port
|
12
|
+
@host = CONFIG.host
|
13
|
+
@port = CONFIG.port
|
14
14
|
@database = CONFIG.database
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
behaves_like 'a Connection'
|
18
|
+
behaves_like 'a Connection via JDNI' if JRUBY
|
19
|
+
# FIXME: behaves_like 'a Connection with JDBC URL support' if JRUBY
|
18
20
|
end
|
data/spec/reader_spec.rb
CHANGED
data/spec/result_spec.rb
CHANGED
@@ -4,16 +4,16 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/result_spec'
|
5
5
|
|
6
6
|
# splitting the descibe into two separate declaration avoids
|
7
|
-
# concurrent execution of the "
|
7
|
+
# concurrent execution of the "behaves_like ....." calls
|
8
8
|
# which would lock the database
|
9
9
|
|
10
10
|
# TODO
|
11
11
|
# the locked database created a deadlock which is worth exploring since
|
12
12
|
# such situation could appear in the wild too
|
13
13
|
describe DataObjects::Sqlite3::Result do
|
14
|
-
|
14
|
+
behaves_like 'a Result'
|
15
15
|
end
|
16
16
|
|
17
17
|
describe DataObjects::Sqlite3::Result do
|
18
|
-
|
18
|
+
behaves_like 'a Result which returns inserted keys'
|
19
19
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,51 +2,36 @@ $TESTING=true
|
|
2
2
|
JRUBY = RUBY_PLATFORM =~ /java/
|
3
3
|
|
4
4
|
require 'rubygems'
|
5
|
-
|
6
|
-
gem 'rspec', '>1.1.12'
|
7
|
-
require 'spec'
|
8
|
-
|
9
5
|
require 'date'
|
10
6
|
require 'ostruct'
|
11
|
-
require 'pathname'
|
12
7
|
require 'fileutils'
|
8
|
+
require 'win32console' if RUBY_PLATFORM =~ /mingw|mswin/
|
9
|
+
|
10
|
+
driver_lib = File.expand_path('../../lib', __FILE__)
|
11
|
+
$LOAD_PATH.unshift(driver_lib) unless $LOAD_PATH.include?(driver_lib)
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
$LOAD_PATH.unshift do_lib_path unless $LOAD_PATH.include?(do_lib_path)
|
21
|
-
|
22
|
-
if JRUBY
|
23
|
-
jdbc_lib_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'do_jdbc', 'lib'))
|
24
|
-
$LOAD_PATH.unshift jdbc_lib_path unless $LOAD_PATH.include?(jdbc_lib_path)
|
25
|
-
require 'do_jdbc'
|
13
|
+
# Prepend data_objects/do_jdbc in the repository to the load path.
|
14
|
+
# DO NOT USE installed gems, except when running the specs from gem.
|
15
|
+
repo_root = File.expand_path('../../..', __FILE__)
|
16
|
+
(['data_objects'] << ('do_jdbc' if JRUBY)).compact.each do |lib|
|
17
|
+
lib_path = "#{repo_root}/#{lib}/lib"
|
18
|
+
$LOAD_PATH.unshift(lib_path) if File.directory?(lib_path) && !$LOAD_PATH.include?(lib_path)
|
26
19
|
end
|
27
20
|
|
28
21
|
require 'data_objects'
|
29
|
-
|
30
|
-
DATAOBJECTS_SPEC_ROOT = Pathname(__FILE__).dirname.parent.parent + 'data_objects' + 'spec'
|
31
|
-
Pathname.glob((DATAOBJECTS_SPEC_ROOT + 'lib/**/*.rb').to_s).each { |f| require f }
|
22
|
+
require 'data_objects/spec/bacon'
|
32
23
|
require 'do_sqlite3'
|
33
24
|
|
34
|
-
|
35
|
-
FileUtils.mkdir_p(File.dirname(log_path))
|
36
|
-
|
37
|
-
DataObjects::Sqlite3.logger = DataObjects::Logger.new(log_path, :debug)
|
38
|
-
|
25
|
+
DataObjects::Sqlite3.logger = DataObjects::Logger.new(STDOUT, :off)
|
39
26
|
at_exit { DataObjects.logger.flush }
|
40
27
|
|
41
|
-
Spec::Runner.configure do |config|
|
42
|
-
config.include(DataObjects::Spec::PendingHelpers)
|
43
|
-
end
|
44
|
-
|
45
28
|
CONFIG = OpenStruct.new
|
46
29
|
CONFIG.scheme = 'sqlite3'
|
47
|
-
CONFIG.database = ENV['DO_SQLITE3_DATABASE'] || "
|
30
|
+
CONFIG.database = ENV['DO_SQLITE3_DATABASE'] || ":memory:"
|
48
31
|
|
49
|
-
CONFIG.uri = ENV["DO_SQLITE3_SPEC_URI"] || "#{CONFIG.scheme}
|
32
|
+
CONFIG.uri = ENV["DO_SQLITE3_SPEC_URI"] || "#{CONFIG.scheme}:#{CONFIG.database}"
|
33
|
+
CONFIG.jdbc_driver = 'org.sqlite.JDBC'
|
34
|
+
CONFIG.jdbc_uri = CONFIG.uri.sub(/sqlite3/,"jdbc:sqlite")
|
50
35
|
|
51
36
|
module DataObjectsSpecHelpers
|
52
37
|
|
@@ -111,7 +96,7 @@ module DataObjectsSpecHelpers
|
|
111
96
|
|
112
97
|
1.upto(16) do |n|
|
113
98
|
conn.create_command(<<-EOF).execute_non_query
|
114
|
-
insert into widgets(code, name, shelf_location, description, image_data, ad_description, ad_image, whitepaper_text, cad_drawing, super_number, weight) VALUES ('W#{n.to_s.rjust(7,"0")}', 'Widget #{n}', 'A14', 'This is a description', 'IMAGE DATA', 'Buy this product now!', 'AD IMAGE DATA', 'String', '
|
99
|
+
insert into widgets(code, name, shelf_location, description, image_data, ad_description, ad_image, whitepaper_text, cad_drawing, super_number, weight) VALUES ('W#{n.to_s.rjust(7,"0")}', 'Widget #{n}', 'A14', 'This is a description', 'IMAGE DATA', 'Buy this product now!', 'AD IMAGE DATA', 'String', X'434144200120002044524157494e47', 1234, 13.4);
|
115
100
|
EOF
|
116
101
|
end
|
117
102
|
|
@@ -151,3 +136,5 @@ module DataObjectsSpecHelpers
|
|
151
136
|
end
|
152
137
|
|
153
138
|
end
|
139
|
+
|
140
|
+
include DataObjectsSpecHelpers
|
data/spec/typecast/array_spec.rb
CHANGED
@@ -4,6 +4,5 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/byte_array_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Sqlite3 with ByteArray' do
|
7
|
-
|
8
|
-
# it_should_behave_like 'supporting ByteArray'
|
7
|
+
behaves_like 'supporting ByteArray'
|
9
8
|
end
|
data/spec/typecast/class_spec.rb
CHANGED
data/spec/typecast/date_spec.rb
CHANGED
data/spec/typecast/float_spec.rb
CHANGED
@@ -4,9 +4,9 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/float_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Sqlite3 with Float' do
|
7
|
-
|
7
|
+
behaves_like 'supporting Float'
|
8
8
|
end
|
9
9
|
|
10
10
|
describe 'DataObjects::Sqlite3 with Float' do
|
11
|
-
|
11
|
+
behaves_like 'supporting Float autocasting'
|
12
12
|
end
|
data/spec/typecast/nil_spec.rb
CHANGED
@@ -4,17 +4,17 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/nil_spec'
|
5
5
|
|
6
6
|
# splitting the descibe into two separate declaration avoids
|
7
|
-
# concurrent execution of the "
|
7
|
+
# concurrent execution of the "behaves_like ....." calls
|
8
8
|
# which would lock the database
|
9
9
|
|
10
10
|
describe 'DataObjects::Sqlite3 with Nil' do
|
11
|
-
|
11
|
+
behaves_like 'supporting Nil'
|
12
12
|
end
|
13
13
|
|
14
14
|
describe 'DataObjects::Sqlite3 with Nil' do
|
15
|
-
|
15
|
+
behaves_like 'supporting writing an Nil'
|
16
16
|
end
|
17
17
|
|
18
18
|
describe 'DataObjects::Sqlite3 with Nil' do
|
19
|
-
|
19
|
+
behaves_like 'supporting Nil autocasting'
|
20
20
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/typecast/other_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::H2 with other (unknown) type' do
|
7
|
+
behaves_like 'supporting other (unknown) type'
|
8
|
+
end
|
data/spec/typecast/range_spec.rb
CHANGED
data/spec/typecast/time_spec.rb
CHANGED
data/tasks/compile.rake
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
begin
|
2
|
+
gem 'rake-compiler', '~>0.7'
|
3
|
+
require 'rake/extensiontask'
|
4
|
+
require 'rake/javaextensiontask'
|
5
|
+
|
6
|
+
# Hack to avoid "allocator undefined for Proc" issue when unpacking Gems:
|
7
|
+
# gemspec provided by Jeweler uses Rake::FileList for files, test_files and
|
8
|
+
# extra_rdoc_files, and procs cannot be marshalled.
|
9
|
+
def gemspec
|
10
|
+
@clean_gemspec ||= eval("#{Rake.application.jeweler.gemspec.to_ruby}") # $SAFE = 3\n
|
11
|
+
end
|
12
|
+
|
13
|
+
Rake::ExtensionTask.new('do_sqlite3', gemspec) do |ext|
|
14
|
+
|
15
|
+
sqlite3_lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'sqlite3'))
|
16
|
+
|
17
|
+
ext.lib_dir = "lib/#{gemspec.name}"
|
18
|
+
|
19
|
+
ext.cross_compile = true
|
20
|
+
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
|
21
|
+
ext.cross_config_options << "--with-sqlite3-dir=#{sqlite3_lib}"
|
22
|
+
|
23
|
+
ext.cross_compiling do |gemspec|
|
24
|
+
gemspec.post_install_message = <<-POST_INSTALL_MESSAGE
|
25
|
+
|
26
|
+
=============================================================================
|
27
|
+
|
28
|
+
You've installed the binary version of #{gemspec.name}.
|
29
|
+
It was built using Sqlite3 version #{BINARY_VERSION}.
|
30
|
+
It's recommended to use the exact same version to avoid potential issues.
|
31
|
+
|
32
|
+
At the time of building this gem, the necessary DLL files where available
|
33
|
+
in the following download:
|
34
|
+
|
35
|
+
http://www.sqlite.org/sqlitedll-#{BINARY_VERSION}.zip
|
36
|
+
|
37
|
+
You can put the sqlite3.dll available in this package in your Ruby bin
|
38
|
+
directory, for example C:\\Ruby\\bin
|
39
|
+
|
40
|
+
=============================================================================
|
41
|
+
|
42
|
+
POST_INSTALL_MESSAGE
|
43
|
+
end
|
44
|
+
|
45
|
+
# automatically add build options to avoid need of manual input
|
46
|
+
if RUBY_PLATFORM =~ /mswin|mingw/ then
|
47
|
+
ext.config_options << "--with-sqlite3-dir=#{sqlite3_lib}"
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
Rake::JavaExtensionTask.new('do_sqlite3', gemspec) do |ext|
|
53
|
+
ext.ext_dir = 'ext-java/src/main/java'
|
54
|
+
ext.lib_dir = "lib/#{gemspec.name}"
|
55
|
+
ext.debug = ENV.has_key?('DO_JAVA_DEBUG') && ENV['DO_JAVA_DEBUG']
|
56
|
+
ext.classpath = '../do_jdbc/lib/do_jdbc_internal.jar'
|
57
|
+
ext.java_compiling do |gem|
|
58
|
+
gem.add_dependency 'jdbc-sqlite3', '>=3.5.8'
|
59
|
+
gem.add_dependency 'do_jdbc', '0.10.1'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
rescue LoadError
|
63
|
+
warn "To compile, install rake-compiler (gem install rake-compiler)"
|
64
|
+
end
|
data/tasks/release.rake
CHANGED
@@ -1,75 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
desc 'Builds all gems (native, binaries for JRuby and Windows)'
|
2
|
+
task :build_all do
|
3
|
+
`rake clean`
|
4
|
+
`rake build`
|
5
|
+
`rake java gem`
|
6
|
+
`rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1`
|
6
7
|
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# compare versions to avoid mistakes
|
15
|
-
unless ver == GEM_SPEC.version.to_s then
|
16
|
-
fail "Version mismatch (supplied and specification versions differ)."
|
17
|
-
end
|
18
|
-
|
19
|
-
# no rubyforge project? no release for you!
|
20
|
-
if GEM_SPEC.rubyforge_project == 'TODO' or GEM_SPEC.rubyforge_project.nil? then
|
21
|
-
fail "Must define rubyforge_project in your gem specification."
|
22
|
-
end
|
23
|
-
|
24
|
-
# instantiate a RubyForge object
|
25
|
-
rf = RubyForge.new
|
26
|
-
|
27
|
-
# read project info and overview
|
28
|
-
notes = begin
|
29
|
-
r = File.read("README.markdown")
|
30
|
-
r.split(/^(.*\n\-+)/)[1..4].join.strip
|
31
|
-
rescue
|
32
|
-
warn "Missing README.markdown"
|
33
|
-
''
|
34
|
-
end
|
35
|
-
|
36
|
-
# read changes
|
37
|
-
changes = begin
|
38
|
-
h = File.read("HISTORY.markdown")
|
39
|
-
h.split(/^(##+ .*)/)[1..2].join.strip
|
40
|
-
rescue
|
41
|
-
warn "Missing HISTORY.markdown"
|
42
|
-
''
|
43
|
-
end
|
44
|
-
|
45
|
-
# build the configuration for the release
|
46
|
-
config = Hash.new
|
47
|
-
config["release_notes"] = notes
|
48
|
-
config["release_changes"] = changes
|
49
|
-
config["preformatted"] = true
|
50
|
-
|
51
|
-
# prepare configuration
|
52
|
-
rf.configure config
|
53
|
-
|
54
|
-
files = FileList["pkg/#{GEM_SPEC.name}-#{GEM_SPEC.version}*.*"].to_a
|
55
|
-
fail "No files found for the release." if files.empty?
|
56
|
-
|
57
|
-
puts "Logging in RubyForge..."
|
58
|
-
rf.login
|
59
|
-
|
60
|
-
puts "Files to upload:"
|
61
|
-
files.each do |f|
|
62
|
-
puts " * #{f}"
|
63
|
-
end
|
64
|
-
|
65
|
-
puts "Releasing #{GEM_SPEC.name} version #{GEM_SPEC.version}..."
|
66
|
-
rf.add_release GEM_SPEC.rubyforge_project, GEM_SPEC.name, GEM_SPEC.version, *files
|
67
|
-
puts "Done."
|
68
|
-
end
|
69
|
-
#Rake::Task['release'].prerequisites.unshift('clean', 'cross', 'native')
|
70
|
-
else
|
71
|
-
warn "no GEM_SPEC is found or defined. 'release' task cannot work without it."
|
9
|
+
desc 'Release all gems (native, binaries for JRuby and Windows)'
|
10
|
+
task :release_all => :build_all do
|
11
|
+
Dir["pkg/do_sqlite3-#{DataObjects::Sqlite3::VERSION}*.gem"].each do |gem_path|
|
12
|
+
command = "gem push #{gem_path}"
|
13
|
+
puts "Executing #{command.inspect}:"
|
14
|
+
sh command
|
72
15
|
end
|
73
|
-
else
|
74
|
-
warn "rubyforge gem is required to generate releases, please install it (gem install rubyforge)."
|
75
16
|
end
|