do_sqlite3 0.10.2-x86-mingw32 → 0.10.3-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.markdown +4 -0
- data/Rakefile +2 -2
- data/ext/do_sqlite3/do_sqlite3.c +92 -12
- data/ext/do_sqlite3/do_sqlite3_extension.c +1 -1
- data/ext/do_sqlite3/extconf.rb +2 -0
- 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/error/sql_error_spec.rb +9 -0
- data/spec/spec_helper.rb +4 -0
- data/tasks/compile.rake +1 -1
- data/tasks/release.rake +1 -1
- data/tasks/retrieve.rake +4 -4
- metadata +24 -10
data/ChangeLog.markdown
CHANGED
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ JRUBY = RUBY_PLATFORM =~ /java/
|
|
11
11
|
IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
|
12
12
|
WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
|
13
13
|
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
|
14
|
-
BINARY_VERSION = '
|
14
|
+
BINARY_VERSION = '3070400'
|
15
15
|
|
16
16
|
CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext/do_sqlite3/Makefile ext-java/target ])
|
17
17
|
|
@@ -38,7 +38,7 @@ begin
|
|
38
38
|
gem.add_dependency 'data_objects', DataObjects::Sqlite3::VERSION
|
39
39
|
|
40
40
|
gem.add_development_dependency 'bacon', '~>1.1'
|
41
|
-
gem.add_development_dependency 'rake-compiler', '
|
41
|
+
gem.add_development_dependency 'rake-compiler', '= 0.7.0'
|
42
42
|
|
43
43
|
gem.has_rdoc = false
|
44
44
|
gem.rubyforge_project = 'dorb'
|
data/ext/do_sqlite3/do_sqlite3.c
CHANGED
@@ -142,10 +142,10 @@ static VALUE parse_date_time(char *date) {
|
|
142
142
|
do_int64 num, den;
|
143
143
|
|
144
144
|
long int gmt_offset;
|
145
|
-
int
|
145
|
+
int dst_adjustment;
|
146
146
|
|
147
147
|
time_t rawtime;
|
148
|
-
struct tm
|
148
|
+
struct tm timeinfo;
|
149
149
|
|
150
150
|
int tokens_read, max_tokens;
|
151
151
|
|
@@ -179,22 +179,48 @@ static VALUE parse_date_time(char *date) {
|
|
179
179
|
}
|
180
180
|
// We read the Date and Time, default to the current locale's offset
|
181
181
|
|
182
|
+
tzset();
|
183
|
+
|
182
184
|
// Get localtime
|
183
185
|
time(&rawtime);
|
184
|
-
|
186
|
+
#ifdef HAVE_LOCALTIME_R
|
187
|
+
localtime_r(&rawtime, &timeinfo);
|
188
|
+
#else
|
189
|
+
timeinfo = *localtime(&rawtime);
|
190
|
+
#endif
|
185
191
|
|
186
|
-
|
192
|
+
timeinfo.tm_sec = sec;
|
193
|
+
timeinfo.tm_min = min;
|
194
|
+
timeinfo.tm_hour = hour;
|
195
|
+
timeinfo.tm_mday = day;
|
196
|
+
timeinfo.tm_mon = month;
|
197
|
+
timeinfo.tm_year = year - 1900;
|
198
|
+
timeinfo.tm_isdst = -1;
|
199
|
+
|
200
|
+
// Update tm_isdst
|
201
|
+
mktime(&timeinfo);
|
202
|
+
|
203
|
+
if (timeinfo.tm_isdst) {
|
204
|
+
dst_adjustment = 3600;
|
205
|
+
} else {
|
206
|
+
dst_adjustment = 0;
|
207
|
+
}
|
187
208
|
|
188
209
|
// Reset to GM Time
|
189
|
-
|
210
|
+
#ifdef HAVE_GMTIME_R
|
211
|
+
gmtime_r(&rawtime, &timeinfo);
|
212
|
+
#else
|
213
|
+
timeinfo = *gmtime(&rawtime);
|
214
|
+
#endif
|
190
215
|
|
191
|
-
gmt_offset = mktime(timeinfo)
|
216
|
+
gmt_offset = rawtime - mktime(&timeinfo);
|
192
217
|
|
193
|
-
if (
|
194
|
-
gmt_offset
|
218
|
+
if (dst_adjustment) {
|
219
|
+
gmt_offset += dst_adjustment;
|
220
|
+
}
|
195
221
|
|
196
|
-
hour_offset =
|
197
|
-
minute_offset =
|
222
|
+
hour_offset = ((int)gmt_offset / 3600);
|
223
|
+
minute_offset = ((int)gmt_offset % 3600 / 60);
|
198
224
|
|
199
225
|
} else {
|
200
226
|
// Something went terribly wrong
|
@@ -364,9 +390,9 @@ static VALUE cConnection_initialize(VALUE self, VALUE uri) {
|
|
364
390
|
path = rb_funcall(uri, rb_intern("path"), 0);
|
365
391
|
|
366
392
|
#ifdef HAVE_SQLITE3_OPEN_V2
|
367
|
-
ret = sqlite3_open_v2(
|
393
|
+
ret = sqlite3_open_v2(StringValuePtr(path), &db, flags_from_uri(uri), 0);
|
368
394
|
#else
|
369
|
-
ret = sqlite3_open(
|
395
|
+
ret = sqlite3_open(StringValuePtr(path), &db);
|
370
396
|
#endif
|
371
397
|
|
372
398
|
if ( ret != SQLITE_OK ) {
|
@@ -469,6 +495,52 @@ static VALUE cConnection_character_set(VALUE self) {
|
|
469
495
|
return rb_iv_get(self, "@encoding");
|
470
496
|
}
|
471
497
|
|
498
|
+
static VALUE cConnection_enable_load_extension(VALUE self, VALUE value) {
|
499
|
+
VALUE connection;
|
500
|
+
int status;
|
501
|
+
sqlite3 *db;
|
502
|
+
|
503
|
+
connection = rb_iv_get(self, "@connection");
|
504
|
+
|
505
|
+
if (Qnil == connection)
|
506
|
+
return Qfalse;
|
507
|
+
|
508
|
+
db = DATA_PTR(connection);
|
509
|
+
|
510
|
+
if (NULL == db)
|
511
|
+
return Qfalse;
|
512
|
+
|
513
|
+
status = sqlite3_enable_load_extension(db, value == Qtrue ? 1 : 0);
|
514
|
+
if ( status != SQLITE_OK ) {
|
515
|
+
rb_raise(eConnectionError, "Error enabling load extension.");
|
516
|
+
}
|
517
|
+
return Qtrue;
|
518
|
+
}
|
519
|
+
|
520
|
+
static VALUE cConnection_load_extension(VALUE self, VALUE string) {
|
521
|
+
VALUE connection;
|
522
|
+
sqlite3 *db;
|
523
|
+
const char *extension_name = rb_str_ptr_readonly(string);
|
524
|
+
char* errmsg;
|
525
|
+
int status;
|
526
|
+
|
527
|
+
connection = rb_iv_get(self, "@connection");
|
528
|
+
|
529
|
+
if (Qnil == connection)
|
530
|
+
return Qfalse;
|
531
|
+
|
532
|
+
db = DATA_PTR(connection);
|
533
|
+
|
534
|
+
if (NULL == db)
|
535
|
+
return Qfalse;
|
536
|
+
|
537
|
+
status = sqlite3_load_extension(db, extension_name, 0, &errmsg);
|
538
|
+
if ( status != SQLITE_OK ) {
|
539
|
+
rb_raise(eConnectionError, "%s", errmsg);
|
540
|
+
}
|
541
|
+
return Qtrue;
|
542
|
+
}
|
543
|
+
|
472
544
|
static VALUE build_query_from_args(VALUE klass, int count, VALUE *args) {
|
473
545
|
VALUE query = rb_iv_get(klass, "@text");
|
474
546
|
int i;
|
@@ -599,6 +671,10 @@ static VALUE cReader_next(VALUE self) {
|
|
599
671
|
VALUE field_type;
|
600
672
|
VALUE value;
|
601
673
|
|
674
|
+
if(rb_iv_get(self, "@done") == Qtrue) {
|
675
|
+
return Qfalse;
|
676
|
+
}
|
677
|
+
|
602
678
|
Data_Get_Struct(rb_iv_get(self, "@reader"), sqlite3_stmt, reader);
|
603
679
|
field_count = NUM2INT(rb_iv_get(self, "@field_count"));
|
604
680
|
|
@@ -611,6 +687,7 @@ static VALUE cReader_next(VALUE self) {
|
|
611
687
|
|
612
688
|
if ( result != SQLITE_ROW ) {
|
613
689
|
rb_iv_set(self, "@values", Qnil);
|
690
|
+
rb_iv_set(self, "@done", Qtrue);
|
614
691
|
return Qfalse;
|
615
692
|
}
|
616
693
|
|
@@ -656,6 +733,7 @@ static VALUE cReader_field_count(VALUE self) {
|
|
656
733
|
void Init_do_sqlite3() {
|
657
734
|
rb_require("bigdecimal");
|
658
735
|
rb_require("date");
|
736
|
+
rb_require("rational");
|
659
737
|
rb_require("data_objects");
|
660
738
|
|
661
739
|
ID_CONST_GET = rb_intern("const_get");
|
@@ -702,6 +780,8 @@ void Init_do_sqlite3() {
|
|
702
780
|
rb_define_method(cConnection, "quote_string", cConnection_quote_string, 1);
|
703
781
|
rb_define_method(cConnection, "quote_byte_array", cConnection_quote_byte_array, 1);
|
704
782
|
rb_define_method(cConnection, "character_set", cConnection_character_set, 0);
|
783
|
+
rb_define_method(cConnection, "enable_load_extension", cConnection_enable_load_extension, 1);
|
784
|
+
rb_define_method(cConnection, "load_extension", cConnection_load_extension, 1);
|
705
785
|
|
706
786
|
cCommand = DRIVER_CLASS("Command", cDO_Command);
|
707
787
|
rb_define_method(cCommand, "set_types", cCommand_set_types, -1);
|
@@ -75,4 +75,4 @@ void Init_do_sqlite3_extension() {
|
|
75
75
|
cExtension = DRIVER_CLASS("Extension", cDO_Extension);
|
76
76
|
rb_define_method(cExtension, "load_extension", cExtension_load_extension, 1);
|
77
77
|
rb_define_method(cExtension, "enable_load_extension", cExtension_enable_load_extension, 1);
|
78
|
-
}
|
78
|
+
}
|
data/ext/do_sqlite3/extconf.rb
CHANGED
Binary file
|
Binary file
|
data/lib/do_sqlite3/version.rb
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/error/sql_error_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::Sqlite3 raising SQLError' do
|
7
|
+
# This fails for now, need to think of a query that also exposes the issue on sqlite :S
|
8
|
+
# behaves_like 'raising a SQLError'
|
9
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -131,6 +131,10 @@ module DataObjectsSpecHelpers
|
|
131
131
|
update widgets set release_timestamp = NULL where id = 9
|
132
132
|
EOF
|
133
133
|
|
134
|
+
conn.create_command(<<-EOF).execute_non_query
|
135
|
+
update widgets set release_datetime = '2008-07-14 00:31:12' where id = 10
|
136
|
+
EOF
|
137
|
+
|
134
138
|
conn.close
|
135
139
|
end
|
136
140
|
|
data/tasks/compile.rake
CHANGED
data/tasks/release.rake
CHANGED
data/tasks/retrieve.rake
CHANGED
@@ -42,7 +42,7 @@ begin
|
|
42
42
|
end
|
43
43
|
|
44
44
|
# download dll binaries
|
45
|
-
file "vendor/
|
45
|
+
file "vendor/sqlite-dll-win32-x86-#{BINARY_VERSION}.zip" => ['vendor'] do |t|
|
46
46
|
url = "http://www.sqlite.org/#{File.basename(t.name)}"
|
47
47
|
when_writing "downloading #{t.name}" do
|
48
48
|
cd File.dirname(t.name) do
|
@@ -56,7 +56,7 @@ begin
|
|
56
56
|
full_file = File.expand_path(t.prerequisites.last)
|
57
57
|
when_writing "creating #{t.name}" do
|
58
58
|
cd File.dirname(t.name) do
|
59
|
-
sh "unzip #{full_file}"
|
59
|
+
sh "unzip -j #{full_file}"
|
60
60
|
# update file timestamp to avoid Rake perform this extraction again.
|
61
61
|
touch File.basename(t.name)
|
62
62
|
end
|
@@ -64,11 +64,11 @@ begin
|
|
64
64
|
end
|
65
65
|
|
66
66
|
# extract dll files into lib folder
|
67
|
-
file "vendor/sqlite3/lib/sqlite3.dll" => ['vendor/sqlite3/lib', "vendor/
|
67
|
+
file "vendor/sqlite3/lib/sqlite3.dll" => ['vendor/sqlite3/lib', "vendor/sqlite-dll-win32-x86-#{BINARY_VERSION}.zip"] do |t|
|
68
68
|
full_file = File.expand_path(t.prerequisites.last)
|
69
69
|
when_writing "creating #{t.name}" do
|
70
70
|
cd File.dirname(t.name) do
|
71
|
-
sh "unzip #{full_file}"
|
71
|
+
sh "unzip -j #{full_file}"
|
72
72
|
# update file timestamp to avoid Rake perform this extraction again.
|
73
73
|
touch File.basename(t.name)
|
74
74
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: do_sqlite3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 49
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 10
|
8
|
-
-
|
9
|
-
version: 0.10.
|
9
|
+
- 3
|
10
|
+
version: 0.10.3
|
10
11
|
platform: x86-mingw32
|
11
12
|
authors:
|
12
13
|
- Dirkjan Bussink
|
@@ -14,30 +15,34 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-01-30 00:00:00 +01:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: data_objects
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - "="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 49
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
- 10
|
30
|
-
-
|
31
|
-
version: 0.10.
|
33
|
+
- 3
|
34
|
+
version: 0.10.3
|
32
35
|
type: :runtime
|
33
36
|
version_requirements: *id001
|
34
37
|
- !ruby/object:Gem::Dependency
|
35
38
|
name: bacon
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ~>
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 13
|
41
46
|
segments:
|
42
47
|
- 1
|
43
48
|
- 1
|
@@ -48,13 +53,16 @@ dependencies:
|
|
48
53
|
name: rake-compiler
|
49
54
|
prerelease: false
|
50
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
51
57
|
requirements:
|
52
|
-
- -
|
58
|
+
- - "="
|
53
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
54
61
|
segments:
|
55
62
|
- 0
|
56
63
|
- 7
|
57
|
-
|
64
|
+
- 0
|
65
|
+
version: 0.7.0
|
58
66
|
type: :development
|
59
67
|
version_requirements: *id003
|
60
68
|
description: Implements the DataObjects API for Sqlite3
|
@@ -74,6 +82,7 @@ files:
|
|
74
82
|
- spec/command_spec.rb
|
75
83
|
- spec/connection_spec.rb
|
76
84
|
- spec/encoding_spec.rb
|
85
|
+
- spec/error/sql_error_spec.rb
|
77
86
|
- spec/reader_spec.rb
|
78
87
|
- spec/result_spec.rb
|
79
88
|
- spec/spec_helper.rb
|
@@ -116,13 +125,13 @@ post_install_message: |+
|
|
116
125
|
=============================================================================
|
117
126
|
|
118
127
|
You've installed the binary version of do_sqlite3.
|
119
|
-
It was built using Sqlite3 version
|
128
|
+
It was built using Sqlite3 version 3070400.
|
120
129
|
It's recommended to use the exact same version to avoid potential issues.
|
121
130
|
|
122
131
|
At the time of building this gem, the necessary DLL files where available
|
123
132
|
in the following download:
|
124
133
|
|
125
|
-
http://www.sqlite.org/sqlitedll-
|
134
|
+
http://www.sqlite.org/sqlitedll-3070400.zip
|
126
135
|
|
127
136
|
You can put the sqlite3.dll available in this package in your Ruby bin
|
128
137
|
directory, for example C:\Ruby\bin
|
@@ -134,23 +143,27 @@ rdoc_options:
|
|
134
143
|
require_paths:
|
135
144
|
- lib
|
136
145
|
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
137
147
|
requirements:
|
138
148
|
- - ">="
|
139
149
|
- !ruby/object:Gem::Version
|
150
|
+
hash: 3
|
140
151
|
segments:
|
141
152
|
- 0
|
142
153
|
version: "0"
|
143
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
144
156
|
requirements:
|
145
157
|
- - ">="
|
146
158
|
- !ruby/object:Gem::Version
|
159
|
+
hash: 3
|
147
160
|
segments:
|
148
161
|
- 0
|
149
162
|
version: "0"
|
150
163
|
requirements: []
|
151
164
|
|
152
165
|
rubyforge_project: dorb
|
153
|
-
rubygems_version: 1.3.
|
166
|
+
rubygems_version: 1.3.7
|
154
167
|
signing_key:
|
155
168
|
specification_version: 3
|
156
169
|
summary: DataObjects Sqlite3 Driver
|
@@ -158,6 +171,7 @@ test_files:
|
|
158
171
|
- spec/command_spec.rb
|
159
172
|
- spec/connection_spec.rb
|
160
173
|
- spec/encoding_spec.rb
|
174
|
+
- spec/error/sql_error_spec.rb
|
161
175
|
- spec/reader_spec.rb
|
162
176
|
- spec/result_spec.rb
|
163
177
|
- spec/spec_helper.rb
|