[#13842] Better introspection for Frames, Thread, and enhancing binding. — "Rocky Bernstein" <rocky.bernstein@...>

The below is a little long. So here's a summary.

11 messages 2007/12/01

[#13851] Array#flatten works quadratic time on length of resulting array. It could be linear — "Voroztsov Artem" <artem.voroztsov@...>

I encountered problem with Array#flatten slowness (it can be much

19 messages 2007/12/03
[#13863] Re: Array#flatten works quadratic time on length of resulting array. It could be linear — Charles Oliver Nutter <charles.nutter@...> 2007/12/03

Voroztsov Artem wrote:

[#13867] Re: Array#flatten works quadratic time on length of resulting array. It could be linear — "Voroztsov Artem" <artem.voroztsov@...> 2007/12/03

2007/12/3, Charles Oliver Nutter <charles.nutter@sun.com>:

[#13868] Re: Array#flatten works quadratic time on length of resulting array. It could be linear — "Voroztsov Artem" <artem.voroztsov@...> 2007/12/03

2007/12/3, Voroztsov Artem <artem.voroztsov@gmail.com>:

[#13870] Re: Array#flatten works quadratic time on length of resulting array. It could be linear — "Yusuke ENDOH" <mame@...> 2007/12/03

Hi,

[#13903] Clarification of retry change — Charles Oliver Nutter <charles.nutter@...>

Matz confirmed that retry-outside-rescue will no longer work, but I

14 messages 2007/12/07
[#13905] Re: Clarification of retry change — SASADA Koichi <ko1@...> 2007/12/07

Hi,

[#13908] What's the status of compiler/compiling on windows? — Gonzalo Garramu <ggarra@...>

20 messages 2007/12/07
[#13913] Re: What's the status of compiler/compiling on windows? — Nobuyoshi Nakada <nobu@...> 2007/12/07

Hi,

[#13914] Re: [Spam] Re: What's the status of compiler/compiling on windows? — Gonzalo Garramu <ggarra@...> 2007/12/07

Nobuyoshi Nakada wrote:

[#13926] Re: [Spam] Re: What's the status of compiler/compiling on windows? — "Luis Lavena" <luislavena@...> 2007/12/07

T24gRGVjIDcsIDIwMDcgODoyMSBBTSwgR29uemFsbyBHYXJyYW11w7FvIDxnZ2FycmFAYWR2YW5j

[#14038] Re: [Spam] Re: What's the status of compiler/compiling on windows? — "Joe Swatosh" <joe.swatosh@...> 2007/12/12

Hi Luis

[#14039] Re: [Spam] Re: What's the status of compiler/compiling on windows? — "Luis Lavena" <luislavena@...> 2007/12/12

On Dec 12, 2007 4:05 PM, Joe Swatosh <joe.swatosh@gmail.com> wrote:

[#14040] Re: [Spam] Re: What's the status of compiler/compiling on windows? — "Austin Ziegler" <halostatue@...> 2007/12/12

> This was discussed in other thread in ruby-talk, but just to summarize:

[#13969] redefineable not operator — David Flanagan <david@...>

Matz,

37 messages 2007/12/10
[#13971] Re: redefineable not operator — murphy <murphy@...> 2007/12/10

David Flanagan wrote:

[#13972] Re: redefineable not operator — Yukihiro Matsumoto <matz@...> 2007/12/10

Hi,

[#14007] Re: redefineable not operator — murphy <murphy@...> 2007/12/11

Yukihiro Matsumoto wrote:

[#14011] Re: redefineable not operator — Yukihiro Matsumoto <matz@...> 2007/12/11

Hi,

[#14013] Re: redefineable not operator — murphy <murphy@...> 2007/12/12

Yukihiro Matsumoto wrote:

[#14016] Re: redefineable not operator — David Flanagan <david@...> 2007/12/12

murphy wrote:

[#14019] Re: redefineable not operator — Yukihiro Matsumoto <matz@...> 2007/12/12

Hi,

[#14024] Re: redefineable not operator — Gary Wright <gwtmp01@...> 2007/12/12

[#14029] Re: redefineable not operator — Dave Thomas <dave@...> 2007/12/12

[#14042] Fix e2mmap.rb for 1.9 — Eric Hodel <drbrain@...7.net>

E2MM.Raise complains about $! being read-only now, and E2MM is used by

22 messages 2007/12/13
[#14043] Re: Fix e2mmap.rb for 1.9 — Dave Thomas <dave@...> 2007/12/13

[#14049] RDoc + irb (Was: Fix e2mmap.rb for 1.9) — Eric Hodel <drbrain@...7.net> 2007/12/13

On Dec 12, 2007, at 16:19 PM, Dave Thomas wrote:

[#14052] Re: RDoc + irb (Was: Fix e2mmap.rb for 1.9) — Dave Thomas <dave@...> 2007/12/13

[#14056] Re: RDoc + irb (Was: Fix e2mmap.rb for 1.9) — Charles Oliver Nutter <charles.nutter@...> 2007/12/13

Dave Thomas wrote:

[#14123] Some Ruby 1.9 loose ends to tie up — David Flanagan <david@...>

Matz,

20 messages 2007/12/17
[#14220] Re: Some Ruby 1.9 loose ends to tie up — Yukihiro Matsumoto <matz@...> 2007/12/21

Hi,

[#14238] Re: Some Ruby 1.9 loose ends to tie up — Charles Oliver Nutter <charles.nutter@...> 2007/12/22

Yukihiro Matsumoto wrote:

[#14147] named captures assigning to local variables — David Flanagan <david@...>

I've just been browsing ruby-dev. For an english speaker, it is kind of

26 messages 2007/12/19
[#14150] Re: named captures assigning to local variables — Tanaka Akira <akr@...> 2007/12/19

In article <47686B87.7050609@davidflanagan.com>,

[#14158] Re: named captures assigning to local variables — david@... 2007/12/19

Thank you for the clarification, akr. I'm embarassed to say that it didn't

[#14161] Re: named captures assigning to local variables — David Flanagan <david@...> 2007/12/20

If I may, have a proposal. My apologies if this has already been

[#14170] Re: named captures assigning to local variables — Tanaka Akira <akr@...> 2007/12/20

In article <476A087E.3070000@davidflanagan.com>,

[#14172] Re: named captures assigning to local variables — David Flanagan <david@...> 2007/12/20

How about making the return value an array of the captured strings, or nil

[#14149] Experimental PATCH to improve thread performance — Brent Roman <brent@...>

The attached patch against Ruby 1.8.6-p110 improves the performance of

38 messages 2007/12/19
[#14202] Re: Experimental PATCH to improve thread performance — Charles Oliver Nutter <charles.nutter@...> 2007/12/21

Brent Roman wrote:

[#14257] Re: Experimental PATCH to improve thread performance — Brent Roman <brent@...> 2007/12/22

[#14266] Re: Experimental PATCH to improve thread performance — Charles Oliver Nutter <charles.nutter@...> 2007/12/22

Brent Roman wrote:

[#14274] Re: Experimental PATCH to improve thread performance — Sylvain Joyeux <sylvain.joyeux@...4x.org> 2007/12/22

On Sat, Dec 22, 2007 at 11:07:25PM +0900, Charles Oliver Nutter wrote:

[#14186] Rake 0.8.0 added to Ruby — Jim Weirich <jim.weirich@...>

Just a heads up here. I've added Rake (version 0.8.0 ... the latest)

34 messages 2007/12/21
[#14210] Re: [Spam] Rake 0.8.0 added to Ruby — Gonzalo Garramu <ggarra@...> 2007/12/21

Jim Weirich wrote:

[#14213] Re: [Spam] Rake 0.8.0 added to Ruby — "Rick DeNatale" <rick.denatale@...> 2007/12/21

On Dec 21, 2007 10:24 AM, Gonzalo Garramu=F1o <ggarra@advancedsl.com.ar> wr=

[#14215] Re: [Spam] Rake 0.8.0 added to Ruby — Jim Weirich <jim.weirich@...> 2007/12/21

[#14303] IRHG - GC Memory Fragmentation? — Charles Thornton <ceo@...>

While working on Chapter 05 and referencing various works

23 messages 2007/12/23
[#14308] Re: IRHG - GC Memory Fragmentation? — Ryan Davis <ryand-ruby@...> 2007/12/23

[#14335] Many external symbols _without_ prefix in libruby object file — Tadashi Saito <shiba@...2.accsnet.ne.jp>

Hi all,

12 messages 2007/12/23

[#14364] RDoc: [FATAL] failed to allocate memory — Martin Duerst <duerst@...>

With revision 14590, I suddenly get an error when I do "make install"

13 messages 2007/12/24

[#14367] replace csv.rb with fastercsv.rb — "NAKAMURA, Hiroshi" <nakahiro@...>

-----BEGIN PGP SIGNED MESSAGE-----

15 messages 2007/12/24
[#14390] Re: replace csv.rb with fastercsv.rb — James Gray <james@...> 2007/12/24

On Dec 24, 2007, at 3:34 AM, NAKAMURA, Hiroshi wrote:

[#14418] Base64 not there makes Rails 2.0.2 fail to load in 1.9.0 — Richard Kilmer <rich@...>

Just re-built latest svn of 1.9.0 and base64.rb is removed. Its

51 messages 2007/12/25
[#14420] Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — Eric Hodel <drbrain@...7.net> 2007/12/25

On Dec 25, 2007, at 07:03 AM, Richard Kilmer wrote:

[#14427] Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — "M. Edward (Ed) Borasky" <znmeb@...> 2007/12/25

Eric Hodel wrote:

[#14431] Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — Dave Thomas <dave@...> 2007/12/25

[#14446] Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — Eric Hodel <drbrain@...7.net> 2007/12/26

On Dec 25, 2007, at 13:35 PM, Dave Thomas wrote:

[#14452] Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — Dave Thomas <dave@...> 2007/12/26

[#14492] Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — Eric Hodel <drbrain@...7.net> 2007/12/27

On Dec 26, 2007, at 06:16 AM, Dave Thomas wrote:

[#14494] Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — Dave Thomas <dave@...> 2007/12/27

[#14503] Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — Richard Kilmer <rich@...> 2007/12/27

[#14505] Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — Charles Oliver Nutter <charles.nutter@...> 2007/12/27

Richard Kilmer wrote:

[#14429] Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — hemant <gethemant@...> 2007/12/25

On Dec 26, 2007 1:01 AM, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:

[#14430] Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0) — "M. Edward (Ed) Borasky" <znmeb@...> 2007/12/25

hemant wrote:

[#14517] Invalid use of mktime() in Ruby 1.8/1.9 results in incorrect Time objects — Dirkjan Bussink <d.bussink@...>

Hello,

12 messages 2007/12/27

[#14549] multibyte strings & bucket-of-bytes efficiency under 1.9.0 — khaines@...

Like everyone else, I've been testing my stuff under 1.9.0. In general,

38 messages 2007/12/28
[#14560] Re: multibyte strings & bucket-of-bytes efficiency under 1.9.0 — Brent Roman <brent@...> 2007/12/28

[#14573] Re: multibyte strings & bucket-of-bytes efficiency under 1.9.0 — murphy <murphy@...> 2007/12/29

Brent Roman wrote:

[#14603] Re: multibyte strings & bucket-of-bytes efficiency under 1.9.0 — Brent Roman <brent@...> 2007/12/30

[#14617] Re: multibyte strings & bucket-of-bytes efficiency under 1.9.0 — Tanaka Akira <akr@...> 2007/12/31

In article <14544702.post@talk.nabble.com>,

[#14568] Layout of includes in ruby 1.9 — Gonzalo Garramu <ggarra@...>

19 messages 2007/12/29
[#14576] Re: Layout of includes in ruby 1.9 — "Rick DeNatale" <rick.denatale@...> 2007/12/29

On Dec 29, 2007 2:39 AM, Gonzalo Garramu=F1o <ggarra@advancedsl.com.ar> wro=

[#14569] Wide strings to ruby strings — Gonzalo Garramu <ggarra@...>

11 messages 2007/12/29

[#14602] RCR allow indexing last n items — "Michal Suchanek" <hramrach@...>

Hello

15 messages 2007/12/30
[#14609] Re: RCR allow indexing last n items — "David A. Black" <dblack@...> 2007/12/30

Hi --

[#14610] Re: RCR allow indexing last n items — "Michal Suchanek" <hramrach@...> 2007/12/30

On 30/12/2007, David A. Black <dblack@rubypal.com> wrote:

[#14616] Re: RCR allow indexing last n items — "David A. Black" <dblack@...> 2007/12/30

Hi --

[#14621] Module.new(&block) in Ruby 1.9 — murphy <murphy@...>

Hello!

21 messages 2007/12/31
[#14622] Re: Module.new(&block) in Ruby 1.9 — "Cheah Chu Yeow" <chuyeow@...> 2007/12/31

This looks like a related bug with passing block arguments to

[#14633] Re: Module.new(&block) in Ruby 1.9 — murphy <murphy@...> 2007/12/31

Cheah Chu Yeow wrote:

[#14716] Re: Module.new(&block) in Ruby 1.9 — SASADA Koichi <ko1@...> 2008/01/03

Hi,

[#14726] Re: Module.new(&block) in Ruby 1.9 — ts <decoux@...> 2008/01/03

>>>>> "S" == SASADA Koichi <ko1@atdot.net> writes:

[#14728] Re: Module.new(&block) in Ruby 1.9 — SASADA Koichi <ko1@...> 2008/01/03

Hi,

[#16093] Re: Module.new(&block) in Ruby 1.9 — "Jeremy Kemper" <jeremy@...> 2008/04/01

Hi,

Re: Legacy support (Was: Base64 not there makes Rails 2.0.2 fail to load in 1.9.0)

From: "Florian Frank" <flori@...>
Date: 2007-12-26 01:30:05 UTC
List: ruby-core #14439
Hello ruby-core and Mr. Tomita,

M. Edward (Ed) Borasky wrote:
> Of the list I see here (rcov, hpricot, active_support, mysql,
> eventmachine and mongrel) I think only eventmachine and mongrel "really
> need" C-level code.

I fixed the mysql extension to make it compile under Ruby 1.9 some time 
ago - it still compiles for 1.8 as well. I attached the patch to this 
mail. BTW: I also tried to use some unsigned conversion functions 
instead of the old signed ones, when I found the values to be defined as 
unsigned in the Mysql header files. This was probably uneccesary, but it 
shouldn't be harmful either.

I CC-ed this Mail to Mr. Tomita, so he can review the patch and maybe 
apply it to the extension. You may apply it yourselves as well, if you 
can't wait. ;)

-- 
Florian Frank

Attachments (1)

mysql-for-ruby-1.9.patch (12.2 KB, text/x-diff)
Index: test.rb
===================================================================
--- test.rb	(revision 3682)
+++ test.rb	(working copy)
@@ -4,9 +4,11 @@
 require "test/unit"
 require "./mysql.o"
 
+ARGS = ARGV.dup
+
 class TC_Mysql < Test::Unit::TestCase
   def setup()
-    @host, @user, @pass, db, port, sock, flag = ARGV
+    @host, @user, @pass, db, port, sock, flag = ARGS
     @db = db || "test"
     @port = port.to_i
     @sock = sock.nil? || sock.empty? ? nil : sock
@@ -95,7 +97,7 @@
 
 class TC_Mysql2 < Test::Unit::TestCase
   def setup()
-    @host, @user, @pass, db, port, sock, flag = ARGV
+    @host, @user, @pass, db, port, sock, flag = ARGS
     @db = db || "test"
     @port = port.to_i
     @sock = sock.nil? || sock.empty? ? nil : sock
@@ -203,7 +205,7 @@
 
 class TC_MysqlRes < Test::Unit::TestCase
   def setup()
-    @host, @user, @pass, db, port, sock, flag = ARGV
+    @host, @user, @pass, db, port, sock, flag = ARGS
     @db = db || "test"
     @port = port.to_i
     @sock = sock.nil? || sock.empty? ? nil : sock
@@ -403,7 +405,7 @@
 
 class TC_MysqlStmt < Test::Unit::TestCase
   def setup()
-    @host, @user, @pass, db, port, sock, flag = ARGV
+    @host, @user, @pass, db, port, sock, flag = ARGS
     @db = db || "test"
     @port = port.to_i
     @sock = sock.nil? || sock.empty? ? nil : sock
@@ -433,7 +435,7 @@
 
 class TC_MysqlStmt2 < Test::Unit::TestCase
   def setup()
-    @host, @user, @pass, db, port, sock, flag = ARGV
+    @host, @user, @pass, db, port, sock, flag = ARGS
     @db = db || "test"
     @port = port.to_i
     @sock = sock.nil? || sock.empty? ? nil : sock
Index: extconf.rb
===================================================================
--- extconf.rb	(revision 3682)
+++ extconf.rb	(working copy)
@@ -70,4 +70,6 @@
   end
 end
 
+have_func('rb_str_set_len')
+
 create_makefile("mysql")
Index: mysql.c.in
===================================================================
--- mysql.c.in	(revision 3682)
+++ mysql.c.in	(working copy)
@@ -3,7 +3,25 @@
  */
 
 #include "ruby.h"
-#include "version.h"
+
+#ifndef RARRAY_PTR
+#define RARRAY_PTR(ARRAY) RARRAY(ARRAY)->ptr
+#endif
+#ifndef RARRAY_LEN
+#define RARRAY_LEN(ARRAY) RARRAY(ARRAY)->len
+#endif
+#ifndef RSTRING_PTR
+#define RSTRING_PTR(string) RSTRING(string)->ptr
+#endif
+#ifndef RSTRING_LEN
+#define RSTRING_LEN(string) RSTRING(string)->len
+#endif
+#if HAVE_RB_STR_SET_LEN
+#define RSTRING_LEN_SET(string, n) rb_str_set_len(string, n)
+#else
+#define RSTRING_LEN_SET(string, n) RSTRING(string)->len = n
+#endif
+
 #ifdef HAVE_MYSQL_H
 #include <mysql.h>
 #include <errmsg.h>
@@ -172,7 +190,7 @@
 static void mysql_raise(MYSQL* m)
 {
     VALUE e = rb_exc_new2(eMysql, mysql_error(m));
-    rb_iv_set(e, "errno", INT2FIX(mysql_errno(m)));
+    rb_iv_set(e, "errno", UINT2NUM(mysql_errno(m)));
 #if MYSQL_VERSION_ID >= 40101
     rb_iv_set(e, "sqlstate", rb_tainted_str_new2(mysql_sqlstate(m)));
 #endif
@@ -202,11 +220,11 @@
     rb_iv_set(obj, "name", f->name? rb_str_freeze(rb_tainted_str_new2(f->name)): Qnil);
     rb_iv_set(obj, "table", f->table? rb_str_freeze(rb_tainted_str_new2(f->table)): Qnil);
     rb_iv_set(obj, "def", f->def? rb_str_freeze(rb_tainted_str_new2(f->def)): Qnil);
-    rb_iv_set(obj, "type", INT2NUM(f->type));
-    rb_iv_set(obj, "length", INT2NUM(f->length));
-    rb_iv_set(obj, "max_length", INT2NUM(f->max_length));
-    rb_iv_set(obj, "flags", INT2NUM(f->flags));
-    rb_iv_set(obj, "decimals", INT2NUM(f->decimals));
+    rb_iv_set(obj, "type", UINT2NUM(f->type));
+    rb_iv_set(obj, "length", UINT2NUM(f->length));
+    rb_iv_set(obj, "max_length", UINT2NUM(f->max_length));
+    rb_iv_set(obj, "flags", UINT2NUM(f->flags));
+    rb_iv_set(obj, "decimals", UINT2NUM(f->decimals));
     return obj;
 }
 
@@ -277,8 +295,8 @@
 {
     VALUE ret;
     Check_Type(str, T_STRING);
-    ret = rb_str_new(0, (RSTRING(str)->len)*2+1);
-    RSTRING(ret)->len = mysql_escape_string(RSTRING(ret)->ptr, RSTRING(str)->ptr, RSTRING(str)->len);
+    ret = rb_str_new(0, (RSTRING_LEN(str))*2+1);
+    RSTRING_LEN_SET(ret, mysql_escape_string(RSTRING_PTR(ret), RSTRING_PTR(str), RSTRING_LEN(str)));
     return ret;
 }
 
@@ -301,7 +319,7 @@
 /*	client_version()	*/
 static VALUE client_version(VALUE obj)
 {
-    return INT2NUM(mysql_get_client_version());
+    return UINT2NUM(mysql_get_client_version());
 }
 #endif
 
@@ -411,8 +429,8 @@
     MYSQL* m = GetHandler(obj);
     VALUE ret;
     Check_Type(str, T_STRING);
-    ret = rb_str_new(0, (RSTRING(str)->len)*2+1);
-    RSTRING(ret)->len = mysql_real_escape_string(m, RSTRING(ret)->ptr, RSTRING(str)->ptr, RSTRING(str)->len);
+    ret = rb_str_new(0, (RSTRING_LEN(str))*2+1);
+    RSTRING_LEN_SET(ret, mysql_real_escape_string(m, RSTRING_PTR(ret), RSTRING_PTR(str), RSTRING_LEN(str)));
     return ret;
 }
 #endif
@@ -426,7 +444,7 @@
 /*	affected_rows()	*/
 static VALUE affected_rows(VALUE obj)
 {
-    return INT2NUM(mysql_affected_rows(GetHandler(obj)));
+    return UINT2NUM(mysql_affected_rows(GetHandler(obj)));
 }
 
 #if MYSQL_VERSION_ID >= 32303
@@ -497,7 +515,7 @@
 /*	errno()		*/
 static VALUE my_errno(VALUE obj)
 {
-    return INT2NUM(mysql_errno(GetHandler(obj)));
+    return UINT2NUM(mysql_errno(GetHandler(obj)));
 }
 
 /*	error()		*/
@@ -509,7 +527,7 @@
 /*	field_count()	*/
 static VALUE field_count(VALUE obj)
 {
-    return INT2NUM(mysql_field_count(GetHandler(obj)));
+    return UINT2NUM(mysql_field_count(GetHandler(obj)));
 }
 
 /*	host_info()	*/
@@ -521,7 +539,7 @@
 /*	proto_info()	*/
 static VALUE proto_info(VALUE obj)
 {
-    return INT2NUM(mysql_get_proto_info(GetHandler(obj)));
+    return UINT2NUM(mysql_get_proto_info(GetHandler(obj)));
 }
 
 /*	server_info()	*/
@@ -540,7 +558,7 @@
 /*	insert_id()	*/
 static VALUE insert_id(VALUE obj)
 {
-    return INT2NUM(mysql_insert_id(GetHandler(obj)));
+    return UINT2NUM(mysql_insert_id(GetHandler(obj)));
 }
 
 /*	kill(pid)	*/
@@ -694,7 +712,7 @@
 /*	thread_id()	*/
 static VALUE thread_id(VALUE obj)
 {
-    return INT2NUM(mysql_thread_id(GetHandler(obj)));
+    return UINT2NUM(mysql_thread_id(GetHandler(obj)));
 }
 
 /*	use_result()	*/
@@ -722,7 +740,7 @@
         if (mysql_get_server_version(m) >= 40101 && mysql_set_server_option(m, MYSQL_OPTION_MULTI_STATEMENTS_ON) != 0)
 	    mysql_raise(m);
 #endif
-	if (mysql_real_query(m, RSTRING(sql)->ptr, RSTRING(sql)->len) != 0)
+	if (mysql_real_query(m, RSTRING_PTR(sql), RSTRING_LEN(sql)) != 0)
 	    mysql_raise(m);
 	do {
 	    MYSQL_RES* res = mysql_store_result(m);
@@ -742,7 +760,7 @@
 #endif
 	return obj;
     }
-    if (mysql_real_query(m, RSTRING(sql)->ptr, RSTRING(sql)->len) != 0)
+    if (mysql_real_query(m, RSTRING_PTR(sql), RSTRING_LEN(sql)) != 0)
 	mysql_raise(m);
     if (GetMysqlStruct(obj)->query_with_result == Qfalse)
 	return obj;
@@ -755,13 +773,13 @@
 /*	server_version()	*/
 static VALUE server_version(VALUE obj)
 {
-    return INT2NUM(mysql_get_server_version(GetHandler(obj)));
+    return UINT2NUM(mysql_get_server_version(GetHandler(obj)));
 }
 
 /*	warning_count()	*/
 static VALUE warning_count(VALUE obj)
 {
-    return INT2NUM(mysql_warning_count(GetHandler(obj)));
+    return UINT2NUM(mysql_warning_count(GetHandler(obj)));
 }
 
 /*	commit()	*/
@@ -894,11 +912,7 @@
 static VALUE query_with_result_set(VALUE obj, VALUE flag)
 {
     if (TYPE(flag) != T_TRUE && TYPE(flag) != T_FALSE)
-#if RUBY_VERSION_CODE < 160
-	TypeError("invalid type, required true or false.");
-#else
         rb_raise(rb_eTypeError, "invalid type, required true or false.");
-#endif
     GetMysqlStruct(obj)->query_with_result = flag;
     return flag;
 }
@@ -971,12 +985,8 @@
     res = GetMysqlRes(obj);
     max = mysql_num_fields(res);
     n = NUM2INT(nr);
-    if (n >= max)
-#if RUBY_VERSION_CODE < 160
-        Raise(eMysql, "%d: out of range (max: %d)", n, max-1);
-#else
+    if (n >= max) 
         rb_raise(eMysql, "%d: out of range (max: %d)", n, max-1);
-#endif
 #if MYSQL_VERSION_ID >= 32226
     return make_field_obj(mysql_fetch_field_direct(res, n));
 #else
@@ -1000,7 +1010,7 @@
 	return Qnil;
     ary = rb_ary_new2(n);
     for (i=0; i<n; i++)
-	rb_ary_store(ary, i, INT2NUM(lengths[i]));
+	rb_ary_store(ary, i, UINT2NUM(lengths[i]));
     return ary;
 }
 
@@ -1045,8 +1055,8 @@
 	    col = rb_tainted_str_new2(fields[i].name);
 	else {
 	    col = rb_tainted_str_new(fields[i].table, strlen(fields[i].table)+strlen(fields[i].name)+1);
-	    RSTRING(col)->ptr[strlen(fields[i].table)] = '.';
-	    strcpy(RSTRING(col)->ptr+strlen(fields[i].table)+1, fields[i].name);
+	    RSTRING_PTR(col)[strlen(fields[i].table)] = '.';
+	    strcpy(RSTRING_PTR(col)+strlen(fields[i].table)+1, fields[i].name);
 	}
 	rb_hash_aset(hash, col, row[i]? rb_tainted_str_new(row[i], lengths[i]): Qnil);
     }
@@ -1068,14 +1078,14 @@
 static VALUE field_seek(VALUE obj, VALUE offset)
 {
     check_free(obj);
-    return INT2NUM(mysql_field_seek(GetMysqlRes(obj), NUM2INT(offset)));
+    return UINT2NUM(mysql_field_seek(GetMysqlRes(obj), NUM2INT(offset)));
 }
 
 /*	field_tell()		*/
 static VALUE field_tell(VALUE obj)
 {
     check_free(obj);
-    return INT2NUM(mysql_field_tell(GetMysqlRes(obj)));
+    return UINT2NUM(mysql_field_tell(GetMysqlRes(obj)));
 }
 
 /*	free()			*/
@@ -1093,14 +1103,14 @@
 static VALUE num_fields(VALUE obj)
 {
     check_free(obj);
-    return INT2NUM(mysql_num_fields(GetMysqlRes(obj)));
+    return UINT2NUM(mysql_num_fields(GetMysqlRes(obj)));
 }
 
 /*	num_rows()	*/
 static VALUE num_rows(VALUE obj)
 {
     check_free(obj);
-    return INT2NUM(mysql_num_rows(GetMysqlRes(obj)));
+    return UINT2NUM(mysql_num_rows(GetMysqlRes(obj)));
 }
 
 /*	row_seek(offset)	*/
@@ -1170,8 +1180,8 @@
 static VALUE field_inspect(VALUE obj)
 {
     VALUE n = rb_iv_get(obj, "name");
-    VALUE s = rb_str_new(0, RSTRING(n)->len + 16);
-    sprintf(RSTRING(s)->ptr, "#<Mysql::Field:%s>", RSTRING(n)->ptr);
+    VALUE s = rb_str_new(0, RSTRING_LEN(n) + 16);
+    sprintf(RSTRING_PTR(s), "#<Mysql::Field:%s>", RSTRING_PTR(n));
     return s;
 }
 
@@ -1240,7 +1250,7 @@
     my_ulonglong n;
     check_stmt_closed(obj);
     n = mysql_stmt_affected_rows(s->stmt);
-    return INT2NUM(n);
+    return UINT2NUM(n);
 }
 
 #if 0
@@ -1297,7 +1307,7 @@
 	else if (argv[i] == cMysqlTime)
 	    s->result.bind[i].buffer_type = MYSQL_TYPE_DATETIME;
 	else
-	    rb_raise(rb_eTypeError, "unrecognized class: %s", RSTRING(rb_inspect(argv[i]))->ptr);
+	    rb_raise(rb_eTypeError, "unrecognized class: %s", RSTRING_PTR(rb_inspect(argv[i])));
 	if (mysql_stmt_bind_result(s->stmt, s->result.bind))
 	    mysql_stmt_raise(s->stmt);
     }
@@ -1359,9 +1369,9 @@
 	    break;
 	case T_STRING:
 	    s->param.bind[i].buffer_type = MYSQL_TYPE_STRING;
-	    s->param.bind[i].buffer = RSTRING(argv[i])->ptr;
-	    s->param.bind[i].buffer_length = RSTRING(argv[i])->len;
-	    s->param.length[i] = RSTRING(argv[i])->len;
+	    s->param.bind[i].buffer = RSTRING_PTR(argv[i]);
+	    s->param.bind[i].buffer_length = RSTRING_LEN(argv[i]);
+	    s->param.length[i] = RSTRING_LEN(argv[i]);
 	    s->param.bind[i].length = &(s->param.length[i]);
 	    break;
 	default:
@@ -1499,7 +1509,7 @@
     unsigned int n;
     check_stmt_closed(obj);
     n = mysql_stmt_field_count(s->stmt);
-    return INT2NUM(n);
+    return UINT2NUM(n);
 }
 
 /*	free_result()	*/
@@ -1519,7 +1529,7 @@
     my_ulonglong n;
     check_stmt_closed(obj);
     n = mysql_stmt_insert_id(s->stmt);
-    return INT2NUM(n);
+    return UINT2NUM(n);
 }
 
 /*	num_rows()	*/
@@ -1529,7 +1539,7 @@
     my_ulonglong n;
     check_stmt_closed(obj);
     n = mysql_stmt_num_rows(s->stmt);
-    return INT2NUM(n);
+    return UINT2NUM(n);
 }
 
 /*	param_count()		*/
@@ -1539,7 +1549,7 @@
     unsigned long n;
     check_stmt_closed(obj);
     n = mysql_stmt_param_count(s->stmt);
-    return INT2NUM(n);
+    return UINT2NUM(n);
 }
 
 /*	prepare(query)	*/
@@ -1594,7 +1604,7 @@
     free_mysqlstmt_memory(s);
     check_stmt_closed(obj);
     Check_Type(query, T_STRING);
-    if (mysql_stmt_prepare(s->stmt, RSTRING(query)->ptr, RSTRING(query)->len))
+    if (mysql_stmt_prepare(s->stmt, RSTRING_PTR(query), RSTRING_LEN(query)))
 	mysql_stmt_raise(s->stmt);
 
     n = mysql_stmt_param_count(s->stmt);
@@ -1686,7 +1696,7 @@
 	if (mysql_stmt_bind_param(s->stmt, s->param.bind))
 	    mysql_stmt_raise(s->stmt);
     }
-    if (mysql_stmt_send_long_data(s->stmt, c, RSTRING(data)->ptr, RSTRING(data)->len))
+    if (mysql_stmt_send_long_data(s->stmt, c, RSTRING_PTR(data), RSTRING_LEN(data)))
 	mysql_stmt_raise(s->stmt);
     return obj;
 }

In This Thread