advantage 0.1.2 → 0.1.3
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 +4 -4
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +15 -0
- data/advantage.gemspec +30 -29
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/advantage/ace.h +1 -1
- data/ext/advantage/advantage.c +1 -1
- metadata +20 -19
- data/test/mytest.rb +0 -63
- data/test/mytest2.rb +0 -67
- data/test/mytest3.rb +0 -84
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d4a533a4bd92806421ec906328dd81643ae4e6f4f22c0d4fa3ea20e1cf7d62a3
|
|
4
|
+
data.tar.gz: f36cdf1a7f3d799830fcf8538fde85005c42d78ee358f2f4eeef50111bfebba9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a19f30c748731609273a46981ca83ea1a76194b982e4267f9dfff50b7e577428c34ce4d619f7783a9935b7a1b65bbca4b7f15106b225f4fe135835a3e0e0df03
|
|
7
|
+
data.tar.gz: 13eedcb294619a892bb982af6419083038b9f727d6e9fd063b9da932da0662ebbeb0608e9cf7953ea2bea24d2d6272eb2505f5d1161d1f55538b00bf51afa718
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/advantage.gemspec
CHANGED
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
lib = File.expand_path(
|
|
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(
|
|
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 =
|
|
12
|
+
spec.name = 'advantage'
|
|
13
13
|
spec.version = pkg_version
|
|
14
|
-
spec.authors = [
|
|
15
|
-
spec.email = [
|
|
14
|
+
spec.authors = ['Edgar Sherman', 'Jon Adams']
|
|
15
|
+
spec.email = ['advantage@sybase.com', 't12nslookup@googlemail.com']
|
|
16
16
|
|
|
17
|
-
spec.summary =
|
|
18
|
-
spec.description =
|
|
19
|
-
spec.homepage =
|
|
20
|
-
spec.license =
|
|
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[
|
|
25
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
26
26
|
|
|
27
|
-
spec.metadata[
|
|
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[
|
|
30
|
-
spec.metadata[
|
|
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
|
|
33
|
-
|
|
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(
|
|
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
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
spec.require_paths = [
|
|
47
|
-
|
|
48
|
-
spec.add_development_dependency
|
|
49
|
-
spec.add_development_dependency
|
|
50
|
-
spec.add_development_dependency
|
|
51
|
-
spec.add_development_dependency
|
|
52
|
-
|
|
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
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
|
data/ext/advantage/advantage.c
CHANGED
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.
|
|
4
|
+
version: 0.1.3
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
40
|
+
version: 12.3.3
|
|
42
41
|
- !ruby/object:Gem::Dependency
|
|
43
|
-
name:
|
|
42
|
+
name: rake-compiler
|
|
44
43
|
requirement: !ruby/object:Gem::Requirement
|
|
45
44
|
requirements:
|
|
46
45
|
- - "~>"
|
|
47
46
|
- !ruby/object:Gem::Version
|
|
48
|
-
version: '
|
|
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: '
|
|
54
|
+
version: '1.1'
|
|
56
55
|
- !ruby/object:Gem::Dependency
|
|
57
|
-
name:
|
|
56
|
+
name: rspec
|
|
58
57
|
requirement: !ruby/object:Gem::Requirement
|
|
59
58
|
requirements:
|
|
60
59
|
- - "~>"
|
|
61
60
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: '
|
|
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: '
|
|
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.
|
|
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"
|