ruby-odbc 0.9998

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.
data/ruby-odbc.gemspec ADDED
@@ -0,0 +1,16 @@
1
+ require 'date'
2
+ spec = Gem::Specification.new do |s|
3
+ s.name = "ruby-odbc"
4
+ s.version = "0.9998"
5
+ s.date = Date.today.to_s
6
+ s.author = "Christian Werner"
7
+ s.email = "chw @nospam@ ch-werner.de"
8
+ s.summary = "ODBC binding for Ruby"
9
+ s.homepage = "http://www.ch-werner.de/rubyodbc"
10
+ s.files = Dir.glob("**/*")
11
+ s.require_paths << 'lib'
12
+ s.test_files = Dir.glob('tests/*.rb')
13
+ s.has_rdoc = false
14
+ s.extra_rdoc_files = ["README", "COPYING", "ChangeLog", "GPL", "doc/odbc.html"]
15
+ s.extensions = ["ext/extconf.rb", "ext/utf8/extconf.rb"]
16
+ end
data/test/00connect.rb ADDED
@@ -0,0 +1 @@
1
+ $c = ODBC.connect($dsn, $uid, $pwd)
@@ -0,0 +1 @@
1
+ $c.run("create table test (id int not null, str varchar(32) not null)")
data/test/20insert.rb ADDED
@@ -0,0 +1,6 @@
1
+ $q = $c.run("insert into test (id, str) values (1, 'foo')")
2
+ $q.run("insert into test (id, str) values (2, 'bar')")
3
+
4
+ $p = $c.proc("insert into test (id, str) values (?, ?)") {}
5
+ $p.call(3, "FOO")
6
+ $p[4, "BAR"]
data/test/30select.rb ADDED
@@ -0,0 +1,69 @@
1
+ $q = $c.prepare("select id,str from test")
2
+
3
+ if $q.column(0).name.upcase != "ID" then raise "fetch failed" end
4
+ if $q.column(1).name.upcase != "STR" then raise "fetch failed" end
5
+
6
+ $q.execute
7
+ if $q.fetch != [1, "foo"] then raise "fetch: failed" end
8
+ if $q.fetch != [2, "bar"] then raise "fetch: failed" end
9
+ if $q.fetch != [3, "FOO"] then raise "fetch: failed" end
10
+ if $q.fetch != [4, "BAR"] then raise "fetch: failed" end
11
+ if $q.fetch != nil then raise "fetch: failed" end
12
+ $q.close
13
+
14
+ if $q.execute.entries != [[1, "foo"], [2, "bar"], [3, "FOO"], [4, "BAR"]] then
15
+ raise "fetch: failed"
16
+ end
17
+ $q.close
18
+
19
+ if $q.execute.fetch_all != [[1, "foo"], [2, "bar"], [3, "FOO"], [4, "BAR"]] then
20
+ raise "fetch: failed"
21
+ end
22
+ $q.close
23
+
24
+ $q.execute
25
+ if $q.fetch_many(2) != [[1, "foo"], [2, "bar"]] then raise "fetch: failed" end
26
+ if $q.fetch_many(3) != [[3, "FOO"], [4, "BAR"]] then raise "fetch: failed" end
27
+ if $q.fetch_many(99) != nil then raise "fetch: failed" end
28
+ $q.close
29
+
30
+ a = []
31
+ $q.execute {|r| a=r.entries}
32
+ if a.size != 4 then raise "fetch: failed" end
33
+ $q.close
34
+
35
+ a = []
36
+ $q.execute.each {|r| a.push(r)}
37
+ if a.size != 4 then raise "fetch: failed" end
38
+ $q.close
39
+
40
+ a = []
41
+ $q.execute.each_hash {|r| a.push(r)}
42
+ if a.size != 4 then raise "fetch: failed" end
43
+ $q.close
44
+
45
+ a = []
46
+ $q.execute.each_hash(true) {|r| a.push(r)}
47
+ if a.size != 4 then raise "fetch: failed" end
48
+ $q.close
49
+
50
+ a = []
51
+ $q.execute.each_hash(:key=>:Symbol) {|r| a.push(r)}
52
+ if a.size != 4 then raise "fetch: failed" end
53
+ $q.close
54
+
55
+ a = []
56
+ $q.execute.each_hash(:key=>:Symbol,:table_names=>true) {|r| a.push(r)}
57
+ if a.size != 4 then raise "fetch: failed" end
58
+ $q.close
59
+
60
+ a = []
61
+ $q.execute.each_hash(:key=>:String,:table_names=>false) {|r| a.push(r)}
62
+ if a.size != 4 then raise "fetch: failed" end
63
+ $q.close
64
+
65
+ a = []
66
+ $q.execute.each_hash(:key=>:Fixnum,:table_names=>false) {|r| a.push(r)}
67
+ if a.size != 4 then raise "fetch: failed" end
68
+ $q.close
69
+
data/test/40update.rb ADDED
@@ -0,0 +1,4 @@
1
+ $q = $c.run("update test set id=0, str='hoge'")
2
+ if $q.nrows != 4 then
3
+ $stderr.print "update row count: expected 4, got ", $q.nrows, "\n"
4
+ end
@@ -0,0 +1,3 @@
1
+ # drop all statements, otherwise table might be locked for drop.
2
+ $c.drop_all
3
+ $c.do("drop table test")
data/test/70close.rb ADDED
@@ -0,0 +1 @@
1
+ $c.disconnect
data/test/test.rb ADDED
@@ -0,0 +1,32 @@
1
+ # $Id: test.rb,v 1.6 2004/11/17 07:40:03 chw Exp chw $
2
+ #
3
+ # Execute in ruby-odbc top directory.
4
+ #
5
+ # ruby test.rb "mysql-DSN" "mysql-user" "mysql-password"
6
+ #
7
+ # Test creates and deletes table "test" in that DSN.
8
+
9
+ require './odbc'
10
+
11
+ $dsn = ARGV.shift
12
+ $uid = ARGV.shift
13
+ $pwd = ARGV.shift
14
+
15
+ begin
16
+ Dir.glob("test/[0-9]*.rb").sort.each do |f|
17
+ f =~ /^test\/\d+(.*)\.rb$/
18
+ print $1 + "."*(20-$1.length)
19
+ $stdout.flush
20
+ load f
21
+ print "ok\n"
22
+ end
23
+ ensure
24
+ begin
25
+ $c.drop_all unless $c.class != ODBC::Database
26
+ rescue
27
+ end
28
+ begin
29
+ ODBC.connect($dsn, $uid, $pwd).do("drop table test")
30
+ rescue
31
+ end
32
+ end
data/test/utf8/test.rb ADDED
@@ -0,0 +1,32 @@
1
+ # $Id: test.rb,v 1.2 2004/11/17 07:40:03 chw Exp chw $
2
+ #
3
+ # Execute in ruby-odbc utf8 directory.
4
+ #
5
+ # ruby test.rb "mysql-DSN" "mysql-user" "mysql-password"
6
+ #
7
+ # Test creates and deletes table "test" in that DSN.
8
+
9
+ require './odbc_utf8'
10
+
11
+ $dsn = ARGV.shift
12
+ $uid = ARGV.shift
13
+ $pwd = ARGV.shift
14
+
15
+ begin
16
+ Dir.glob("../test/[0-9]*.rb").sort.each do |f|
17
+ f =~ /^..\/test\/\d+(.*)\.rb$/
18
+ print $1 + "."*(20-$1.length)
19
+ $stdout.flush
20
+ load f
21
+ print "ok\n"
22
+ end
23
+ ensure
24
+ begin
25
+ $c.drop_all unless $c.class != ODBC::Database
26
+ rescue
27
+ end
28
+ begin
29
+ ODBC.connect($dsn, $uid, $pwd).do("drop table test")
30
+ rescue
31
+ end
32
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: ruby-odbc
5
+ version: !ruby/object:Gem::Version
6
+ version: "0.9998"
7
+ date: 2010-01-15 00:00:00 +01:00
8
+ summary: ODBC binding for Ruby
9
+ require_paths:
10
+ - lib
11
+ - lib
12
+ email: chw @nospam@ ch-werner.de
13
+ homepage: http://www.ch-werner.de/rubyodbc
14
+ rubyforge_project:
15
+ description:
16
+ autorequire:
17
+ default_executable:
18
+ bindir: bin
19
+ has_rdoc: false
20
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
21
+ requirements:
22
+ - - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ platform: ruby
27
+ signing_key:
28
+ cert_chain:
29
+ post_install_message:
30
+ authors:
31
+ - Christian Werner
32
+ files:
33
+ - COPYING
34
+ - doc
35
+ - GPL
36
+ - lib
37
+ - ruby-odbc.gemspec
38
+ - README
39
+ - ChangeLog
40
+ - ext
41
+ - test
42
+ - MANIFEST
43
+ - doc/odbc.html
44
+ - lib/cqgen.rb
45
+ - ext/utf8
46
+ - ext/odbc.c
47
+ - ext/init.c
48
+ - ext/extconf.rb
49
+ - ext/utf8/odbc.c
50
+ - ext/utf8/init.c
51
+ - ext/utf8/extconf.rb
52
+ - test/00connect.rb
53
+ - test/50drop_table.rb
54
+ - test/test.rb
55
+ - test/30select.rb
56
+ - test/utf8
57
+ - test/70close.rb
58
+ - test/40update.rb
59
+ - test/10create_table.rb
60
+ - test/20insert.rb
61
+ - test/utf8/test.rb
62
+ test_files: []
63
+
64
+ rdoc_options: []
65
+
66
+ extra_rdoc_files:
67
+ - README
68
+ - COPYING
69
+ - ChangeLog
70
+ - GPL
71
+ - doc/odbc.html
72
+ executables: []
73
+
74
+ extensions:
75
+ - ext/extconf.rb
76
+ - ext/utf8/extconf.rb
77
+ requirements: []
78
+
79
+ dependencies: []
80
+