mysql 2.7.1-mswin32 → 2.7.3-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -1
- data/Rakefile +6 -12
- data/docs/README.html +27 -5
- data/ext/extconf.rb +73 -18
- data/ext/mysql.c.in +19 -12
- data/ext/mysql.c.in.patch +13 -0
- data/ext/mysql.so +0 -0
- data/ext/test.rb +70 -6
- metadata +5 -4
- data/ext/extconf.rb.orig +0 -67
data/README
CHANGED
@@ -8,7 +8,12 @@ A win32 native build of the MySQL API module for Ruby.
|
|
8
8
|
|
9
9
|
= Dependencies
|
10
10
|
|
11
|
-
|
11
|
+
For this to work, you must have libmysql.dll in your PATH environmental variable. If you have MySQL installed locally,
|
12
|
+
just make sure that <mysql_install_dir>\bin is in your path. If you don't have MySQL installed locally, you can
|
13
|
+
install one or more of the MySQL tools, find the libmysql.dll included in their bin directory, and copy it to
|
14
|
+
the %SystemRoot%\System32 folder.
|
15
|
+
|
16
|
+
I can't include the dll here due to licensing conflicts.
|
12
17
|
|
13
18
|
= Installation
|
14
19
|
|
data/Rakefile
CHANGED
@@ -5,30 +5,24 @@ require 'fileutils'
|
|
5
5
|
#require 'date'
|
6
6
|
include FileUtils
|
7
7
|
|
8
|
-
CLEAN.include ["ext/*.{log,c,so,obj,pdb,lib,def,exp,manifest}", "ext/Makefile", "*.gem"]
|
8
|
+
CLEAN.include ["ext/*.{log,c,so,obj,pdb,lib,def,exp,manifest,orig}", "ext/Makefile", "*.gem"]
|
9
9
|
|
10
10
|
name="mysql"
|
11
|
-
version="2.7.
|
11
|
+
version="2.7.3"
|
12
12
|
|
13
13
|
desc "Do everything, baby!"
|
14
14
|
task :default => [:package]
|
15
15
|
|
16
|
-
#task :package => [:clobber,:compile,:test,:makegem]
|
17
16
|
task :package => [:clean,:compile,:makegem]
|
18
17
|
|
19
18
|
desc "Compiles all extensions"
|
20
19
|
task :compile do
|
20
|
+
cp 'ext/mysql.c.in', 'ext/mysql.c.in.orig'
|
21
|
+
sh %{ patch -p0 ext/mysql.c.in < ext/mysql.c.in.patch }
|
21
22
|
cd "ext" do
|
22
23
|
sh %{ ruby extconf.rb --with-mysql-include=C:/Progra~1/MySQL/MySQLS~1.0/include --with-mysql-lib=C:/Progra~1/MySQL/MySQLS~1.0/lib/opt }
|
23
24
|
sh %{ nmake }
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
desc "runs the given tests"
|
28
|
-
task :test do
|
29
|
-
cd "ext" do
|
30
|
-
# TODO: improve test setup so that tests pass with authentication
|
31
|
-
ruby "test.rb", %{#{ENV["TESTOPTS"]}}
|
25
|
+
mv 'mysql.c.in.orig', 'mysql.c.in', :force => true
|
32
26
|
end
|
33
27
|
end
|
34
28
|
|
@@ -43,7 +37,7 @@ task :makegem do
|
|
43
37
|
s.summary = "A win32-native build of the MySQL API module for Ruby."
|
44
38
|
s.description = s.summary
|
45
39
|
s.rubyforge_project = s.name
|
46
|
-
s.files += %w(docs ext/mysql.so ext/extconf.rb ext/
|
40
|
+
s.files += %w(docs ext/mysql.so ext/extconf.rb ext/mysql.c.in ext/mysql.c.in.patch ext/test.rb README Rakefile)
|
47
41
|
s.rdoc_options << '--exclude' << 'ext' << '--main' << 'README'
|
48
42
|
s.extra_rdoc_files = ["README", "docs/README.html"]
|
49
43
|
s.has_rdoc = true
|
data/docs/README.html
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2
|
-
<!-- $Id: README.html,v 1.
|
2
|
+
<!-- $Id: README.html,v 1.20 2006-12-20 05:31:52 tommy Exp $ -->
|
3
3
|
<html>
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="content-style-type" content="text/css">
|
@@ -22,8 +22,8 @@
|
|
22
22
|
|
23
23
|
<h2>Requirement</h2>
|
24
24
|
<ul>
|
25
|
-
<li>MySQL
|
26
|
-
<li>Ruby 1.8.
|
25
|
+
<li>MySQL 5.0.27
|
26
|
+
<li>Ruby 1.8.5
|
27
27
|
</ul>
|
28
28
|
<p>
|
29
29
|
The module may work for other versions, but that has not been verified.
|
@@ -103,6 +103,9 @@
|
|
103
103
|
<pre class="code">
|
104
104
|
% env LD_RUN_PATH=<i>libmysqlclient.so directory</i> make
|
105
105
|
</pre>
|
106
|
+
<p>
|
107
|
+
test.rb is tested on Linux only.
|
108
|
+
</p>
|
106
109
|
|
107
110
|
<h2>Usage</h2>
|
108
111
|
<p>
|
@@ -697,7 +700,7 @@ st.close
|
|
697
700
|
<tr><td>FLOAT, DOUBLE<td>Float
|
698
701
|
<tr><td>DECIMAL<td>String
|
699
702
|
<tr><td>DATE, DATETIME, TIMESTAMP, TIME<td>Mysql::Time
|
700
|
-
<tr><td>CHAR, VARCHAR, BINARY, VARBINARY, TINYBLOB, TINYTEXT, TINYBLOB, TINYTEXT, MEDIUMBLOB, MEDIUMTEXT, LONGBLOB, LONGTEXT, ENUM, SET<td>String
|
703
|
+
<tr><td>CHAR, VARCHAR, BINARY, VARBINARY, TINYBLOB, TINYTEXT, TINYBLOB, TINYTEXT, MEDIUMBLOB, MEDIUMTEXT, LONGBLOB, LONGTEXT, ENUM, SET, BIT<td>String
|
701
704
|
<tr><td>NULL<td>NilClass
|
702
705
|
</table>
|
703
706
|
|
@@ -811,6 +814,25 @@ st.close
|
|
811
814
|
|
812
815
|
<h2>History</h2>
|
813
816
|
<dl>
|
817
|
+
<dt>2006-12-20
|
818
|
+
<dd>
|
819
|
+
version 2.7.3
|
820
|
+
<ul>
|
821
|
+
<li>BUG: Mysql#query with block is stopped when last query failed.
|
822
|
+
</ul>
|
823
|
+
|
824
|
+
<dt>2006-10-28
|
825
|
+
<dd>
|
826
|
+
version 2.7.2
|
827
|
+
<ul>
|
828
|
+
<li>BUG: Mysql::Stmt#result_metadata don't return nil. (Thanks to Hidetoshi)
|
829
|
+
<li>BUG: Mysql#close check mysql_errno.
|
830
|
+
<li>BUG: multistatement Mysql#query with block ignore error.
|
831
|
+
<li>extconf.rb for Visual C++. (Thanks to Shugo Maeda)
|
832
|
+
<li>support MySQL BIT type.
|
833
|
+
<li>add Mysql::Field::TYPE_BIT, TYPE_NEWDECIMAL.
|
834
|
+
</ul>
|
835
|
+
|
814
836
|
<dt>2006-06-04
|
815
837
|
<dd>
|
816
838
|
version 2.7.1
|
@@ -1011,7 +1033,7 @@ st.close
|
|
1011
1033
|
<address><a href="mailto:tommy@tmtm.org">TOMITA Masahiro</a></address>
|
1012
1034
|
<!-- Created: Sun Aug 29 11:52:09 JST 2004 -->
|
1013
1035
|
<!-- hhmts start -->
|
1014
|
-
Last modified:
|
1036
|
+
Last modified: Wed Dec 20 14:30:14 JST 2006
|
1015
1037
|
<!-- hhmts end -->
|
1016
1038
|
</body>
|
1017
1039
|
</html>
|
data/ext/extconf.rb
CHANGED
@@ -1,18 +1,73 @@
|
|
1
|
-
require 'mkmf'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
require 'mkmf'
|
2
|
+
|
3
|
+
if /mswin32/ =~ RUBY_PLATFORM
|
4
|
+
inc, lib = dir_config('mysql')
|
5
|
+
exit 1 unless have_library("libmysql")
|
6
|
+
elsif mc = with_config('mysql-config') then
|
7
|
+
mc = 'mysql_config' if mc == true
|
8
|
+
cflags = `#{mc} --cflags`.chomp
|
9
|
+
exit 1 if $? != 0
|
10
|
+
libs = `#{mc} --libs`.chomp
|
11
|
+
exit 1 if $? != 0
|
12
|
+
$CPPFLAGS += ' ' + cflags
|
13
|
+
$libs = libs + " " + $libs
|
14
|
+
else
|
15
|
+
inc, lib = dir_config('mysql', '/usr/local')
|
16
|
+
libs = ['m', 'z', 'socket', 'nsl', 'mygcc']
|
17
|
+
while not find_library('mysqlclient', 'mysql_query', lib, "#{lib}/mysql") do
|
18
|
+
exit 1 if libs.empty?
|
19
|
+
have_library(libs.shift)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
have_func('mysql_ssl_set')
|
24
|
+
|
25
|
+
if have_header('mysql.h') then
|
26
|
+
src = "#include <errmsg.h>\n#include <mysqld_error.h>\n"
|
27
|
+
elsif have_header('mysql/mysql.h') then
|
28
|
+
src = "#include <mysql/errmsg.h>\n#include <mysql/mysqld_error.h>\n"
|
29
|
+
else
|
30
|
+
exit 1
|
31
|
+
end
|
32
|
+
|
33
|
+
# make mysql constant
|
34
|
+
File::open("conftest.c", "w") do |f|
|
35
|
+
f.puts src
|
36
|
+
end
|
37
|
+
if defined? cpp_command then
|
38
|
+
cpp = Config::expand(cpp_command(''))
|
39
|
+
else
|
40
|
+
cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')
|
41
|
+
end
|
42
|
+
if /mswin32/ =~ RUBY_PLATFORM && !/-E/.match(cpp)
|
43
|
+
cpp << " -E"
|
44
|
+
end
|
45
|
+
unless system "#{cpp} > confout" then
|
46
|
+
exit 1
|
47
|
+
end
|
48
|
+
File::unlink "conftest.c"
|
49
|
+
|
50
|
+
error_syms = []
|
51
|
+
IO::foreach('confout') do |l|
|
52
|
+
next unless l =~ /errmsg\.h|mysqld_error\.h/
|
53
|
+
fn = l.split(/\"/)[1]
|
54
|
+
IO::foreach(fn) do |m|
|
55
|
+
if m =~ /^#define\s+([CE]R_[0-9A-Z_]+)/ then
|
56
|
+
error_syms << $1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
File::unlink 'confout'
|
61
|
+
error_syms.uniq!
|
62
|
+
|
63
|
+
newf = File::open('mysql.c', 'w')
|
64
|
+
IO::foreach('mysql.c.in') do |l|
|
65
|
+
newf.puts l
|
66
|
+
if l =~ /\/\* Mysql::Error constant \*\// then
|
67
|
+
error_syms.each do |s|
|
68
|
+
newf.puts " rb_define_const(eMysql, \"#{s}\", INT2NUM(#{s}));"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
create_makefile("mysql")
|
data/ext/mysql.c.in
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ruby mysql module
|
2
|
-
* $Id: mysql.c.in,v 1.
|
2
|
+
* $Id: mysql.c.in,v 1.38 2006-12-20 05:31:52 tommy Exp $
|
3
3
|
*/
|
4
4
|
|
5
5
|
#include "ruby.h"
|
@@ -14,7 +14,7 @@
|
|
14
14
|
#include <mysql/mysqld_error.h>
|
15
15
|
#endif
|
16
16
|
|
17
|
-
#define MYSQL_RUBY_VERSION
|
17
|
+
#define MYSQL_RUBY_VERSION 20703
|
18
18
|
|
19
19
|
#define GC_STORE_RESULT_LIMIT 20
|
20
20
|
|
@@ -182,7 +182,6 @@ static VALUE mysqlres2obj(MYSQL_RES* res)
|
|
182
182
|
static VALUE make_field_obj(MYSQL_FIELD* f)
|
183
183
|
{
|
184
184
|
VALUE obj;
|
185
|
-
VALUE hash;
|
186
185
|
if (f == NULL)
|
187
186
|
return Qnil;
|
188
187
|
obj = rb_obj_alloc(cMysqlField);
|
@@ -446,8 +445,6 @@ static VALUE my_close(VALUE obj)
|
|
446
445
|
{
|
447
446
|
MYSQL* m = GetHandler(obj);
|
448
447
|
mysql_close(m);
|
449
|
-
if (mysql_errno(m))
|
450
|
-
mysql_raise(m);
|
451
448
|
GetMysqlStruct(obj)->connection = Qfalse;
|
452
449
|
return obj;
|
453
450
|
}
|
@@ -700,6 +697,7 @@ static VALUE res_free(VALUE);
|
|
700
697
|
/* query(sql) */
|
701
698
|
static VALUE query(VALUE obj, VALUE sql)
|
702
699
|
{
|
700
|
+
int loop = 0;
|
703
701
|
MYSQL* m = GetHandler(obj);
|
704
702
|
Check_Type(sql, T_STRING);
|
705
703
|
if (rb_block_given_p()) {
|
@@ -718,11 +716,12 @@ static VALUE query(VALUE obj, VALUE sql)
|
|
718
716
|
VALUE robj = mysqlres2obj(res);
|
719
717
|
rb_ensure(rb_yield, robj, res_free, robj);
|
720
718
|
}
|
721
|
-
}
|
722
719
|
#if MYSQL_VERSION_ID >= 40101
|
723
|
-
|
720
|
+
if ((loop = mysql_next_result(m)) > 0)
|
721
|
+
mysql_raise(m);
|
722
|
+
} while (loop == 0);
|
724
723
|
#else
|
725
|
-
while (0);
|
724
|
+
} while (0);
|
726
725
|
#endif
|
727
726
|
return obj;
|
728
727
|
}
|
@@ -1313,7 +1312,6 @@ static VALUE stmt_execute(int argc, VALUE *argv, VALUE obj)
|
|
1313
1312
|
struct mysql_stmt *s = DATA_PTR(obj);
|
1314
1313
|
MYSQL_STMT *stmt = s->stmt;
|
1315
1314
|
my_bool true = 1;
|
1316
|
-
my_bool false = 0;
|
1317
1315
|
int i;
|
1318
1316
|
|
1319
1317
|
check_stmt_closed(obj);
|
@@ -1334,7 +1332,7 @@ static VALUE stmt_execute(int argc, VALUE *argv, VALUE obj)
|
|
1334
1332
|
case T_BIGNUM:
|
1335
1333
|
s->param.bind[i].buffer_type = MYSQL_TYPE_LONGLONG;
|
1336
1334
|
s->param.bind[i].buffer = &(s->param.buffer[i]);
|
1337
|
-
*(
|
1335
|
+
*(LONG_LONG*)(s->param.bind[i].buffer) = rb_big2ll(argv[i]);
|
1338
1336
|
break;
|
1339
1337
|
case T_FLOAT:
|
1340
1338
|
s->param.bind[i].buffer_type = MYSQL_TYPE_DOUBLE;
|
@@ -1435,7 +1433,7 @@ static VALUE stmt_fetch(VALUE obj)
|
|
1435
1433
|
v = INT2NUM(*(long*)s->result.bind[i].buffer);
|
1436
1434
|
break;
|
1437
1435
|
case MYSQL_TYPE_LONGLONG:
|
1438
|
-
v = rb_ll2inum(*(
|
1436
|
+
v = rb_ll2inum(*(LONG_LONG*)s->result.bind[i].buffer);
|
1439
1437
|
break;
|
1440
1438
|
case MYSQL_TYPE_DOUBLE:
|
1441
1439
|
v = rb_float_new(*(double*)s->result.bind[i].buffer);
|
@@ -1560,6 +1558,7 @@ static enum enum_field_types buffer_type(MYSQL_FIELD *field)
|
|
1560
1558
|
case FIELD_TYPE_DECIMAL:
|
1561
1559
|
#if MYSQL_VERSION_ID >= 50003
|
1562
1560
|
case FIELD_TYPE_NEWDECIMAL:
|
1561
|
+
case FIELD_TYPE_BIT:
|
1563
1562
|
#endif
|
1564
1563
|
return MYSQL_TYPE_STRING;
|
1565
1564
|
case FIELD_TYPE_BLOB:
|
@@ -1630,8 +1629,11 @@ static VALUE stmt_result_metadata(VALUE obj)
|
|
1630
1629
|
MYSQL_RES *res;
|
1631
1630
|
check_stmt_closed(obj);
|
1632
1631
|
res = mysql_stmt_result_metadata(s->stmt);
|
1633
|
-
if (res == NULL
|
1632
|
+
if (res == NULL) {
|
1633
|
+
if (mysql_stmt_errno(s->stmt) != 0)
|
1634
1634
|
mysql_stmt_raise(s->stmt);
|
1635
|
+
return Qnil;
|
1636
|
+
}
|
1635
1637
|
return mysqlres2obj(res);
|
1636
1638
|
}
|
1637
1639
|
|
@@ -1700,6 +1702,7 @@ static VALUE time_initialize(int argc, VALUE* argv, VALUE obj)
|
|
1700
1702
|
rb_iv_set(obj, "second", NILorFIXvalue(second));
|
1701
1703
|
rb_iv_set(obj, "neg", (neg == Qnil || neg == Qfalse) ? Qfalse : Qtrue);
|
1702
1704
|
rb_iv_set(obj, "second_part", NILorFIXvalue(second_part));
|
1705
|
+
return obj;
|
1703
1706
|
}
|
1704
1707
|
|
1705
1708
|
static VALUE time_inspect(VALUE obj)
|
@@ -2080,6 +2083,10 @@ void Init_mysql(void)
|
|
2080
2083
|
rb_define_const(cMysqlField, "TYPE_DATETIME", INT2NUM(FIELD_TYPE_DATETIME));
|
2081
2084
|
#if MYSQL_VERSION_ID >= 32130
|
2082
2085
|
rb_define_const(cMysqlField, "TYPE_YEAR", INT2NUM(FIELD_TYPE_YEAR));
|
2086
|
+
#endif
|
2087
|
+
#if MYSQL_VERSION_ID >= 50003
|
2088
|
+
rb_define_const(cMysqlField, "TYPE_BIT", INT2NUM(FIELD_TYPE_BIT));
|
2089
|
+
rb_define_const(cMysqlField, "TYPE_NEWDECIMAL", INT2NUM(FIELD_TYPE_NEWDECIMAL));
|
2083
2090
|
#endif
|
2084
2091
|
rb_define_const(cMysqlField, "TYPE_SET", INT2NUM(FIELD_TYPE_SET));
|
2085
2092
|
rb_define_const(cMysqlField, "TYPE_BLOB", INT2NUM(FIELD_TYPE_BLOB));
|
@@ -0,0 +1,13 @@
|
|
1
|
+
--- mysql.c.in Tue Dec 19 22:31:52 2006
|
2
|
+
+++ mysql.c.in.new Thu Dec 28 09:33:30 2006
|
3
|
+
@@ -14,6 +14,10 @@
|
4
|
+
#include <mysql/mysqld_error.h>
|
5
|
+
#endif
|
6
|
+
|
7
|
+
+#if !defined(HAVE_ULONG) && !defined(TARGET_OS_LINUX) && !defined(__USE_MISC)
|
8
|
+
+typedef unsigned long ulong; /* Short for unsigned long */
|
9
|
+
+#endif
|
10
|
+
+
|
11
|
+
#define MYSQL_RUBY_VERSION 20703
|
12
|
+
|
13
|
+
#define GC_STORE_RESULT_LIMIT 20
|
data/ext/mysql.so
CHANGED
Binary file
|
data/ext/test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
|
-
# $Id: test.rb,v 1.
|
2
|
+
# $Id: test.rb,v 1.23 2006-12-20 05:31:52 tommy Exp $
|
3
3
|
|
4
4
|
require "test/unit"
|
5
5
|
require "./mysql.o"
|
@@ -16,7 +16,7 @@ class TC_Mysql < Test::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_version()
|
19
|
-
assert_equal(
|
19
|
+
assert_equal(20703, Mysql::VERSION)
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_init()
|
@@ -48,11 +48,11 @@ class TC_Mysql < Test::Unit::TestCase
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_get_client_info()
|
51
|
-
assert_match(/^\d.\d+.\d+(-.*)?$/, Mysql.get_client_info())
|
51
|
+
assert_match(/^\d.\d+.\d+[a-z]?(-.*)?$/, Mysql.get_client_info())
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_client_info()
|
55
|
-
assert_match(/^\d.\d+.\d+(-.*)?$/, Mysql.client_info())
|
55
|
+
assert_match(/^\d.\d+.\d+[a-z]?(-.*)?$/, Mysql.client_info())
|
56
56
|
end
|
57
57
|
|
58
58
|
def test_options()
|
@@ -103,7 +103,7 @@ class TC_Mysql2 < Test::Unit::TestCase
|
|
103
103
|
@m = Mysql.new(@host, @user, @pass, @db, @port, @sock, @flag)
|
104
104
|
end
|
105
105
|
def teardown()
|
106
|
-
@m.close
|
106
|
+
@m.close if @m
|
107
107
|
end
|
108
108
|
|
109
109
|
def test_affected_rows()
|
@@ -142,6 +142,33 @@ class TC_Mysql2 < Test::Unit::TestCase
|
|
142
142
|
end
|
143
143
|
end if Mysql.client_version >= 40100
|
144
144
|
|
145
|
+
def test_query_with_block()
|
146
|
+
if @m.server_version >= 40100 then
|
147
|
+
expect = [["1","2","3"], ["4","5","6"]]
|
148
|
+
@m.query("select 1,2,3; select 4,5,6") {|res|
|
149
|
+
assert_equal(1, res.num_rows)
|
150
|
+
assert_equal(expect.shift, res.fetch_row)
|
151
|
+
}
|
152
|
+
assert(expect.empty?)
|
153
|
+
expect = [["1","2","3"], ["4","5","6"]]
|
154
|
+
assert_raises(Mysql::Error) {
|
155
|
+
@m.query("select 1,2,3; hoge; select 4,5,6") {|res|
|
156
|
+
assert_equal(1, res.num_rows)
|
157
|
+
assert_equal(expect.shift, res.fetch_row)
|
158
|
+
}
|
159
|
+
}
|
160
|
+
assert_equal(1, expect.size)
|
161
|
+
expect = [["1","2","3"], ["4","5","6"]]
|
162
|
+
assert_raises(Mysql::Error) {
|
163
|
+
@m.query("select 1,2,3; select 4,5,6; hoge") {|res|
|
164
|
+
assert_equal(1, res.num_rows)
|
165
|
+
assert_equal(expect.shift, res.fetch_row)
|
166
|
+
}
|
167
|
+
}
|
168
|
+
assert(expect.empty?)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
145
172
|
def test_set_server_option()
|
146
173
|
if @m.server_version >= 40101 then
|
147
174
|
assert_equal(@m, @m.set_server_option(Mysql::OPTION_MULTI_STATEMENTS_ON))
|
@@ -662,6 +689,31 @@ class TC_MysqlStmt2 < Test::Unit::TestCase
|
|
662
689
|
end
|
663
690
|
end
|
664
691
|
|
692
|
+
def test_fetch_bit()
|
693
|
+
if @m.client_version >= 50003 and @m.server_version >= 50003 then
|
694
|
+
@m.query("create temporary table t (i bit(8))")
|
695
|
+
@m.query("insert into t values (0),(-1),(127),(-128),(255),(-255),(256)")
|
696
|
+
@s.prepare("select i from t")
|
697
|
+
@s.execute
|
698
|
+
assert_equal(["\x00"], @s.fetch)
|
699
|
+
assert_equal(["\xff"], @s.fetch)
|
700
|
+
assert_equal(["\x7f"], @s.fetch)
|
701
|
+
assert_equal(["\xff"], @s.fetch)
|
702
|
+
assert_equal(["\xff"], @s.fetch)
|
703
|
+
assert_equal(["\xff"], @s.fetch)
|
704
|
+
assert_equal(["\xff"], @s.fetch)
|
705
|
+
@m.query("create temporary table t2 (i bit(64))")
|
706
|
+
@m.query("insert into t2 values (0),(-1),(4294967296),(18446744073709551615),(18446744073709551616)")
|
707
|
+
@s.prepare("select i from t2")
|
708
|
+
@s.execute
|
709
|
+
assert_equal(["\x00\x00\x00\x00\x00\x00\x00\x00"], @s.fetch)
|
710
|
+
assert_equal(["\xff\xff\xff\xff\xff\xff\xff\xff"], @s.fetch)
|
711
|
+
assert_equal(["\x00\x00\x00\x01\x00\x00\x00\x00"], @s.fetch)
|
712
|
+
assert_equal(["\xff\xff\xff\xff\xff\xff\xff\xff"], @s.fetch)
|
713
|
+
assert_equal(["\xff\xff\xff\xff\xff\xff\xff\xff"], @s.fetch)
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
665
717
|
def test_fetch_tinyint()
|
666
718
|
if @m.server_version >= 40100 then
|
667
719
|
@m.query("create temporary table t (i tinyint)")
|
@@ -1254,6 +1306,14 @@ class TC_MysqlStmt2 < Test::Unit::TestCase
|
|
1254
1306
|
end
|
1255
1307
|
end
|
1256
1308
|
|
1309
|
+
def test_result_metadata_nodata()
|
1310
|
+
if @m.server_version >= 40100 then
|
1311
|
+
@m.query("create temporary table t (i int)")
|
1312
|
+
@s.prepare("insert into t values (1)")
|
1313
|
+
assert_equal(nil, @s.result_metadata())
|
1314
|
+
end
|
1315
|
+
end
|
1316
|
+
|
1257
1317
|
def test_row_seek_tell()
|
1258
1318
|
if @m.server_version >= 40100 then
|
1259
1319
|
@m.query("create temporary table t (i int)")
|
@@ -1285,7 +1345,11 @@ class TC_MysqlStmt2 < Test::Unit::TestCase
|
|
1285
1345
|
def test_sqlstate()
|
1286
1346
|
if @m.server_version >= 40100 then
|
1287
1347
|
@s.prepare("select 1")
|
1288
|
-
|
1348
|
+
if @m.client_version >= 50000 then
|
1349
|
+
assert_equal("00000", @s.sqlstate)
|
1350
|
+
else
|
1351
|
+
assert_equal("", @s.sqlstate)
|
1352
|
+
end
|
1289
1353
|
assert_raises(Mysql::Error){@s.prepare("hogehoge")}
|
1290
1354
|
assert_equal("42000", @s.sqlstate)
|
1291
1355
|
end
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
2
|
+
rubygems_version: 0.9.0
|
3
3
|
specification_version: 1
|
4
4
|
name: mysql
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 2.7.
|
7
|
-
date: 2006-
|
6
|
+
version: 2.7.3
|
7
|
+
date: 2006-12-28 00:00:00 -07:00
|
8
8
|
summary: A win32-native build of the MySQL API module for Ruby.
|
9
9
|
require_paths:
|
10
10
|
- ext
|
@@ -25,14 +25,15 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
25
25
|
platform: mswin32
|
26
26
|
signing_key:
|
27
27
|
cert_chain:
|
28
|
+
post_install_message:
|
28
29
|
authors:
|
29
30
|
- Kevin Williams
|
30
31
|
files:
|
31
32
|
- docs
|
32
33
|
- ext/mysql.so
|
33
34
|
- ext/extconf.rb
|
34
|
-
- ext/extconf.rb.orig
|
35
35
|
- ext/mysql.c.in
|
36
|
+
- ext/mysql.c.in.patch
|
36
37
|
- ext/test.rb
|
37
38
|
- README
|
38
39
|
- Rakefile
|
data/ext/extconf.rb.orig
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
require 'mkmf'
|
2
|
-
|
3
|
-
if mc = with_config('mysql-config') then
|
4
|
-
mc = 'mysql_config' if mc == true
|
5
|
-
cflags = `#{mc} --cflags`.chomp
|
6
|
-
exit 1 if $? != 0
|
7
|
-
libs = `#{mc} --libs`.chomp
|
8
|
-
exit 1 if $? != 0
|
9
|
-
$CPPFLAGS += ' ' + cflags
|
10
|
-
$libs = libs + " " + $libs
|
11
|
-
else
|
12
|
-
inc, lib = dir_config('mysql', '/usr/local')
|
13
|
-
libs = ['m', 'z', 'socket', 'nsl']
|
14
|
-
while not find_library('mysqlclient', 'mysql_query', lib, "#{lib}/mysql") do
|
15
|
-
exit 1 if libs.empty?
|
16
|
-
have_library(libs.shift)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
have_func('mysql_ssl_set')
|
21
|
-
|
22
|
-
if have_header('mysql.h') then
|
23
|
-
src = "#include <errmsg.h>\n#include <mysqld_error.h>\n"
|
24
|
-
elsif have_header('mysql/mysql.h') then
|
25
|
-
src = "#include <mysql/errmsg.h>\n#include <mysql/mysqld_error.h>\n"
|
26
|
-
else
|
27
|
-
exit 1
|
28
|
-
end
|
29
|
-
|
30
|
-
# make mysql constant
|
31
|
-
File::open("conftest.c", "w") do |f|
|
32
|
-
f.puts src
|
33
|
-
end
|
34
|
-
if defined? cpp_command then
|
35
|
-
cpp = Config::expand(cpp_command(''))
|
36
|
-
else
|
37
|
-
cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')
|
38
|
-
end
|
39
|
-
unless system "#{cpp} > confout" then
|
40
|
-
exit 1
|
41
|
-
end
|
42
|
-
File::unlink "conftest.c"
|
43
|
-
|
44
|
-
error_syms = []
|
45
|
-
IO::foreach('confout') do |l|
|
46
|
-
next unless l =~ /errmsg\.h|mysqld_error\.h/
|
47
|
-
fn = l.split(/\"/)[1]
|
48
|
-
IO::foreach(fn) do |m|
|
49
|
-
if m =~ /^#define\s+([CE]R_[0-9A-Z_]+)/ then
|
50
|
-
error_syms << $1
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
File::unlink 'confout'
|
55
|
-
error_syms.uniq!
|
56
|
-
|
57
|
-
newf = File::open('mysql.c', 'w')
|
58
|
-
IO::foreach('mysql.c.in') do |l|
|
59
|
-
newf.puts l
|
60
|
-
if l =~ /\/\* Mysql::Error constant \*\// then
|
61
|
-
error_syms.each do |s|
|
62
|
-
newf.puts " rb_define_const(eMysql, \"#{s}\", INT2NUM(#{s}));"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
create_makefile("mysql")
|