rubyfb 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. data/CHANGELOG +9 -0
  2. data/Manifest +5 -0
  3. data/Rakefile +2 -2
  4. data/ext/AddUser.c +21 -16
  5. data/ext/Backup.c +12 -10
  6. data/ext/Common.c +1 -1
  7. data/ext/Connection.c +7 -3
  8. data/ext/DataArea.c +1 -9
  9. data/ext/Database.c +11 -7
  10. data/ext/FireRuby.c +1 -1
  11. data/ext/FireRubyException.c +1 -1
  12. data/ext/Generator.c +6 -12
  13. data/ext/RemoveUser.c +6 -4
  14. data/ext/Restore.c +6 -6
  15. data/ext/ResultSet.c +2 -2
  16. data/ext/Row.c +7 -7
  17. data/ext/ServiceManager.c +6 -6
  18. data/ext/Services.c +2 -1
  19. data/ext/Statement.c +3 -1
  20. data/ext/TypeMap.c +37 -40
  21. data/ext/extconf.rb +5 -0
  22. data/ext/rfbint.h +14 -0
  23. data/ext/rfbsleep.h +15 -0
  24. data/lib/active_record/connection_adapters/rubyfb_adapter.rb +13 -6
  25. data/lib/arel/visitors/rubyfb.rb +21 -0
  26. data/lib/rubyfb.rb +5 -5
  27. data/lib/rubyfb_lib.so +0 -0
  28. data/mswin32fb/fbclient_mingw.def +86 -0
  29. data/mswin32fb/fbclient_mingw.lib +0 -0
  30. data/rubyfb.gemspec +5 -5
  31. data/test/AddRemoveUserTest.rb +3 -3
  32. data/test/BackupRestoreTest.rb +3 -3
  33. data/test/BlobTest.rb +3 -3
  34. data/test/CharacterSetTest.rb +7 -6
  35. data/test/ConnectionTest.rb +7 -7
  36. data/test/DDLTest.rb +3 -3
  37. data/test/DatabaseTest.rb +3 -3
  38. data/test/GeneratorTest.rb +3 -3
  39. data/test/KeyTest.rb +3 -3
  40. data/test/ResultSetTest.rb +3 -3
  41. data/test/RoleTest.rb +3 -3
  42. data/test/RowCountTest.rb +3 -3
  43. data/test/RowTest.rb +3 -3
  44. data/test/SQLTest.rb +3 -3
  45. data/test/SQLTypeTest.rb +3 -3
  46. data/test/ServiceManagerTest.rb +3 -3
  47. data/test/StatementTest.rb +3 -3
  48. data/test/TransactionTest.rb +5 -5
  49. data/test/TypeTest.rb +3 -3
  50. metadata +14 -4
data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ v0.5.5 ==
2
+ Ruby 1.9 compatibility
3
+ Initial Rails 3 support
4
+ !!!WARNING!!!
5
+ Rails 3 support uses derived tables (Firebird server >= 2.0)
6
+ !!!WARNING!!!
7
+ DevKit build support (see https://github.com/oneclick/rubyinstaller/wiki/Development-Kit) thanks to Alex Vangelov
8
+ updated test suite
9
+
1
10
  v0.5.4 ==
2
11
  add configurable boolen domain and boolean name match patterns
3
12
  fix scale handling for view columns
data/Manifest CHANGED
@@ -43,14 +43,19 @@ ext/Transaction.h
43
43
  ext/TypeMap.c
44
44
  ext/TypeMap.h
45
45
  ext/extconf.rb
46
+ ext/rfbint.h
47
+ ext/rfbsleep.h
46
48
  lib/Connection.rb
47
49
  lib/ProcedureCall.rb
48
50
  lib/SQLType.rb
49
51
  lib/active_record/connection_adapters/rubyfb_adapter.rb
52
+ lib/arel/visitors/rubyfb.rb
50
53
  lib/mkdoc
51
54
  lib/rubyfb.rb
52
55
  lib/rubyfb_lib.so
53
56
  lib/src.rb
57
+ mswin32fb/fbclient_mingw.def
58
+ mswin32fb/fbclient_mingw.lib
54
59
  mswin32fb/fbclient_ms.lib
55
60
  mswin32fb/ibase.h
56
61
  mswin32fb/iberror.h
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
1
  require 'echoe'
2
- e = Echoe.new('rubyfb', '0.5.4') do |p|
2
+ e = Echoe.new('rubyfb', '0.5.5') do |p|
3
3
  p.description = "Firebird SQL access library"
4
4
  p.url = "http://rubyforge.org/projects/rubyfb"
5
5
  p.author = "George Georgiev"
6
6
  p.email = "georgiev@heatbs.com"
7
7
  p.rdoc_pattern = ["{examples,ext,lib}/*.rb", "CHANGELOG", "README", "LICENSE"]
8
- p.need_tar_gz = !PLATFORM.include?("win32")
8
+ p.need_tar_gz = !(RUBY_PLATFORM.include?("win32") || RUBY_PLATFORM.include?("mingw32"))
9
9
 
10
10
  if ARGV.include? "binpkg"
11
11
  p.platform=Gem::Platform::CURRENT
data/ext/AddUser.c CHANGED
@@ -356,34 +356,39 @@ void createAddUserBuffer(VALUE self, char **buffer, short *length)
356
356
  VALUE value = Qnil,
357
357
  first = Qnil,
358
358
  middle = Qnil,
359
- last = Qnil;
359
+ last = Qnil,
360
+ tmp_str = Qnil;
360
361
  char *offset = NULL;
361
362
  int number = 0;
362
363
 
363
364
  /* Calculate the required buffer length. */
364
365
  *length = 1;
365
- *length += strlen(STR2CSTR(rb_iv_get(self, "@user_name"))) + 3;
366
- *length += strlen(STR2CSTR(rb_iv_get(self, "@password"))) + 3;
366
+
367
+ tmp_str = rb_iv_get(self, "@user_name");
368
+ *length += strlen(StringValuePtr(tmp_str)) + 3;
369
+
370
+ tmp_str = rb_iv_get(self, "@password");
371
+ *length += strlen(StringValuePtr(tmp_str)) + 3;
367
372
 
368
373
  value = rb_iv_get(self, "@first_name");
369
374
  if(value != Qnil)
370
375
  {
371
376
  first = rb_funcall(value, rb_intern("to_s"), 0);
372
- *length += strlen(STR2CSTR(first)) + 3;
377
+ *length += strlen(StringValuePtr(first)) + 3;
373
378
  }
374
379
 
375
380
  value = rb_iv_get(self, "@middle_name");
376
381
  if(value != Qnil)
377
382
  {
378
383
  middle = rb_funcall(value, rb_intern("to_s"), 0);
379
- *length += strlen(STR2CSTR(middle)) + 3;
384
+ *length += strlen(StringValuePtr(middle)) + 3;
380
385
  }
381
386
 
382
387
  value = rb_iv_get(self, "@last_name");
383
388
  if(value != Qnil)
384
389
  {
385
390
  last = rb_funcall(value, rb_intern("to_s"), 0);
386
- *length += strlen(STR2CSTR(last)) + 3;
391
+ *length += strlen(StringValuePtr(last)) + 3;
387
392
  }
388
393
 
389
394
  /* Create and populate the buffer. */
@@ -399,42 +404,42 @@ void createAddUserBuffer(VALUE self, char **buffer, short *length)
399
404
 
400
405
  *offset++ = isc_spb_sec_username;
401
406
  value = rb_iv_get(self, "@user_name");
402
- number = strlen(STR2CSTR(value));
407
+ number = strlen(StringValuePtr(value));
403
408
  ADD_SPB_LENGTH(offset, number);
404
- memcpy(offset, STR2CSTR(value), number);
409
+ memcpy(offset, StringValuePtr(value), number);
405
410
  offset += number;
406
411
 
407
412
  *offset++ = isc_spb_sec_password;
408
413
  value = rb_iv_get(self, "@password");
409
- number = strlen(STR2CSTR(value));
414
+ number = strlen(StringValuePtr(value));
410
415
  ADD_SPB_LENGTH(offset, number);
411
- memcpy(offset, STR2CSTR(value), number);
416
+ memcpy(offset, StringValuePtr(value), number);
412
417
  offset += number;
413
418
 
414
419
  if(first != Qnil)
415
420
  {
416
421
  *offset++ = isc_spb_sec_firstname;
417
- number = strlen(STR2CSTR(first));
422
+ number = strlen(StringValuePtr(first));
418
423
  ADD_SPB_LENGTH(offset, number);
419
- memcpy(offset, STR2CSTR(first), number);
424
+ memcpy(offset, StringValuePtr(first), number);
420
425
  offset += number;
421
426
  }
422
427
 
423
428
  if(middle != Qnil)
424
429
  {
425
430
  *offset++ = isc_spb_sec_middlename;
426
- number = strlen(STR2CSTR(middle));
431
+ number = strlen(StringValuePtr(middle));
427
432
  ADD_SPB_LENGTH(offset, number);
428
- memcpy(offset, STR2CSTR(middle), number);
433
+ memcpy(offset, StringValuePtr(middle), number);
429
434
  offset += number;
430
435
  }
431
436
 
432
437
  if(last != Qnil)
433
438
  {
434
439
  *offset++ = isc_spb_sec_lastname;
435
- number = strlen(STR2CSTR(last));
440
+ number = strlen(StringValuePtr(last));
436
441
  ADD_SPB_LENGTH(offset, number);
437
- memcpy(offset, STR2CSTR(last), number);
442
+ memcpy(offset, StringValuePtr(last), number);
438
443
  offset += number;
439
444
  }
440
445
  }
data/ext/Backup.c CHANGED
@@ -602,7 +602,8 @@ void createBackupBuffer(VALUE from, VALUE to, VALUE options, char **buffer,
602
602
  ID id = rb_intern("key?");
603
603
  VALUE names = rb_funcall(to, rb_intern("keys"), 0),
604
604
  sizes = rb_funcall(to, rb_intern("values"), 0),
605
- count = rb_funcall(names, rb_intern("size"), 0);
605
+ count = rb_funcall(names, rb_intern("size"), 0),
606
+ tmp_str = Qnil;
606
607
  char *position = NULL;
607
608
  short number,
608
609
  flags = 0,
@@ -621,17 +622,18 @@ void createBackupBuffer(VALUE from, VALUE to, VALUE options, char **buffer,
621
622
 
622
623
  /* Calculate the length needed for the buffer. */
623
624
  *length = 2;
624
- *length += strlen(STR2CSTR(from)) + 3;
625
+ *length += strlen(StringValuePtr(from)) + 3;
625
626
 
626
627
  /* Count file name and length sizes. */
627
628
  for(i = 0; i < size; i++)
628
629
  {
629
- *length += strlen(STR2CSTR(rb_ary_entry(names, i))) + 3;
630
+ tmp_str = rb_ary_entry(names, i);
631
+ *length += strlen(StringValuePtr(tmp_str)) + 3;
630
632
  if(i != size - 1)
631
633
  {
632
634
  VALUE num = rb_funcall(rb_ary_entry(sizes, i), rb_intern("to_s"), 0);
633
635
 
634
- *length += strlen(STR2CSTR(num)) + 3;
636
+ *length += strlen(StringValuePtr(num)) + 3;
635
637
  }
636
638
  }
637
639
 
@@ -668,9 +670,9 @@ void createBackupBuffer(VALUE from, VALUE to, VALUE options, char **buffer,
668
670
  *position++ = isc_action_svc_backup;
669
671
 
670
672
  *position++ = isc_spb_dbname;
671
- number = strlen(STR2CSTR(from));
673
+ number = strlen(StringValuePtr(from));
672
674
  ADD_SPB_LENGTH(position, number);
673
- memcpy(position, STR2CSTR(from), number);
675
+ memcpy(position, StringValuePtr(from), number);
674
676
  position += number;
675
677
 
676
678
  for(i = 0; i < size; i++)
@@ -678,9 +680,9 @@ void createBackupBuffer(VALUE from, VALUE to, VALUE options, char **buffer,
678
680
  VALUE name = rb_ary_entry(names, i);
679
681
 
680
682
  *position++ = isc_spb_bkp_file;
681
- number = strlen(STR2CSTR(name));
683
+ number = strlen(StringValuePtr(name));
682
684
  ADD_SPB_LENGTH(position, number);
683
- memcpy(position, STR2CSTR(name), number);
685
+ memcpy(position, StringValuePtr(name), number);
684
686
  position += number;
685
687
 
686
688
  if(i != size - 1)
@@ -689,9 +691,9 @@ void createBackupBuffer(VALUE from, VALUE to, VALUE options, char **buffer,
689
691
 
690
692
  max = rb_funcall(max, rb_intern("to_s"), 0);
691
693
  *position++ = isc_spb_bkp_length;
692
- number = strlen(STR2CSTR(max));
694
+ number = strlen(StringValuePtr(max));
693
695
  ADD_SPB_LENGTH(position, number);
694
- memcpy(position, STR2CSTR(max), number);
696
+ memcpy(position, StringValuePtr(max), number);
695
697
  position += number;
696
698
  }
697
699
  }
data/ext/Common.c CHANGED
@@ -48,7 +48,7 @@ VALUE forbidObjectCopy(VALUE copy, VALUE original)
48
48
  array[1] = rb_funcall(value, rb_intern("name"), 0);
49
49
  message = rb_funcall(message, rb_intern("gsub"), 2, array);
50
50
 
51
- rb_fireruby_raise(NULL, STR2CSTR(message));
51
+ rb_fireruby_raise(NULL, StringValuePtr(message));
52
52
 
53
53
  return(Qnil);
54
54
  }
data/ext/Connection.c CHANGED
@@ -106,7 +106,8 @@ static VALUE initializeConnection(int argc, VALUE *argv, VALUE self)
106
106
  *dpb = NULL;
107
107
  VALUE user = Qnil,
108
108
  password = Qnil,
109
- options = Qnil;
109
+ options = Qnil,
110
+ tmp_str = Qnil;
110
111
 
111
112
  if(argc < 1)
112
113
  {
@@ -118,7 +119,10 @@ static VALUE initializeConnection(int argc, VALUE *argv, VALUE self)
118
119
  {
119
120
  rb_fireruby_raise(NULL, "Invalid database specified for connection.");
120
121
  }
121
- file = STR2CSTR(rb_iv_get(argv[0], "@file"));
122
+
123
+ tmp_str = rb_iv_get(argv[0], "@file");
124
+ file = StringValuePtr(tmp_str);
125
+
122
126
  Data_Get_Struct(self, ConnectionHandle, connection);
123
127
 
124
128
  /* Extract parameters. */
@@ -300,7 +304,7 @@ static VALUE connectionToString(VALUE self)
300
304
  file = rb_iv_get(database, "@file");
301
305
  char text[256];
302
306
 
303
- sprintf(text, "%s@%s (OPEN)", STR2CSTR(user), STR2CSTR(file));
307
+ sprintf(text, "%s@%s (OPEN)", StringValuePtr(user), StringValuePtr(file));
304
308
  result = rb_str_new2(text);
305
309
  }
306
310
 
data/ext/DataArea.c CHANGED
@@ -26,15 +26,7 @@
26
26
  /* Includes. */
27
27
  #include "DataArea.h"
28
28
  #include "FireRubyException.h"
29
-
30
- #ifdef OS_UNIX
31
- #include <inttypes.h>
32
- #else
33
- typedef short int16_t;
34
- typedef long int32_t;
35
- typedef long long int64_t;
36
- #endif
37
-
29
+ #include "rfbint.h"
38
30
 
39
31
  /**
40
32
  * This function allocates the memory for a output XSQLDA based on a specified
data/ext/Database.c CHANGED
@@ -195,7 +195,8 @@ static VALUE connectToDatabase(int argc, VALUE *argv, VALUE self)
195
195
  static VALUE createDatabase(int argc, VALUE *argv, VALUE unused)
196
196
  {
197
197
  VALUE database = Qnil,
198
- set = Qnil;
198
+ set = Qnil,
199
+ tmp_str = Qnil;
199
200
  char sql[512] = "",
200
201
  *text = NULL;
201
202
  int value = 1024;
@@ -223,17 +224,20 @@ static VALUE createDatabase(int argc, VALUE *argv, VALUE unused)
223
224
  }
224
225
 
225
226
  /* Prepare the SQL statement. */
226
- sprintf(sql, "CREATE DATABASE '%s'",
227
- STR2CSTR(rb_funcall(argv[0], rb_intern("to_s"), 0)));
228
- text = STR2CSTR(rb_funcall(argv[1], rb_intern("to_s"), 0));
227
+ tmp_str = rb_funcall(argv[0], rb_intern("to_s"), 0);
228
+ sprintf(sql, "CREATE DATABASE '%s'", StringValuePtr(tmp_str));
229
+
230
+ tmp_str = rb_funcall(argv[1], rb_intern("to_s"), 0);
231
+ text = StringValuePtr(tmp_str);
229
232
  if(strlen(text) > 0)
230
233
  {
231
234
  strcat(sql, " USER '");
232
235
  strcat(sql, text);
233
236
  strcat(sql, "'");
234
237
  }
235
-
236
- text = STR2CSTR(rb_funcall(argv[2], rb_intern("to_s"), 0));
238
+
239
+ tmp_str = rb_funcall(argv[2], rb_intern("to_s"), 0);
240
+ text = StringValuePtr(tmp_str);
237
241
  if(strlen(text) > 0)
238
242
  {
239
243
  strcat(sql, " PASSWORD '");
@@ -254,7 +258,7 @@ static VALUE createDatabase(int argc, VALUE *argv, VALUE unused)
254
258
  char *text = NULL;
255
259
 
256
260
  set = rb_funcall(argv[4], rb_intern("to_s"), 0);
257
- text = STR2CSTR(set);
261
+ text = StringValuePtr(set);
258
262
  if(strlen(text) > 0)
259
263
  {
260
264
  strcat(sql, " DEFAULT CHARACTER SET ");
data/ext/FireRuby.c CHANGED
@@ -70,7 +70,7 @@ void getClassName(VALUE object, char *name)
70
70
  VALUE klass = rb_funcall(object, rb_intern("class"), 0),
71
71
  string = rb_funcall(klass, rb_intern("name"), 0);
72
72
 
73
- strcpy(name, STR2CSTR(string));
73
+ strcpy(name, StringValuePtr(string));
74
74
  }
75
75
 
76
76
 
@@ -227,7 +227,7 @@ void rb_fireruby_raise(ISC_STATUS *status, const char *message)
227
227
  {
228
228
  VALUE text = decodeException(status, message);
229
229
 
230
- rb_raise(cFireRubyException, STR2CSTR(text));
230
+ rb_raise(cFireRubyException, StringValuePtr(text));
231
231
  }
232
232
 
233
233
 
data/ext/Generator.c CHANGED
@@ -30,13 +30,7 @@
30
30
  #include "Statement.h"
31
31
  #include "Transaction.h"
32
32
  #include "DataArea.h"
33
- #ifdef OS_UNIX
34
- #include <inttypes.h>
35
- #else
36
- typedef short int16_t;
37
- typedef long int32_t;
38
- typedef long long int64_t;
39
- #endif
33
+ #include "rfbint.h"
40
34
 
41
35
  /* Function prototypes. */
42
36
  static VALUE allocateGenerator(VALUE);
@@ -176,7 +170,7 @@ static VALUE getLastGeneratorValue(VALUE self)
176
170
 
177
171
  Data_Get_Struct(self, GeneratorHandle, generator);
178
172
 
179
- number = getGeneratorValue(STR2CSTR(name), 0, generator->connection);
173
+ number = getGeneratorValue(StringValuePtr(name), 0, generator->connection);
180
174
 
181
175
  return(INT2NUM(number));
182
176
  }
@@ -206,7 +200,7 @@ static VALUE getNextGeneratorValue(VALUE self, VALUE step)
206
200
  rb_fireruby_raise(NULL, "Invalid generator step value.");
207
201
  }
208
202
 
209
- number = getGeneratorValue(STR2CSTR(name), FIX2INT(step),
203
+ number = getGeneratorValue(StringValuePtr(name), FIX2INT(step),
210
204
  generator->connection);
211
205
 
212
206
  return(INT2NUM(number));
@@ -230,7 +224,7 @@ static VALUE dropGenerator(VALUE self)
230
224
  name = rb_iv_get(self, "@name");
231
225
 
232
226
  /* Drop the generator. */
233
- deleteGenerator(STR2CSTR(name), generator->connection);
227
+ deleteGenerator(StringValuePtr(name), generator->connection);
234
228
 
235
229
  return(self);
236
230
  }
@@ -267,7 +261,7 @@ static VALUE doesGeneratorExist(VALUE klass, VALUE name, VALUE connection)
267
261
  rb_fireruby_raise(NULL, "Connection is closed.");
268
262
  }
269
263
 
270
- if(checkForGenerator(STR2CSTR(name), &handle->handle))
264
+ if(checkForGenerator(StringValuePtr(name), &handle->handle))
271
265
  {
272
266
  exists = Qtrue;
273
267
  }
@@ -310,7 +304,7 @@ static VALUE createGenerator(VALUE klass, VALUE name, VALUE connection)
310
304
  Data_Get_Struct(connection, ConnectionHandle, handle);
311
305
  if(handle->handle != 0)
312
306
  {
313
- installGenerator(STR2CSTR(name), &handle->handle);
307
+ installGenerator(StringValuePtr(name), &handle->handle);
314
308
  result = rb_generator_new(name, connection);
315
309
  }
316
310
  else
data/ext/RemoveUser.c CHANGED
@@ -168,13 +168,15 @@ VALUE executeRemoveUser(VALUE self, VALUE manager)
168
168
  */
169
169
  void createRemoveUserBuffer(VALUE self, char **buffer, short *length)
170
170
  {
171
- VALUE value = Qnil;
171
+ VALUE value = Qnil,
172
+ tmp_str = Qnil;
172
173
  char *offset = NULL;
173
174
  int number = 0;
174
175
 
175
176
  /* Calculate the required buffer length. */
176
177
  *length = 1;
177
- *length += strlen(STR2CSTR(rb_iv_get(self, "@user_name"))) + 3;
178
+ tmp_str = rb_iv_get(self, "@user_name");
179
+ *length += strlen(StringValuePtr(tmp_str)) + 3;
178
180
 
179
181
  /* Create and populate the buffer. */
180
182
  offset = *buffer = ALLOC_N(char, *length);
@@ -189,9 +191,9 @@ void createRemoveUserBuffer(VALUE self, char **buffer, short *length)
189
191
 
190
192
  *offset++ = isc_spb_sec_username;
191
193
  value = rb_iv_get(self, "@user_name");
192
- number = strlen(STR2CSTR(value));
194
+ number = strlen(StringValuePtr(value));
193
195
  ADD_SPB_LENGTH(offset, number);
194
- memcpy(offset, STR2CSTR(value), number);
196
+ memcpy(offset, StringValuePtr(value), number);
195
197
  offset += number;
196
198
  }
197
199
 
data/ext/Restore.c CHANGED
@@ -717,8 +717,8 @@ void createRestoreBuffer(VALUE file, VALUE database, VALUE options,
717
717
 
718
718
  /* Determine the length of the buffer. */
719
719
  *length = 7;
720
- *length += strlen(STR2CSTR(file)) + 3;
721
- *length += strlen(STR2CSTR(database)) + 3;
720
+ *length += strlen(StringValuePtr(file)) + 3;
721
+ *length += strlen(StringValuePtr(database)) + 3;
722
722
  if(cache != Qnil)
723
723
  {
724
724
  *length += 5;
@@ -743,16 +743,16 @@ void createRestoreBuffer(VALUE file, VALUE database, VALUE options,
743
743
 
744
744
  *offset++ = isc_action_svc_restore;
745
745
 
746
- number = strlen(STR2CSTR(file));
746
+ number = strlen(StringValuePtr(file));
747
747
  *offset++ = isc_spb_bkp_file;
748
748
  ADD_SPB_LENGTH(offset, number);
749
- memcpy(offset, STR2CSTR(file), number);
749
+ memcpy(offset, StringValuePtr(file), number);
750
750
  offset += number;
751
751
 
752
- number = strlen(STR2CSTR(database));
752
+ number = strlen(StringValuePtr(database));
753
753
  *offset++ = isc_spb_dbname;
754
754
  ADD_SPB_LENGTH(offset, number);
755
- memcpy(offset, STR2CSTR(database), number);
755
+ memcpy(offset, StringValuePtr(database), number);
756
756
  offset += number;
757
757
 
758
758
  if(cache != Qnil)
data/ext/ResultSet.c CHANGED
@@ -169,7 +169,7 @@ VALUE initializeResultSet(VALUE self, VALUE connection, VALUE transaction,
169
169
  Data_Get_Struct(connection, ConnectionHandle, cHandle);
170
170
  Data_Get_Struct(transaction, TransactionHandle, tHandle);
171
171
  Data_Get_Struct(self, ResultsHandle, results);
172
- prepare(&cHandle->handle, &tHandle->handle, STR2CSTR(sql), &results->handle,
172
+ prepare(&cHandle->handle, &tHandle->handle, StringValuePtr(sql), &results->handle,
173
173
  setting, &type, &inputs, &outputs);
174
174
 
175
175
  if(type != isc_info_sql_stmt_select &&
@@ -188,7 +188,7 @@ VALUE initializeResultSet(VALUE self, VALUE connection, VALUE transaction,
188
188
  results->dialect = setting;
189
189
 
190
190
  /* UNCOMMENT FOR DEBUGGING PURPOSES! */
191
- /*strcpy(results->sql, STR2CSTR(sql));*/
191
+ /*strcpy(results->sql, StringValuePtr(sql));*/
192
192
 
193
193
  /* Check if input parameters are needed. */
194
194
  if(inputs > 0)
data/ext/Row.c CHANGED
@@ -133,8 +133,8 @@ static VALUE initializeRow(VALUE self, VALUE results, VALUE data, VALUE number)
133
133
  index = INT2NUM(i);
134
134
  name = rb_funcall(results, rb_intern("column_name"), 1, index);
135
135
  alias = rb_funcall(results, rb_intern("column_alias"), 1, index);
136
- strcpy(row->columns[i].name, STR2CSTR(name));
137
- strcpy(row->columns[i].alias, STR2CSTR(alias));
136
+ strcpy(row->columns[i].name, StringValuePtr(name));
137
+ strcpy(row->columns[i].alias, StringValuePtr(alias));
138
138
  items = rb_ary_entry(data, i);
139
139
  row->columns[i].value = rb_ary_entry(items, 0);
140
140
  row->columns[i].type = rb_ary_entry(items, 1);
@@ -265,7 +265,7 @@ static VALUE getColumnValue(VALUE self, VALUE index)
265
265
  done = 0;
266
266
  VALUE flag = getFireRubySetting("ALIAS_KEYS");
267
267
 
268
- strcpy(name, STR2CSTR(index));
268
+ strcpy(name, StringValuePtr(index));
269
269
  for(i = 0; i < row->size && done == 0; i++)
270
270
  {
271
271
  int match;
@@ -447,7 +447,7 @@ VALUE fetchRowValue(int size, VALUE *parameters, VALUE self)
447
447
  if(size == 1)
448
448
  {
449
449
  rb_raise(rb_eIndexError, "Column identifier '%s' not found in row.",
450
- STR2CSTR(parameters[0]));
450
+ StringValuePtr(parameters[0]));
451
451
  }
452
452
  value = parameters[1];
453
453
  }
@@ -477,7 +477,7 @@ VALUE hasColumnKey(VALUE self, VALUE name)
477
477
  VALUE flag = getFireRubySetting("ALIAS_KEYS");
478
478
 
479
479
  Data_Get_Struct(self, RowHandle, row);
480
- strcpy(text, STR2CSTR(name));
480
+ strcpy(text, StringValuePtr(name));
481
481
  for(i = 0; i < row->size && result == Qfalse; i++)
482
482
  {
483
483
  int match;
@@ -521,7 +521,7 @@ VALUE hasColumnName(VALUE self, VALUE name)
521
521
  int i;
522
522
 
523
523
  Data_Get_Struct(self, RowHandle, row);
524
- strcpy(text, STR2CSTR(name));
524
+ strcpy(text, StringValuePtr(name));
525
525
  for(i = 0; i < row->size && result == Qfalse; i++)
526
526
  {
527
527
  if(strcmp(text, row->columns[i].name) == 0)
@@ -553,7 +553,7 @@ VALUE hasColumnAlias(VALUE self, VALUE name)
553
553
  int i;
554
554
 
555
555
  Data_Get_Struct(self, RowHandle, row);
556
- strcpy(text, STR2CSTR(name));
556
+ strcpy(text, StringValuePtr(name));
557
557
  for(i = 0; i < row->size && result == Qfalse; i++)
558
558
  {
559
559
  if(strcmp(text, row->columns[i].alias) == 0)
data/ext/ServiceManager.c CHANGED
@@ -113,8 +113,8 @@ VALUE connectServiceManager(VALUE self, VALUE user, VALUE password)
113
113
  }
114
114
 
115
115
  /* Calculate the size of the service parameter buffer. */
116
- length += strlen(STR2CSTR(user)) + 2;
117
- length += strlen(STR2CSTR(password)) + 2;
116
+ length += strlen(StringValuePtr(user)) + 2;
117
+ length += strlen(StringValuePtr(password)) + 2;
118
118
 
119
119
  /* Create the service parameter buffer. */
120
120
  position = buffer = ALLOC_N(char, length);
@@ -129,21 +129,21 @@ VALUE connectServiceManager(VALUE self, VALUE user, VALUE password)
129
129
  *position++ = isc_spb_version;
130
130
  *position++ = isc_spb_current_version;
131
131
 
132
- text = STR2CSTR(user);
132
+ text = StringValuePtr(user);
133
133
  size = strlen(text);
134
134
  *position++ = isc_spb_user_name;
135
135
  *position++ = size;
136
136
  strncpy(position, text, size);
137
137
  position += size;
138
138
 
139
- text = STR2CSTR(password);
139
+ text = StringValuePtr(password);
140
140
  size = strlen(text);
141
141
  *position++ = isc_spb_password;
142
142
  *position++ = size;
143
143
  strncpy(position, text, size);
144
144
 
145
145
  /* Create the service name. */
146
- size = strlen(STR2CSTR(host)) + 13;
146
+ size = strlen(StringValuePtr(host)) + 13;
147
147
  service = ALLOC_N(char, size);
148
148
  if(service == NULL)
149
149
  {
@@ -152,7 +152,7 @@ VALUE connectServiceManager(VALUE self, VALUE user, VALUE password)
152
152
  "Memory allocation failure service manager service name.");
153
153
  }
154
154
  memset(service, 0, size);
155
- sprintf(service, "%s:service_mgr", STR2CSTR(host));
155
+ sprintf(service, "%s:service_mgr", StringValuePtr(host));
156
156
 
157
157
  /* Make the attachment call. */
158
158
  if(isc_service_attach(status, 0, service, &manager->handle, length,
data/ext/Services.c CHANGED
@@ -25,6 +25,7 @@
25
25
 
26
26
  #include "Services.h"
27
27
  #include "FireRubyException.h"
28
+ #include "rfbsleep.h"
28
29
  #ifdef OS_UNIX
29
30
  #include <unistd.h>
30
31
  #endif
@@ -116,7 +117,7 @@ VALUE queryService(isc_svc_handle *handle)
116
117
  /* Snooze if we're not done. */
117
118
  if(!done)
118
119
  {
119
- sleep(1);
120
+ rfb_sleep(1);
120
121
  }
121
122
  }
122
123
 
data/ext/Statement.c CHANGED
@@ -234,14 +234,16 @@ VALUE getStatementType(VALUE self)
234
234
  ConnectionHandle *connection = NULL;
235
235
  TransactionHandle *transaction = NULL;
236
236
  int outputs = 0;
237
+ VALUE tmp_str = Qnil;
237
238
 
238
239
  Data_Get_Struct(self, StatementHandle, statement);
239
240
  Data_Get_Struct(rb_iv_get(self, "@connection"), ConnectionHandle, connection);
240
241
  Data_Get_Struct(rb_iv_get(self, "@transaction"), TransactionHandle, transaction);
241
242
  if(statement->handle == 0)
242
243
  {
244
+ tmp_str = rb_iv_get(self, "@sql");
243
245
  prepare(&connection->handle, &transaction->handle,
244
- STR2CSTR(rb_iv_get(self, "@sql")), &statement->handle,
246
+ StringValuePtr(tmp_str), &statement->handle,
245
247
  statement->dialect, &statement->type, &statement->inputs,
246
248
  &outputs);
247
249
  }