do_mysql 0.10.8-x86-mingw32 → 0.10.9-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 +6 -0
- data/Rakefile +1 -1
- data/ext/do_mysql/do_common.c +8 -0
- data/ext/do_mysql/do_mysql.c +2 -2
- data/lib/do_mysql.rb +1 -1
- data/lib/do_mysql/1.8/do_mysql.so +0 -0
- data/lib/do_mysql/1.9/do_mysql.so +0 -0
- data/lib/do_mysql/version.rb +1 -1
- data/spec/connection_spec.rb +1 -0
- data/spec/result_spec.rb +26 -0
- data/spec/spec_helper.rb +13 -1
- data/spec/typecast/date_spec.rb +26 -0
- data/spec/typecast/datetime_spec.rb +26 -0
- data/tasks/compile.rake +1 -1
- metadata +20 -29
data/ChangeLog.markdown
CHANGED
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ JRUBY = RUBY_PLATFORM =~ /java/
|
|
15
15
|
IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
|
16
16
|
WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
|
17
17
|
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
|
18
|
-
BINARY_VERSION = '5.1.
|
18
|
+
BINARY_VERSION = '5.1.65'
|
19
19
|
|
20
20
|
CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext/do_mysql/Makefile ext-java/target ])
|
21
21
|
|
data/ext/do_mysql/do_common.c
CHANGED
@@ -185,6 +185,10 @@ VALUE data_objects_parse_date(const char *date) {
|
|
185
185
|
return Qnil;
|
186
186
|
}
|
187
187
|
|
188
|
+
if(!year && !month && !day) {
|
189
|
+
return Qnil;
|
190
|
+
}
|
191
|
+
|
188
192
|
return rb_funcall(rb_cDate, ID_NEW, 3, INT2NUM(year), INT2NUM(month), INT2NUM(day));
|
189
193
|
}
|
190
194
|
|
@@ -237,6 +241,10 @@ VALUE data_objects_parse_date_time(const char *date) {
|
|
237
241
|
fmt_datetime = strchr(date, '.') ? _fmt_datetime_tz_subsec : _fmt_datetime_tz_normal;
|
238
242
|
tokens_read = sscanf(date, fmt_datetime, &year, &month, &day, &hour, &min, &sec, &hour_offset, &minute_offset);
|
239
243
|
|
244
|
+
if(!year && !month && !day && !hour && !min && !sec) {
|
245
|
+
return Qnil;
|
246
|
+
}
|
247
|
+
|
240
248
|
switch (tokens_read) {
|
241
249
|
case 8:
|
242
250
|
minute_offset *= hour_offset < 0 ? -1 : 1;
|
data/ext/do_mysql/do_mysql.c
CHANGED
@@ -228,7 +228,7 @@ void do_mysql_full_connect(VALUE self, MYSQL *db) {
|
|
228
228
|
}
|
229
229
|
|
230
230
|
if (!database || !*database) {
|
231
|
-
|
231
|
+
database = NULL;
|
232
232
|
}
|
233
233
|
|
234
234
|
VALUE r_query = rb_iv_get(self, "@query");
|
@@ -489,7 +489,7 @@ VALUE do_mysql_cCommand_execute_non_query(int argc, VALUE *argv, VALUE self) {
|
|
489
489
|
return Qnil;
|
490
490
|
}
|
491
491
|
|
492
|
-
return rb_funcall(cMysqlResult, ID_NEW, 3, self, INT2NUM(affected_rows), insert_id == 0 ? Qnil :
|
492
|
+
return rb_funcall(cMysqlResult, ID_NEW, 3, self, INT2NUM(affected_rows), insert_id == 0 ? Qnil : ULL2NUM(insert_id));
|
493
493
|
}
|
494
494
|
|
495
495
|
VALUE do_mysql_cCommand_execute_reader(int argc, VALUE *argv, VALUE self) {
|
data/lib/do_mysql.rb
CHANGED
@@ -11,7 +11,7 @@ if RUBY_PLATFORM =~ /java/
|
|
11
11
|
|
12
12
|
begin
|
13
13
|
java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::Mysql::JDBC_DRIVER, true)
|
14
|
-
rescue
|
14
|
+
rescue java.lang.ClassNotFoundException
|
15
15
|
require 'jdbc/mysql' # the JDBC driver, packaged as a gem
|
16
16
|
end
|
17
17
|
|
Binary file
|
Binary file
|
data/lib/do_mysql/version.rb
CHANGED
data/spec/connection_spec.rb
CHANGED
@@ -18,6 +18,7 @@ describe DataObjects::Mysql::Connection do
|
|
18
18
|
|
19
19
|
it_should_behave_like 'a Connection'
|
20
20
|
it_should_behave_like 'a Connection with authentication support'
|
21
|
+
it_should_behave_like 'a Connection allowing default database'
|
21
22
|
it_should_behave_like 'a Connection with JDBC URL support' if JRUBY
|
22
23
|
it_should_behave_like 'a Connection with SSL support' unless JRUBY
|
23
24
|
it_should_behave_like 'a Connection via JDNI' if JRUBY
|
data/spec/result_spec.rb
CHANGED
@@ -15,3 +15,29 @@ describe DataObjects::Mysql::Result do
|
|
15
15
|
it_should_behave_like 'a Result which returns inserted key with sequences'
|
16
16
|
it_should_behave_like 'a Result which returns nil without sequences'
|
17
17
|
end
|
18
|
+
|
19
|
+
describe DataObjects::Mysql::Result do
|
20
|
+
|
21
|
+
describe 'insert_id' do
|
22
|
+
|
23
|
+
before do
|
24
|
+
setup_test_environment
|
25
|
+
@connection = DataObjects::Connection.new(CONFIG.uri)
|
26
|
+
# set the sequence to a value larger than SQL integer
|
27
|
+
command = @connection.create_command('INSERT INTO stuff (id, value) VALUES (?,?)')
|
28
|
+
command.execute_non_query(3_000_000_000, 'cow')
|
29
|
+
# use the sequence to generate an id
|
30
|
+
command = @connection.create_command('INSERT INTO stuff (value) VALUES (?)')
|
31
|
+
@result = command.execute_non_query('monkey')
|
32
|
+
end
|
33
|
+
|
34
|
+
after do
|
35
|
+
@connection.close
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return the bigint id' do
|
39
|
+
@result.insert_id.should == 3_000_000_001
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -45,7 +45,7 @@ CONFIG.ssl = SSLHelpers.query(:ca_cert, :client_cert, :client_key)
|
|
45
45
|
|
46
46
|
CONFIG.driver = 'mysql'
|
47
47
|
CONFIG.jdbc_driver = DataObjects::Mysql.const_get('JDBC_DRIVER') rescue nil
|
48
|
-
CONFIG.uri = ENV["DO_MYSQL_SPEC_URI"] || "#{CONFIG.scheme}://#{CONFIG.user_info}#{CONFIG.host}:#{CONFIG.port}#{CONFIG.database}"
|
48
|
+
CONFIG.uri = ENV["DO_MYSQL_SPEC_URI"] || "#{CONFIG.scheme}://#{CONFIG.user_info}#{CONFIG.host}:#{CONFIG.port}#{CONFIG.database}?zeroDateTimeBehavior=convertToNull"
|
49
49
|
CONFIG.jdbc_uri = "jdbc:#{CONFIG.uri}"
|
50
50
|
CONFIG.sleep = "SELECT sleep(1)"
|
51
51
|
|
@@ -62,6 +62,10 @@ module DataObjectsSpecHelpers
|
|
62
62
|
DROP TABLE IF EXISTS `users`
|
63
63
|
EOF
|
64
64
|
|
65
|
+
conn.create_command(<<-EOF).execute_non_query
|
66
|
+
DROP TABLE IF EXISTS `stuff`
|
67
|
+
EOF
|
68
|
+
|
65
69
|
conn.create_command(<<-EOF).execute_non_query
|
66
70
|
DROP TABLE IF EXISTS `widgets`
|
67
71
|
EOF
|
@@ -82,6 +86,14 @@ module DataObjectsSpecHelpers
|
|
82
86
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
83
87
|
EOF
|
84
88
|
|
89
|
+
conn.create_command(<<-EOF).execute_non_query
|
90
|
+
CREATE TABLE `stuff` (
|
91
|
+
`id` bigint NOT NULL auto_increment,
|
92
|
+
`value` varchar(50) NULL,
|
93
|
+
PRIMARY KEY (`id`)
|
94
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
95
|
+
EOF
|
96
|
+
|
85
97
|
conn.create_command(<<-EOF).execute_non_query
|
86
98
|
CREATE TABLE `widgets` (
|
87
99
|
`id` int(11) NOT NULL auto_increment,
|
data/spec/typecast/date_spec.rb
CHANGED
@@ -6,4 +6,30 @@ require 'data_objects/spec/shared/typecast/date_spec'
|
|
6
6
|
describe 'DataObjects::Mysql with Date' do
|
7
7
|
it_should_behave_like 'supporting Date'
|
8
8
|
it_should_behave_like 'supporting Date autocasting'
|
9
|
+
|
10
|
+
describe 'reading 0000-00-00' do
|
11
|
+
|
12
|
+
before do
|
13
|
+
@connection = DataObjects::Connection.new(CONFIG.uri)
|
14
|
+
|
15
|
+
@connection.create_command("SET SESSION sql_mode = 'ALLOW_INVALID_DATES'").execute_non_query
|
16
|
+
@connection.create_command("INSERT INTO widgets (release_date) VALUES ('')").execute_non_query
|
17
|
+
|
18
|
+
@command = @connection.create_command("SELECT release_date FROM widgets WHERE release_date = '0000-00-00'")
|
19
|
+
@reader = @command.execute_reader
|
20
|
+
@reader.next!
|
21
|
+
@values = @reader.values
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
@reader.close
|
26
|
+
@connection.close
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should return the number of created rows' do
|
30
|
+
@values.first.should be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
9
35
|
end
|
@@ -6,4 +6,30 @@ require 'data_objects/spec/shared/typecast/datetime_spec'
|
|
6
6
|
describe 'DataObjects::Mysql with DateTime' do
|
7
7
|
it_should_behave_like 'supporting DateTime'
|
8
8
|
it_should_behave_like 'supporting DateTime autocasting'
|
9
|
+
|
10
|
+
describe 'reading 0000-00-00 00:00:00' do
|
11
|
+
|
12
|
+
before do
|
13
|
+
@connection = DataObjects::Connection.new(CONFIG.uri)
|
14
|
+
|
15
|
+
@connection.create_command("SET SESSION sql_mode = 'ALLOW_INVALID_DATES'").execute_non_query
|
16
|
+
@connection.create_command("INSERT INTO widgets (release_datetime) VALUES ('')").execute_non_query
|
17
|
+
|
18
|
+
@command = @connection.create_command("SELECT release_datetime FROM widgets WHERE release_datetime = '0000-00-00 00:00:00'")
|
19
|
+
@reader = @command.execute_reader
|
20
|
+
@reader.next!
|
21
|
+
@values = @reader.values
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
@reader.close
|
26
|
+
@connection.close
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should return the number of created rows' do
|
30
|
+
@values.first.should be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
9
35
|
end
|
data/tasks/compile.rake
CHANGED
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: do_mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 10
|
9
|
-
-
|
10
|
-
version: 0.10.
|
8
|
+
- 9
|
9
|
+
version: 0.10.9
|
11
10
|
platform: x86-mingw32
|
12
11
|
authors:
|
13
12
|
- Dirkjan Bussink
|
@@ -15,53 +14,48 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-03-29 00:00:00
|
17
|
+
date: 2011-03-29 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
+
prerelease: false
|
22
|
+
type: :runtime
|
23
|
+
name: data_objects
|
21
24
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
-
none: false
|
23
25
|
requirements:
|
24
26
|
- - "="
|
25
27
|
- !ruby/object:Gem::Version
|
26
|
-
hash: 39
|
27
28
|
segments:
|
28
29
|
- 0
|
29
30
|
- 10
|
30
|
-
-
|
31
|
-
version: 0.10.
|
32
|
-
name: data_objects
|
33
|
-
prerelease: false
|
34
|
-
type: :runtime
|
31
|
+
- 9
|
32
|
+
version: 0.10.9
|
35
33
|
requirement: *id001
|
36
34
|
- !ruby/object:Gem::Dependency
|
35
|
+
prerelease: false
|
36
|
+
type: :development
|
37
|
+
name: rspec
|
37
38
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
39
|
requirements:
|
40
40
|
- - ~>
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
hash: 9
|
43
42
|
segments:
|
44
43
|
- 2
|
45
44
|
- 5
|
46
45
|
version: "2.5"
|
47
|
-
name: rspec
|
48
|
-
prerelease: false
|
49
|
-
type: :development
|
50
46
|
requirement: *id002
|
51
47
|
- !ruby/object:Gem::Dependency
|
48
|
+
prerelease: false
|
49
|
+
type: :development
|
50
|
+
name: rake-compiler
|
52
51
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
52
|
requirements:
|
55
53
|
- - ~>
|
56
54
|
- !ruby/object:Gem::Version
|
57
|
-
hash: 5
|
58
55
|
segments:
|
59
56
|
- 0
|
60
57
|
- 7
|
61
58
|
version: "0.7"
|
62
|
-
name: rake-compiler
|
63
|
-
prerelease: false
|
64
|
-
type: :development
|
65
59
|
requirement: *id003
|
66
60
|
description: Implements the DataObjects API for MySQL
|
67
61
|
email: d.bussink@gmail.com
|
@@ -117,6 +111,7 @@ files:
|
|
117
111
|
- tasks/ssl.rake
|
118
112
|
- lib/do_mysql/1.8/do_mysql.so
|
119
113
|
- lib/do_mysql/1.9/do_mysql.so
|
114
|
+
has_rdoc: true
|
120
115
|
homepage:
|
121
116
|
licenses: []
|
122
117
|
|
@@ -125,13 +120,13 @@ post_install_message: |+
|
|
125
120
|
======================================================================================================
|
126
121
|
|
127
122
|
You've installed the binary version of do_mysql.
|
128
|
-
It was built using MySQL version 5.1.
|
123
|
+
It was built using MySQL version 5.1.65.
|
129
124
|
It's recommended to use the exact same version to avoid potential issues.
|
130
125
|
|
131
126
|
At the time of building this gem, the necessary DLL files where available
|
132
127
|
in the following download:
|
133
128
|
|
134
|
-
http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-noinstall-5.1.
|
129
|
+
http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-noinstall-5.1.65-win32.zip/from/pick
|
135
130
|
|
136
131
|
You can put the lib\opt\libmysql.dll available in this package in your Ruby bin
|
137
132
|
directory, for example C:\Ruby\bin
|
@@ -143,27 +138,23 @@ rdoc_options: []
|
|
143
138
|
require_paths:
|
144
139
|
- lib
|
145
140
|
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
141
|
requirements:
|
148
142
|
- - ">="
|
149
143
|
- !ruby/object:Gem::Version
|
150
|
-
hash: 3
|
151
144
|
segments:
|
152
145
|
- 0
|
153
146
|
version: "0"
|
154
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
148
|
requirements:
|
157
149
|
- - ">="
|
158
150
|
- !ruby/object:Gem::Version
|
159
|
-
hash: 3
|
160
151
|
segments:
|
161
152
|
- 0
|
162
153
|
version: "0"
|
163
154
|
requirements: []
|
164
155
|
|
165
156
|
rubyforge_project: dorb
|
166
|
-
rubygems_version: 1.
|
157
|
+
rubygems_version: 1.3.6
|
167
158
|
signing_key:
|
168
159
|
specification_version: 3
|
169
160
|
summary: DataObjects MySQL Driver
|