fb 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README +0 -52
  2. data/extconf.rb +2 -2
  3. data/fb.c +23 -11
  4. data/test/DataTypesTestCases.rb +6 -0
  5. metadata +7 -6
data/README CHANGED
@@ -178,55 +178,3 @@ conn.close
178
178
 
179
179
  # We could have called conn.drop.
180
180
  # We could still call db.drop
181
-
182
- __END__
183
- 5. Changes
184
-
185
- 0.01 - 1999-06-11 - baseline
186
- 0.02 - 1999-07-16 - memory bug in ibconn_cursor, English documents.
187
- 0.03 - ???
188
- 0.04 - 2001-08-17 - insert, fetch blobs as strings
189
- 0.05 - 2001-09-05 - add block syntax for Connection#connect and Connection#execute
190
- 0.06 - 2004-11-02 - ???
191
- 0.07 - 2004-11-03 - ???
192
-
193
- Change Log
194
-
195
- 2006-05-18 - 2006-06-04
196
-
197
- * Forked to create Fb extension.
198
- * Converted from K&R to ANSI C.
199
- * Added ability to create and drop databases.
200
- * Created near-comprehensive unit tests.
201
- * Renamed functions for consistency and improved style.
202
- * Improved error message reporting.
203
- * Added the option of returning rows as Hashes as well as tuples.
204
- * Fixed bug inserting blobs larger than 64K.
205
- * Added methods to retrieve lists of tables, generators, views, stored procedures and roles.
206
- * Added .NET-style connection strings.
207
- * Improved reporting on column types.
208
- * Added the option to report column names in lowercase where they were not already in mixed case (this feature is for Rails).
209
- * Changed automatic transaction semantics so automatically-started transactions are also committed automatically.
210
- * Converted from using a single, global transaction to a transaction per connection.
211
- * Converted from using global buffers to per-cursor input and output buffers.
212
- * Added RDoc documentation.
213
- * Insert, update and delete statements may be given an array of tuples for a parameter and will be executed once per tuple.
214
- * Rewrote README to match new API.
215
-
216
- 2007-12-11
217
-
218
- * Properly scaled NUMERIC and DECIMAL types when inserting with parameters.
219
-
220
- 2007-12-13
221
-
222
- * Rounded instead of flooring NUMERIC and DECIMAL types.
223
- * Replace deprecated isc_interprete method call for FB2.
224
-
225
- 2008-04-22
226
-
227
- * Implement explicit end-of-data flag for cursors to avoid synchronization error in newer Firebird builds.
228
- * Allocated longer buffers to avoid memory access error reported by valgrind
229
- * Tightened up C syntax for stricter compilers.
230
- * Factored symbol and regex creation out to global scope for efficiency.
231
- * Removed global transaction functions that weren't exposed anyway.
232
- * Removed remaining global state. This should allow for better concurrency.
data/extconf.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  # = Windows
3
3
  # === Sample of Makefile creation:
4
- # <tt>ruby extconf.rb --with-opt-dir=C:/Progra~1/Firebird/Firebird_2_1</tt>
4
+ # <tt>ruby extconf.rb --with-opt-dir=C:/Progra~1/Firebird/Firebird_2_5</tt>
5
5
  # === Notes
6
- # * Windows is known to build with Ruby 1.8.7 from rubyinstaller.org.
6
+ # * Windows is known to build with Ruby from rubyinstaller.org.
7
7
  # * New in this release is automatically finding your Firebird install under Program Files.
8
8
  # * If your install is some place non-standard (or on a non-English version of Windows), you'll need to run extconf.rb manually as above.
9
9
  # * mkmf doesn't like directories with spaces, hence the 8.3 notation in the example above.
data/fb.c CHANGED
@@ -174,7 +174,6 @@ typedef struct trans_opts
174
174
 
175
175
  /* global utilities */
176
176
 
177
- #define ALIGN(n, b) ((n + b - 1) & ~(b - 1))
178
177
  #define FB_ALIGN(n, b) ((n + b - 1) & ~(b - 1))
179
178
  /* #define FB_ALIGN(n,b) ((n+1) & ~1) */
180
179
  #define UPPER(c) (((c) >= 'a' && (c)<= 'z') ? (c) - 'a' + 'A' : (c))
@@ -317,8 +316,9 @@ static void tm_from_timestamp(struct tm *tm, VALUE obj)
317
316
  {
318
317
  #ifdef TypedData_Get_Struct
319
318
  VALUE year, month, day, hour, min, sec;
320
- #endif
319
+ #else
321
320
  struct time_object *tobj;
321
+ #endif
322
322
 
323
323
  if (!rb_obj_is_kind_of(obj, rb_cTime))
324
324
  {
@@ -646,7 +646,7 @@ static unsigned short fb_connection_db_SQL_Dialect(struct FbConnection *fb_conne
646
646
  {
647
647
  long dialect;
648
648
  long length;
649
- char db_info_command = isc_info_db_SQL_dialect;
649
+ char db_info_command = isc_info_db_sql_dialect;
650
650
  char isc_info_buff[16];
651
651
 
652
652
  /* Get the db SQL Dialect */
@@ -655,7 +655,7 @@ static unsigned short fb_connection_db_SQL_Dialect(struct FbConnection *fb_conne
655
655
  sizeof(isc_info_buff), isc_info_buff);
656
656
  fb_error_check(fb_connection->isc_status);
657
657
 
658
- if (isc_info_buff[0] == isc_info_db_SQL_dialect) {
658
+ if (isc_info_buff[0] == isc_info_db_sql_dialect) {
659
659
  length = isc_vax_integer(&isc_info_buff[1], 2);
660
660
  dialect = isc_vax_integer(&isc_info_buff[3], (short)length);
661
661
  } else {
@@ -1500,7 +1500,7 @@ static void fb_cursor_set_inputparams(struct FbCursor *fb_cursor, long argc, VAL
1500
1500
  struct FbConnection *fb_connection;
1501
1501
  long count;
1502
1502
  long offset;
1503
- long type;
1503
+ /* long type; */
1504
1504
  short dtp;
1505
1505
  VALUE obj;
1506
1506
  long lvalue;
@@ -1533,7 +1533,7 @@ static void fb_cursor_set_inputparams(struct FbCursor *fb_cursor, long argc, VAL
1533
1533
  for (count = 0,offset = 0; count < argc; count++) {
1534
1534
  obj = argv[count];
1535
1535
 
1536
- type = TYPE(obj);
1536
+ /* type = TYPE(obj); */
1537
1537
 
1538
1538
  /* Convert the data type for InterBase */
1539
1539
  var = &fb_cursor->i_sqlda->sqlvar[count];
@@ -1580,7 +1580,11 @@ static void fb_cursor_set_inputparams(struct FbCursor *fb_cursor, long argc, VAL
1580
1580
  ratio *= 10;
1581
1581
  obj = double_from_obj(obj);
1582
1582
  dvalue = NUM2DBL(obj) * ratio;
1583
- lvalue = (ISC_LONG)(dvalue + 0.5);
1583
+ if (dvalue >= 0.0) {
1584
+ lvalue = (ISC_LONG)(dvalue + 0.5);
1585
+ } else {
1586
+ lvalue = (ISC_LONG)(dvalue - 0.5);
1587
+ }
1584
1588
  } else {
1585
1589
  obj = long_from_obj(obj);
1586
1590
  lvalue = NUM2LONG(obj);
@@ -1601,7 +1605,11 @@ static void fb_cursor_set_inputparams(struct FbCursor *fb_cursor, long argc, VAL
1601
1605
  ratio *= 10;
1602
1606
  obj = double_from_obj(obj);
1603
1607
  dvalue = NUM2DBL(obj) * ratio;
1604
- lvalue = (ISC_LONG)(dvalue + 0.5);
1608
+ if (dvalue >= 0.0) {
1609
+ lvalue = (ISC_LONG)(dvalue + 0.5);
1610
+ } else {
1611
+ lvalue = (ISC_LONG)(dvalue - 0.5);
1612
+ }
1605
1613
  } else {
1606
1614
  obj = long_from_obj(obj);
1607
1615
  lvalue = NUM2LONG(obj);
@@ -1649,7 +1657,11 @@ static void fb_cursor_set_inputparams(struct FbCursor *fb_cursor, long argc, VAL
1649
1657
  ratio *= 10;
1650
1658
  obj = double_from_obj(obj);
1651
1659
  dvalue = NUM2DBL(obj) * ratio;
1652
- llvalue = (ISC_INT64)(dvalue + 0.5);
1660
+ if (dvalue >= 0.0) {
1661
+ llvalue = (ISC_INT64)(dvalue + 0.5);
1662
+ } else {
1663
+ llvalue = (ISC_INT64)(dvalue - 0.5);
1664
+ }
1653
1665
  } else {
1654
1666
  obj = ll_from_obj(obj);
1655
1667
  llvalue = NUM2LL(obj);
@@ -2968,7 +2980,7 @@ static void check_page_size(int page_size)
2968
2980
  * :charset:: character set to be used with the connection (default: 'NONE')
2969
2981
  * :role:: database role to connect using (default: nil)
2970
2982
  * :downcase_names:: Column names are reported in lowercase, unless they were originally mixed case (default: nil).
2971
- * :page_size:: page size to use when creating a database (default: 1024)
2983
+ * :page_size:: page size to use when creating a database (default: 4096)
2972
2984
  */
2973
2985
  static VALUE database_initialize(int argc, VALUE *argv, VALUE self)
2974
2986
  {
@@ -2990,7 +3002,7 @@ static VALUE database_initialize(int argc, VALUE *argv, VALUE self)
2990
3002
  rb_iv_set(self, "@role", rb_hash_aref(parms, ID2SYM(rb_intern("role"))));
2991
3003
  rb_iv_set(self, "@downcase_names", rb_hash_aref(parms, ID2SYM(rb_intern("downcase_names"))));
2992
3004
  rb_iv_set(self, "@encoding", default_string(parms, "encoding", "ASCII-8BIT"));
2993
- rb_iv_set(self, "@page_size", default_int(parms, "page_size", 1024));
3005
+ rb_iv_set(self, "@page_size", default_int(parms, "page_size", 4096));
2994
3006
  }
2995
3007
  return self;
2996
3008
  }
@@ -483,24 +483,30 @@ class DataTypesTestCases < Test::Unit::TestCase
483
483
  elsif cols[i] == 'N92'
484
484
  connection.execute(sql_insert, 12345.12)
485
485
  connection.execute(sql_insert, "12345.12")
486
+ connection.execute(sql_insert, -12345.12)
486
487
  vals = connection.query(sql_select)
487
488
  # puts vals.inspect
488
489
  assert_equal 12345.12, vals[0][0], "NUMERIC (decimal)"
489
490
  assert_equal 12345.12, vals[1][0], "NUMERIC (string)"
491
+ assert_equal -12345.12, vals[2][0], "NUMERIC (string)"
490
492
  elsif cols[i] == 'D92'
491
493
  connection.execute(sql_insert, 12345.12)
492
494
  connection.execute(sql_insert, "12345.12")
495
+ connection.execute(sql_insert, -12345.12)
493
496
  vals = connection.query(sql_select)
494
497
  # puts vals.inspect
495
498
  assert_equal 12345.12, vals[0][0], "DECIMAL (decimal)"
496
499
  assert_equal 12345.12, vals[1][0], "DECIMAL (string)"
500
+ assert_equal -12345.12, vals[2][0], "DECIMAL (string)"
497
501
  elsif cols[i] == 'N154'
498
502
  connection.execute(sql_insert, 12345.12)
499
503
  connection.execute(sql_insert, "12345.12")
504
+ connection.execute(sql_insert, -12345.12)
500
505
  vals = connection.query(sql_select)
501
506
  # puts vals.inspect
502
507
  assert_equal 12345.12, vals[0][0], "NUMERIC (decimal)"
503
508
  assert_equal 12345.12, vals[1][0], "NUMERIC (string)"
509
+ assert_equal -12345.12, vals[2][0], "NUMERIC (string)"
504
510
  end
505
511
  end
506
512
  connection.drop
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.0
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,9 +9,9 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-15 00:00:00.000000000 Z
12
+ date: 2014-05-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description:
14
+ description: Ruby Firebird Extension Library
15
15
  email: rowland@rowlandresearch.com
16
16
  executables: []
17
17
  extensions:
@@ -32,7 +32,8 @@ files:
32
32
  - test/FbTestSuite.rb
33
33
  - test/TransactionTestCases.rb
34
34
  homepage: http://github.com/rowland/fb
35
- licenses: []
35
+ licenses:
36
+ - MIT
36
37
  post_install_message:
37
38
  rdoc_options:
38
39
  - --title
@@ -57,10 +58,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  version: '0'
58
59
  requirements:
59
60
  - Firebird client library fbclient.dll, libfbclient.so or Firebird.framework.
60
- rubyforge_project: fblib
61
+ rubyforge_project:
61
62
  rubygems_version: 1.8.23
62
63
  signing_key:
63
64
  specification_version: 3
64
- summary: Firebird and Interbase driver
65
+ summary: Firebird database driver
65
66
  test_files:
66
67
  - test/FbTestSuite.rb