sqlite3 1.3.7-x86-mswin32-60 → 1.3.8-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,4 +1,21 @@
1
- === 1.3.7
1
+ === 1.3.8 / 2013-08-17
2
+
3
+ * Enhancements:
4
+ * Windows: build against SQLite 3.7.17
5
+
6
+ * Bugfixes:
7
+ * Reset exception message. Closes #80
8
+ * Correctly convert BLOB values to Ruby. Closes #65
9
+ * Add MIT license reference to gemspec. Closes #99
10
+ * Remove unused pointer. Closes #89
11
+
12
+ * Internal:
13
+ * Backport improvements in cross compilation for Windows
14
+ * Use of Minitest for internal tests
15
+ * Use Gemfile (generated by Hoe) to deal with dependencies
16
+ * Cleanup Travis CI
17
+
18
+ === 1.3.7 / 2013-01-11
2
19
 
3
20
  * Bugfixes
4
21
  * Closing a bad statement twice will not segv.
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # -*- ruby -*-
2
+
3
+ # DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`.
4
+
5
+ source "https://rubygems.org/"
6
+
7
+
8
+ gem "minitest", "~>5.0", :group => [:development, :test]
9
+ gem "rdoc", "~>4.0", :group => [:development, :test]
10
+ gem "rake-compiler", "~>0.9.1", :group => [:development, :test]
11
+ gem "mini_portile", "~>0.5.1", :group => [:development, :test]
12
+ gem "hoe-bundler", "~>1.0", :group => [:development, :test]
13
+ gem "hoe", "~>3.7", :group => [:development, :test]
14
+
15
+ # vim: syntax=ruby
data/Manifest.txt CHANGED
@@ -1,6 +1,7 @@
1
1
  API_CHANGES.rdoc
2
2
  CHANGELOG.rdoc
3
3
  ChangeLog.cvs
4
+ Gemfile
4
5
  LICENSE
5
6
  Manifest.txt
6
7
  README.rdoc
@@ -45,6 +46,7 @@ test/test_integration_open_close.rb
45
46
  test/test_integration_pending.rb
46
47
  test/test_integration_resultset.rb
47
48
  test/test_integration_statement.rb
49
+ test/test_result_set.rb
48
50
  test/test_sqlite3.rb
49
51
  test/test_statement.rb
50
52
  test/test_statement_execute.rb
@@ -281,9 +281,16 @@ static VALUE sqlite3val2rb(sqlite3_value * val)
281
281
  case SQLITE_TEXT:
282
282
  return rb_tainted_str_new2((const char *)sqlite3_value_text(val));
283
283
  break;
284
- case SQLITE_BLOB:
285
- return rb_tainted_str_new2((const char *)sqlite3_value_blob(val));
284
+ case SQLITE_BLOB: {
285
+ /* Sqlite warns calling sqlite3_value_bytes may invalidate pointer from sqlite3_value_blob,
286
+ so we explicitly get the length before getting blob pointer.
287
+ Note that rb_str_new and rb_tainted_str_new apparently create string with ASCII-8BIT (BINARY) encoding,
288
+ which is what we want, as blobs are binary
289
+ */
290
+ int len = sqlite3_value_bytes(val);
291
+ return rb_tainted_str_new((const char *)sqlite3_value_blob(val), len);
286
292
  break;
293
+ }
287
294
  case SQLITE_NULL:
288
295
  return Qnil;
289
296
  break;
@@ -79,7 +79,6 @@ static VALUE initialize(VALUE self, VALUE db, VALUE sql)
79
79
  static VALUE sqlite3_rb_close(VALUE self)
80
80
  {
81
81
  sqlite3StmtRubyPtr ctx;
82
- sqlite3 * db;
83
82
 
84
83
  Data_Get_Struct(self, sqlite3StmtRuby, ctx);
85
84
 
@@ -186,6 +185,8 @@ static VALUE step(VALUE self)
186
185
  return Qnil;
187
186
  break;
188
187
  default:
188
+ sqlite3_reset(stmt);
189
+ ctx->done_p = 0;
189
190
  CHECK(sqlite3_db_handle(ctx->st), value);
190
191
  }
191
192
 
Binary file
Binary file
Binary file
@@ -1,12 +1,12 @@
1
1
  module SQLite3
2
2
 
3
- VERSION = '1.3.7'
3
+ VERSION = '1.3.8'
4
4
 
5
5
  module VersionProxy
6
6
 
7
7
  MAJOR = 1
8
8
  MINOR = 3
9
- TINY = 7
9
+ TINY = 8
10
10
  BUILD = nil
11
11
 
12
12
  STRING = [ MAJOR, MINOR, TINY, BUILD ].compact.join( "." )
data/tasks/gem.rake CHANGED
@@ -6,23 +6,28 @@ rescue LoadError
6
6
  require 'hoe'
7
7
  end
8
8
 
9
- Hoe.plugin :debugging, :doofus, :git
9
+ Hoe.plugin :debugging, :doofus, :git, :minitest, :bundler
10
10
 
11
11
  HOE = Hoe.spec 'sqlite3' do
12
12
  developer 'Jamis Buck', 'jamis@37signals.com'
13
13
  developer 'Luis Lavena', 'luislavena@gmail.com'
14
14
  developer 'Aaron Patterson', 'aaron@tenderlovemaking.com'
15
15
 
16
+ license "MIT"
17
+
16
18
  self.readme_file = 'README.rdoc'
17
19
  self.history_file = 'CHANGELOG.rdoc'
18
20
  self.extra_rdoc_files = FileList['*.rdoc', 'ext/**/*.c']
19
21
 
20
- spec_extras[:required_ruby_version] = Gem::Requirement.new('>= 1.8.7')
21
- spec_extras[:required_rubygems_version] = '>= 1.3.5'
22
- spec_extras[:extensions] = ["ext/sqlite3/extconf.rb"]
22
+ require_ruby_version ">= 1.8.7"
23
+ require_rubygems_version ">= 1.3.5"
24
+
25
+ spec_extras[:extensions] = ["ext/sqlite3/extconf.rb"]
23
26
 
24
- extra_dev_deps << ['rake-compiler', "~> 0.8.2"]
25
- extra_dev_deps << ["mini_portile", "~> 0.2.2"]
27
+ extra_dev_deps << ['rake-compiler', "~> 0.9.1"]
28
+ extra_dev_deps << ["mini_portile", "~> 0.5.1"]
29
+ extra_dev_deps << ["minitest", "~> 5.0"]
30
+ extra_dev_deps << ["hoe-bundler", "~> 1.0"]
26
31
 
27
32
  clean_globs.push('**/test.db')
28
33
  end
data/tasks/native.rake CHANGED
@@ -1,14 +1,16 @@
1
1
  # use rake-compiler for building the extension
2
2
  require 'rake/extensiontask'
3
+ require 'rake/extensioncompiler'
3
4
 
4
5
  # NOTE: version used by cross compilation of Windows native extension
5
6
  # It do not affect compilation under other operating systems
6
7
  # The version indicated is the minimum DLL suggested for correct functionality
7
- BINARY_VERSION = "3.7.11"
8
- URL_VERSION = "3071100"
8
+ BINARY_VERSION = "3.7.17"
9
+ URL_VERSION = "3071700"
10
+ URL_PATH = "/2013"
9
11
 
10
12
  # build sqlite3_native C extension
11
- Rake::ExtensionTask.new('sqlite3_native', HOE.spec) do |ext|
13
+ RUBY_EXTENSION = Rake::ExtensionTask.new('sqlite3_native', HOE.spec) do |ext|
12
14
  # where to locate the extension
13
15
  ext.ext_dir = 'ext/sqlite3'
14
16
 
@@ -25,9 +27,15 @@ Rake::ExtensionTask.new('sqlite3_native', HOE.spec) do |ext|
25
27
  ext.lib_dir = "lib/sqlite3/#{$1}"
26
28
  ext.config_options << "--enable-local"
27
29
  else
28
- ext.cross_compile = true
29
- ext.cross_platform = ['i386-mswin32-60', 'i386-mingw32']
30
- ext.cross_config_options << "--enable-local"
30
+
31
+ # detect cross-compiler available
32
+ begin
33
+ Rake::ExtensionCompiler.mingw_host
34
+ ext.cross_compile = true
35
+ ext.cross_platform = ['i386-mswin32-60', 'i386-mingw32', 'x64-mingw32']
36
+ rescue RuntimeError
37
+ # noop
38
+ end
31
39
  end
32
40
  end
33
41
 
@@ -2,50 +2,86 @@ require "rake/clean"
2
2
  require "rake/extensioncompiler"
3
3
  require "mini_portile"
4
4
 
5
- $recipes = {}
5
+ CLOBBER.include("ports")
6
6
 
7
- $recipes[:sqlite3] = MiniPortile.new "sqlite3", BINARY_VERSION
8
- $recipes[:sqlite3].files << "http://sqlite.org/sqlite-autoconf-#{URL_VERSION}.tar.gz"
7
+ directory "ports"
9
8
 
10
- namespace :ports do
11
- directory "ports"
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
12
13
 
13
- desc "Install port sqlite3 #{$recipes[:sqlite3].version}"
14
- task :sqlite3 => ["ports"] do |t|
15
- recipe = $recipes[:sqlite3]
14
+ desc "Compile sqlite3 for #{platform} (#{host})"
15
+ task "ports:sqlite3:#{platform}" => ["ports"] do |t|
16
16
  checkpoint = "ports/.#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
17
17
 
18
18
  unless File.exist?(checkpoint)
19
19
  cflags = "-O2 -DSQLITE_ENABLE_COLUMN_METADATA"
20
- cflags << " -fPIC" if recipe.host && recipe.host.include?("x86_64")
20
+ cflags << " -fPIC" if recipe.host.include?("x86_64")
21
21
  recipe.configure_options << "CFLAGS='#{cflags}'"
22
22
  recipe.cook
23
23
  touch checkpoint
24
24
  end
25
-
26
- recipe.activate
27
25
  end
26
+
27
+ recipe
28
28
  end
29
29
 
30
+ # native sqlite3 compilation
31
+ define_sqlite_task RUBY_PLATFORM, RbConfig::CONFIG["host"]
32
+
33
+ # trick to test local compilation of sqlite3
34
+ if ENV["USE_MINI_PORTILE"] == "true"
35
+ # fake recipe so we can build a directory to it
36
+ recipe = MiniPortile.new "sqlite3", BINARY_VERSION
37
+ recipe.host = RbConfig::CONFIG["host"]
38
+
39
+ RUBY_EXTENSION.config_options << "--with-opt-dir=#{recipe.path}"
40
+
41
+ # compile sqlite3 first
42
+ Rake::Task["compile"].prerequisites.unshift "ports:sqlite3:#{RUBY_PLATFORM}"
43
+ end
44
+
45
+ # force compilation of sqlite3 when working natively under MinGW
30
46
  if RUBY_PLATFORM =~ /mingw/
31
- Rake::Task['compile'].prerequisites.unshift "ports:sqlite3"
47
+ Rake::Task['compile'].prerequisites.unshift "ports:sqlite3:#{RUBY_PLATFORM}"
32
48
  end
33
49
 
34
- if ENV["USE_MINI_PORTILE"] == "true"
35
- Rake::Task["compile"].prerequisites.unshift "ports:sqlite3"
50
+ # iterate over all cross-compilation platforms and define the proper
51
+ # sqlite3 recipe for it.
52
+ if RUBY_EXTENSION.cross_compile
53
+ config_path = File.expand_path("~/.rake-compiler/config.yml")
54
+ if File.exist?(config_path)
55
+ # obtains platforms from rake-compiler's config.yml
56
+ config_file = YAML.load_file(config_path)
57
+
58
+ Array(RUBY_EXTENSION.cross_platform).each do |platform|
59
+ # obtain platform from rbconfig file
60
+ config_key = config_file.keys.sort.find { |key|
61
+ key.start_with?("rbconfig-#{platform}-")
62
+ }
63
+ rbfile = config_file[config_key]
64
+
65
+ # skip if rbconfig cannot be read
66
+ next unless File.exist?(rbfile)
67
+
68
+ host = IO.read(rbfile).match(/CONFIG\["CC"\] = "(.*)"/)[1].sub(/\-gcc/, '')
69
+ recipe = define_sqlite_task(platform, host)
70
+
71
+ RUBY_EXTENSION.cross_config_options << {
72
+ platform => "--with-opt-dir=#{recipe.path}"
73
+ }
74
+
75
+ # pre-compile sqlite3 port when cross-compiling
76
+ task :cross => "ports:sqlite3:#{platform}"
77
+ end
78
+ else
79
+ warn "rake-compiler configuration doesn't exist, but is required for ports"
80
+ end
36
81
  end
37
82
 
38
83
  task :cross do
39
84
  ["CC", "CXX", "LDFLAGS", "CPPFLAGS", "RUBYOPT"].each do |var|
40
85
  ENV.delete(var)
41
86
  end
42
- host = ENV.fetch("HOST", Rake::ExtensionCompiler.mingw_host)
43
- $recipes.each do |_, recipe|
44
- recipe.host = host
45
- end
46
-
47
- # hook compile task with dependencies
48
- Rake::Task["compile"].prerequisites.unshift "ports:sqlite3"
49
87
  end
50
-
51
- CLOBBER.include("ports")
data/test/helper.rb CHANGED
@@ -1,14 +1,18 @@
1
1
  require 'sqlite3'
2
- require 'test/unit'
2
+ require 'minitest/autorun'
3
3
 
4
4
  unless RUBY_VERSION >= "1.9"
5
5
  require 'iconv'
6
6
  end
7
7
 
8
8
  module SQLite3
9
- class TestCase < Test::Unit::TestCase
10
- unless RUBY_VERSION >= '1.9'
11
- undef :default_test
9
+ class TestCase < Minitest::Test
10
+ alias :assert_not_equal :refute_equal
11
+ alias :assert_not_nil :refute_nil
12
+ alias :assert_raise :assert_raises
13
+
14
+ def assert_nothing_raised
15
+ yield
12
16
  end
13
17
  end
14
18
  end
@@ -22,9 +22,9 @@ module SQLite3
22
22
 
23
23
  def test_blob
24
24
  @db.execute("CREATE TABLE blobs ( id INTEGER, hash BLOB(10) )")
25
- str = "\0foo"
26
- @db.execute("INSERT INTO blobs VALUES (0, ?)", [str])
27
- assert_equal [[0, str]], @db.execute("SELECT * FROM blobs")
25
+ blob = Blob.new("foo\0bar")
26
+ @db.execute("INSERT INTO blobs VALUES (0, ?)", [blob])
27
+ assert_equal [[0, blob, blob.length, blob.length*2]], @db.execute("SELECT id, hash, length(hash), length(hex(hash)) FROM blobs")
28
28
  end
29
29
 
30
30
  def test_get_first_row
@@ -227,6 +227,17 @@ module SQLite3
227
227
  assert_equal [2.2, 'foo', nil], called_with
228
228
  end
229
229
 
230
+ def test_call_func_blob
231
+ called_with = nil
232
+ @db.define_function("hello") do |a, b|
233
+ called_with = [a, b, a.length]
234
+ nil
235
+ end
236
+ blob = Blob.new("a\0fine\0kettle\0of\0fish")
237
+ @db.execute("select hello(?, length(?))", [blob, blob])
238
+ assert_equal [blob, blob.length, 21], called_with
239
+ end
240
+
230
241
  def test_function_return
231
242
  @db.define_function("hello") { |a| 10 }
232
243
  assert_equal [10], @db.execute("select hello('world')").first
@@ -24,6 +24,15 @@ module SQLite3
24
24
  end
25
25
  end
26
26
 
27
+ def test_insert_duplicate_records
28
+ @db.execute 'CREATE TABLE "things" ("name" varchar(20) CONSTRAINT "index_things_on_name" UNIQUE)'
29
+ stmt = @db.prepare("INSERT INTO things(name) VALUES(?)")
30
+ stmt.execute('ruby')
31
+
32
+ exception = assert_raises(SQLite3::ConstraintException) { stmt.execute('ruby') }
33
+ assert_match /column(s)? .* (is|are) not unique/, exception.message
34
+ end
35
+
27
36
  ###
28
37
  # This method may not exist depending on how sqlite3 was compiled
29
38
  def test_database_name
@@ -227,9 +236,7 @@ module SQLite3
227
236
  stmt.execute('employee-1')
228
237
  stmt.execute('employee-1') rescue SQLite3::ConstraintException
229
238
  stmt.reset!
230
- assert_nothing_raised(SQLite3::ConstraintException) {
231
- stmt.execute('employee-2')
232
- }
239
+ assert stmt.execute('employee-2')
233
240
  end
234
241
 
235
242
  def test_clear_bindings
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 7
10
- version: 1.3.7
9
+ - 8
10
+ version: 1.3.8
11
11
  platform: x86-mswin32-60
12
12
  authors:
13
13
  - Jamis Buck
@@ -17,70 +17,100 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2013-01-12 00:00:00 Z
20
+ date: 2013-08-17 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- prerelease: false
24
- type: :development
25
- name: rdoc
26
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
27
24
  none: false
28
25
  requirements:
29
26
  - - ~>
30
27
  - !ruby/object:Gem::Version
31
- hash: 19
28
+ hash: 31
32
29
  segments:
33
- - 3
34
- - 10
35
- version: "3.10"
36
- requirement: *id001
37
- - !ruby/object:Gem::Dependency
30
+ - 5
31
+ - 0
32
+ version: "5.0"
33
+ name: minitest
38
34
  prerelease: false
39
35
  type: :development
40
- name: rake-compiler
36
+ requirement: *id001
37
+ - !ruby/object:Gem::Dependency
41
38
  version_requirements: &id002 !ruby/object:Gem::Requirement
42
39
  none: false
43
40
  requirements:
44
41
  - - ~>
45
42
  - !ruby/object:Gem::Version
46
- hash: 59
43
+ hash: 27
47
44
  segments:
45
+ - 4
48
46
  - 0
49
- - 8
50
- - 2
51
- version: 0.8.2
52
- requirement: *id002
53
- - !ruby/object:Gem::Dependency
47
+ version: "4.0"
48
+ name: rdoc
54
49
  prerelease: false
55
50
  type: :development
56
- name: mini_portile
51
+ requirement: *id002
52
+ - !ruby/object:Gem::Dependency
57
53
  version_requirements: &id003 !ruby/object:Gem::Requirement
58
54
  none: false
59
55
  requirements:
60
56
  - - ~>
61
57
  - !ruby/object:Gem::Version
62
- hash: 19
58
+ hash: 57
63
59
  segments:
64
60
  - 0
65
- - 2
66
- - 2
67
- version: 0.2.2
61
+ - 9
62
+ - 1
63
+ version: 0.9.1
64
+ name: rake-compiler
65
+ prerelease: false
66
+ type: :development
68
67
  requirement: *id003
69
68
  - !ruby/object:Gem::Dependency
69
+ version_requirements: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ hash: 9
75
+ segments:
76
+ - 0
77
+ - 5
78
+ - 1
79
+ version: 0.5.1
80
+ name: mini_portile
70
81
  prerelease: false
71
82
  type: :development
72
- name: hoe
73
- version_requirements: &id004 !ruby/object:Gem::Requirement
83
+ requirement: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
74
86
  none: false
75
87
  requirements:
76
88
  - - ~>
77
89
  - !ruby/object:Gem::Version
78
90
  hash: 15
79
91
  segments:
92
+ - 1
93
+ - 0
94
+ version: "1.0"
95
+ name: hoe-bundler
96
+ prerelease: false
97
+ type: :development
98
+ requirement: *id005
99
+ - !ruby/object:Gem::Dependency
100
+ version_requirements: &id006 !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ~>
104
+ - !ruby/object:Gem::Version
105
+ hash: 9
106
+ segments:
80
107
  - 3
81
- - 4
82
- version: "3.4"
83
- requirement: *id004
108
+ - 7
109
+ version: "3.7"
110
+ name: hoe
111
+ prerelease: false
112
+ type: :development
113
+ requirement: *id006
84
114
  description: |-
85
115
  This module allows Ruby programs to interface with the SQLite3
86
116
  database engine (http://www.sqlite.org). You must have the
@@ -109,6 +139,7 @@ files:
109
139
  - API_CHANGES.rdoc
110
140
  - CHANGELOG.rdoc
111
141
  - ChangeLog.cvs
142
+ - Gemfile
112
143
  - LICENSE
113
144
  - Manifest.txt
114
145
  - README.rdoc
@@ -153,16 +184,17 @@ files:
153
184
  - test/test_integration_pending.rb
154
185
  - test/test_integration_resultset.rb
155
186
  - test/test_integration_statement.rb
187
+ - test/test_result_set.rb
156
188
  - test/test_sqlite3.rb
157
189
  - test/test_statement.rb
158
190
  - test/test_statement_execute.rb
159
- - test/test_result_set.rb
160
191
  - .gemtest
161
192
  - lib/sqlite3/1.8/sqlite3_native.so
162
193
  - lib/sqlite3/1.9/sqlite3_native.so
194
+ - lib/sqlite3/2.0/sqlite3_native.so
163
195
  homepage: http://github.com/luislavena/sqlite3-ruby
164
- licenses: []
165
-
196
+ licenses:
197
+ - MIT
166
198
  post_install_message:
167
199
  rdoc_options:
168
200
  - --main
@@ -194,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
226
  requirements: []
195
227
 
196
228
  rubyforge_project: sqlite3
197
- rubygems_version: 1.8.24
229
+ rubygems_version: 1.8.25
198
230
  signing_key:
199
231
  specification_version: 3
200
232
  summary: This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org)