advantage 0.1.2 → 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: 6cf8b67fe44d883fae68869b14f8304d14cf1ac6cd2bf9efd94b685b8933533d
4
- data.tar.gz: d90319799c8034c2e1055e5c797077136c940994de80231d62377b9741b92cfb
3
+ metadata.gz: 384998f9525f51b6edf754a2d4c4c4e988af28dbecf60be2f0b27ea99378f00c
4
+ data.tar.gz: e5ae988ce3e9a1e03220cdee7d23ee440e1bcc0bf29ac2664311a906d12efed9
5
5
  SHA512:
6
- metadata.gz: dfeabef311ac48beda103957c17c43ba16612a3ab166c2624dbdfd86e2d841c1b3e98e09a4a7774370ceed96587ed686fb76644290f8dfb05d6cd430a4513521
7
- data.tar.gz: afcb82f0dbb6f41e6ed3b0af9b946d67f5269176a2f09e65db4e445041029e7b593ece2b7ce3cf5de282543720ef3c2dcf93aa6d7f6da40f4a4a30df5ab22a25
6
+ metadata.gz: 3cfdf5c0d4b0eafcc9fcfcc77430a45fd17ac40a34c0096b7e9ced94297ed0959bec97b25efd21f8d61fe43701f577a003b3de4352713081c935ca77b86b0728
7
+ data.tar.gz: c9e090d0191ff557abb1cc99cb4b86730b6ac27da1fd5b94558202c84c3e5f0f4ccb8fe8811aa9c9504c95377e4f44c03fd4ca848d2572b8ac035224428914fd
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.8
7
+ before_install: gem install bundler -v 1.17.3
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in advantage.gemspec
4
+ gem 'test-unit'
5
+
data/Gemfile.lock ADDED
@@ -0,0 +1,15 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ power_assert (2.0.3)
5
+ test-unit (3.5.9)
6
+ power_assert
7
+
8
+ PLATFORMS
9
+ ruby
10
+
11
+ DEPENDENCIES
12
+ test-unit
13
+
14
+ BUNDLED WITH
15
+ 2.1.4
data/advantage.gemspec CHANGED
@@ -1,53 +1,54 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
- pkg_version = ""
5
- File.open(File.join("ext", "advantage", "advantage.c")) do |f|
4
+ pkg_version = ''
5
+ File.open(File.join('ext', 'advantage', 'advantage.c')) do |f|
6
6
  f.grep(/const char\s*\*\s*VERSION/) do |line|
7
7
  pkg_version = /\s*const char\s*\*\s*VERSION\s*=\s*["|']([^"']+)["|'];\s*/.match(line)[1]
8
8
  end
9
9
  end
10
10
 
11
11
  Gem::Specification.new do |spec|
12
- spec.name = "advantage"
12
+ spec.name = 'advantage'
13
13
  spec.version = pkg_version
14
- spec.authors = ["Edgar Sherman", "Jon Adams"]
15
- spec.email = ["advantage@sybase.com", "t12nslookup@googlemail.com"]
14
+ spec.authors = ['Edgar Sherman', 'Jon Adams']
15
+ spec.email = ['advantage@sybase.com', 't12nslookup@googlemail.com']
16
16
 
17
- spec.summary = %q{Advantage Database library for Ruby}
18
- spec.description = %q{Advantage Database Driver for Ruby}
19
- spec.homepage = "http://devzone.advantagedatabase.com"
20
- spec.license = "Apache-2.0"
17
+ spec.summary = 'Advantage Database library for Ruby'
18
+ spec.description = 'Advantage Database Driver for Ruby'
19
+ spec.homepage = 'http://devzone.advantagedatabase.com'
20
+ spec.license = 'Apache-2.0'
21
21
 
22
22
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
23
23
  # to allow pushing to a single host or delete this section to allow pushing to any host.
24
24
  if spec.respond_to?(:metadata)
25
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
25
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
26
26
 
27
- spec.metadata["homepage_uri"] = spec.homepage
27
+ spec.metadata['homepage_uri'] = spec.homepage
28
28
  # Changed to the github project, as this is the actively maintained source, now.
29
- spec.metadata["source_code_uri"] = "https://github.com/t12nslookup/advantage/"
30
- spec.metadata["changelog_uri"] = "https://github.com/t12nslookup/advantage/blob/master/CHANGELOG.md"
29
+ spec.metadata['source_code_uri'] = 'https://github.com/t12nslookup/advantage/'
30
+ spec.metadata['changelog_uri'] = 'https://github.com/t12nslookup/advantage/blob/master/CHANGELOG.md'
31
31
  else
32
- raise "RubyGems 2.0 or newer is required to protect against " \
33
- "public gem pushes."
32
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
33
+ 'public gem pushes.'
34
34
  end
35
35
 
36
36
  # Specify which files should be added to the gem when it is released.
37
37
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
38
- spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
38
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
39
39
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
40
40
  end
41
- spec.files = Dir["{test,lib,ext}/**/*",
42
- "LICENSE",
43
- "Rakefile",
44
- "README",
45
- "advantage.gemspec"]
46
- spec.require_paths = ["lib"]
47
-
48
- spec.add_development_dependency "bundler", "~> 1.17"
49
- spec.add_development_dependency "rake", "~> 10.0"
50
- spec.add_development_dependency "rspec", "~> 3.0"
51
- spec.add_development_dependency "rake-compiler", "~> 1.1"
52
- spec.extensions << "ext/advantage/extconf.rb"
41
+ spec.files += Dir['{test,lib,ext}/**/*',
42
+ 'LICENSE',
43
+ 'Rakefile',
44
+ 'README',
45
+ 'advantage.gemspec']
46
+ spec.require_paths = ['lib']
47
+
48
+ spec.add_development_dependency 'bundler', '~> 2.2.10'
49
+ spec.add_development_dependency 'rake', '~> 12.3.3'
50
+ spec.add_development_dependency 'rake-compiler', '~> 1.1'
51
+ spec.add_development_dependency 'rspec', '~> 3.0'
52
+
53
+ spec.extensions << 'ext/advantage/extconf.rb'
53
54
  end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "advantage"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/ext/advantage/ace.h CHANGED
@@ -154,7 +154,7 @@ typedef loff_t SIGNED64;
154
154
  #define RUBY_EXTERN extern
155
155
  #define STATIC static
156
156
 
157
- #if defined(ASANT) || defined(ADS_NT) || defined(ADS_WIN9X) || (defined(x64) && !defined(ADS_LINUX))
157
+ #if defined(ASANT) || defined(ADS_NT) || defined(ADS_WIN9X) || (defined(x64) && !defined(ADS_LINUX)) || (defined(_WIN64) && !defined(ADS_LINUX))
158
158
  #define ENTRYPOINT WINAPI
159
159
  #elif defined(ASANLM) || defined(ADS_LINUX) || defined(NLM)
160
160
  #define ENTRYPOINT
@@ -21,7 +21,7 @@
21
21
  #include "ruby.h"
22
22
  #include "adscapidll.h"
23
23
 
24
- const char *VERSION = "0.1.2";
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,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: advantage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgar Sherman
8
8
  - Jon Adams
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2020-11-09 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
@@ -17,56 +16,56 @@ dependencies:
17
16
  requirements:
18
17
  - - "~>"
19
18
  - !ruby/object:Gem::Version
20
- version: '1.17'
19
+ version: 2.2.10
21
20
  type: :development
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
24
  - - "~>"
26
25
  - !ruby/object:Gem::Version
27
- version: '1.17'
26
+ version: 2.2.10
28
27
  - !ruby/object:Gem::Dependency
29
28
  name: rake
30
29
  requirement: !ruby/object:Gem::Requirement
31
30
  requirements:
32
31
  - - "~>"
33
32
  - !ruby/object:Gem::Version
34
- version: '10.0'
33
+ version: 12.3.3
35
34
  type: :development
36
35
  prerelease: false
37
36
  version_requirements: !ruby/object:Gem::Requirement
38
37
  requirements:
39
38
  - - "~>"
40
39
  - !ruby/object:Gem::Version
41
- version: '10.0'
40
+ version: 12.3.3
42
41
  - !ruby/object:Gem::Dependency
43
- name: rspec
42
+ name: rake-compiler
44
43
  requirement: !ruby/object:Gem::Requirement
45
44
  requirements:
46
45
  - - "~>"
47
46
  - !ruby/object:Gem::Version
48
- version: '3.0'
47
+ version: '1.1'
49
48
  type: :development
50
49
  prerelease: false
51
50
  version_requirements: !ruby/object:Gem::Requirement
52
51
  requirements:
53
52
  - - "~>"
54
53
  - !ruby/object:Gem::Version
55
- version: '3.0'
54
+ version: '1.1'
56
55
  - !ruby/object:Gem::Dependency
57
- name: rake-compiler
56
+ name: rspec
58
57
  requirement: !ruby/object:Gem::Requirement
59
58
  requirements:
60
59
  - - "~>"
61
60
  - !ruby/object:Gem::Version
62
- version: '1.1'
61
+ version: '3.0'
63
62
  type: :development
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
66
65
  requirements:
67
66
  - - "~>"
68
67
  - !ruby/object:Gem::Version
69
- version: '1.1'
68
+ version: '3.0'
70
69
  description: Advantage Database Driver for Ruby
71
70
  email:
72
71
  - advantage@sybase.com
@@ -76,10 +75,17 @@ extensions:
76
75
  - ext/advantage/extconf.rb
77
76
  extra_rdoc_files: []
78
77
  files:
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".travis.yml"
81
+ - Gemfile
82
+ - Gemfile.lock
79
83
  - LICENSE
80
84
  - README
81
85
  - Rakefile
82
86
  - advantage.gemspec
87
+ - bin/console
88
+ - bin/setup
83
89
  - ext/advantage/ace.h
84
90
  - ext/advantage/adscapidll.c
85
91
  - ext/advantage/adscapidll.h
@@ -89,9 +95,6 @@ files:
89
95
  - ext/advantage/extconf.rb
90
96
  - test/advantage/advantage_test.rb
91
97
  - test/advantage/test.sql
92
- - test/mytest.rb
93
- - test/mytest2.rb
94
- - test/mytest3.rb
95
98
  homepage: http://devzone.advantagedatabase.com
96
99
  licenses:
97
100
  - Apache-2.0
@@ -100,7 +103,6 @@ metadata:
100
103
  homepage_uri: http://devzone.advantagedatabase.com
101
104
  source_code_uri: https://github.com/t12nslookup/advantage/
102
105
  changelog_uri: https://github.com/t12nslookup/advantage/blob/master/CHANGELOG.md
103
- post_install_message:
104
106
  rdoc_options: []
105
107
  require_paths:
106
108
  - lib
@@ -115,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
117
  - !ruby/object:Gem::Version
116
118
  version: '0'
117
119
  requirements: []
118
- rubygems_version: 3.1.2
119
- signing_key:
120
+ rubygems_version: 3.6.9
120
121
  specification_version: 4
121
122
  summary: Advantage Database library for Ruby
122
123
  test_files: []
data/test/mytest.rb DELETED
@@ -1,63 +0,0 @@
1
- begin
2
- require "rubygems"
3
- require "advantage"
4
- unless defined? Advantage
5
- # require 'advantage'
6
- if RUBY_VERSION >= "1.9"
7
- require_relative "../lib/advantage/advantage.so"
8
- else
9
- require File.join(File.dirname(__FILE__), "../lib/advantage/advantage.so")
10
- end
11
- end
12
- end
13
-
14
- # create an interface
15
- api = Advantage::AdvantageInterface.new()
16
- #
17
- # initialize the interface (loads the DLL/SO)
18
- Advantage::API.ads_initialize_interface(api)
19
- #
20
- # initialize our api object
21
- api.ads_init()
22
-
23
- # create a connection
24
- conn = api.ads_new_connection()
25
-
26
- # establish a connection
27
- conn_str = "data source=//172.27.144.1:6262/c\$/ads/db/mydb.add;user id=adssys;DateFormat=YYYY-MM-DD;CommType=TCP_IP;Compression=INTERNET"
28
- # conn_str = "data source=//10.0.0.4:6262/aislims/db/;user id=adssys;DateFormat=YYYY-MM-DD;CommType=TCP_IP;"
29
- val = api.ads_connect(conn, conn_str)
30
- puts "VAL: #{val.inspect}"
31
-
32
- # execute a query without a result set
33
- # puts api.ads_execute_immediate(conn, "select 'Successful Ruby Connection' from system.iota;").inspect
34
- # sql = "select 'Successful Ruby Connection' from system.iota;"
35
- # sql = "select * from discount;"
36
- sql = "EXECUTE PROCEDURE sp_GetTables( NULL, NULL, NULL, 'TABLE' );"
37
- rs = api.ads_execute_direct(conn, sql)
38
- puts "RS: #{rs.inspect}"
39
- loop do
40
- fetch = api.ads_fetch_next(rs)
41
- break if fetch == 0
42
- puts "FETCH: #{fetch.inspect}"
43
- res, ret_id = api.ads_get_column(rs, 0)
44
- puts "RES: #{res.inspect}, id: #{ret_id.inspect}"
45
- end
46
-
47
- puts "RS: #{rs.inspect}"
48
- puts "fetch: #{fetch.inspect}"
49
- puts "RES: #{res.inspect}, id: #{id.inspect}"
50
-
51
- # disconnect from the database
52
- puts api.ads_disconnect(conn).inspect
53
-
54
- # free the connection resources
55
- api.ads_free_connection(conn)
56
-
57
- # free resources the api object uses
58
- api.ads_fini()
59
-
60
- # close the interface
61
- Advantage::API.ads_finalize_interface(api)
62
-
63
- puts "finished"
data/test/mytest2.rb DELETED
@@ -1,67 +0,0 @@
1
- begin
2
- require "rubygems"
3
- require "advantage"
4
- unless defined? Advantage
5
- # require 'advantage'
6
- if RUBY_VERSION >= "1.9"
7
- require_relative "../lib/advantage/advantage.so"
8
- else
9
- require File.join(File.dirname(__FILE__), "../lib/advantage/advantage.so")
10
- end
11
- end
12
- end
13
-
14
- # create an interface
15
- api = Advantage::AdvantageInterface.new()
16
- #
17
- # initialize the interface (loads the DLL/SO)
18
- Advantage::API.ads_initialize_interface(api)
19
- #
20
- # initialize our api object
21
- api.ads_init()
22
-
23
- # create a connection
24
- conn = api.ads_new_connection()
25
-
26
- # establish a connection
27
- conn_str = "data source=//172.27.144.1:6262/c\$/ads/db/mydb.add;user id=adssys;DateFormat=YYYY-MM-DD;CommType=TCP_IP;Compression=INTERNET"
28
- # conn_str = "data source=//10.0.0.4:6262/aislims/db/;user id=adssys;DateFormat=YYYY-MM-DD;CommType=TCP_IP;"
29
- val = api.ads_connect(conn, conn_str)
30
- puts "VAL: #{val.inspect}"
31
-
32
- # execute a query without a result set
33
- # puts api.ads_execute_immediate(conn, "select 'Successful Ruby Connection' from system.iota;").inspect
34
- #sql = "select 'Successful Ruby Connection' from system.iota;"
35
- sql = "select * from discount;"
36
- rs = api.ads_execute_direct(conn, sql)
37
- puts "RS: #{rs.inspect}"
38
-
39
- record = []
40
- if (api.ads_num_cols(rs) > 0)
41
- while api.ads_fetch_next(rs) == 1
42
- max_cols = api.ads_num_cols(rs)
43
- result = Hash.new()
44
- max_cols.times do |cols|
45
- result[api.ads_get_column_info(rs, cols)[2]] = api.ads_get_column(rs, cols)[1]
46
- end
47
- record << result
48
- end
49
- @affected_rows = 0
50
- else
51
- @affected_rows = api.ads_affected_rows(rs)
52
- end
53
- puts "RECORD: #{record.inspect}"
54
-
55
- # disconnect from the database
56
- puts api.ads_disconnect(conn).inspect
57
-
58
- # free the connection resources
59
- api.ads_free_connection(conn)
60
-
61
- # free resources the api object uses
62
- api.ads_fini()
63
-
64
- # close the interface
65
- Advantage::API.ads_finalize_interface(api)
66
-
67
- puts "finished"
data/test/mytest3.rb DELETED
@@ -1,84 +0,0 @@
1
- begin
2
- require "rubygems"
3
- require "advantage"
4
- unless defined? Advantage
5
- # require 'advantage'
6
- if RUBY_VERSION >= "1.9"
7
- require_relative "../lib/advantage/advantage.so"
8
- else
9
- require File.join(File.dirname(__FILE__), "../lib/advantage/advantage.so")
10
- end
11
- end
12
- end
13
-
14
- # create an interface
15
- api = Advantage::AdvantageInterface.new()
16
- #
17
- # initialize the interface (loads the DLL/SO)
18
- Advantage::API.ads_initialize_interface(api)
19
- #
20
- # initialize our api object
21
- api.ads_init()
22
-
23
- # create a connection
24
- conn = api.ads_new_connection()
25
-
26
- # establish a connection
27
- conn_str = "data source=//172.27.144.1:6262/c\$/ads/db/;user id=adssys;DateFormat=YYYY-MM-DD;CommType=TCP_IP;Compression=INTERNET"
28
- # conn_str = "data source=//10.0.0.4:6262/aislims/db/;user id=adssys;DateFormat=YYYY-MM-DD;CommType=TCP_IP;"
29
- val = api.ads_connect(conn, conn_str)
30
- puts "VAL: #{val.inspect}"
31
-
32
- # execute a query without a result set
33
- # puts api.ads_execute_immediate(conn, "select 'Successful Ruby Connection' from system.iota;").inspect
34
- #sql = "select 'Successful Ruby Connection' from system.iota;"
35
- #sql = "EXECUTE PROCEDURE sp_GetTables( NULL, NULL, NULL, 'TABLE' );"
36
- sql = 'SELECT COUNT(*) FROM "DISCOUNT";'
37
- rs = api.ads_execute_direct(conn, sql)
38
- puts "RS: #{rs.inspect}"
39
-
40
- row_record = []
41
- cols = []
42
- acols = api.ads_num_cols(rs)
43
- puts "ACOLS: #{acols.inspect}"
44
-
45
- #if( api.ads_num_cols(rs) > 0)
46
- puts "HOORAY!"
47
- loop do
48
- fetch = api.ads_fetch_next(rs)
49
- puts "FETCH: #{fetch.inspect}"
50
- break if fetch == 0
51
- max_cols = api.ads_num_cols(rs)
52
- puts "MAX_COLS: #{max_cols.inspect}"
53
- max_cols = api.ads_num_cols(rs)
54
- row = []
55
- max_cols.times do |cols|
56
- # result[api.ads_get_column_info(rs, cols)[2]] = api.ads_get_column(rs, cols)[1]
57
- cinfo = api.ads_get_column_info(rs, cols)
58
- cols << cinfo[2].to_s
59
- cvalue = api.ads_get_column(rs, cols)[1]
60
- cvalue = "0.0" if cinfo[3] == 13 and cvalue.rstrip == ""
61
- cvalue.rstrip! if cinfo[3] == 2 and cvalue
62
- row << cvalue
63
- end
64
- row_record << row
65
- #end
66
- #else
67
- #puts "BOO!"
68
- end
69
- api.ads_free_stmt(rs)
70
- puts "RECORD: #{record.inspect}"
71
-
72
- # disconnect from the database
73
- puts api.ads_disconnect(conn).inspect
74
-
75
- # free the connection resources
76
- api.ads_free_connection(conn)
77
-
78
- # free resources the api object uses
79
- api.ads_fini()
80
-
81
- # close the interface
82
- Advantage::API.ads_finalize_interface(api)
83
-
84
- puts "finished"