advantage 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4a533a4bd92806421ec906328dd81643ae4e6f4f22c0d4fa3ea20e1cf7d62a3
4
- data.tar.gz: f36cdf1a7f3d799830fcf8538fde85005c42d78ee358f2f4eeef50111bfebba9
3
+ metadata.gz: 384998f9525f51b6edf754a2d4c4c4e988af28dbecf60be2f0b27ea99378f00c
4
+ data.tar.gz: e5ae988ce3e9a1e03220cdee7d23ee440e1bcc0bf29ac2664311a906d12efed9
5
5
  SHA512:
6
- metadata.gz: a19f30c748731609273a46981ca83ea1a76194b982e4267f9dfff50b7e577428c34ce4d619f7783a9935b7a1b65bbca4b7f15106b225f4fe135835a3e0e0df03
7
- data.tar.gz: 13eedcb294619a892bb982af6419083038b9f727d6e9fd063b9da932da0662ebbeb0608e9cf7953ea2bea24d2d6272eb2505f5d1161d1f55538b00bf51afa718
6
+ metadata.gz: 3cfdf5c0d4b0eafcc9fcfcc77430a45fd17ac40a34c0096b7e9ced94297ed0959bec97b25efd21f8d61fe43701f577a003b3de4352713081c935ca77b86b0728
7
+ data.tar.gz: c9e090d0191ff557abb1cc99cb4b86730b6ac27da1fd5b94558202c84c3e5f0f4ccb8fe8811aa9c9504c95377e4f44c03fd4ca848d2572b8ac035224428914fd
@@ -21,7 +21,7 @@
21
21
  #include "ruby.h"
22
22
  #include "adscapidll.h"
23
23
 
24
- const char *VERSION = "0.1.3";
24
+ const char *VERSION = "0.1.4";
25
25
 
26
26
  typedef struct imp_drh_st
27
27
  {
@@ -29,6 +29,12 @@ typedef struct imp_drh_st
29
29
  void *adscapi_context;
30
30
  } imp_drh_st;
31
31
 
32
+ static const rb_data_type_t ads_connection_type = {
33
+ "a_ads_connection",
34
+ { 0, 0, 0 },
35
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
36
+ };
37
+
32
38
  // Defining the Ruby Modules
33
39
  static VALUE mAdvantage;
34
40
  static VALUE mAPI;
@@ -334,7 +340,7 @@ static_AdvantageInterface_ads_new_connection(VALUE imp_drh)
334
340
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
335
341
  ptr = s_imp_drh->api.ads_new_connection();
336
342
 
337
- tdata = Data_Wrap_Struct(cA_ads_connection, 0, 0, ptr);
343
+ tdata = TypedData_Wrap_Struct(cA_ads_connection, &ads_connection_type, ptr);
338
344
 
339
345
  return (tdata);
340
346
  }
@@ -396,7 +402,7 @@ static_AdvantageInterface_ads_connect(VALUE imp_drh, VALUE ads_conn, VALUE str)
396
402
  UNSIGNED32 result;
397
403
 
398
404
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
399
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
405
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
400
406
 
401
407
  s_str = StringValueCStr(str);
402
408
 
@@ -429,7 +435,7 @@ static_AdvantageInterface_ads_disconnect(VALUE imp_drh, VALUE ads_conn)
429
435
  a_ads_connection *s_ads_conn;
430
436
 
431
437
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
432
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
438
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
433
439
 
434
440
  s_imp_drh->api.ads_disconnect(s_ads_conn);
435
441
 
@@ -457,7 +463,7 @@ static_AdvantageInterface_ads_free_connection(VALUE imp_drh, VALUE ads_conn)
457
463
  a_ads_connection *s_ads_conn;
458
464
 
459
465
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
460
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
466
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
461
467
 
462
468
  s_imp_drh->api.ads_free_connection(s_ads_conn);
463
469
 
@@ -520,7 +526,7 @@ static_AdvantageInterface_ads_error(VALUE imp_drh, VALUE ads_conn)
520
526
  VALUE multi_result;
521
527
 
522
528
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
523
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
529
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
524
530
 
525
531
  result = s_imp_drh->api.ads_error(s_ads_conn, (UNSIGNED8 *)s_buffer, 255);
526
532
 
@@ -562,7 +568,7 @@ static_AdvantageInterface_ads_execute_immediate(VALUE imp_drh, VALUE ads_conn, V
562
568
  s_sql = StringValueCStr(sql);
563
569
 
564
570
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
565
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
571
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
566
572
 
567
573
  result = s_imp_drh->api.ads_execute_immediate(s_ads_conn, (UNSIGNED8 *)s_sql);
568
574
 
@@ -604,13 +610,13 @@ static_AdvantageInterface_ads_execute_direct(VALUE imp_drh, VALUE ads_conn, VALU
604
610
  s_sql = StringValueCStr(sql);
605
611
 
606
612
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
607
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
613
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
608
614
 
609
615
  resultset = s_imp_drh->api.ads_execute_direct(s_ads_conn, (UNSIGNED8 *)s_sql);
610
616
 
611
617
  if (resultset)
612
618
  {
613
- tdata = INT2FIX(resultset);
619
+ tdata = ULL2NUM((unsigned long long)resultset);
614
620
  }
615
621
  else
616
622
  {
@@ -643,7 +649,7 @@ static_AdvantageInterface_ads_num_cols(VALUE imp_drh, VALUE ads_stmt)
643
649
 
644
650
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
645
651
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_stmt );
646
- s_stmt = NUM2ULONG(ads_stmt);
652
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
647
653
 
648
654
  result = s_imp_drh->api.ads_num_cols(s_stmt);
649
655
 
@@ -673,7 +679,7 @@ static_AdvantageInterface_ads_num_rows(VALUE imp_drh, VALUE ads_stmt)
673
679
 
674
680
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
675
681
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_stmt );
676
- s_stmt = NUM2ULONG(ads_stmt);
682
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
677
683
 
678
684
  result = s_imp_drh->api.ads_num_rows(s_stmt);
679
685
 
@@ -707,7 +713,7 @@ static_AdvantageInterface_ads_get_column(VALUE imp_drh, VALUE ads_stmt, VALUE co
707
713
 
708
714
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
709
715
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_stmt );
710
- s_stmt = NUM2ULONG(ads_stmt);
716
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
711
717
  s_col_num = NUM2INT(col_num);
712
718
 
713
719
  result = s_imp_drh->api.ads_get_column(s_stmt, s_col_num, &value);
@@ -763,7 +769,7 @@ static_AdvantageInterface_ads_fetch_next(VALUE imp_drh, VALUE ads_stmt)
763
769
 
764
770
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
765
771
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_stmt );
766
- s_stmt = NUM2ULONG(ads_stmt);
772
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
767
773
 
768
774
  result = s_imp_drh->api.ads_fetch_next(s_stmt);
769
775
 
@@ -811,7 +817,7 @@ static_AdvantageInterface_ads_get_column_info(VALUE imp_drh, VALUE ads_stmt, VAL
811
817
 
812
818
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
813
819
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_stmt );
814
- s_stmt = NUM2ULONG(ads_stmt);
820
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
815
821
  s_col_num = NUM2INT(col_num);
816
822
 
817
823
  result = s_imp_drh->api.ads_get_column_info(s_stmt, s_col_num, &info);
@@ -852,7 +858,7 @@ static_AdvantageInterface_AdsBeginTransaction(VALUE imp_drh, VALUE ads_conn)
852
858
  UNSIGNED32 result;
853
859
 
854
860
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
855
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
861
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
856
862
 
857
863
  result = s_imp_drh->api.AdsBeginTransaction(s_ads_conn->hConnect);
858
864
  if (result == 0)
@@ -883,7 +889,7 @@ static_AdvantageInterface_ads_commit(VALUE imp_drh, VALUE ads_conn)
883
889
  UNSIGNED32 result;
884
890
 
885
891
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
886
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
892
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
887
893
 
888
894
  result = s_imp_drh->api.ads_commit(s_ads_conn);
889
895
 
@@ -912,7 +918,7 @@ static_AdvantageInterface_ads_rollback(VALUE imp_drh, VALUE ads_conn)
912
918
  UNSIGNED32 result;
913
919
 
914
920
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
915
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
921
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
916
922
 
917
923
  result = s_imp_drh->api.ads_rollback(s_ads_conn);
918
924
 
@@ -951,14 +957,14 @@ static_AdvantageInterface_ads_prepare(VALUE imp_drh, VALUE ads_conn, VALUE sql)
951
957
  s_sql = StringValueCStr(sql);
952
958
 
953
959
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
954
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
960
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
955
961
 
956
962
  //EJS Passing FALSE for isUnicode
957
963
  s_stmt = s_imp_drh->api.ads_prepare(s_ads_conn, (UNSIGNED8 *)s_sql, '\0');
958
964
 
959
965
  if (s_stmt)
960
966
  {
961
- tdata = INT2FIX(s_stmt);
967
+ tdata = ULL2NUM((unsigned long long)s_stmt);
962
968
  }
963
969
  else
964
970
  {
@@ -996,7 +1002,7 @@ static_AdvantageInterface_ads_free_stmt(VALUE imp_drh, VALUE ads_stmt)
996
1002
 
997
1003
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
998
1004
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_ads_stmt );
999
- s_stmt = NUM2ULONG(ads_stmt);
1005
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
1000
1006
 
1001
1007
  number_of_params = s_imp_drh->api.ads_num_params(s_stmt);
1002
1008
 
@@ -1062,7 +1068,7 @@ static_AdvantageInterface_ads_reset(VALUE imp_drh, VALUE ads_stmt)
1062
1068
 
1063
1069
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1064
1070
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_ads_stmt );
1065
- s_stmt = NUM2ULONG(ads_stmt);
1071
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
1066
1072
 
1067
1073
  result = s_imp_drh->api.ads_reset(s_stmt);
1068
1074
 
@@ -1092,7 +1098,7 @@ static_AdvantageInterface_ads_execute(VALUE imp_drh, VALUE ads_stmt)
1092
1098
 
1093
1099
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1094
1100
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_ads_stmt );
1095
- s_stmt = NUM2ULONG(ads_stmt);
1101
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
1096
1102
 
1097
1103
  //printf( "CEXT s_ads_stmt: %d \n", s_stmt );
1098
1104
  result = s_imp_drh->api.ads_execute(s_stmt);
@@ -1127,7 +1133,7 @@ static_AdvantageInterface_ads_affected_rows(VALUE imp_drh, VALUE ads_stmt)
1127
1133
 
1128
1134
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1129
1135
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_ads_stmt );
1130
- s_stmt = NUM2ULONG(ads_stmt);
1136
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
1131
1137
 
1132
1138
  result = s_imp_drh->api.ads_affected_rows(s_stmt);
1133
1139
 
@@ -1171,7 +1177,7 @@ static_AdvantageInterface_ads_describe_bind_param(VALUE imp_drh, VALUE ads_stmt,
1171
1177
  memset(s_ads_bind_param, 0, sizeof(a_ads_bind_param));
1172
1178
 
1173
1179
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1174
- s_stmt = NUM2ULONG(ads_stmt);
1180
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
1175
1181
  s_index = NUM2INT(index);
1176
1182
 
1177
1183
  result = s_imp_drh->api.ads_describe_bind_param(s_stmt, s_index, s_ads_bind_param);
@@ -1215,7 +1221,7 @@ static_AdvantageInterface_ads_bind_param(VALUE imp_drh, VALUE ads_stmt, VALUE in
1215
1221
 
1216
1222
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1217
1223
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_ads_stmt );
1218
- s_stmt = NUM2ULONG(ads_stmt);
1224
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
1219
1225
  Data_Get_Struct(ads_bind_param, a_ads_bind_param, s_ads_bind_param);
1220
1226
  s_index = NUM2INT(index);
1221
1227
 
@@ -1255,7 +1261,7 @@ static_AdvantageInterface_ads_get_bind_param_info(VALUE imp_drh, VALUE ads_stmt,
1255
1261
  VALUE multi_result;
1256
1262
 
1257
1263
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1258
- s_stmt = NUM2ULONG(ads_stmt);
1264
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
1259
1265
  s_index = NUM2INT(index);
1260
1266
 
1261
1267
  result = s_imp_drh->api.ads_get_bind_param_info(s_stmt, s_index, &s_ads_bind_param_info);
@@ -1299,7 +1305,7 @@ static_AdvantageInterface_ads_num_params(VALUE imp_drh, VALUE ads_stmt)
1299
1305
 
1300
1306
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1301
1307
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_ads_stmt );
1302
- s_stmt = NUM2ULONG(ads_stmt);
1308
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
1303
1309
 
1304
1310
  result = s_imp_drh->api.ads_num_params(s_stmt);
1305
1311
 
@@ -1333,7 +1339,7 @@ static_AdvantageInterface_ads_get_next_result(VALUE imp_drh, VALUE ads_stmt)
1333
1339
 
1334
1340
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1335
1341
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_ads_stmt );
1336
- s_stmt = NUM2ULONG(ads_stmt);
1342
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
1337
1343
 
1338
1344
  result = s_imp_drh->api.ads_get_next_result(s_stmt);
1339
1345
 
@@ -1368,7 +1374,7 @@ static_AdvantageInterface_ads_fetch_absolute(VALUE imp_drh, VALUE ads_stmt, VALU
1368
1374
 
1369
1375
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1370
1376
  //Data_Get_Struct( ads_stmt, ADSHANDLE, s_ads_stmt );
1371
- s_stmt = NUM2ULONG(ads_stmt);
1377
+ s_stmt = (ADSHANDLE)NUM2ULL(ads_stmt);
1372
1378
  s_offset = NUM2INT(offset);
1373
1379
  result = s_imp_drh->api.ads_fetch_absolute(s_stmt, s_offset);
1374
1380
 
@@ -1398,7 +1404,7 @@ static_AdvantageInterface_ads_sqlstate(VALUE imp_drh, VALUE ads_conn)
1398
1404
  char s_buffer[255];
1399
1405
 
1400
1406
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1401
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
1407
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
1402
1408
 
1403
1409
  result = s_imp_drh->api.ads_sqlstate(s_ads_conn, (UNSIGNED8 *)s_buffer, sizeof(s_buffer));
1404
1410
 
@@ -1429,7 +1435,7 @@ static_AdvantageInterface_ads_clear_error(VALUE imp_drh, VALUE ads_conn)
1429
1435
  a_ads_connection *s_ads_conn;
1430
1436
 
1431
1437
  Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);
1432
- Data_Get_Struct(ads_conn, a_ads_connection, s_ads_conn);
1438
+ TypedData_Get_Struct(ads_conn, a_ads_connection, &ads_connection_type, s_ads_conn);
1433
1439
 
1434
1440
  s_imp_drh->api.ads_clear_error(s_ads_conn);
1435
1441
 
@@ -24,6 +24,20 @@ require 'mkmf'
24
24
  CONFIG["debugflags"] = "-ggdb3"
25
25
  CONFIG["optflags"] = "-O0"
26
26
 
27
+ if RUBY_PLATFORM =~ /x64/
28
+ $defs << "-Dx64"
29
+ elsif RUBY_PLATFORM =~ /mingw|mswin/
30
+ # On 32-bit MinGW, ADS_WIN32 is defined but ENTRYPOINT falls through to
31
+ # _declspec(dllexport) which MinGW doesn't support (needs __declspec).
32
+ # Defining ADS_NT routes ENTRYPOINT to plain WINAPI instead.
33
+ $defs << "-DADS_NT"
34
+ end
35
+
36
+ # GCC 14+ (used by newer MinGW) promotes -Wincompatible-pointer-types to an
37
+ # error by default. The rb_define_method calls use the old VALUE(*)(ANYARGS)
38
+ # pattern which triggers this — downgrade back to a warning.
39
+ $CFLAGS << " -Wno-incompatible-pointer-types"
40
+
27
41
  dir_config('ADS')
28
42
 
29
43
  create_makefile("advantage")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: advantage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgar Sherman