dbd-mysql 0.3.3 → 0.4.0
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/lib/dbd/Mysql.rb +1 -1
- data/lib/dbd/mysql/database.rb +1 -1
- data/lib/dbd/mysql/statement.rb +3 -1
- data/test/dbd/general/test_statement.rb +11 -2
- data/test/dbd/mysql/test_patches.rb +20 -15
- metadata +2 -2
data/lib/dbd/Mysql.rb
CHANGED
data/lib/dbd/mysql/database.rb
CHANGED
data/lib/dbd/mysql/statement.rb
CHANGED
@@ -128,7 +128,7 @@ module DBI::DBD::Mysql
|
|
128
128
|
# is set only by mysql_list_fields()
|
129
129
|
|
130
130
|
@res_handle.fetch_fields.each {|col|
|
131
|
-
mysql_type_name = Database::TYPE_MAP[col.type]
|
131
|
+
mysql_type_name, dbi_type = Database::TYPE_MAP[col.type] rescue [nil, nil]
|
132
132
|
xopen_info = Database::MYSQL_to_XOPEN[mysql_type_name] ||
|
133
133
|
Database::MYSQL_to_XOPEN[nil]
|
134
134
|
sql_type = xopen_info[0]
|
@@ -158,6 +158,8 @@ module DBI::DBD::Mysql
|
|
158
158
|
|
159
159
|
if retval[-1]['sql_type'] == DBI::SQL_TINYINT and retval[-1]['precision'] == 1
|
160
160
|
retval[-1]['dbi_type'] = DBI::Type::Boolean
|
161
|
+
elsif dbi_type
|
162
|
+
retval[-1]['dbi_type'] = dbi_type
|
161
163
|
end
|
162
164
|
}
|
163
165
|
retval
|
@@ -1,4 +1,13 @@
|
|
1
1
|
@class = Class.new(DBDConfig.testbase(DBDConfig.current_dbtype)) do
|
2
|
+
|
3
|
+
def test_execute
|
4
|
+
assert_nothing_raised do
|
5
|
+
@dbh.execute("select * from names order by age") do |sth|
|
6
|
+
assert_equal([["Joe", 19], ["Bob", 21], ["Jim", 30]], sth.fetch_all)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
2
11
|
def test_quoting # FIXME breaks sqlite-ruby to a segfault - research
|
3
12
|
@sth = nil
|
4
13
|
|
@@ -114,7 +123,7 @@
|
|
114
123
|
@sth.finish
|
115
124
|
end
|
116
125
|
|
117
|
-
def
|
126
|
+
def test_prepare_execute
|
118
127
|
assert_nothing_raised do
|
119
128
|
@sth = @dbh.prepare("select * from names")
|
120
129
|
@sth.execute
|
@@ -134,7 +143,7 @@
|
|
134
143
|
end
|
135
144
|
end
|
136
145
|
|
137
|
-
def
|
146
|
+
def test_prepare_execute_with_transactions
|
138
147
|
@dbh["AutoCommit"] = false
|
139
148
|
config = DBDConfig.get_config['sqlite3']
|
140
149
|
|
@@ -4,9 +4,13 @@ class TestMysqlPatches < DBDConfig.testbase(:mysql)
|
|
4
4
|
sth = @dbh.prepare("select sum(age) from names")
|
5
5
|
sth.execute
|
6
6
|
row = sth.fetch
|
7
|
-
# FIXME: this is BROKEN - should not be a string, should be fixnum
|
8
7
|
assert_equal(70.0, row[0])
|
9
8
|
sth.finish
|
9
|
+
|
10
|
+
sth = @dbh.prepare("select count(*) from names")
|
11
|
+
sth.execute
|
12
|
+
assert_equal([3], sth.fetch)
|
13
|
+
sth.finish
|
10
14
|
end
|
11
15
|
end
|
12
16
|
|
@@ -45,20 +49,21 @@ class TestMysqlPatches < DBDConfig.testbase(:mysql)
|
|
45
49
|
assert_equal [2], row
|
46
50
|
assert_equal [
|
47
51
|
{
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
52
|
+
:dbi_type => DBI::Type::Integer,
|
53
|
+
:name =>"foo",
|
54
|
+
:mysql_type_name =>"INT",
|
55
|
+
:mysql_max_length =>1,
|
56
|
+
:primary =>true,
|
57
|
+
:scale =>0,
|
58
|
+
:mysql_flags =>49155,
|
59
|
+
:sql_type =>4,
|
60
|
+
:nullable =>false,
|
61
|
+
:mysql_type =>3,
|
62
|
+
:indexed =>true,
|
63
|
+
:mysql_length =>11,
|
64
|
+
:precision =>11,
|
65
|
+
:type_name =>"INTEGER",
|
66
|
+
:unique =>true
|
62
67
|
}
|
63
68
|
], columns
|
64
69
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbd-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Hollensbe
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2008-
|
13
|
+
date: 2008-09-02 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|