mysql2 0.1.1 → 0.1.2
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/.gitignore +3 -1
- data/CHANGELOG.md +3 -0
- data/README.rdoc +18 -1
- data/VERSION +1 -1
- data/ext/mysql2_ext.c +2 -2
- data/lib/mysql2.rb +1 -1
- data/mysql2.gemspec +2 -2
- metadata +3 -3
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.1.2 (April 9th, 2010)
|
4
|
+
* fix a bug (copy/paste fail) around checking for empty TIME values and returning nil (thanks @marius)
|
5
|
+
|
3
6
|
## 0.1.1 (April 6th, 2010)
|
4
7
|
* added affected_rows method (mysql_affected_rows)
|
5
8
|
* added last_id method (last_insert_id)
|
data/README.rdoc
CHANGED
@@ -16,7 +16,7 @@ Mysql2::Result - returned from issuing a #query on the connection. It includes E
|
|
16
16
|
|
17
17
|
gem install mysql2
|
18
18
|
|
19
|
-
You may have to specify --with-mysql-
|
19
|
+
You may have to specify --with-mysql-config=/some/random/path/bin/mysql_config
|
20
20
|
|
21
21
|
== Usage
|
22
22
|
|
@@ -58,6 +58,23 @@ How about with symbolized keys?
|
|
58
58
|
# do something with row, it's ready to rock
|
59
59
|
end
|
60
60
|
|
61
|
+
== Async
|
62
|
+
|
63
|
+
Mysql2::Client takes advantage of the MySQL C API's (undocumented) non-blocking function mysql_send_query for *all* queries.
|
64
|
+
But, in order to take full advantage of it in your Ruby code, you can do:
|
65
|
+
|
66
|
+
client.query("SELECT sleep(5)", :async => true)
|
67
|
+
|
68
|
+
Which will return nil immediately. At this point you'll probably want to use some socket monitoring mechanism
|
69
|
+
like EventMachine or even IO.select. Once the socket becomes readable, you can do:
|
70
|
+
|
71
|
+
# result will be a Mysql2::Result instance
|
72
|
+
result = client.async_result
|
73
|
+
|
74
|
+
NOTE: Because of the way MySQL's query API works, this method will block until the result is ready.
|
75
|
+
So if you really need things to stay async, it's best to just monitor the socket with something like EventMachine.
|
76
|
+
If you need multiple query concurrency take a look at using a connection pool.
|
77
|
+
|
61
78
|
== Compatibility
|
62
79
|
|
63
80
|
The specs pass on my system (SL 10.6.3, x86_64) in these rubies:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/ext/mysql2_ext.c
CHANGED
@@ -346,8 +346,8 @@ static VALUE rb_mysql_result_fetch_row(int argc, VALUE * argv, VALUE self) {
|
|
346
346
|
val = rb_float_new(strtod(row[i], NULL));
|
347
347
|
break;
|
348
348
|
case MYSQL_TYPE_TIME: // TIME field
|
349
|
-
if (memcmp("00:00:00", row[i],
|
350
|
-
val =
|
349
|
+
if (memcmp("00:00:00", row[i], 8) == 0) {
|
350
|
+
val = Qnil;
|
351
351
|
} else {
|
352
352
|
strptime(row[i], "%T", &parsedTime);
|
353
353
|
val = rb_funcall(rb_cTime, intern_local, 6, INT2NUM(1900+parsedTime.tm_year), INT2NUM(parsedTime.tm_mon+1), INT2NUM(parsedTime.tm_mday), INT2NUM(parsedTime.tm_hour), INT2NUM(parsedTime.tm_min), INT2NUM(parsedTime.tm_sec));
|
data/lib/mysql2.rb
CHANGED
data/mysql2.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mysql2}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Lopez"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-09}
|
13
13
|
s.email = %q{seniorlopez@gmail.com}
|
14
14
|
s.extensions = ["ext/extconf.rb"]
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Brian Lopez
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-09 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|