ydbi 0.5.0 → 0.5.1

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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +4 -0
  3. data/build/Rakefile.dbi.rb +4 -4
  4. data/lib/dbi/version.rb +1 -1
  5. data/test/dbi/tc_dbi.rb +1 -1
  6. metadata +9 -124
  7. data/.gitignore +0 -6
  8. data/Gemfile +0 -4
  9. data/Rakefile +0 -8
  10. data/TODO +0 -44
  11. data/bench/bench.rb +0 -79
  12. data/build/rake_task_lib.rb +0 -187
  13. data/doc/DBD_SPEC.rdoc +0 -88
  14. data/doc/DBI_SPEC.rdoc +0 -157
  15. data/doc/homepage/contact.html +0 -62
  16. data/doc/homepage/development.html +0 -124
  17. data/doc/homepage/index.html +0 -83
  18. data/doc/homepage/ruby-dbi.css +0 -91
  19. data/lib/dbd/Mysql.rb +0 -137
  20. data/lib/dbd/ODBC.rb +0 -89
  21. data/lib/dbd/Pg.rb +0 -188
  22. data/lib/dbd/SQLite.rb +0 -97
  23. data/lib/dbd/SQLite3.rb +0 -124
  24. data/lib/dbd/mysql/database.rb +0 -405
  25. data/lib/dbd/mysql/driver.rb +0 -125
  26. data/lib/dbd/mysql/statement.rb +0 -188
  27. data/lib/dbd/odbc/database.rb +0 -128
  28. data/lib/dbd/odbc/driver.rb +0 -38
  29. data/lib/dbd/odbc/statement.rb +0 -137
  30. data/lib/dbd/pg/database.rb +0 -516
  31. data/lib/dbd/pg/exec.rb +0 -47
  32. data/lib/dbd/pg/statement.rb +0 -160
  33. data/lib/dbd/pg/tuples.rb +0 -121
  34. data/lib/dbd/pg/type.rb +0 -209
  35. data/lib/dbd/sqlite/database.rb +0 -151
  36. data/lib/dbd/sqlite/statement.rb +0 -125
  37. data/lib/dbd/sqlite3/database.rb +0 -201
  38. data/lib/dbd/sqlite3/statement.rb +0 -78
  39. data/prototypes/types2.rb +0 -237
  40. data/setup.rb +0 -1585
  41. data/test/DBD_TESTS +0 -50
  42. data/test/TESTING +0 -16
  43. data/test/dbd/general/test_database.rb +0 -206
  44. data/test/dbd/general/test_statement.rb +0 -326
  45. data/test/dbd/general/test_types.rb +0 -296
  46. data/test/dbd/mysql/base.rb +0 -26
  47. data/test/dbd/mysql/down.sql +0 -19
  48. data/test/dbd/mysql/test_blob.rb +0 -18
  49. data/test/dbd/mysql/test_new_methods.rb +0 -7
  50. data/test/dbd/mysql/test_patches.rb +0 -111
  51. data/test/dbd/mysql/up.sql +0 -28
  52. data/test/dbd/odbc/base.rb +0 -30
  53. data/test/dbd/odbc/down.sql +0 -19
  54. data/test/dbd/odbc/test_new_methods.rb +0 -12
  55. data/test/dbd/odbc/test_ping.rb +0 -10
  56. data/test/dbd/odbc/test_statement.rb +0 -44
  57. data/test/dbd/odbc/test_transactions.rb +0 -58
  58. data/test/dbd/odbc/up.sql +0 -33
  59. data/test/dbd/postgresql/base.rb +0 -31
  60. data/test/dbd/postgresql/down.sql +0 -31
  61. data/test/dbd/postgresql/test_arrays.rb +0 -179
  62. data/test/dbd/postgresql/test_async.rb +0 -121
  63. data/test/dbd/postgresql/test_blob.rb +0 -36
  64. data/test/dbd/postgresql/test_bytea.rb +0 -87
  65. data/test/dbd/postgresql/test_ping.rb +0 -10
  66. data/test/dbd/postgresql/test_timestamp.rb +0 -77
  67. data/test/dbd/postgresql/test_transactions.rb +0 -58
  68. data/test/dbd/postgresql/testdbipg.rb +0 -307
  69. data/test/dbd/postgresql/up.sql +0 -60
  70. data/test/dbd/sqlite/base.rb +0 -32
  71. data/test/dbd/sqlite/test_database.rb +0 -30
  72. data/test/dbd/sqlite/test_driver.rb +0 -68
  73. data/test/dbd/sqlite/test_statement.rb +0 -112
  74. data/test/dbd/sqlite/up.sql +0 -25
  75. data/test/dbd/sqlite3/base.rb +0 -32
  76. data/test/dbd/sqlite3/test_database.rb +0 -77
  77. data/test/dbd/sqlite3/test_driver.rb +0 -67
  78. data/test/dbd/sqlite3/test_statement.rb +0 -88
  79. data/test/dbd/sqlite3/up.sql +0 -33
  80. data/test/ts_dbd.rb +0 -131
  81. data/ydbi.gemspec +0 -24
@@ -1,77 +0,0 @@
1
- class TestDatabase < DBDConfig.testbase(:sqlite3)
2
- def test_database_name
3
- assert_nothing_raised do
4
- assert_equal DBDConfig.get_config[dbtype]['dbname'], @dbh.database_name
5
- end
6
- end
7
-
8
- def test_disconnect
9
- assert_nil @dbh.disconnect
10
- assert_nil @dbh.instance_variable_get("@db")
11
- end
12
-
13
- def test_columns
14
- assert_equal [
15
- {
16
- :name => "name",
17
- :default => nil,
18
- :nullable => true,
19
- :sql_type => 100,
20
- :precision => 255,
21
- :type_name => "varchar"
22
- },
23
- {
24
- :name => "age",
25
- :default => nil,
26
- :nullable => true,
27
- :sql_type => 4,
28
- :type_name => "integer"
29
- }
30
- ], @dbh.columns("names")
31
-
32
- assert_equal [
33
- {
34
- :name => "name",
35
- :default => nil,
36
- :nullable => true,
37
- :sql_type => 100,
38
- :precision => 255,
39
- :type_name => "varchar"
40
- },
41
- {
42
- :name => "age",
43
- :default => nil,
44
- :nullable => true,
45
- :sql_type => 4,
46
- :type_name => "integer"
47
- }
48
- ], @dbh.columns("names_defined_with_spaces")
49
- end
50
-
51
- def test_parse_type
52
- # Some tests to ensure various whitespace and case styles don't confuse parse_type.
53
-
54
- match = DBI::DBD::SQLite3.parse_type( 'VARCHAR' )
55
- assert_equal 'VARCHAR', match[ 1 ]
56
-
57
- match = DBI::DBD::SQLite3.parse_type( 'VARCHAR(4096)' )
58
- assert_equal 'VARCHAR', match[ 1 ]
59
- assert_equal '4096', match[ 3 ]
60
-
61
- match = DBI::DBD::SQLite3.parse_type( 'varchar(4096)' )
62
- assert_equal 'varchar', match[ 1 ]
63
- assert_equal '4096', match[ 3 ]
64
-
65
- match = DBI::DBD::SQLite3.parse_type( 'VARCHAR( 4096 )' )
66
- assert_equal 'VARCHAR', match[ 1 ]
67
- assert_equal '4096', match[ 3 ]
68
-
69
- match = DBI::DBD::SQLite3.parse_type( 'VARCHAR ( 4096 )' )
70
- assert_equal 'VARCHAR', match[ 1 ]
71
- assert_equal '4096', match[ 3 ]
72
-
73
- match = DBI::DBD::SQLite3.parse_type( 'VARCHAR (4096)' )
74
- assert_equal 'VARCHAR', match[ 1 ]
75
- assert_equal '4096', match[ 3 ]
76
- end
77
- end
@@ -1,67 +0,0 @@
1
- class TestDriver < DBDConfig.testbase(:sqlite3)
2
- def test_require
3
- require 'dbd/SQLite3'
4
- assert_kind_of Module, DBI
5
- assert_kind_of Module, DBI::DBD
6
- assert_kind_of Module, DBI::DBD::SQLite3
7
- assert_kind_of Class, DBI::DBD::SQLite3::Driver
8
- assert_kind_of Class, DBI::DBD::SQLite3::Database
9
- assert_kind_of Class, DBI::DBD::SQLite3::Statement
10
- end
11
-
12
- def test_connect
13
- config = DBDConfig.get_config['sqlite3']
14
-
15
- # this tests DBI more than SQLite, but makes sure our chain works with it.
16
- dbh = DBI.connect("dbi:SQLite3:" + config['dbname'], nil, nil, {})
17
- assert dbh
18
- assert_kind_of DBI::DatabaseHandle, dbh
19
-
20
- # first argument should be a string
21
- assert_raises(DBI::InterfaceError) do
22
- DBI::DBD::SQLite3::Driver.new.connect(nil, nil, nil, { })
23
- end
24
-
25
- # that string should have some frackin' length
26
- assert_raises(DBI::InterfaceError) do
27
- DBI::DBD::SQLite3::Driver.new.connect("", nil, nil, { })
28
- end
29
-
30
- # last argument should be a hash
31
- assert_raises(DBI::InterfaceError) do
32
- DBI::DBD::SQLite3::Driver.new.connect(config['dbname'], nil, nil, nil)
33
- end
34
-
35
- dbh = nil
36
- driver = nil
37
- assert_nothing_raised do
38
- driver = DBI::DBD::SQLite3::Driver.new
39
- dbh = driver.connect(config['dbname'], nil, nil, { })
40
- end
41
-
42
- assert_kind_of DBI::DBD::SQLite3::Driver, driver
43
- assert_kind_of DBI::DBD::SQLite3::Database, dbh
44
-
45
- assert !dbh.instance_variable_get("@autocommit")
46
-
47
- dbh = nil
48
- driver = nil
49
- assert_nothing_raised do
50
- dbh = DBI::DBD::SQLite3::Driver.new.connect(config['dbname'], nil, nil, { "AutoCommit" => true, "sqlite_full_column_names" => true })
51
- end
52
-
53
- assert dbh
54
- assert dbh.instance_variable_get("@attr")
55
- assert_kind_of SQLite3::Database, dbh.instance_variable_get("@db")
56
-
57
- assert File.exists?(config['dbname'])
58
- end
59
-
60
- def setup
61
- end
62
-
63
- def teardown
64
- config = DBDConfig.get_config['sqlite3']
65
- FileUtils.rm_f(config['dbname'])
66
- end
67
- end
@@ -1,88 +0,0 @@
1
- class TestStatement < DBDConfig.testbase(:sqlite3)
2
- def test_constructor
3
- sth = DBI::DBD::SQLite3::Statement.new("select * from names", @dbh.instance_variable_get("@handle").instance_variable_get("@db"))
4
-
5
- assert_kind_of DBI::DBD::SQLite3::Statement, sth
6
- assert sth.instance_variable_get("@db")
7
- assert_kind_of ::SQLite3::Database, sth.instance_variable_get("@db")
8
- assert_equal(@dbh.instance_variable_get("@handle").instance_variable_get("@db"), sth.instance_variable_get("@db"))
9
- assert_kind_of ::SQLite3::Statement, sth.instance_variable_get("@stmt")
10
- assert_nil(@sth.instance_variable_get("@result"))
11
-
12
- sth.finish
13
-
14
- sth = @dbh.prepare("select * from names")
15
-
16
- assert_kind_of DBI::StatementHandle, sth
17
- sth.finish
18
- end
19
-
20
- def test_bind_param
21
- sth = DBI::DBD::SQLite3::Statement.new("select * from names", @dbh.instance_variable_get("@handle").instance_variable_get("@db"))
22
-
23
- assert_raises(DBI::InterfaceError) do
24
- sth.bind_param(:foo, "monkeys")
25
- end
26
-
27
- sth.finish
28
- end
29
-
30
- def test_column_info
31
- @sth = nil
32
-
33
- assert_nothing_raised do
34
- @sth = @dbh.prepare("select * from names")
35
- @sth.execute
36
- end
37
-
38
- assert_kind_of Array, @sth.column_info
39
- assert_kind_of DBI::ColumnInfo, @sth.column_info[0]
40
- assert_kind_of DBI::ColumnInfo, @sth.column_info[1]
41
- assert_equal [
42
- {
43
- :name => "name",
44
- :sql_type => 12,
45
- :precision => 255,
46
- :type_name => "varchar"
47
- },
48
- {
49
- :name => "age",
50
- :sql_type => 4,
51
- :type_name => "integer"
52
- }
53
- ], @sth.column_info
54
-
55
- @sth.finish
56
- end
57
-
58
- def test_specific_types
59
- assert_nothing_raised do
60
- @sth = @dbh.prepare("insert into db_specific_types_test (dbl) values (?)")
61
- @sth.execute(11111111.111111)
62
- @sth.execute(22)
63
- @sth.finish
64
- end
65
-
66
- assert_nothing_raised do
67
- @sth = @dbh.prepare("select * from db_specific_types_test")
68
- @sth.execute
69
- assert_equal([11111111.111111], @sth.fetch)
70
- assert_equal([22], @sth.fetch)
71
- @sth.finish
72
-
73
- assert_equal([[11111111.111111], [22]], @dbh.select_all("select * from db_specific_types_test"))
74
- end
75
-
76
- assert_nothing_raised do
77
- @sth = @dbh.prepare("insert into names (name, age) values (?, ?)")
78
- @sth.execute(:joseph, 20)
79
- @sth.finish
80
-
81
- @sth = @dbh.prepare("select name, age from names where name=?")
82
- @sth.execute("joseph")
83
- rows = @sth.fetch_all
84
- @sth.finish
85
- assert_equal(rows, [["joseph", 20]])
86
- end
87
- end
88
- end
@@ -1,33 +0,0 @@
1
- create table names (name varchar(255), age integer);
2
- ---
3
- insert into names (name, age) values ("Bob", 21);
4
- ---
5
- insert into names (name, age) values ("Joe", 19);
6
- ---
7
- insert into names (name, age) values ("Jim", 30);
8
- ---
9
- create table precision_test (text_field varchar(20) primary key not null, integer_field integer, decimal_field decimal(2,1), numeric_field numeric(30,6));
10
- ---
11
- create view view_names as select * from names;
12
- ---
13
- create table blob_test (name varchar(255));
14
- ---
15
- create table boolean_test (num integer, mybool boolean);
16
- ---
17
- create table time_test (mytime time);
18
- ---
19
- create table timestamp_test (mytimestamp timestamp);
20
- ---
21
- create table bit_test (mybit bit);
22
- ---
23
- create table field_types_test (foo integer not null primary key default 1);
24
- ---
25
- create table db_specific_types_test (dbl double);
26
- ---
27
- create table names_defined_with_spaces ( name varchar( 255 ), age integer );
28
- ---
29
- insert into names_defined_with_spaces (name, age) values ("Bob", 21);
30
- ---
31
- insert into names_defined_with_spaces (name, age) values ("Joe", 19);
32
- ---
33
- insert into names_defined_with_spaces (name, age) values ("Jim", 30);
data/test/ts_dbd.rb DELETED
@@ -1,131 +0,0 @@
1
- require 'rubygems'
2
- gem 'test-unit'
3
- # figure out what tests to run
4
- require 'yaml'
5
- require 'test/unit/testsuite'
6
- require 'test/unit/ui/console/testrunner'
7
-
8
- if File.basename(Dir.pwd) == "test"
9
- $:.unshift('../lib')
10
- else
11
- $:.unshift('lib')
12
- end
13
-
14
- module Test::Unit::Assertions
15
- def build_message(head, template=nil, *arguments)
16
- template += "\n" + "DATABASE: " + dbtype
17
- template &&= template.chomp
18
- return AssertionMessage.new(head, template, arguments)
19
- end
20
- end
21
-
22
- class Class
23
- def name=(klass_name)
24
- @name = klass_name
25
- end
26
-
27
- def name
28
- return @name || super
29
- end
30
- end
31
-
32
- module DBDConfig
33
- @testbase = { }
34
- @current_dbtype = nil
35
-
36
- def self.get_config
37
- config = nil
38
-
39
- begin
40
- config = YAML.load_file(File.join(ENV["HOME"], ".ruby-dbi.test-config.yaml"))
41
- rescue Exception => e
42
- config = { }
43
- config["dbtypes"] = [ ]
44
- end
45
-
46
- return config
47
- end
48
-
49
- def self.inject_sql(dbh, dbtype, file)
50
- # splits by --- in the file, strips newlines and the semicolons.
51
- # this way we can still manually import the file, but use it with our
52
- # drivers for client-independent injection.
53
- File.open(file).read.split(/\n*---\n*/, -1).collect { |x| x.gsub!(/\n/, ''); x.sub(/;\z/, '') }.each do |stmt|
54
- tmp = STDERR.dup
55
- STDERR.reopen('sql.log', 'a')
56
- begin
57
- dbh.commit rescue nil
58
- dbh["AutoCommit"] = true rescue nil
59
- dbh.do(stmt)
60
- dbh.commit unless dbtype == 'sqlite3'
61
- rescue Exception => e
62
- tmp.puts "Error injecting '#{stmt}' for db #{dbtype}"
63
- tmp.puts "Error: #{e.message}"
64
- end
65
- STDERR.reopen(tmp)
66
- end
67
- end
68
-
69
- def self.current_dbtype
70
- @current_dbtype
71
- end
72
-
73
- def self.current_dbtype=(setting)
74
- @current_dbtype = setting
75
- end
76
-
77
- def self.testbase(klass_name)
78
- return @testbase[klass_name]
79
- end
80
-
81
- def self.set_testbase(klass_name, klass)
82
- @testbase[klass_name] = klass
83
- klass.name = klass_name.to_s
84
- end
85
-
86
- def self.suite
87
- @suite ||= []
88
- end
89
- end
90
-
91
- if __FILE__ == $0
92
- Dir.chdir("..") if File.basename(Dir.pwd) == "test"
93
- $LOAD_PATH.unshift(File.join(Dir.pwd, "lib"))
94
- Dir.chdir("test") rescue nil
95
-
96
- begin
97
- require 'dbi'
98
- rescue LoadError => e
99
- begin
100
- require 'rubygems'
101
- gem 'dbi'
102
- require 'dbi'
103
- rescue LoadError => e
104
- abort "DBI must already be installed or must come with this package for tests to work."
105
- end
106
- end
107
-
108
- Deprecate.set_action(proc { })
109
-
110
- config = DBDConfig.get_config
111
-
112
- config["dbtypes"] = ENV["DBTYPES"].split(/\s+/) if ENV["DBTYPES"]
113
-
114
- if config and config["dbtypes"]
115
- config["dbtypes"].each do |dbtype|
116
- unless config[dbtype]
117
- warn "#{dbtype} is selected for testing but not configured; see test/DBD_TESTS"
118
- next
119
- end
120
-
121
- # base.rb is special, see DBD_TESTS
122
- require "dbd/#{dbtype}/base.rb"
123
- Dir["dbd/#{dbtype}/test*.rb"].each { |file| require file }
124
- # run the general tests
125
- DBDConfig.current_dbtype = dbtype.to_sym
126
- Dir["dbd/general/test*.rb"].each { |file| load file; @class.name = file; DBDConfig.suite << @class }
127
- end
128
- elsif !config["dbtypes"]
129
- warn "Please see test/DBD_TESTS for information on configuring DBD tests."
130
- end
131
- end
data/ydbi.gemspec DELETED
@@ -1,24 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'dbi/version'
5
- Gem::Specification.new do |gem|
6
- gem.name = 'ydbi'
7
- gem.version = DBI::VERSION
8
- gem.authors = ['Erik Hollensbe', 'Christopher Maujean']
9
- gem.email = 'ruby-dbi-users@rubyforge.org'
10
- gem.homepage = 'http://www.rubyforge.org/projects/ruby-dbi'
11
- gem.summary = 'A vendor independent interface for accessing databases, similar to Perl\'s DBI'
12
- gem.description = 'Branch by ywesee com, as our patches were never accepted by upstream'
13
- gem.has_rdoc = true
14
-
15
- gem.files = `git ls-files`.split($/)
16
- gem.test_file = 'test/ts_dbi.rb'
17
- gem.executables = ['dbi', 'test_broken_dbi']
18
- gem.require_paths = ['lib']
19
-
20
- gem.add_development_dependency "rake"
21
- gem.add_development_dependency "minitest"
22
- gem.add_development_dependency "test-unit"
23
- gem.add_runtime_dependency 'deprecated', '= 2.0.1'
24
- end