fb 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/fb.c +6 -33
  2. data/test/DataTypesTestCases.rb +7 -5
  3. metadata +2 -2
data/fb.c CHANGED
@@ -22,23 +22,6 @@
22
22
 
23
23
  #include "ruby.h"
24
24
 
25
- /* Ensure compatibility with early releases of Ruby 1.8.5 */
26
- #ifndef RSTRING_PTR
27
- # define RSTRING_PTR(v) RSTRING(v)->ptr
28
- #endif
29
-
30
- #ifndef RSTRING_LEN
31
- # define RSTRING_LEN(v) RSTRING(v)->len
32
- #endif
33
-
34
- #ifndef RARRAY_PTR
35
- # define RARRAY_PTR(v) RARRAY(v)->ptr
36
- #endif
37
-
38
- #ifndef RARRAY_LEN
39
- # define RARRAY_LEN(v) RARRAY(v)->len
40
- #endif
41
-
42
25
  #ifdef HAVE_RUBY_REGEX_H
43
26
  # include "ruby/re.h"
44
27
  #else
@@ -48,18 +31,8 @@
48
31
  // this sucks. but for some reason these moved around between 1.8 and 1.9
49
32
  #ifdef ONIGURUMA_H
50
33
  #define IGNORECASE ONIG_OPTION_IGNORECASE
51
- #define MULTILINE ONIG_OPTION_MULTILINE
52
- #define EXTENDED ONIG_OPTION_EXTEND
53
34
  #else
54
35
  #define IGNORECASE RE_OPTION_IGNORECASE
55
- #define MULTILINE RE_OPTION_MULTILINE
56
- #define EXTENDED RE_OPTION_EXTENDED
57
- #endif
58
-
59
- // this sucks too.
60
- #ifndef RREGEXP_SRC_PTR
61
- #define RREGEXP_SRC_PTR(r) RREGEXP(r)->str
62
- #define RREGEXP_SRC_LEN(r) RREGEXP(r)->len
63
36
  #endif
64
37
 
65
38
  #include <stdio.h>
@@ -1645,7 +1618,7 @@ static void fb_cursor_set_inputparams(struct FbCursor *fb_cursor, long argc, VAL
1645
1618
  *(double *)var->sqldata = dvalue;
1646
1619
  offset += alignment;
1647
1620
  break;
1648
- #if HAVE_LONG_LONG
1621
+
1649
1622
  case SQL_INT64 :
1650
1623
  offset = FB_ALIGN(offset, alignment);
1651
1624
  var->sqldata = (char *)(fb_cursor->i_buffer + offset);
@@ -1669,7 +1642,7 @@ static void fb_cursor_set_inputparams(struct FbCursor *fb_cursor, long argc, VAL
1669
1642
  *(ISC_INT64 *)var->sqldata = llvalue;
1670
1643
  offset += alignment;
1671
1644
  break;
1672
- #endif
1645
+
1673
1646
  case SQL_BLOB :
1674
1647
  offset = FB_ALIGN(offset, alignment);
1675
1648
  var->sqldata = (char *)(fb_cursor->i_buffer + offset);
@@ -2062,18 +2035,18 @@ static VALUE fb_cursor_fetch(struct FbCursor *fb_cursor)
2062
2035
  case SQL_DOUBLE:
2063
2036
  val = rb_float_new(*(double*)var->sqldata);
2064
2037
  break;
2065
- #if HAVE_LONG_LONG
2038
+
2066
2039
  case SQL_INT64:
2067
2040
  if (var->sqlscale < 0) {
2068
2041
  ratio = 1;
2069
2042
  for (scnt = 0; scnt > var->sqlscale; scnt--) ratio *= 10;
2070
- dval = (double)*(long*)var->sqldata/ratio;
2043
+ dval = (double)*(ISC_INT64*)var->sqldata/ratio;
2071
2044
  val = rb_float_new(dval);
2072
2045
  } else {
2073
- val = LL2NUM(*(LONG_LONG*)var->sqldata);
2046
+ val = LL2NUM(*(ISC_INT64*)var->sqldata);
2074
2047
  }
2075
2048
  break;
2076
- #endif
2049
+
2077
2050
  case SQL_TIMESTAMP:
2078
2051
  isc_decode_timestamp((ISC_TIMESTAMP *)var->sqldata, &tms);
2079
2052
  val = fb_mktime(&tms, "local");
@@ -65,7 +65,7 @@ class DataTypesTestCases < Test::Unit::TestCase
65
65
  end
66
66
 
67
67
  def gen_d92(i)
68
- i * 100
68
+ i * 10000
69
69
  end
70
70
 
71
71
  def sum_i(range)
@@ -114,13 +114,14 @@ class DataTypesTestCases < Test::Unit::TestCase
114
114
  TS TIMESTAMP,
115
115
  N92 NUMERIC(9,2),
116
116
  D92 DECIMAL(9,2),
117
- N154 NUMERIC(15,4));
117
+ N154 NUMERIC(15,4),
118
+ D185 DECIMAL(18,5));
118
119
  END
119
120
  sql_insert = <<-END
120
121
  insert into test
121
- (I, SI, BI, F, D, C, C10, VC, VC10, VC10000, DT, TM, TS, N92, D92, N154)
122
+ (I, SI, BI, F, D, C, C10, VC, VC10, VC10000, DT, TM, TS, N92, D92, N154, D185)
122
123
  values
123
- (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
124
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
124
125
  END
125
126
  sql_select = "select * from TEST order by I"
126
127
  sql_sum = "select sum(I), sum(SI), sum(BI), sum(F), sum(D), sum(N92), sum(D92), sum(N154) from TEST"
@@ -137,7 +138,7 @@ class DataTypesTestCases < Test::Unit::TestCase
137
138
  gen_f(i), gen_d(i),
138
139
  gen_c(i), gen_c10(i), gen_vc(i), gen_vc10(i), gen_vc10000(i),
139
140
  gen_dt(i), gen_tm(i), gen_ts(i),
140
- gen_n92(i), gen_d92(i), gen_n92(i))
141
+ gen_n92(i), gen_d92(i), gen_n92(i), gen_d92(i))
141
142
  end
142
143
  end
143
144
  connection.execute(sql_select) do |cursor|
@@ -159,6 +160,7 @@ class DataTypesTestCases < Test::Unit::TestCase
159
160
  assert_equal gen_n92(i), row["N92"], "NUMERIC"
160
161
  assert_equal gen_d92(i), row["D92"], "DECIMAL"
161
162
  assert_equal gen_n92(i), row["N154"], "NUMERIC"
163
+ assert_equal gen_d92(i), row["D185"], "DECIMAL"
162
164
  i += 1
163
165
  end
164
166
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-17 00:00:00.000000000 Z
12
+ date: 2014-08-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Ruby Firebird Extension Library
15
15
  email: rowland@rowlandresearch.com