do_mysql 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,4 @@
1
1
  #include <ruby.h>
2
- #include <version.h>
3
2
  #include <string.h>
4
3
  #include <math.h>
5
4
  #include <ctype.h>
@@ -25,6 +24,10 @@
25
24
  #define RSTRING_LEN(s) (RSTRING(s)->len)
26
25
  #endif
27
26
 
27
+ #ifndef RARRAY_LEN
28
+ #define RARRAY_LEN(a) RARRAY(a)->len
29
+ #endif
30
+
28
31
  #ifdef _WIN32
29
32
  #define do_int64 signed __int64
30
33
  #else
@@ -59,7 +62,9 @@ static VALUE cDO_Reader;
59
62
  // References to Ruby classes that we'll need
60
63
  static VALUE rb_cDate;
61
64
  static VALUE rb_cDateTime;
65
+ #ifndef RUBY_19_COMPATIBILITY
62
66
  static VALUE rb_cRational;
67
+ #endif
63
68
  static VALUE rb_cBigDecimal;
64
69
  static VALUE rb_cCGI;
65
70
 
@@ -542,7 +547,7 @@ static VALUE cCommand_set_types(VALUE self, VALUE array) {
542
547
  VALUE type_strings = rb_ary_new();
543
548
  int i;
544
549
 
545
- for (i = 0; i < RARRAY(array)->len; i++) {
550
+ for (i = 0; i < RARRAY_LEN(array); i++) {
546
551
  rb_ary_push(type_strings, RUBY_STRING(rb_class2name(rb_ary_entry(array, i))));
547
552
  }
548
553
 
@@ -703,15 +708,15 @@ static VALUE cCommand_execute_reader(int argc, VALUE *argv, VALUE self) {
703
708
  field_names = rb_ary_new();
704
709
  field_types = rb_iv_get(self, "@field_types");
705
710
 
706
- if ( field_types == Qnil || 0 == RARRAY(field_types)->len ) {
711
+ if ( field_types == Qnil || 0 == RARRAY_LEN(field_types) ) {
707
712
  field_types = rb_ary_new();
708
713
  guess_default_field_types = 1;
709
- } else if (RARRAY(field_types)->len != field_count) {
714
+ } else if (RARRAY_LEN(field_types) != field_count) {
710
715
  // Whoops... wrong number of types passed to set_types. Close the reader and raise
711
716
  // and error
712
717
  rb_funcall(reader, rb_intern("close"), 0);
713
718
  flush_pool(connection);
714
- rb_raise(eMysqlError, "Field-count mismatch. Expected %d fields, but the query yielded %d", RARRAY(field_types)->len, field_count);
719
+ rb_raise(eMysqlError, "Field-count mismatch. Expected %ld fields, but the query yielded %d", RARRAY_LEN(field_types), field_count);
715
720
  }
716
721
 
717
722
  for(i = 0; i < field_count; i++) {
@@ -786,7 +791,7 @@ static VALUE cReader_next(VALUE self) {
786
791
 
787
792
  for (i = 0; i < reader->field_count; i++) {
788
793
  // The field_type data could be cached in a c-array
789
- field_type = RSTRING(rb_ary_entry(ruby_field_type_strings, i))->ptr;
794
+ field_type = RSTRING_PTR(rb_ary_entry(ruby_field_type_strings, i));
790
795
  rb_ary_push(row, typecast(result[i], field_type));
791
796
  }
792
797
 
@@ -824,7 +829,11 @@ void Init_do_mysql_ext() {
824
829
  ID_TO_TIME = rb_intern("to_time");
825
830
  ID_NEW = rb_intern("new");
826
831
  ID_NEW_RATIONAL = rb_intern("new!");
827
- ID_NEW_DATE = RUBY_VERSION_CODE < 186 ? rb_intern("new0") : rb_intern("new!");
832
+ #ifdef RUBY_LESS_THAN_186
833
+ ID_NEW_DATE = rb_intern("new0");
834
+ #else
835
+ ID_NEW_DATE = rb_intern("new!");
836
+ #endif
828
837
  ID_CONST_GET = rb_intern("const_get");
829
838
  ID_UTC = rb_intern("utc");
830
839
  ID_ESCAPE_SQL = rb_intern("escape_sql");
@@ -63,4 +63,11 @@ unless RUBY_PLATFORM =~ /mswin|mingw/
63
63
  end
64
64
 
65
65
  $CFLAGS << ' -Wall ' unless RUBY_PLATFORM =~ /mswin/
66
+
67
+ if RUBY_VERSION < '1.8.6'
68
+ $CFLAGS << ' -DRUBY_LESS_THAN_186'
69
+ elsif RUBY_VERSION >= '1.9.0'
70
+ $CFLAGS << ' -DRUBY_19_COMPATIBILITY'
71
+ end
72
+
66
73
  create_makefile('do_mysql_ext')
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'data_objects'
3
- require 'do_mysql_ext' # the C/Java extension for this DO driver
4
- require 'do_mysql/transaction'
3
+ require 'do_mysql_ext' # the C/Java extension for this DO driver
4
+ require 'do_mysql' / 'transaction'
5
5
 
6
6
  if RUBY_PLATFORM =~ /java/
7
7
  require 'do_jdbc/mysql' # the JDBC driver, packaged as a gem
@@ -1,5 +1,5 @@
1
1
  module DataObjects
2
2
  module Mysql
3
- VERSION = "0.9.7"
3
+ VERSION = "0.9.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: do_mysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Bauer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-18 00:00:00 -08:00
12
+ date: 2008-11-24 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.7
23
+ version: 0.9.8
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hoe