ruby-informix 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 (4) hide show
  1. data/Changelog +11 -0
  2. data/ext/informixc.c +498 -483
  3. data/ext/informixc.ec +93 -65
  4. metadata +2 -2
data/Changelog CHANGED
@@ -1,3 +1,14 @@
1
+ 0.7.1 04/02/2008
2
+ ------------------
3
+ Bugs fixed:
4
+ * The name of Informix resources were not unique. This problem was
5
+ introduced in 0.7.0. It doesn't affect previous versions.
6
+ * The documentation insisted that Database#execute is an alias for
7
+ Database#immediate.
8
+ * Cursor for Database#columns was prepared and declared every time it was
9
+ called.
10
+
11
+
1
12
  0.7.0 03/31/2008
2
13
  ------------------
3
14
  New features:
data/ext/informixc.c CHANGED
@@ -1,9 +1,9 @@
1
1
  #include <sqlhdr.h>
2
2
  #include <sqliapi.h>
3
3
  #line 1 "informixc.ec"
4
- /* $Id: informixc.ec,v 1.26 2008/04/01 05:30:21 santana Exp $ */
4
+ /* $Id: informixc.ec,v 1.28 2008/04/02 19:28:06 santana Exp $ */
5
5
  /*
6
- * Copyright (c) 2006-2008, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
6
+ * Copyright (c) 2006-2008, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
7
7
  * All rights reserved.
8
8
  *
9
9
  * Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
31
31
  * POSSIBILITY OF SUCH DAMAGE.
32
32
  */
33
33
 
34
- static const char rcsid[] = "$Id: informixc.ec,v 1.26 2008/04/01 05:30:21 santana Exp $";
34
+ static const char rcsid[] = "$Id: informixc.ec,v 1.28 2008/04/02 19:28:06 santana Exp $";
35
35
 
36
36
  #include "ruby.h"
37
37
 
@@ -72,6 +72,13 @@ static VALUE sym_params;
72
72
 
73
73
  #define IDSIZE 30
74
74
 
75
+ typedef struct {
76
+ char database_id[IDSIZE];
77
+ char cursor_id[IDSIZE];
78
+ char stmt_id[IDSIZE];
79
+ long idcount;
80
+ } database_t;
81
+
75
82
  typedef struct {
76
83
  short is_select, is_open;
77
84
  struct sqlda daInput, *daOutput;
@@ -162,8 +169,8 @@ rbifx_ext_exception(VALUE exception_class)
162
169
  /*
163
170
  * EXEC SQL BEGIN DECLARE SECTION;
164
171
  */
165
- #line 159 "informixc.ec"
166
- #line 160 "informixc.ec"
172
+ #line 166 "informixc.ec"
173
+ #line 167 "informixc.ec"
167
174
  int4 sql_code;
168
175
  char sql_state[6];
169
176
  char class_origin_val[256];
@@ -178,7 +185,7 @@ mint i;
178
185
  /*
179
186
  * EXEC SQL END DECLARE SECTION;
180
187
  */
181
- #line 174 "informixc.ec"
188
+ #line 181 "informixc.ec"
182
189
 
183
190
 
184
191
  new_instance = rb_class_new_instance(0, 0, exception_class);
@@ -198,19 +205,19 @@ mint i;
198
205
  /*
199
206
  * EXEC SQL GET DIAGNOSTICS :exc_count = NUMBER;
200
207
  */
201
- #line 190 "informixc.ec"
208
+ #line 197 "informixc.ec"
202
209
  {
203
- #line 190 "informixc.ec"
210
+ #line 197 "informixc.ec"
204
211
  static ifx_hostvar_t _SQhtab[] =
205
212
  {
206
213
  { 0, 1, 102, sizeof(exc_count), 0, 0, 0, 0 },
207
214
  { 0, 0, 0, 0, 0, 0, 0, 0 }
208
- #line 190 "informixc.ec"
215
+ #line 197 "informixc.ec"
209
216
  };
210
217
  _SQhtab[0].hostaddr = (char *)&exc_count;
211
- #line 190 "informixc.ec"
218
+ #line 197 "informixc.ec"
212
219
  sqli_diag_get(ESQLINTVERSION, _SQhtab, -1);
213
- #line 190 "informixc.ec"
220
+ #line 197 "informixc.ec"
214
221
  }
215
222
 
216
223
  if (exc_count == 0) { /* Something went wrong */
@@ -241,9 +248,9 @@ mint i;
241
248
  * :connection_name = CONNECTION_NAME
242
249
  * ;
243
250
  */
244
- #line 208 "informixc.ec"
251
+ #line 215 "informixc.ec"
245
252
  {
246
- #line 217 "informixc.ec"
253
+ #line 224 "informixc.ec"
247
254
  static ifx_hostvar_t _SQhtab[] =
248
255
  {
249
256
  { 0, 11, 103, sizeof(sql_code), 0, 0, 0, 0 },
@@ -255,7 +262,7 @@ mint i;
255
262
  { 0, 9, 100, 256, 0, 0, 0, 0 },
256
263
  { 0, 10, 100, 256, 0, 0, 0, 0 },
257
264
  { 0, 0, 0, 0, 0, 0, 0, 0 }
258
- #line 217 "informixc.ec"
265
+ #line 224 "informixc.ec"
259
266
  };
260
267
  _SQhtab[0].hostaddr = (char *)&sql_code;
261
268
  _SQhtab[1].hostaddr = (sql_state);
@@ -265,9 +272,9 @@ mint i;
265
272
  _SQhtab[5].hostaddr = (char *)&message_len;
266
273
  _SQhtab[6].hostaddr = (server_name);
267
274
  _SQhtab[7].hostaddr = (connection_name);
268
- #line 217 "informixc.ec"
275
+ #line 224 "informixc.ec"
269
276
  sqli_diag_get(ESQLINTVERSION, _SQhtab, sql_exception_number);
270
- #line 217 "informixc.ec"
277
+ #line 224 "informixc.ec"
271
278
  }
272
279
 
273
280
  TRIM_BLANKS(class_origin_val);
@@ -344,13 +351,13 @@ rb_slobstat_initialize(VALUE self, VALUE slob)
344
351
  /*
345
352
  * EXEC SQL begin declare section;
346
353
  */
347
- #line 290 "informixc.ec"
348
- #line 291 "informixc.ec"
354
+ #line 297 "informixc.ec"
355
+ #line 298 "informixc.ec"
349
356
  char *did;
350
357
  /*
351
358
  * EXEC SQL end declare section;
352
359
  */
353
- #line 292 "informixc.ec"
360
+ #line 299 "informixc.ec"
354
361
 
355
362
 
356
363
  Data_Get_Struct(slob, slob_t, sb);
@@ -364,11 +371,11 @@ rb_slobstat_initialize(VALUE self, VALUE slob)
364
371
  /*
365
372
  * EXEC SQL set connection :did;
366
373
  */
367
- #line 302 "informixc.ec"
374
+ #line 309 "informixc.ec"
368
375
  {
369
- #line 302 "informixc.ec"
376
+ #line 309 "informixc.ec"
370
377
  sqli_connect_set(0, did, 0);
371
- #line 302 "informixc.ec"
378
+ #line 309 "informixc.ec"
372
379
  }
373
380
  if (SQLCODE < 0)
374
381
  raise_ifx_extended();
@@ -515,24 +522,24 @@ slob_free(slob_t *slob)
515
522
  /*
516
523
  * EXEC SQL begin declare section;
517
524
  */
518
- #line 445 "informixc.ec"
519
- #line 446 "informixc.ec"
525
+ #line 452 "informixc.ec"
526
+ #line 453 "informixc.ec"
520
527
  char *did;
521
528
  /*
522
529
  * EXEC SQL end declare section;
523
530
  */
524
- #line 447 "informixc.ec"
531
+ #line 454 "informixc.ec"
525
532
 
526
533
 
527
534
  did = slob->database_id;
528
535
  /*
529
536
  * EXEC SQL set connection :did;
530
537
  */
531
- #line 450 "informixc.ec"
538
+ #line 457 "informixc.ec"
532
539
  {
533
- #line 450 "informixc.ec"
540
+ #line 457 "informixc.ec"
534
541
  sqli_connect_set(0, did, 0);
535
- #line 450 "informixc.ec"
542
+ #line 457 "informixc.ec"
536
543
  }
537
544
  if (SQLCODE >= 0)
538
545
  ifx_lo_close(slob->fd);
@@ -570,13 +577,13 @@ rb_slob_initialize(int argc, VALUE *argv, VALUE self)
570
577
  /*
571
578
  * EXEC SQL begin declare section;
572
579
  */
573
- #line 484 "informixc.ec"
574
- #line 485 "informixc.ec"
580
+ #line 491 "informixc.ec"
581
+ #line 492 "informixc.ec"
575
582
  char *did;
576
583
  /*
577
584
  * EXEC SQL end declare section;
578
585
  */
579
- #line 486 "informixc.ec"
586
+ #line 493 "informixc.ec"
580
587
 
581
588
 
582
589
  rb_scan_args(argc, argv, "12", &db, &type, &options);
@@ -585,11 +592,11 @@ rb_slob_initialize(int argc, VALUE *argv, VALUE self)
585
592
  /*
586
593
  * EXEC SQL set connection :did;
587
594
  */
588
- #line 491 "informixc.ec"
595
+ #line 498 "informixc.ec"
589
596
  {
590
- #line 491 "informixc.ec"
597
+ #line 498 "informixc.ec"
591
598
  sqli_connect_set(0, did, 0);
592
- #line 491 "informixc.ec"
599
+ #line 498 "informixc.ec"
593
600
  }
594
601
  if (SQLCODE < 0)
595
602
  raise_ifx_extended();
@@ -697,13 +704,13 @@ rb_slob_open(int argc, VALUE *argv, VALUE self)
697
704
  /*
698
705
  * EXEC SQL begin declare section;
699
706
  */
700
- #line 595 "informixc.ec"
701
- #line 596 "informixc.ec"
707
+ #line 602 "informixc.ec"
708
+ #line 603 "informixc.ec"
702
709
  char *did;
703
710
  /*
704
711
  * EXEC SQL end declare section;
705
712
  */
706
- #line 597 "informixc.ec"
713
+ #line 604 "informixc.ec"
707
714
 
708
715
 
709
716
  Data_Get_Struct(self, slob_t, slob);
@@ -715,11 +722,11 @@ rb_slob_open(int argc, VALUE *argv, VALUE self)
715
722
  /*
716
723
  * EXEC SQL set connection :did;
717
724
  */
718
- #line 605 "informixc.ec"
725
+ #line 612 "informixc.ec"
719
726
  {
720
- #line 605 "informixc.ec"
727
+ #line 612 "informixc.ec"
721
728
  sqli_connect_set(0, did, 0);
722
- #line 605 "informixc.ec"
729
+ #line 612 "informixc.ec"
723
730
  }
724
731
  if (SQLCODE < 0)
725
732
  raise_ifx_extended();
@@ -750,24 +757,24 @@ rb_slob_close(VALUE self)
750
757
  /*
751
758
  * EXEC SQL begin declare section;
752
759
  */
753
- #line 632 "informixc.ec"
754
- #line 633 "informixc.ec"
760
+ #line 639 "informixc.ec"
761
+ #line 640 "informixc.ec"
755
762
  char *did;
756
763
  /*
757
764
  * EXEC SQL end declare section;
758
765
  */
759
- #line 634 "informixc.ec"
766
+ #line 641 "informixc.ec"
760
767
 
761
768
 
762
769
  did = slob->database_id;
763
770
  /*
764
771
  * EXEC SQL set connection :did;
765
772
  */
766
- #line 637 "informixc.ec"
773
+ #line 644 "informixc.ec"
767
774
  {
768
- #line 637 "informixc.ec"
775
+ #line 644 "informixc.ec"
769
776
  sqli_connect_set(0, did, 0);
770
- #line 637 "informixc.ec"
777
+ #line 644 "informixc.ec"
771
778
  }
772
779
  if (SQLCODE < 0)
773
780
  return self;
@@ -798,13 +805,13 @@ rb_slob_read(VALUE self, VALUE nbytes)
798
805
  /*
799
806
  * EXEC SQL begin declare section;
800
807
  */
801
- #line 664 "informixc.ec"
802
- #line 665 "informixc.ec"
808
+ #line 671 "informixc.ec"
809
+ #line 672 "informixc.ec"
803
810
  char *did;
804
811
  /*
805
812
  * EXEC SQL end declare section;
806
813
  */
807
- #line 666 "informixc.ec"
814
+ #line 673 "informixc.ec"
808
815
 
809
816
 
810
817
 
@@ -817,11 +824,11 @@ rb_slob_read(VALUE self, VALUE nbytes)
817
824
  /*
818
825
  * EXEC SQL set connection :did;
819
826
  */
820
- #line 675 "informixc.ec"
827
+ #line 682 "informixc.ec"
821
828
  {
822
- #line 675 "informixc.ec"
829
+ #line 682 "informixc.ec"
823
830
  sqli_connect_set(0, did, 0);
824
- #line 675 "informixc.ec"
831
+ #line 682 "informixc.ec"
825
832
  }
826
833
  if (SQLCODE < 0)
827
834
  raise_ifx_extended();
@@ -861,13 +868,13 @@ rb_slob_write(VALUE self, VALUE data)
861
868
  /*
862
869
  * EXEC SQL begin declare section;
863
870
  */
864
- #line 711 "informixc.ec"
865
- #line 712 "informixc.ec"
871
+ #line 718 "informixc.ec"
872
+ #line 719 "informixc.ec"
866
873
  char *did;
867
874
  /*
868
875
  * EXEC SQL end declare section;
869
876
  */
870
- #line 713 "informixc.ec"
877
+ #line 720 "informixc.ec"
871
878
 
872
879
 
873
880
  Data_Get_Struct(self, slob_t, slob);
@@ -879,11 +886,11 @@ rb_slob_write(VALUE self, VALUE data)
879
886
  /*
880
887
  * EXEC SQL set connection :did;
881
888
  */
882
- #line 721 "informixc.ec"
889
+ #line 728 "informixc.ec"
883
890
  {
884
- #line 721 "informixc.ec"
891
+ #line 728 "informixc.ec"
885
892
  sqli_connect_set(0, did, 0);
886
- #line 721 "informixc.ec"
893
+ #line 728 "informixc.ec"
887
894
  }
888
895
  if (SQLCODE < 0)
889
896
  raise_ifx_extended();
@@ -945,13 +952,13 @@ rb_slob_seek(VALUE self, VALUE offset, VALUE whence)
945
952
  /*
946
953
  * EXEC SQL begin declare section;
947
954
  */
948
- #line 779 "informixc.ec"
949
- #line 780 "informixc.ec"
955
+ #line 786 "informixc.ec"
956
+ #line 787 "informixc.ec"
950
957
  char *did;
951
958
  /*
952
959
  * EXEC SQL end declare section;
953
960
  */
954
- #line 781 "informixc.ec"
961
+ #line 788 "informixc.ec"
955
962
 
956
963
 
957
964
  Data_Get_Struct(self, slob_t, slob);
@@ -963,11 +970,11 @@ rb_slob_seek(VALUE self, VALUE offset, VALUE whence)
963
970
  /*
964
971
  * EXEC SQL set connection :did;
965
972
  */
966
- #line 789 "informixc.ec"
973
+ #line 796 "informixc.ec"
967
974
  {
968
- #line 789 "informixc.ec"
975
+ #line 796 "informixc.ec"
969
976
  sqli_connect_set(0, did, 0);
970
- #line 789 "informixc.ec"
977
+ #line 796 "informixc.ec"
971
978
  }
972
979
  if (SQLCODE < 0)
973
980
  raise_ifx_extended();
@@ -1023,13 +1030,13 @@ rb_slob_tell(VALUE self)
1023
1030
  /*
1024
1031
  * EXEC SQL begin declare section;
1025
1032
  */
1026
- #line 841 "informixc.ec"
1027
- #line 842 "informixc.ec"
1033
+ #line 848 "informixc.ec"
1034
+ #line 849 "informixc.ec"
1028
1035
  char *did;
1029
1036
  /*
1030
1037
  * EXEC SQL end declare section;
1031
1038
  */
1032
- #line 843 "informixc.ec"
1039
+ #line 850 "informixc.ec"
1033
1040
 
1034
1041
 
1035
1042
  Data_Get_Struct(self, slob_t, slob);
@@ -1041,11 +1048,11 @@ rb_slob_tell(VALUE self)
1041
1048
  /*
1042
1049
  * EXEC SQL set connection :did;
1043
1050
  */
1044
- #line 851 "informixc.ec"
1051
+ #line 858 "informixc.ec"
1045
1052
  {
1046
- #line 851 "informixc.ec"
1053
+ #line 858 "informixc.ec"
1047
1054
  sqli_connect_set(0, did, 0);
1048
- #line 851 "informixc.ec"
1055
+ #line 858 "informixc.ec"
1049
1056
  }
1050
1057
  if (SQLCODE < 0)
1051
1058
  raise_ifx_extended();
@@ -1076,13 +1083,13 @@ rb_slob_truncate(VALUE self, VALUE offset)
1076
1083
  /*
1077
1084
  * EXEC SQL begin declare section;
1078
1085
  */
1079
- #line 878 "informixc.ec"
1080
- #line 879 "informixc.ec"
1086
+ #line 885 "informixc.ec"
1087
+ #line 886 "informixc.ec"
1081
1088
  char *did;
1082
1089
  /*
1083
1090
  * EXEC SQL end declare section;
1084
1091
  */
1085
- #line 880 "informixc.ec"
1092
+ #line 887 "informixc.ec"
1086
1093
 
1087
1094
 
1088
1095
  Data_Get_Struct(self, slob_t, slob);
@@ -1094,11 +1101,11 @@ rb_slob_truncate(VALUE self, VALUE offset)
1094
1101
  /*
1095
1102
  * EXEC SQL set connection :did;
1096
1103
  */
1097
- #line 888 "informixc.ec"
1104
+ #line 895 "informixc.ec"
1098
1105
  {
1099
- #line 888 "informixc.ec"
1106
+ #line 895 "informixc.ec"
1100
1107
  sqli_connect_set(0, did, 0);
1101
- #line 888 "informixc.ec"
1108
+ #line 895 "informixc.ec"
1102
1109
  }
1103
1110
  if (SQLCODE < 0)
1104
1111
  raise_ifx_extended();
@@ -1148,13 +1155,13 @@ rb_slob_lock(VALUE self, VALUE offset, VALUE whence, VALUE range, VALUE mode)
1148
1155
  /*
1149
1156
  * EXEC SQL begin declare section;
1150
1157
  */
1151
- #line 934 "informixc.ec"
1152
- #line 935 "informixc.ec"
1158
+ #line 941 "informixc.ec"
1159
+ #line 942 "informixc.ec"
1153
1160
  char *did;
1154
1161
  /*
1155
1162
  * EXEC SQL end declare section;
1156
1163
  */
1157
- #line 936 "informixc.ec"
1164
+ #line 943 "informixc.ec"
1158
1165
 
1159
1166
 
1160
1167
  Data_Get_Struct(self, slob_t, slob);
@@ -1166,11 +1173,11 @@ rb_slob_lock(VALUE self, VALUE offset, VALUE whence, VALUE range, VALUE mode)
1166
1173
  /*
1167
1174
  * EXEC SQL set connection :did;
1168
1175
  */
1169
- #line 944 "informixc.ec"
1176
+ #line 951 "informixc.ec"
1170
1177
  {
1171
- #line 944 "informixc.ec"
1178
+ #line 951 "informixc.ec"
1172
1179
  sqli_connect_set(0, did, 0);
1173
- #line 944 "informixc.ec"
1180
+ #line 951 "informixc.ec"
1174
1181
  }
1175
1182
  if (SQLCODE < 0)
1176
1183
  raise_ifx_extended();
@@ -1208,13 +1215,13 @@ rb_slob_unlock(VALUE self, VALUE offset, VALUE whence, VALUE range)
1208
1215
  /*
1209
1216
  * EXEC SQL begin declare section;
1210
1217
  */
1211
- #line 978 "informixc.ec"
1212
- #line 979 "informixc.ec"
1218
+ #line 985 "informixc.ec"
1219
+ #line 986 "informixc.ec"
1213
1220
  char *did;
1214
1221
  /*
1215
1222
  * EXEC SQL end declare section;
1216
1223
  */
1217
- #line 980 "informixc.ec"
1224
+ #line 987 "informixc.ec"
1218
1225
 
1219
1226
 
1220
1227
  Data_Get_Struct(self, slob_t, slob);
@@ -1226,11 +1233,11 @@ rb_slob_unlock(VALUE self, VALUE offset, VALUE whence, VALUE range)
1226
1233
  /*
1227
1234
  * EXEC SQL set connection :did;
1228
1235
  */
1229
- #line 988 "informixc.ec"
1236
+ #line 995 "informixc.ec"
1230
1237
  {
1231
- #line 988 "informixc.ec"
1238
+ #line 995 "informixc.ec"
1232
1239
  sqli_connect_set(0, did, 0);
1233
- #line 988 "informixc.ec"
1240
+ #line 995 "informixc.ec"
1234
1241
  }
1235
1242
  if (SQLCODE < 0)
1236
1243
  raise_ifx_extended();
@@ -1265,13 +1272,13 @@ slob_specget(VALUE self, slob_option_t option)
1265
1272
  /*
1266
1273
  * EXEC SQL begin declare section;
1267
1274
  */
1268
- #line 1019 "informixc.ec"
1269
- #line 1020 "informixc.ec"
1275
+ #line 1026 "informixc.ec"
1276
+ #line 1027 "informixc.ec"
1270
1277
  char *did;
1271
1278
  /*
1272
1279
  * EXEC SQL end declare section;
1273
1280
  */
1274
- #line 1021 "informixc.ec"
1281
+ #line 1028 "informixc.ec"
1275
1282
 
1276
1283
 
1277
1284
  Data_Get_Struct(self, slob_t, slob);
@@ -1283,11 +1290,11 @@ slob_specget(VALUE self, slob_option_t option)
1283
1290
  /*
1284
1291
  * EXEC SQL set connection :did;
1285
1292
  */
1286
- #line 1029 "informixc.ec"
1293
+ #line 1036 "informixc.ec"
1287
1294
  {
1288
- #line 1029 "informixc.ec"
1295
+ #line 1036 "informixc.ec"
1289
1296
  sqli_connect_set(0, did, 0);
1290
- #line 1029 "informixc.ec"
1297
+ #line 1036 "informixc.ec"
1291
1298
  }
1292
1299
  if (SQLCODE < 0)
1293
1300
  raise_ifx_extended();
@@ -1351,13 +1358,13 @@ slob_specset(VALUE self, slob_option_t option, VALUE value)
1351
1358
  /*
1352
1359
  * EXEC SQL begin declare section;
1353
1360
  */
1354
- #line 1089 "informixc.ec"
1355
- #line 1090 "informixc.ec"
1361
+ #line 1096 "informixc.ec"
1362
+ #line 1097 "informixc.ec"
1356
1363
  char *did;
1357
1364
  /*
1358
1365
  * EXEC SQL end declare section;
1359
1366
  */
1360
- #line 1091 "informixc.ec"
1367
+ #line 1098 "informixc.ec"
1361
1368
 
1362
1369
 
1363
1370
  Data_Get_Struct(self, slob_t, slob);
@@ -1369,11 +1376,11 @@ slob_specset(VALUE self, slob_option_t option, VALUE value)
1369
1376
  /*
1370
1377
  * EXEC SQL set connection :did;
1371
1378
  */
1372
- #line 1099 "informixc.ec"
1379
+ #line 1106 "informixc.ec"
1373
1380
  {
1374
- #line 1099 "informixc.ec"
1381
+ #line 1106 "informixc.ec"
1375
1382
  sqli_connect_set(0, did, 0);
1376
- #line 1099 "informixc.ec"
1383
+ #line 1106 "informixc.ec"
1377
1384
  }
1378
1385
  if (SQLCODE < 0)
1379
1386
  raise_ifx_extended();
@@ -1509,13 +1516,13 @@ slob_stat(VALUE self, slob_stat_t stat)
1509
1516
  /*
1510
1517
  * EXEC SQL begin declare section;
1511
1518
  */
1512
- #line 1231 "informixc.ec"
1513
- #line 1232 "informixc.ec"
1519
+ #line 1238 "informixc.ec"
1520
+ #line 1239 "informixc.ec"
1514
1521
  char *did;
1515
1522
  /*
1516
1523
  * EXEC SQL end declare section;
1517
1524
  */
1518
- #line 1233 "informixc.ec"
1525
+ #line 1240 "informixc.ec"
1519
1526
 
1520
1527
 
1521
1528
  Data_Get_Struct(self, slob_t, slob);
@@ -1528,11 +1535,11 @@ slob_stat(VALUE self, slob_stat_t stat)
1528
1535
  /*
1529
1536
  * EXEC SQL set connection :did;
1530
1537
  */
1531
- #line 1242 "informixc.ec"
1538
+ #line 1249 "informixc.ec"
1532
1539
  {
1533
- #line 1242 "informixc.ec"
1540
+ #line 1249 "informixc.ec"
1534
1541
  sqli_connect_set(0, did, 0);
1535
- #line 1242 "informixc.ec"
1542
+ #line 1249 "informixc.ec"
1536
1543
  }
1537
1544
  if (SQLCODE < 0)
1538
1545
  raise_ifx_extended();
@@ -2220,27 +2227,29 @@ make_result(cursor_t *c, VALUE record)
2220
2227
  static void
2221
2228
  database_free(void *p)
2222
2229
  {
2230
+ database_t *dbt;
2223
2231
  /*
2224
2232
  * EXEC SQL begin declare section;
2225
2233
  */
2226
- #line 1929 "informixc.ec"
2227
- #line 1930 "informixc.ec"
2228
- char *did;
2234
+ #line 1937 "informixc.ec"
2235
+ #line 1938 "informixc.ec"
2236
+ char *id;
2229
2237
  /*
2230
2238
  * EXEC SQL end declare section;
2231
2239
  */
2232
- #line 1931 "informixc.ec"
2240
+ #line 1939 "informixc.ec"
2233
2241
 
2234
2242
 
2235
- did = p;
2243
+ dbt = p;
2244
+ id = dbt->database_id;
2236
2245
  /*
2237
- * EXEC SQL disconnect :did;
2246
+ * EXEC SQL disconnect :id;
2238
2247
  */
2239
- #line 1934 "informixc.ec"
2248
+ #line 1943 "informixc.ec"
2240
2249
  {
2241
- #line 1934 "informixc.ec"
2242
- sqli_connect_close(0, did, 0, 0);
2243
- #line 1934 "informixc.ec"
2250
+ #line 1943 "informixc.ec"
2251
+ sqli_connect_close(0, id, 0, 0);
2252
+ #line 1943 "informixc.ec"
2244
2253
  }
2245
2254
  xfree(p);
2246
2255
  }
@@ -2248,11 +2257,12 @@ database_free(void *p)
2248
2257
  static VALUE
2249
2258
  database_alloc(VALUE klass)
2250
2259
  {
2251
- char *did;
2260
+ database_t *dbt;
2252
2261
 
2253
- did = ALLOC_N(char, IDSIZE<<1);
2254
- did[0] = did[IDSIZE] = 0;
2255
- return Data_Wrap_Struct(klass, 0, database_free, did);
2262
+ dbt = ALLOC(database_t);
2263
+ dbt->database_id[0] = dbt->cursor_id[0] = dbt->stmt_id[0] = 0;
2264
+ dbt->idcount = 0;
2265
+ return Data_Wrap_Struct(klass, 0, database_free, dbt);
2256
2266
  }
2257
2267
 
2258
2268
  /* :nodoc: */
@@ -2261,13 +2271,15 @@ rb_database_initialize(int argc, VALUE *argv, VALUE self)
2261
2271
  {
2262
2272
  VALUE arg[3], version;
2263
2273
  VALUE server_type, major, minor, os, level, full;
2274
+ database_t *dbt;
2264
2275
 
2265
2276
  /*
2266
2277
  * EXEC SQL begin declare section;
2267
2278
  */
2268
- #line 1955 "informixc.ec"
2269
- #line 1956 "informixc.ec"
2270
- char *dbname, *user = NULL, *pass = NULL, *did;
2279
+ #line 1966 "informixc.ec"
2280
+ #line 1967 "informixc.ec"
2281
+ char *dbname, *user = NULL, *pass = NULL;
2282
+ char *did, *cid, *sid;
2271
2283
  struct version_t
2272
2284
  {
2273
2285
  char server_type[41], major[3], minor[3], os[3], level[3];
@@ -2276,7 +2288,7 @@ struct version_t
2276
2288
  /*
2277
2289
  * EXEC SQL end declare section;
2278
2290
  */
2279
- #line 1961 "informixc.ec"
2291
+ #line 1973 "informixc.ec"
2280
2292
 
2281
2293
 
2282
2294
  rb_scan_args(argc, argv, "12", &arg[0], &arg[1], &arg[2]);
@@ -2284,10 +2296,14 @@ struct version_t
2284
2296
  if (NIL_P(arg[0]))
2285
2297
  rb_raise(rb_eProgrammingError, "A database name must be specified");
2286
2298
 
2287
- Data_Get_Struct(self, char, did);
2299
+ Data_Get_Struct(self, database_t, dbt);
2288
2300
 
2289
2301
  dbname = StringValueCStr(arg[0]);
2290
- snprintf(did, IDSIZE, "DB%lX", self);
2302
+ snprintf(dbt->database_id, IDSIZE, "DB%lX", self);
2303
+ snprintf(dbt->cursor_id, IDSIZE, "CUR%lX", dbt->idcount);
2304
+ snprintf(dbt->stmt_id, IDSIZE, "STMT%lX", dbt->idcount);
2305
+ ++dbt->idcount;
2306
+ did = dbt->database_id;
2291
2307
 
2292
2308
  if (!NIL_P(arg[1]))
2293
2309
  user = StringValueCStr(arg[1]);
@@ -2300,24 +2316,58 @@ struct version_t
2300
2316
  * EXEC SQL connect to :dbname as :did user :user
2301
2317
  * using :pass with concurrent transaction;
2302
2318
  */
2303
- #line 1980 "informixc.ec"
2319
+ #line 1996 "informixc.ec"
2304
2320
  {
2305
- #line 1981 "informixc.ec"
2321
+ #line 1997 "informixc.ec"
2306
2322
  ifx_conn_t *_sqiconn;
2307
2323
  _sqiconn = (ifx_conn_t *)ifx_alloc_conn_user(user, pass);
2308
2324
  sqli_connect_open(ESQLINTVERSION, 0, dbname, did, _sqiconn, 1);
2309
2325
  ifx_free_conn_user(&_sqiconn);
2310
- #line 1981 "informixc.ec"
2326
+ #line 1997 "informixc.ec"
2311
2327
  }
2312
2328
  else
2313
2329
  /*
2314
2330
  * EXEC SQL connect to :dbname as :did with concurrent transaction;
2315
2331
  */
2316
- #line 1983 "informixc.ec"
2332
+ #line 1999 "informixc.ec"
2317
2333
  {
2318
- #line 1983 "informixc.ec"
2334
+ #line 1999 "informixc.ec"
2319
2335
  sqli_connect_open(ESQLINTVERSION, 0, dbname, did, (ifx_conn_t *)0, 1);
2320
- #line 1983 "informixc.ec"
2336
+ #line 1999 "informixc.ec"
2337
+ }
2338
+
2339
+ if (SQLCODE < 0)
2340
+ raise_ifx_extended();
2341
+
2342
+ cid = dbt->cursor_id;
2343
+ sid = dbt->stmt_id;
2344
+
2345
+ /*
2346
+ * EXEC SQL prepare :sid from
2347
+ * 'select colname, coltype, collength, extended_id,
2348
+ * type, default, c.colno
2349
+ * from syscolumns c, outer sysdefaults d
2350
+ * where c.tabid = ? and c.tabid = d.tabid and c.colno = d.colno
2351
+ * order by c.colno';
2352
+ */
2353
+ #line 2007 "informixc.ec"
2354
+ {
2355
+ #line 2012 "informixc.ec"
2356
+ sqli_prep(ESQLINTVERSION, sid, "select colname, coltype, collength, extended_id, type, default, c.colno from syscolumns c, outer sysdefaults d where c.tabid = ? and c.tabid = d.tabid and c.colno = d.colno order by c.colno",(ifx_literal_t *)0, (ifx_namelist_t *)0, 2, 0, 0 );
2357
+ #line 2012 "informixc.ec"
2358
+ }
2359
+
2360
+ if (SQLCODE < 0)
2361
+ raise_ifx_extended();
2362
+
2363
+ /*
2364
+ * EXEC SQL declare :cid cursor for :sid;
2365
+ */
2366
+ #line 2017 "informixc.ec"
2367
+ {
2368
+ #line 2017 "informixc.ec"
2369
+ sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 0), cid, sqli_curs_locate(ESQLINTVERSION, sid, 1), 0, 0);
2370
+ #line 2017 "informixc.ec"
2321
2371
  }
2322
2372
 
2323
2373
  if (SQLCODE < 0)
@@ -2332,17 +2382,17 @@ struct version_t
2332
2382
  * dbinfo('version', 'full')
2333
2383
  * into :c_version from systables where tabid = 1;
2334
2384
  */
2335
- #line 1988 "informixc.ec"
2385
+ #line 2022 "informixc.ec"
2336
2386
  {
2337
- #line 1994 "informixc.ec"
2387
+ #line 2028 "informixc.ec"
2338
2388
  static const char *sqlcmdtxt[] =
2339
- #line 1994 "informixc.ec"
2389
+ #line 2028 "informixc.ec"
2340
2390
  {
2341
- #line 1994 "informixc.ec"
2391
+ #line 2028 "informixc.ec"
2342
2392
  "select dbinfo ( 'version' , 'server-type' ) , dbinfo ( 'version' , 'major' ) , dbinfo ( 'version' , 'minor' ) , dbinfo ( 'version' , 'os' ) , dbinfo ( 'version' , 'level' ) , dbinfo ( 'version' , 'full' ) from systables where tabid = 1",
2343
2393
  0
2344
2394
  };
2345
- #line 1994 "informixc.ec"
2395
+ #line 2028 "informixc.ec"
2346
2396
  static ifx_cursor_t _SQ0 = {0};
2347
2397
  static ifx_sqlvar_t _sqobind[] =
2348
2398
  {
@@ -2352,23 +2402,23 @@ static ifx_cursor_t _SQ0 = {0};
2352
2402
  { 114, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
2353
2403
  { 114, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
2354
2404
  { 114, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
2355
- #line 1994 "informixc.ec"
2405
+ #line 2028 "informixc.ec"
2356
2406
  };
2357
- #line 1994 "informixc.ec"
2407
+ #line 2028 "informixc.ec"
2358
2408
  _sqobind[0].sqldata = (c_version).server_type;
2359
- #line 1994 "informixc.ec"
2409
+ #line 2028 "informixc.ec"
2360
2410
  _sqobind[1].sqldata = (c_version).major;
2361
- #line 1994 "informixc.ec"
2411
+ #line 2028 "informixc.ec"
2362
2412
  _sqobind[2].sqldata = (c_version).minor;
2363
- #line 1994 "informixc.ec"
2413
+ #line 2028 "informixc.ec"
2364
2414
  _sqobind[3].sqldata = (c_version).os;
2365
- #line 1994 "informixc.ec"
2415
+ #line 2028 "informixc.ec"
2366
2416
  _sqobind[4].sqldata = (c_version).level;
2367
- #line 1994 "informixc.ec"
2417
+ #line 2028 "informixc.ec"
2368
2418
  _sqobind[5].sqldata = (c_version).full;
2369
- #line 1994 "informixc.ec"
2419
+ #line 2028 "informixc.ec"
2370
2420
  sqli_slct(ESQLINTVERSION, &_SQ0,sqlcmdtxt,0,(ifx_sqlvar_t *)0,6,_sqobind,0,(ifx_literal_t *)0,(ifx_namelist_t *)0,0);
2371
- #line 1994 "informixc.ec"
2421
+ #line 2028 "informixc.ec"
2372
2422
  }
2373
2423
 
2374
2424
 
@@ -2391,53 +2441,42 @@ static ifx_cursor_t _SQ0 = {0};
2391
2441
  * call-seq:
2392
2442
  * db.close => db
2393
2443
  *
2394
- * Disconnects <i>db</i> and returns __self__
2444
+ * Disconnects <i>db</i> and returns nil.
2395
2445
  */
2396
2446
  static VALUE
2397
2447
  rb_database_close(VALUE self)
2398
2448
  {
2449
+ database_t *dbt;
2399
2450
  /*
2400
2451
  * EXEC SQL begin declare section;
2401
2452
  */
2402
- #line 2021 "informixc.ec"
2403
- #line 2022 "informixc.ec"
2404
- char *did;
2453
+ #line 2056 "informixc.ec"
2454
+ #line 2057 "informixc.ec"
2455
+ char *id;
2405
2456
  /*
2406
2457
  * EXEC SQL end declare section;
2407
2458
  */
2408
- #line 2023 "informixc.ec"
2459
+ #line 2058 "informixc.ec"
2409
2460
 
2410
2461
 
2411
- Data_Get_Struct(self, char, did);
2412
- did += IDSIZE;
2413
- if (*did)
2414
- /*
2415
- * EXEC SQL free :did;
2416
- */
2417
- #line 2028 "informixc.ec"
2418
- {
2419
- #line 2028 "informixc.ec"
2420
- sqli_curs_free(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, did, 258));
2421
- #line 2028 "informixc.ec"
2422
- }
2423
- did -= IDSIZE;
2462
+ Data_Get_Struct(self, database_t, dbt);
2463
+ id = dbt->database_id;
2424
2464
  /*
2425
- * EXEC SQL disconnect :did;
2465
+ * EXEC SQL disconnect :id;
2426
2466
  */
2427
- #line 2030 "informixc.ec"
2467
+ #line 2062 "informixc.ec"
2428
2468
  {
2429
- #line 2030 "informixc.ec"
2430
- sqli_connect_close(0, did, 0, 0);
2431
- #line 2030 "informixc.ec"
2469
+ #line 2062 "informixc.ec"
2470
+ sqli_connect_close(0, id, 0, 0);
2471
+ #line 2062 "informixc.ec"
2432
2472
  }
2433
2473
 
2434
- return self;
2474
+ return Qnil;
2435
2475
  }
2436
2476
 
2437
2477
  /*
2438
2478
  * call-seq:
2439
2479
  * db.immediate(query) => fixnum
2440
- * db.execute(query) => fixnum
2441
2480
  *
2442
2481
  * Executes <i>query</i> and returns the number of rows affected.
2443
2482
  * <i>query</i> must not return rows. Executes efficiently any
@@ -2457,29 +2496,31 @@ rb_database_close(VALUE self)
2457
2496
  static VALUE
2458
2497
  rb_database_immediate(VALUE self, VALUE arg)
2459
2498
  {
2499
+ database_t *dbt;
2460
2500
  /*
2461
2501
  * EXEC SQL begin declare section;
2462
2502
  */
2463
- #line 2058 "informixc.ec"
2464
- #line 2059 "informixc.ec"
2503
+ #line 2090 "informixc.ec"
2504
+ #line 2091 "informixc.ec"
2465
2505
  char *query, *did;
2466
2506
  /*
2467
2507
  * EXEC SQL end declare section;
2468
2508
  */
2469
- #line 2060 "informixc.ec"
2470
-
2509
+ #line 2092 "informixc.ec"
2471
2510
 
2472
- Data_Get_Struct(self, char, did);
2473
2511
 
2512
+ Data_Get_Struct(self, database_t, dbt);
2513
+ did = dbt->database_id;
2474
2514
  /*
2475
2515
  * EXEC SQL set connection :did;
2476
2516
  */
2477
- #line 2064 "informixc.ec"
2517
+ #line 2096 "informixc.ec"
2478
2518
  {
2479
- #line 2064 "informixc.ec"
2519
+ #line 2096 "informixc.ec"
2480
2520
  sqli_connect_set(0, did, 0);
2481
- #line 2064 "informixc.ec"
2521
+ #line 2096 "informixc.ec"
2482
2522
  }
2523
+
2483
2524
  if (SQLCODE < 0)
2484
2525
  raise_ifx_extended();
2485
2526
 
@@ -2487,11 +2528,11 @@ rb_database_immediate(VALUE self, VALUE arg)
2487
2528
  /*
2488
2529
  * EXEC SQL execute immediate :query;
2489
2530
  */
2490
- #line 2069 "informixc.ec"
2531
+ #line 2102 "informixc.ec"
2491
2532
  {
2492
- #line 2069 "informixc.ec"
2533
+ #line 2102 "informixc.ec"
2493
2534
  sqli_exec_immed(query);
2494
- #line 2069 "informixc.ec"
2535
+ #line 2102 "informixc.ec"
2495
2536
  }
2496
2537
  if (SQLCODE < 0)
2497
2538
  raise_ifx_extended();
@@ -2508,41 +2549,44 @@ rb_database_immediate(VALUE self, VALUE arg)
2508
2549
  static VALUE
2509
2550
  rb_database_rollback(VALUE self)
2510
2551
  {
2552
+ database_t *dbt;
2511
2553
  /*
2512
2554
  * EXEC SQL begin declare section;
2513
2555
  */
2514
- #line 2085 "informixc.ec"
2515
- #line 2086 "informixc.ec"
2556
+ #line 2119 "informixc.ec"
2557
+ #line 2120 "informixc.ec"
2516
2558
  char *did;
2517
2559
  /*
2518
2560
  * EXEC SQL end declare section;
2519
2561
  */
2520
- #line 2087 "informixc.ec"
2521
-
2562
+ #line 2121 "informixc.ec"
2522
2563
 
2523
- Data_Get_Struct(self, char, did);
2524
2564
 
2565
+ Data_Get_Struct(self, database_t, dbt);
2566
+ did = dbt->database_id;
2525
2567
  /*
2526
2568
  * EXEC SQL set connection :did;
2527
2569
  */
2528
- #line 2091 "informixc.ec"
2570
+ #line 2125 "informixc.ec"
2529
2571
  {
2530
- #line 2091 "informixc.ec"
2572
+ #line 2125 "informixc.ec"
2531
2573
  sqli_connect_set(0, did, 0);
2532
- #line 2091 "informixc.ec"
2574
+ #line 2125 "informixc.ec"
2533
2575
  }
2576
+
2534
2577
  if (SQLCODE < 0)
2535
2578
  raise_ifx_extended();
2536
2579
 
2537
2580
  /*
2538
2581
  * EXEC SQL rollback;
2539
2582
  */
2540
- #line 2095 "informixc.ec"
2583
+ #line 2130 "informixc.ec"
2541
2584
  {
2542
- #line 2095 "informixc.ec"
2585
+ #line 2130 "informixc.ec"
2543
2586
  sqli_trans_rollback();
2544
- #line 2095 "informixc.ec"
2587
+ #line 2130 "informixc.ec"
2545
2588
  }
2589
+
2546
2590
  return self;
2547
2591
  }
2548
2592
 
@@ -2555,41 +2599,44 @@ rb_database_rollback(VALUE self)
2555
2599
  static VALUE
2556
2600
  rb_database_commit(VALUE self)
2557
2601
  {
2602
+ database_t *dbt;
2558
2603
  /*
2559
2604
  * EXEC SQL begin declare section;
2560
2605
  */
2561
- #line 2108 "informixc.ec"
2562
- #line 2109 "informixc.ec"
2606
+ #line 2145 "informixc.ec"
2607
+ #line 2146 "informixc.ec"
2563
2608
  char *did;
2564
2609
  /*
2565
2610
  * EXEC SQL end declare section;
2566
2611
  */
2567
- #line 2110 "informixc.ec"
2568
-
2612
+ #line 2147 "informixc.ec"
2569
2613
 
2570
- Data_Get_Struct(self, char, did);
2571
2614
 
2615
+ Data_Get_Struct(self, database_t, dbt);
2616
+ did = dbt->database_id;
2572
2617
  /*
2573
2618
  * EXEC SQL set connection :did;
2574
2619
  */
2575
- #line 2114 "informixc.ec"
2620
+ #line 2151 "informixc.ec"
2576
2621
  {
2577
- #line 2114 "informixc.ec"
2622
+ #line 2151 "informixc.ec"
2578
2623
  sqli_connect_set(0, did, 0);
2579
- #line 2114 "informixc.ec"
2624
+ #line 2151 "informixc.ec"
2580
2625
  }
2626
+
2581
2627
  if (SQLCODE < 0)
2582
2628
  raise_ifx_extended();
2583
2629
 
2584
2630
  /*
2585
2631
  * EXEC SQL commit;
2586
2632
  */
2587
- #line 2118 "informixc.ec"
2633
+ #line 2156 "informixc.ec"
2588
2634
  {
2589
- #line 2118 "informixc.ec"
2635
+ #line 2156 "informixc.ec"
2590
2636
  sqli_trans_commit();
2591
- #line 2118 "informixc.ec"
2637
+ #line 2156 "informixc.ec"
2592
2638
  }
2639
+
2593
2640
  return self;
2594
2641
  }
2595
2642
 
@@ -2628,63 +2675,67 @@ static VALUE
2628
2675
  rb_database_transaction(VALUE self)
2629
2676
  {
2630
2677
  VALUE ret;
2678
+ database_t *dbt;
2631
2679
  /*
2632
2680
  * EXEC SQL begin declare section;
2633
2681
  */
2634
- #line 2157 "informixc.ec"
2635
- #line 2158 "informixc.ec"
2682
+ #line 2197 "informixc.ec"
2683
+ #line 2198 "informixc.ec"
2636
2684
  char *did;
2637
2685
  /*
2638
2686
  * EXEC SQL end declare section;
2639
2687
  */
2640
- #line 2159 "informixc.ec"
2688
+ #line 2199 "informixc.ec"
2641
2689
 
2642
2690
 
2643
- Data_Get_Struct(self, char, did);
2644
-
2691
+ Data_Get_Struct(self, database_t, dbt);
2692
+ did = dbt->database_id;
2645
2693
  /*
2646
2694
  * EXEC SQL set connection :did;
2647
2695
  */
2648
- #line 2163 "informixc.ec"
2696
+ #line 2203 "informixc.ec"
2649
2697
  {
2650
- #line 2163 "informixc.ec"
2698
+ #line 2203 "informixc.ec"
2651
2699
  sqli_connect_set(0, did, 0);
2652
- #line 2163 "informixc.ec"
2700
+ #line 2203 "informixc.ec"
2653
2701
  }
2702
+
2654
2703
  if (SQLCODE < 0)
2655
2704
  raise_ifx_extended();
2656
2705
 
2657
2706
  /*
2658
2707
  * EXEC SQL commit;
2659
2708
  */
2660
- #line 2167 "informixc.ec"
2709
+ #line 2208 "informixc.ec"
2661
2710
  {
2662
- #line 2167 "informixc.ec"
2711
+ #line 2208 "informixc.ec"
2663
2712
  sqli_trans_commit();
2664
- #line 2167 "informixc.ec"
2713
+ #line 2208 "informixc.ec"
2665
2714
  }
2666
-
2667
2715
  /*
2668
2716
  * EXEC SQL begin work;
2669
2717
  */
2670
- #line 2169 "informixc.ec"
2718
+ #line 2209 "informixc.ec"
2671
2719
  {
2672
- #line 2169 "informixc.ec"
2720
+ #line 2209 "informixc.ec"
2673
2721
  sqli_trans_begin2((mint)1);
2674
- #line 2169 "informixc.ec"
2722
+ #line 2209 "informixc.ec"
2675
2723
  }
2676
2724
  ret = rb_rescue(rb_yield, self, database_transfail, self);
2725
+
2677
2726
  if (ret == Qundef)
2678
2727
  rb_raise(rb_eOperationalError, "Transaction rolled back");
2728
+
2679
2729
  /*
2680
2730
  * EXEC SQL commit;
2681
2731
  */
2682
- #line 2173 "informixc.ec"
2732
+ #line 2215 "informixc.ec"
2683
2733
  {
2684
- #line 2173 "informixc.ec"
2734
+ #line 2215 "informixc.ec"
2685
2735
  sqli_trans_commit();
2686
- #line 2173 "informixc.ec"
2736
+ #line 2215 "informixc.ec"
2687
2737
  }
2738
+
2688
2739
  return self;
2689
2740
  }
2690
2741
 
@@ -2711,11 +2762,12 @@ rb_database_columns(VALUE self, VALUE tablename)
2711
2762
  "YEAR", "MONTH", "DAY", "HOUR", "MINUTE", "SECOND"
2712
2763
  };
2713
2764
 
2765
+ database_t *dbt;
2714
2766
  /*
2715
2767
  * EXEC SQL begin declare section;
2716
2768
  */
2717
- #line 2200 "informixc.ec"
2718
- #line 2201 "informixc.ec"
2769
+ #line 2244 "informixc.ec"
2770
+ #line 2245 "informixc.ec"
2719
2771
  char *did, *cid;
2720
2772
  char *tabname;
2721
2773
  int tabid, xid;
@@ -2726,20 +2778,21 @@ short coltype, collength;
2726
2778
  /*
2727
2779
  * EXEC SQL end declare section;
2728
2780
  */
2729
- #line 2208 "informixc.ec"
2781
+ #line 2252 "informixc.ec"
2730
2782
 
2731
2783
 
2732
- Data_Get_Struct(self, char, did);
2733
-
2784
+ Data_Get_Struct(self, database_t, dbt);
2785
+ did = dbt->database_id;
2734
2786
  /*
2735
2787
  * EXEC SQL set connection :did;
2736
2788
  */
2737
- #line 2212 "informixc.ec"
2789
+ #line 2256 "informixc.ec"
2738
2790
  {
2739
- #line 2212 "informixc.ec"
2791
+ #line 2256 "informixc.ec"
2740
2792
  sqli_connect_set(0, did, 0);
2741
- #line 2212 "informixc.ec"
2793
+ #line 2256 "informixc.ec"
2742
2794
  }
2795
+
2743
2796
  if (SQLCODE < 0)
2744
2797
  raise_ifx_extended();
2745
2798
 
@@ -2748,107 +2801,60 @@ short coltype, collength;
2748
2801
  /*
2749
2802
  * EXEC SQL select tabid into :tabid from systables where tabname = :tabname;
2750
2803
  */
2751
- #line 2218 "informixc.ec"
2804
+ #line 2263 "informixc.ec"
2752
2805
  {
2753
- #line 2218 "informixc.ec"
2806
+ #line 2263 "informixc.ec"
2754
2807
  static const char *sqlcmdtxt[] =
2755
- #line 2218 "informixc.ec"
2808
+ #line 2263 "informixc.ec"
2756
2809
  {
2757
- #line 2218 "informixc.ec"
2810
+ #line 2263 "informixc.ec"
2758
2811
  "select tabid from systables where tabname = ?",
2759
2812
  0
2760
2813
  };
2761
- #line 2218 "informixc.ec"
2814
+ #line 2263 "informixc.ec"
2762
2815
  static ifx_cursor_t _SQ0 = {0};
2763
2816
  static ifx_sqlvar_t _sqibind[] =
2764
2817
  {
2765
2818
  { 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
2766
- #line 2218 "informixc.ec"
2819
+ #line 2263 "informixc.ec"
2767
2820
  };
2768
2821
  static ifx_sqlvar_t _sqobind[] =
2769
2822
  {
2770
2823
  { 102, sizeof(tabid), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
2771
- #line 2218 "informixc.ec"
2824
+ #line 2263 "informixc.ec"
2772
2825
  };
2773
- #line 2218 "informixc.ec"
2826
+ #line 2263 "informixc.ec"
2774
2827
  _sqibind[0].sqldata = tabname;
2775
- #line 2218 "informixc.ec"
2828
+ #line 2263 "informixc.ec"
2776
2829
  _sqobind[0].sqldata = (char *) &tabid;
2777
- #line 2218 "informixc.ec"
2830
+ #line 2263 "informixc.ec"
2778
2831
  sqli_slct(ESQLINTVERSION, &_SQ0,sqlcmdtxt,1,_sqibind,1,_sqobind,0,(ifx_literal_t *)0,(ifx_namelist_t *)0,0);
2779
- #line 2218 "informixc.ec"
2832
+ #line 2263 "informixc.ec"
2780
2833
  }
2781
2834
 
2782
2835
  if (SQLCODE == SQLNOTFOUND)
2783
2836
  rb_raise(rb_eProgrammingError, "Table '%s' doesn't exist", tabname);
2784
2837
 
2785
2838
  result = rb_ary_new();
2786
-
2787
- cid = did + IDSIZE;
2788
-
2789
- if (!*cid) {
2790
- /*
2791
- * EXEC SQL begin declare section;
2792
- */
2793
- #line 2228 "informixc.ec"
2794
- #line 2229 "informixc.ec"
2795
- char sid[IDSIZE];
2796
- /*
2797
- * EXEC SQL end declare section;
2798
- */
2799
- #line 2230 "informixc.ec"
2800
-
2801
-
2802
- snprintf(sid, IDSIZE, "COLS%lX", self);
2803
- snprintf(cid, IDSIZE, "COLC%lX", self);
2804
-
2805
- /*
2806
- * EXEC SQL prepare :sid from
2807
- * 'select colname, coltype, collength, extended_id,
2808
- * type, default, c.colno
2809
- * from syscolumns c, outer sysdefaults d
2810
- * where c.tabid = ? and c.tabid = d.tabid
2811
- * and c.colno = d.colno
2812
- * order by c.colno';
2813
- */
2814
- #line 2235 "informixc.ec"
2815
- {
2816
- #line 2241 "informixc.ec"
2817
- sqli_prep(ESQLINTVERSION, sid, "select colname, coltype, collength, extended_id, type, default, c.colno from syscolumns c, outer sysdefaults d where c.tabid = ? and c.tabid = d.tabid and c.colno = d.colno order by c.colno",(ifx_literal_t *)0, (ifx_namelist_t *)0, 2, 0, 0 );
2818
- #line 2241 "informixc.ec"
2819
- }
2820
- /*
2821
- * EXEC SQL declare :cid cursor for :sid;
2822
- */
2823
- #line 2242 "informixc.ec"
2824
- {
2825
- #line 2242 "informixc.ec"
2826
- sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 0), cid, sqli_curs_locate(ESQLINTVERSION, sid, 1), 0, 0);
2827
- #line 2242 "informixc.ec"
2828
- }
2829
- if (SQLCODE < 0) {
2830
- cid[0] = 0;
2831
- raise_ifx_extended();
2832
- }
2833
- }
2834
-
2839
+ cid = dbt->cursor_id;
2835
2840
  /*
2836
2841
  * EXEC SQL open :cid using :tabid;
2837
2842
  */
2838
- #line 2249 "informixc.ec"
2843
+ #line 2270 "informixc.ec"
2839
2844
  {
2840
- #line 2249 "informixc.ec"
2845
+ #line 2270 "informixc.ec"
2841
2846
  static ifx_sqlvar_t _sqibind[] =
2842
2847
  {
2843
2848
  { 102, sizeof(tabid), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
2844
- #line 2249 "informixc.ec"
2849
+ #line 2270 "informixc.ec"
2845
2850
  };
2846
2851
  static ifx_sqlda_t _SD0 = { 1, _sqibind, {0}, 1, 0 };
2847
- #line 2249 "informixc.ec"
2852
+ #line 2270 "informixc.ec"
2848
2853
  _sqibind[0].sqldata = (char *) &tabid;
2849
2854
  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), &_SD0, (char *)0, (struct value *)0, 1, 0);
2850
- #line 2249 "informixc.ec"
2855
+ #line 2270 "informixc.ec"
2851
2856
  }
2857
+
2852
2858
  if (SQLCODE < 0)
2853
2859
  raise_ifx_extended();
2854
2860
 
@@ -2857,9 +2863,9 @@ static ifx_cursor_t _SQ0 = {0};
2857
2863
  * EXEC SQL fetch :cid into :colname, :coltype, :collength, :xid,
2858
2864
  * :deftype, :defvalue;
2859
2865
  */
2860
- #line 2254 "informixc.ec"
2866
+ #line 2276 "informixc.ec"
2861
2867
  {
2862
- #line 2255 "informixc.ec"
2868
+ #line 2277 "informixc.ec"
2863
2869
  static ifx_sqlvar_t _sqobind[] =
2864
2870
  {
2865
2871
  { 114, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -2868,24 +2874,24 @@ static ifx_cursor_t _SQ0 = {0};
2868
2874
  { 102, sizeof(xid), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
2869
2875
  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
2870
2876
  { 114, 257, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
2871
- #line 2255 "informixc.ec"
2877
+ #line 2277 "informixc.ec"
2872
2878
  };
2873
2879
  static ifx_sqlda_t _SD0 = { 6, _sqobind, {0}, 6, 0 };
2874
2880
  static _FetchSpec _FS1 = { 0, 1, 0 };
2875
- #line 2255 "informixc.ec"
2881
+ #line 2277 "informixc.ec"
2876
2882
  _sqobind[0].sqldata = colname;
2877
- #line 2255 "informixc.ec"
2883
+ #line 2277 "informixc.ec"
2878
2884
  _sqobind[1].sqldata = (char *) &coltype;
2879
- #line 2255 "informixc.ec"
2885
+ #line 2277 "informixc.ec"
2880
2886
  _sqobind[2].sqldata = (char *) &collength;
2881
- #line 2255 "informixc.ec"
2887
+ #line 2277 "informixc.ec"
2882
2888
  _sqobind[3].sqldata = (char *) &xid;
2883
- #line 2255 "informixc.ec"
2889
+ #line 2277 "informixc.ec"
2884
2890
  _sqobind[4].sqldata = deftype;
2885
- #line 2255 "informixc.ec"
2891
+ #line 2277 "informixc.ec"
2886
2892
  _sqobind[5].sqldata = defvalue;
2887
2893
  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, &_SD0, (char *)0, &_FS1);
2888
- #line 2255 "informixc.ec"
2894
+ #line 2277 "informixc.ec"
2889
2895
  }
2890
2896
  if (SQLCODE < 0)
2891
2897
  raise_ifx_extended();
@@ -2983,11 +2989,11 @@ static ifx_cursor_t _SQ0 = {0};
2983
2989
  /*
2984
2990
  * EXEC SQL close :cid;
2985
2991
  */
2986
- #line 2349 "informixc.ec"
2992
+ #line 2371 "informixc.ec"
2987
2993
  {
2988
- #line 2349 "informixc.ec"
2994
+ #line 2371 "informixc.ec"
2989
2995
  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256));
2990
- #line 2349 "informixc.ec"
2996
+ #line 2371 "informixc.ec"
2991
2997
  }
2992
2998
 
2993
2999
  return result;
@@ -3013,13 +3019,13 @@ st_free(cursor_t *c)
3013
3019
  /*
3014
3020
  * EXEC SQL begin declare section;
3015
3021
  */
3016
- #line 2371 "informixc.ec"
3017
- #line 2372 "informixc.ec"
3022
+ #line 2393 "informixc.ec"
3023
+ #line 2394 "informixc.ec"
3018
3024
  char *sid, *did;
3019
3025
  /*
3020
3026
  * EXEC SQL end declare section;
3021
3027
  */
3022
- #line 2373 "informixc.ec"
3028
+ #line 2395 "informixc.ec"
3023
3029
 
3024
3030
 
3025
3031
  free_input_slots(c);
@@ -3029,11 +3035,11 @@ st_free(cursor_t *c)
3029
3035
  /*
3030
3036
  * EXEC SQL set connection :did;
3031
3037
  */
3032
- #line 2379 "informixc.ec"
3038
+ #line 2401 "informixc.ec"
3033
3039
  {
3034
- #line 2379 "informixc.ec"
3040
+ #line 2401 "informixc.ec"
3035
3041
  sqli_connect_set(0, did, 0);
3036
- #line 2379 "informixc.ec"
3042
+ #line 2401 "informixc.ec"
3037
3043
  }
3038
3044
  if (SQLCODE < 0)
3039
3045
  return;
@@ -3042,11 +3048,11 @@ st_free(cursor_t *c)
3042
3048
  /*
3043
3049
  * EXEC SQL free :sid;
3044
3050
  */
3045
- #line 2384 "informixc.ec"
3051
+ #line 2406 "informixc.ec"
3046
3052
  {
3047
- #line 2384 "informixc.ec"
3053
+ #line 2406 "informixc.ec"
3048
3054
  sqli_curs_free(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, sid, 258));
3049
- #line 2384 "informixc.ec"
3055
+ #line 2406 "informixc.ec"
3050
3056
  }
3051
3057
  }
3052
3058
 
@@ -3073,27 +3079,29 @@ rb_statement_initialize(VALUE self, VALUE db, VALUE query)
3073
3079
  {
3074
3080
  struct sqlda *output;
3075
3081
  cursor_t *c;
3082
+ database_t *dbt;
3076
3083
  /*
3077
3084
  * EXEC SQL begin declare section;
3078
3085
  */
3079
- #line 2410 "informixc.ec"
3080
- #line 2411 "informixc.ec"
3086
+ #line 2433 "informixc.ec"
3087
+ #line 2434 "informixc.ec"
3081
3088
  char *c_query, *sid, *did;
3082
3089
  /*
3083
3090
  * EXEC SQL end declare section;
3084
3091
  */
3085
- #line 2412 "informixc.ec"
3092
+ #line 2435 "informixc.ec"
3086
3093
 
3087
3094
 
3088
- Data_Get_Struct(db, char, did);
3095
+ Data_Get_Struct(db, database_t, dbt);
3096
+ did = dbt->database_id;
3089
3097
  /*
3090
3098
  * EXEC SQL set connection :did;
3091
3099
  */
3092
- #line 2415 "informixc.ec"
3100
+ #line 2439 "informixc.ec"
3093
3101
  {
3094
- #line 2415 "informixc.ec"
3102
+ #line 2439 "informixc.ec"
3095
3103
  sqli_connect_set(0, did, 0);
3096
- #line 2415 "informixc.ec"
3104
+ #line 2439 "informixc.ec"
3097
3105
  }
3098
3106
  if (SQLCODE < 0)
3099
3107
  raise_ifx_extended();
@@ -3102,18 +3110,18 @@ rb_statement_initialize(VALUE self, VALUE db, VALUE query)
3102
3110
  c->db = db;
3103
3111
  c->database_id = did;
3104
3112
  output = c->daOutput;
3105
- snprintf(c->stmt_id, sizeof(c->stmt_id), "STMT%lX", self);
3113
+ snprintf(c->stmt_id, sizeof(c->stmt_id), "STMT%lX", dbt->idcount++);
3106
3114
  sid = c->stmt_id;
3107
3115
  c_query = StringValueCStr(query);
3108
3116
 
3109
3117
  /*
3110
3118
  * EXEC SQL prepare :sid from :c_query;
3111
3119
  */
3112
- #line 2427 "informixc.ec"
3120
+ #line 2451 "informixc.ec"
3113
3121
  {
3114
- #line 2427 "informixc.ec"
3122
+ #line 2451 "informixc.ec"
3115
3123
  sqli_prep(ESQLINTVERSION, sid, c_query,(ifx_literal_t *)0, (ifx_namelist_t *)0, -1, 0, 0 );
3116
- #line 2427 "informixc.ec"
3124
+ #line 2451 "informixc.ec"
3117
3125
  }
3118
3126
  if (SQLCODE < 0)
3119
3127
  raise_ifx_extended();
@@ -3122,11 +3130,11 @@ rb_statement_initialize(VALUE self, VALUE db, VALUE query)
3122
3130
  /*
3123
3131
  * EXEC SQL describe :sid into output;
3124
3132
  */
3125
- #line 2432 "informixc.ec"
3133
+ #line 2456 "informixc.ec"
3126
3134
  {
3127
- #line 2432 "informixc.ec"
3135
+ #line 2456 "informixc.ec"
3128
3136
  sqli_describe_stmt(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, sid, 257), &output, 0);
3129
- #line 2432 "informixc.ec"
3137
+ #line 2456 "informixc.ec"
3130
3138
  }
3131
3139
  c->daOutput = output;
3132
3140
 
@@ -3173,13 +3181,13 @@ rb_statement_call(int argc, VALUE *argv, VALUE self)
3173
3181
  /*
3174
3182
  * EXEC SQL begin declare section;
3175
3183
  */
3176
- #line 2475 "informixc.ec"
3177
- #line 2476 "informixc.ec"
3184
+ #line 2499 "informixc.ec"
3185
+ #line 2500 "informixc.ec"
3178
3186
  char *sid, *did;
3179
3187
  /*
3180
3188
  * EXEC SQL end declare section;
3181
3189
  */
3182
- #line 2477 "informixc.ec"
3190
+ #line 2501 "informixc.ec"
3183
3191
 
3184
3192
 
3185
3193
  Data_Get_Struct(self, cursor_t, c);
@@ -3188,11 +3196,11 @@ rb_statement_call(int argc, VALUE *argv, VALUE self)
3188
3196
  /*
3189
3197
  * EXEC SQL set connection :did;
3190
3198
  */
3191
- #line 2482 "informixc.ec"
3199
+ #line 2506 "informixc.ec"
3192
3200
  {
3193
- #line 2482 "informixc.ec"
3201
+ #line 2506 "informixc.ec"
3194
3202
  sqli_connect_set(0, did, 0);
3195
- #line 2482 "informixc.ec"
3203
+ #line 2506 "informixc.ec"
3196
3204
  }
3197
3205
  if (SQLCODE < 0)
3198
3206
  raise_ifx_extended();
@@ -3212,11 +3220,11 @@ rb_statement_call(int argc, VALUE *argv, VALUE self)
3212
3220
  * EXEC SQL execute :sid into descriptor output
3213
3221
  * using descriptor input;
3214
3222
  */
3215
- #line 2497 "informixc.ec"
3223
+ #line 2521 "informixc.ec"
3216
3224
  {
3217
- #line 2498 "informixc.ec"
3225
+ #line 2522 "informixc.ec"
3218
3226
  sqli_exec(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, sid, 257), input, (char *)0, (struct value *)0, output, (char *)0, (struct value *)0, 0);
3219
- #line 2498 "informixc.ec"
3227
+ #line 2522 "informixc.ec"
3220
3228
  }
3221
3229
  clean_input_slots(c);
3222
3230
  }
@@ -3224,11 +3232,11 @@ rb_statement_call(int argc, VALUE *argv, VALUE self)
3224
3232
  /*
3225
3233
  * EXEC SQL execute :sid into descriptor output;
3226
3234
  */
3227
- #line 2502 "informixc.ec"
3235
+ #line 2526 "informixc.ec"
3228
3236
  {
3229
- #line 2502 "informixc.ec"
3237
+ #line 2526 "informixc.ec"
3230
3238
  sqli_exec(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, sid, 257), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, output, (char *)0, (struct value *)0, 0);
3231
- #line 2502 "informixc.ec"
3239
+ #line 2526 "informixc.ec"
3232
3240
  }
3233
3241
 
3234
3242
  if (SQLCODE < 0)
@@ -3244,11 +3252,11 @@ rb_statement_call(int argc, VALUE *argv, VALUE self)
3244
3252
  /*
3245
3253
  * EXEC SQL execute :sid using descriptor input;
3246
3254
  */
3247
- #line 2514 "informixc.ec"
3255
+ #line 2538 "informixc.ec"
3248
3256
  {
3249
- #line 2514 "informixc.ec"
3257
+ #line 2538 "informixc.ec"
3250
3258
  sqli_exec(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, sid, 257), input, (char *)0, (struct value *)0, (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0);
3251
- #line 2514 "informixc.ec"
3259
+ #line 2538 "informixc.ec"
3252
3260
  }
3253
3261
  clean_input_slots(c);
3254
3262
  }
@@ -3256,11 +3264,11 @@ rb_statement_call(int argc, VALUE *argv, VALUE self)
3256
3264
  /*
3257
3265
  * EXEC SQL execute :sid;
3258
3266
  */
3259
- #line 2518 "informixc.ec"
3267
+ #line 2542 "informixc.ec"
3260
3268
  {
3261
- #line 2518 "informixc.ec"
3269
+ #line 2542 "informixc.ec"
3262
3270
  sqli_exec(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, sid, 257), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0);
3263
- #line 2518 "informixc.ec"
3271
+ #line 2542 "informixc.ec"
3264
3272
  }
3265
3273
  }
3266
3274
  if (SQLCODE < 0)
@@ -3322,13 +3330,13 @@ fetch(VALUE self, VALUE type, VALUE bang)
3322
3330
  /*
3323
3331
  * EXEC SQL begin declare section;
3324
3332
  */
3325
- #line 2576 "informixc.ec"
3326
- #line 2577 "informixc.ec"
3333
+ #line 2600 "informixc.ec"
3334
+ #line 2601 "informixc.ec"
3327
3335
  char *cid, *did;
3328
3336
  /*
3329
3337
  * EXEC SQL end declare section;
3330
3338
  */
3331
- #line 2578 "informixc.ec"
3339
+ #line 2602 "informixc.ec"
3332
3340
 
3333
3341
  short c_bang;
3334
3342
  cursor_t *c;
@@ -3343,11 +3351,11 @@ fetch(VALUE self, VALUE type, VALUE bang)
3343
3351
  /*
3344
3352
  * EXEC SQL set connection :did;
3345
3353
  */
3346
- #line 2589 "informixc.ec"
3354
+ #line 2613 "informixc.ec"
3347
3355
  {
3348
- #line 2589 "informixc.ec"
3356
+ #line 2613 "informixc.ec"
3349
3357
  sqli_connect_set(0, did, 0);
3350
- #line 2589 "informixc.ec"
3358
+ #line 2613 "informixc.ec"
3351
3359
  }
3352
3360
  if (SQLCODE < 0)
3353
3361
  raise_ifx_extended();
@@ -3358,12 +3366,12 @@ fetch(VALUE self, VALUE type, VALUE bang)
3358
3366
  /*
3359
3367
  * EXEC SQL fetch :cid using descriptor output;
3360
3368
  */
3361
- #line 2596 "informixc.ec"
3369
+ #line 2620 "informixc.ec"
3362
3370
  {
3363
- #line 2596 "informixc.ec"
3371
+ #line 2620 "informixc.ec"
3364
3372
  static _FetchSpec _FS0 = { 0, 1, 0 };
3365
3373
  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, output, (char *)0, &_FS0);
3366
- #line 2596 "informixc.ec"
3374
+ #line 2620 "informixc.ec"
3367
3375
  }
3368
3376
  if (SQLCODE < 0)
3369
3377
  raise_ifx_extended();
@@ -3385,13 +3393,13 @@ fetch_many(VALUE self, VALUE n, VALUE type)
3385
3393
  /*
3386
3394
  * EXEC SQL begin declare section;
3387
3395
  */
3388
- #line 2614 "informixc.ec"
3389
- #line 2615 "informixc.ec"
3396
+ #line 2638 "informixc.ec"
3397
+ #line 2639 "informixc.ec"
3390
3398
  char *cid, *did;
3391
3399
  /*
3392
3400
  * EXEC SQL end declare section;
3393
3401
  */
3394
- #line 2616 "informixc.ec"
3402
+ #line 2640 "informixc.ec"
3395
3403
 
3396
3404
  cursor_t *c;
3397
3405
  struct sqlda *output;
@@ -3407,11 +3415,11 @@ fetch_many(VALUE self, VALUE n, VALUE type)
3407
3415
  /*
3408
3416
  * EXEC SQL set connection :did;
3409
3417
  */
3410
- #line 2628 "informixc.ec"
3418
+ #line 2652 "informixc.ec"
3411
3419
  {
3412
- #line 2628 "informixc.ec"
3420
+ #line 2652 "informixc.ec"
3413
3421
  sqli_connect_set(0, did, 0);
3414
- #line 2628 "informixc.ec"
3422
+ #line 2652 "informixc.ec"
3415
3423
  }
3416
3424
  if (SQLCODE < 0)
3417
3425
  raise_ifx_extended();
@@ -3431,12 +3439,12 @@ fetch_many(VALUE self, VALUE n, VALUE type)
3431
3439
  /*
3432
3440
  * EXEC SQL fetch :cid using descriptor output;
3433
3441
  */
3434
- #line 2644 "informixc.ec"
3442
+ #line 2668 "informixc.ec"
3435
3443
  {
3436
- #line 2644 "informixc.ec"
3444
+ #line 2668 "informixc.ec"
3437
3445
  static _FetchSpec _FS0 = { 0, 1, 0 };
3438
3446
  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, output, (char *)0, &_FS0);
3439
- #line 2644 "informixc.ec"
3447
+ #line 2668 "informixc.ec"
3440
3448
  }
3441
3449
  if (SQLCODE < 0)
3442
3450
  raise_ifx_extended();
@@ -3465,13 +3473,13 @@ each(VALUE self, VALUE type, VALUE bang)
3465
3473
  /*
3466
3474
  * EXEC SQL begin declare section;
3467
3475
  */
3468
- #line 2669 "informixc.ec"
3469
- #line 2670 "informixc.ec"
3476
+ #line 2693 "informixc.ec"
3477
+ #line 2694 "informixc.ec"
3470
3478
  char *cid, *did;
3471
3479
  /*
3472
3480
  * EXEC SQL end declare section;
3473
3481
  */
3474
- #line 2671 "informixc.ec"
3482
+ #line 2695 "informixc.ec"
3475
3483
 
3476
3484
  short c_bang;
3477
3485
  struct sqlda *output;
@@ -3485,11 +3493,11 @@ each(VALUE self, VALUE type, VALUE bang)
3485
3493
  /*
3486
3494
  * EXEC SQL set connection :did;
3487
3495
  */
3488
- #line 2681 "informixc.ec"
3496
+ #line 2705 "informixc.ec"
3489
3497
  {
3490
- #line 2681 "informixc.ec"
3498
+ #line 2705 "informixc.ec"
3491
3499
  sqli_connect_set(0, did, 0);
3492
- #line 2681 "informixc.ec"
3500
+ #line 2705 "informixc.ec"
3493
3501
  }
3494
3502
  if (SQLCODE < 0)
3495
3503
  raise_ifx_extended();
@@ -3501,12 +3509,12 @@ each(VALUE self, VALUE type, VALUE bang)
3501
3509
  /*
3502
3510
  * EXEC SQL fetch :cid using descriptor output;
3503
3511
  */
3504
- #line 2689 "informixc.ec"
3512
+ #line 2713 "informixc.ec"
3505
3513
  {
3506
- #line 2689 "informixc.ec"
3514
+ #line 2713 "informixc.ec"
3507
3515
  static _FetchSpec _FS0 = { 0, 1, 0 };
3508
3516
  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, output, (char *)0, &_FS0);
3509
- #line 2689 "informixc.ec"
3517
+ #line 2713 "informixc.ec"
3510
3518
  }
3511
3519
  if (SQLCODE < 0)
3512
3520
  raise_ifx_extended();
@@ -3568,13 +3576,13 @@ rb_inscur_put(int argc, VALUE *argv, VALUE self)
3568
3576
  /*
3569
3577
  * EXEC SQL begin declare section;
3570
3578
  */
3571
- #line 2747 "informixc.ec"
3572
- #line 2748 "informixc.ec"
3579
+ #line 2771 "informixc.ec"
3580
+ #line 2772 "informixc.ec"
3573
3581
  char *cid, *did;
3574
3582
  /*
3575
3583
  * EXEC SQL end declare section;
3576
3584
  */
3577
- #line 2749 "informixc.ec"
3585
+ #line 2773 "informixc.ec"
3578
3586
 
3579
3587
 
3580
3588
  Data_Get_Struct(self, cursor_t, c);
@@ -3585,11 +3593,11 @@ rb_inscur_put(int argc, VALUE *argv, VALUE self)
3585
3593
  /*
3586
3594
  * EXEC SQL set connection :did;
3587
3595
  */
3588
- #line 2756 "informixc.ec"
3596
+ #line 2780 "informixc.ec"
3589
3597
  {
3590
- #line 2756 "informixc.ec"
3598
+ #line 2780 "informixc.ec"
3591
3599
  sqli_connect_set(0, did, 0);
3592
- #line 2756 "informixc.ec"
3600
+ #line 2780 "informixc.ec"
3593
3601
  }
3594
3602
  if (SQLCODE < 0)
3595
3603
  raise_ifx_extended();
@@ -3605,11 +3613,11 @@ rb_inscur_put(int argc, VALUE *argv, VALUE self)
3605
3613
  /*
3606
3614
  * EXEC SQL put :cid using descriptor input;
3607
3615
  */
3608
- #line 2768 "informixc.ec"
3616
+ #line 2792 "informixc.ec"
3609
3617
  {
3610
- #line 2768 "informixc.ec"
3618
+ #line 2792 "informixc.ec"
3611
3619
  sqli_curs_put(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), input, (char *)0);
3612
- #line 2768 "informixc.ec"
3620
+ #line 2792 "informixc.ec"
3613
3621
  }
3614
3622
  clean_input_slots(c);
3615
3623
  if (SQLCODE < 0)
@@ -3634,13 +3642,13 @@ rb_inscur_flush(VALUE self)
3634
3642
  /*
3635
3643
  * EXEC SQL begin declare section;
3636
3644
  */
3637
- #line 2789 "informixc.ec"
3638
- #line 2790 "informixc.ec"
3645
+ #line 2813 "informixc.ec"
3646
+ #line 2814 "informixc.ec"
3639
3647
  char *cid, *did;
3640
3648
  /*
3641
3649
  * EXEC SQL end declare section;
3642
3650
  */
3643
- #line 2791 "informixc.ec"
3651
+ #line 2815 "informixc.ec"
3644
3652
 
3645
3653
 
3646
3654
  Data_Get_Struct(self, cursor_t, c);
@@ -3651,11 +3659,11 @@ rb_inscur_flush(VALUE self)
3651
3659
  /*
3652
3660
  * EXEC SQL set connection :did;
3653
3661
  */
3654
- #line 2798 "informixc.ec"
3662
+ #line 2822 "informixc.ec"
3655
3663
  {
3656
- #line 2798 "informixc.ec"
3664
+ #line 2822 "informixc.ec"
3657
3665
  sqli_connect_set(0, did, 0);
3658
- #line 2798 "informixc.ec"
3666
+ #line 2822 "informixc.ec"
3659
3667
  }
3660
3668
  if (SQLCODE < 0)
3661
3669
  raise_ifx_extended();
@@ -3664,11 +3672,11 @@ rb_inscur_flush(VALUE self)
3664
3672
  /*
3665
3673
  * EXEC SQL flush :cid;
3666
3674
  */
3667
- #line 2803 "informixc.ec"
3675
+ #line 2827 "informixc.ec"
3668
3676
  {
3669
- #line 2803 "informixc.ec"
3677
+ #line 2827 "informixc.ec"
3670
3678
  sqli_curs_flush(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256));
3671
- #line 2803 "informixc.ec"
3679
+ #line 2827 "informixc.ec"
3672
3680
  }
3673
3681
  return self;
3674
3682
  }
@@ -3689,14 +3697,14 @@ rb_scrollcur_entry(VALUE self, VALUE index, VALUE type, VALUE bang)
3689
3697
  /*
3690
3698
  * EXEC SQL begin declare section;
3691
3699
  */
3692
- #line 2820 "informixc.ec"
3693
- #line 2821 "informixc.ec"
3700
+ #line 2844 "informixc.ec"
3701
+ #line 2845 "informixc.ec"
3694
3702
  char *cid, *did;
3695
3703
  long pos;
3696
3704
  /*
3697
3705
  * EXEC SQL end declare section;
3698
3706
  */
3699
- #line 2823 "informixc.ec"
3707
+ #line 2847 "informixc.ec"
3700
3708
 
3701
3709
 
3702
3710
  Data_Get_Struct(self, cursor_t, c);
@@ -3707,11 +3715,11 @@ long pos;
3707
3715
  /*
3708
3716
  * EXEC SQL set connection :did;
3709
3717
  */
3710
- #line 2830 "informixc.ec"
3718
+ #line 2854 "informixc.ec"
3711
3719
  {
3712
- #line 2830 "informixc.ec"
3720
+ #line 2854 "informixc.ec"
3713
3721
  sqli_connect_set(0, did, 0);
3714
- #line 2830 "informixc.ec"
3722
+ #line 2854 "informixc.ec"
3715
3723
  }
3716
3724
  if (SQLCODE < 0)
3717
3725
  return Qnil;
@@ -3723,60 +3731,60 @@ long pos;
3723
3731
  /*
3724
3732
  * EXEC SQL fetch current :cid using descriptor output;
3725
3733
  */
3726
- #line 2838 "informixc.ec"
3734
+ #line 2862 "informixc.ec"
3727
3735
  {
3728
- #line 2838 "informixc.ec"
3736
+ #line 2862 "informixc.ec"
3729
3737
  static _FetchSpec _FS0 = { 0, 5, 0 };
3730
3738
  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, output, (char *)0, &_FS0);
3731
- #line 2838 "informixc.ec"
3739
+ #line 2862 "informixc.ec"
3732
3740
  }
3733
3741
  else if ((pos = NUM2LONG(index) + 1) > 0)
3734
3742
  /*
3735
3743
  * EXEC SQL fetch absolute :pos :cid using descriptor output;
3736
3744
  */
3737
- #line 2840 "informixc.ec"
3745
+ #line 2864 "informixc.ec"
3738
3746
  {
3739
- #line 2840 "informixc.ec"
3747
+ #line 2864 "informixc.ec"
3740
3748
  static ifx_sqlvar_t _sqibind[] =
3741
3749
  {
3742
3750
  { 103, sizeof(pos), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
3743
- #line 2840 "informixc.ec"
3751
+ #line 2864 "informixc.ec"
3744
3752
  };
3745
3753
  static ifx_sqlda_t _SD0 = { 1, _sqibind, {0}, 1, 0 };
3746
3754
  static _FetchSpec _FS1 = { 0, 6, 0 };
3747
- #line 2840 "informixc.ec"
3755
+ #line 2864 "informixc.ec"
3748
3756
  _sqibind[0].sqldata = (char *) &pos;
3749
3757
  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), &_SD0, output, (char *)0, &_FS1);
3750
- #line 2840 "informixc.ec"
3758
+ #line 2864 "informixc.ec"
3751
3759
  }
3752
3760
  else {
3753
3761
  /*
3754
3762
  * EXEC SQL fetch last :cid;
3755
3763
  */
3756
- #line 2842 "informixc.ec"
3764
+ #line 2866 "informixc.ec"
3757
3765
  {
3758
- #line 2842 "informixc.ec"
3766
+ #line 2866 "informixc.ec"
3759
3767
  static _FetchSpec _FS0 = { 0, 4, 0 };
3760
3768
  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (ifx_sqlda_t *)0, (char *)0, &_FS0);
3761
- #line 2842 "informixc.ec"
3769
+ #line 2866 "informixc.ec"
3762
3770
  }
3763
3771
  /*
3764
3772
  * EXEC SQL fetch relative :pos :cid using descriptor output;
3765
3773
  */
3766
- #line 2843 "informixc.ec"
3774
+ #line 2867 "informixc.ec"
3767
3775
  {
3768
- #line 2843 "informixc.ec"
3776
+ #line 2867 "informixc.ec"
3769
3777
  static ifx_sqlvar_t _sqibind[] =
3770
3778
  {
3771
3779
  { 103, sizeof(pos), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
3772
- #line 2843 "informixc.ec"
3780
+ #line 2867 "informixc.ec"
3773
3781
  };
3774
3782
  static ifx_sqlda_t _SD0 = { 1, _sqibind, {0}, 1, 0 };
3775
3783
  static _FetchSpec _FS1 = { 0, 7, 0 };
3776
- #line 2843 "informixc.ec"
3784
+ #line 2867 "informixc.ec"
3777
3785
  _sqibind[0].sqldata = (char *) &pos;
3778
3786
  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), &_SD0, output, (char *)0, &_FS1);
3779
- #line 2843 "informixc.ec"
3787
+ #line 2867 "informixc.ec"
3780
3788
  }
3781
3789
  }
3782
3790
 
@@ -3804,14 +3812,14 @@ rb_scrollcur_rel(VALUE self, VALUE offset, VALUE type, VALUE bang)
3804
3812
  /*
3805
3813
  * EXEC SQL begin declare section;
3806
3814
  */
3807
- #line 2867 "informixc.ec"
3808
- #line 2868 "informixc.ec"
3815
+ #line 2891 "informixc.ec"
3816
+ #line 2892 "informixc.ec"
3809
3817
  char *cid, *did;
3810
3818
  long pos;
3811
3819
  /*
3812
3820
  * EXEC SQL end declare section;
3813
3821
  */
3814
- #line 2870 "informixc.ec"
3822
+ #line 2894 "informixc.ec"
3815
3823
 
3816
3824
 
3817
3825
  Data_Get_Struct(self, cursor_t, c);
@@ -3822,11 +3830,11 @@ long pos;
3822
3830
  /*
3823
3831
  * EXEC SQL set connection :did;
3824
3832
  */
3825
- #line 2877 "informixc.ec"
3833
+ #line 2901 "informixc.ec"
3826
3834
  {
3827
- #line 2877 "informixc.ec"
3835
+ #line 2901 "informixc.ec"
3828
3836
  sqli_connect_set(0, did, 0);
3829
- #line 2877 "informixc.ec"
3837
+ #line 2901 "informixc.ec"
3830
3838
  }
3831
3839
  if (SQLCODE < 0)
3832
3840
  return Qnil;
@@ -3838,20 +3846,20 @@ long pos;
3838
3846
  /*
3839
3847
  * EXEC SQL fetch relative :pos :cid using descriptor output;
3840
3848
  */
3841
- #line 2885 "informixc.ec"
3849
+ #line 2909 "informixc.ec"
3842
3850
  {
3843
- #line 2885 "informixc.ec"
3851
+ #line 2909 "informixc.ec"
3844
3852
  static ifx_sqlvar_t _sqibind[] =
3845
3853
  {
3846
3854
  { 103, sizeof(pos), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
3847
- #line 2885 "informixc.ec"
3855
+ #line 2909 "informixc.ec"
3848
3856
  };
3849
3857
  static ifx_sqlda_t _SD0 = { 1, _sqibind, {0}, 1, 0 };
3850
3858
  static _FetchSpec _FS1 = { 0, 7, 0 };
3851
- #line 2885 "informixc.ec"
3859
+ #line 2909 "informixc.ec"
3852
3860
  _sqibind[0].sqldata = (char *) &pos;
3853
3861
  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), &_SD0, output, (char *)0, &_FS1);
3854
- #line 2885 "informixc.ec"
3862
+ #line 2909 "informixc.ec"
3855
3863
  }
3856
3864
 
3857
3865
  if (SQLCODE == SQLNOTFOUND)
@@ -3873,13 +3881,13 @@ cursorbase_close_or_free(cursor_t *c, short op)
3873
3881
  /*
3874
3882
  * EXEC SQL begin declare section;
3875
3883
  */
3876
- #line 2903 "informixc.ec"
3877
- #line 2904 "informixc.ec"
3884
+ #line 2927 "informixc.ec"
3885
+ #line 2928 "informixc.ec"
3878
3886
  char *cid, *sid, *did;
3879
3887
  /*
3880
3888
  * EXEC SQL end declare section;
3881
3889
  */
3882
- #line 2905 "informixc.ec"
3890
+ #line 2929 "informixc.ec"
3883
3891
 
3884
3892
 
3885
3893
  if (op == 1 && !c->is_open)
@@ -3895,11 +3903,11 @@ cursorbase_close_or_free(cursor_t *c, short op)
3895
3903
  /*
3896
3904
  * EXEC SQL set connection :did;
3897
3905
  */
3898
- #line 2917 "informixc.ec"
3906
+ #line 2941 "informixc.ec"
3899
3907
  {
3900
- #line 2917 "informixc.ec"
3908
+ #line 2941 "informixc.ec"
3901
3909
  sqli_connect_set(0, did, 0);
3902
- #line 2917 "informixc.ec"
3910
+ #line 2941 "informixc.ec"
3903
3911
  }
3904
3912
  if (SQLCODE < 0)
3905
3913
  return;
@@ -3907,22 +3915,22 @@ cursorbase_close_or_free(cursor_t *c, short op)
3907
3915
  /*
3908
3916
  * EXEC SQL close :cid;
3909
3917
  */
3910
- #line 2921 "informixc.ec"
3918
+ #line 2945 "informixc.ec"
3911
3919
  {
3912
- #line 2921 "informixc.ec"
3920
+ #line 2945 "informixc.ec"
3913
3921
  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256));
3914
- #line 2921 "informixc.ec"
3922
+ #line 2945 "informixc.ec"
3915
3923
  }
3916
3924
  if (op == 1)
3917
3925
  break;
3918
3926
  /*
3919
3927
  * EXEC SQL free :cid;
3920
3928
  */
3921
- #line 2924 "informixc.ec"
3929
+ #line 2948 "informixc.ec"
3922
3930
  {
3923
- #line 2924 "informixc.ec"
3931
+ #line 2948 "informixc.ec"
3924
3932
  sqli_curs_free(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 258));
3925
- #line 2924 "informixc.ec"
3933
+ #line 2948 "informixc.ec"
3926
3934
  }
3927
3935
  st_free(c);
3928
3936
  break;
@@ -3990,13 +3998,13 @@ rb_cursorbase_open(int argc, VALUE *argv, VALUE self)
3990
3998
  /*
3991
3999
  * EXEC SQL begin declare section;
3992
4000
  */
3993
- #line 2988 "informixc.ec"
3994
- #line 2989 "informixc.ec"
4001
+ #line 3012 "informixc.ec"
4002
+ #line 3013 "informixc.ec"
3995
4003
  char *cid, *did;
3996
4004
  /*
3997
4005
  * EXEC SQL end declare section;
3998
4006
  */
3999
- #line 2990 "informixc.ec"
4007
+ #line 3014 "informixc.ec"
4000
4008
 
4001
4009
 
4002
4010
  Data_Get_Struct(self, cursor_t, c);
@@ -4008,11 +4016,11 @@ rb_cursorbase_open(int argc, VALUE *argv, VALUE self)
4008
4016
  /*
4009
4017
  * EXEC SQL set connection :did;
4010
4018
  */
4011
- #line 2998 "informixc.ec"
4019
+ #line 3022 "informixc.ec"
4012
4020
  {
4013
- #line 2998 "informixc.ec"
4021
+ #line 3022 "informixc.ec"
4014
4022
  sqli_connect_set(0, did, 0);
4015
- #line 2998 "informixc.ec"
4023
+ #line 3022 "informixc.ec"
4016
4024
  }
4017
4025
  if (SQLCODE < 0)
4018
4026
  raise_ifx_extended();
@@ -4031,11 +4039,11 @@ rb_cursorbase_open(int argc, VALUE *argv, VALUE self)
4031
4039
  * EXEC SQL open :cid using descriptor input
4032
4040
  * with reoptimization;
4033
4041
  */
4034
- #line 3012 "informixc.ec"
4042
+ #line 3036 "informixc.ec"
4035
4043
  {
4036
- #line 3013 "informixc.ec"
4044
+ #line 3037 "informixc.ec"
4037
4045
  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), input, (char *)0, (struct value *)0, 1, 1);
4038
- #line 3013 "informixc.ec"
4046
+ #line 3037 "informixc.ec"
4039
4047
  }
4040
4048
  clean_input_slots(c);
4041
4049
  }
@@ -4043,22 +4051,22 @@ rb_cursorbase_open(int argc, VALUE *argv, VALUE self)
4043
4051
  /*
4044
4052
  * EXEC SQL open :cid with reoptimization;
4045
4053
  */
4046
- #line 3017 "informixc.ec"
4054
+ #line 3041 "informixc.ec"
4047
4055
  {
4048
- #line 3017 "informixc.ec"
4056
+ #line 3041 "informixc.ec"
4049
4057
  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 1);
4050
- #line 3017 "informixc.ec"
4058
+ #line 3041 "informixc.ec"
4051
4059
  }
4052
4060
  }
4053
4061
  else
4054
4062
  /*
4055
4063
  * EXEC SQL open :cid;
4056
4064
  */
4057
- #line 3020 "informixc.ec"
4065
+ #line 3044 "informixc.ec"
4058
4066
  {
4059
- #line 3020 "informixc.ec"
4067
+ #line 3044 "informixc.ec"
4060
4068
  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 0);
4061
- #line 3020 "informixc.ec"
4069
+ #line 3044 "informixc.ec"
4062
4070
  }
4063
4071
 
4064
4072
  if (SQLCODE < 0)
@@ -4115,40 +4123,47 @@ rb_cursor_s_new0(int argc, VALUE *argv, VALUE self)
4115
4123
  VALUE scroll, hold;
4116
4124
  struct sqlda *output;
4117
4125
  cursor_t c, *cur;
4126
+ database_t *dbt;
4127
+ long id;
4118
4128
  /*
4119
4129
  * EXEC SQL begin declare section;
4120
4130
  */
4121
- #line 3076 "informixc.ec"
4122
- #line 3077 "informixc.ec"
4131
+ #line 3102 "informixc.ec"
4132
+ #line 3103 "informixc.ec"
4123
4133
  char *c_query;
4124
4134
  char *cid, *sid, *did;
4125
4135
  /*
4126
4136
  * EXEC SQL end declare section;
4127
4137
  */
4128
- #line 3079 "informixc.ec"
4138
+ #line 3105 "informixc.ec"
4129
4139
 
4130
4140
 
4131
4141
  memset(&c, 0, sizeof(c));
4132
4142
  rb_scan_args(argc, argv, "21", &db, &query, &options);
4133
- Data_Get_Struct(db, char, did);
4134
-
4143
+ Data_Get_Struct(db, database_t, dbt);
4144
+ did = dbt->database_id;
4145
+ fprintf(stderr, "%s\n", did);
4146
+ fflush(stderr);
4135
4147
  /*
4136
4148
  * EXEC SQL set connection :did;
4137
4149
  */
4138
- #line 3085 "informixc.ec"
4150
+ #line 3113 "informixc.ec"
4139
4151
  {
4140
- #line 3085 "informixc.ec"
4152
+ #line 3113 "informixc.ec"
4141
4153
  sqli_connect_set(0, did, 0);
4142
- #line 3085 "informixc.ec"
4154
+ #line 3113 "informixc.ec"
4143
4155
  }
4156
+
4144
4157
  if (SQLCODE < 0)
4145
4158
  raise_ifx_extended();
4146
4159
 
4147
4160
  c.db = db;
4148
4161
  c.database_id = did;
4149
4162
  scroll = hold = Qfalse;
4150
- snprintf(c.cursor_id, sizeof(c.cursor_id), "CUR%lX", self);
4151
- snprintf(c.stmt_id, sizeof(c.stmt_id), "STMT%lX", self);
4163
+ /*id = random();*/
4164
+ id = dbt->idcount++;
4165
+ snprintf(c.cursor_id, sizeof(c.cursor_id), "CUR%lX", id);
4166
+ snprintf(c.stmt_id, sizeof(c.stmt_id), "STMT%lX", id);
4152
4167
  cid = c.cursor_id; sid = c.stmt_id;
4153
4168
  c_query = StringValueCStr(query);
4154
4169
 
@@ -4161,11 +4176,11 @@ rb_cursor_s_new0(int argc, VALUE *argv, VALUE self)
4161
4176
  /*
4162
4177
  * EXEC SQL prepare :sid from :c_query;
4163
4178
  */
4164
- #line 3103 "informixc.ec"
4179
+ #line 3134 "informixc.ec"
4165
4180
  {
4166
- #line 3103 "informixc.ec"
4181
+ #line 3134 "informixc.ec"
4167
4182
  sqli_prep(ESQLINTVERSION, sid, c_query,(ifx_literal_t *)0, (ifx_namelist_t *)0, -1, 0, 0 );
4168
- #line 3103 "informixc.ec"
4183
+ #line 3134 "informixc.ec"
4169
4184
  }
4170
4185
  if (SQLCODE < 0)
4171
4186
  raise_ifx_extended();
@@ -4174,41 +4189,41 @@ rb_cursor_s_new0(int argc, VALUE *argv, VALUE self)
4174
4189
  /*
4175
4190
  * EXEC SQL declare :cid scroll cursor with hold for :sid;
4176
4191
  */
4177
- #line 3108 "informixc.ec"
4192
+ #line 3139 "informixc.ec"
4178
4193
  {
4179
- #line 3108 "informixc.ec"
4194
+ #line 3139 "informixc.ec"
4180
4195
  sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 0), cid, sqli_curs_locate(ESQLINTVERSION, sid, 1), 4128, 0);
4181
- #line 3108 "informixc.ec"
4196
+ #line 3139 "informixc.ec"
4182
4197
  }
4183
4198
  else if (RTEST(hold))
4184
4199
  /*
4185
4200
  * EXEC SQL declare :cid cursor with hold for :sid;
4186
4201
  */
4187
- #line 3110 "informixc.ec"
4202
+ #line 3141 "informixc.ec"
4188
4203
  {
4189
- #line 3110 "informixc.ec"
4204
+ #line 3141 "informixc.ec"
4190
4205
  sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 0), cid, sqli_curs_locate(ESQLINTVERSION, sid, 1), 4096, 0);
4191
- #line 3110 "informixc.ec"
4206
+ #line 3141 "informixc.ec"
4192
4207
  }
4193
4208
  else if (RTEST(scroll))
4194
4209
  /*
4195
4210
  * EXEC SQL declare :cid scroll cursor for :sid;
4196
4211
  */
4197
- #line 3112 "informixc.ec"
4212
+ #line 3143 "informixc.ec"
4198
4213
  {
4199
- #line 3112 "informixc.ec"
4214
+ #line 3143 "informixc.ec"
4200
4215
  sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 0), cid, sqli_curs_locate(ESQLINTVERSION, sid, 1), 32, 0);
4201
- #line 3112 "informixc.ec"
4216
+ #line 3143 "informixc.ec"
4202
4217
  }
4203
4218
  else
4204
4219
  /*
4205
4220
  * EXEC SQL declare :cid cursor for :sid;
4206
4221
  */
4207
- #line 3114 "informixc.ec"
4222
+ #line 3145 "informixc.ec"
4208
4223
  {
4209
- #line 3114 "informixc.ec"
4224
+ #line 3145 "informixc.ec"
4210
4225
  sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cid, 0), cid, sqli_curs_locate(ESQLINTVERSION, sid, 1), 0, 0);
4211
- #line 3114 "informixc.ec"
4226
+ #line 3145 "informixc.ec"
4212
4227
  }
4213
4228
 
4214
4229
  if (SQLCODE < 0)
@@ -4218,11 +4233,11 @@ rb_cursor_s_new0(int argc, VALUE *argv, VALUE self)
4218
4233
  /*
4219
4234
  * EXEC SQL describe :sid into output;
4220
4235
  */
4221
- #line 3120 "informixc.ec"
4236
+ #line 3151 "informixc.ec"
4222
4237
  {
4223
- #line 3120 "informixc.ec"
4238
+ #line 3151 "informixc.ec"
4224
4239
  sqli_describe_stmt(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, sid, 257), &output, 0);
4225
- #line 3120 "informixc.ec"
4240
+ #line 3151 "informixc.ec"
4226
4241
  }
4227
4242
  c.daOutput = output;
4228
4243
 
@@ -4515,4 +4530,4 @@ void Init_informixc(void)
4515
4530
  sym_params = ID2SYM(rb_intern("params"));
4516
4531
  }
4517
4532
 
4518
- #line 3410 "informixc.ec"
4533
+ #line 3441 "informixc.ec"