dbi 0.4.1 → 0.4.2

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.
@@ -13,14 +13,17 @@ end
13
13
  task :package => (map_task("package") + map_task("gem"))
14
14
  task :clobber_package => map_task("clobber_package")
15
15
 
16
+ desc 'Run interface tests (no database connectivity required)'
16
17
  task :test_dbi do
17
18
  ruby("test/ts_dbi.rb")
18
19
  end
19
20
 
21
+ desc 'Run database-specific tests'
20
22
  task :test_dbd do
21
23
  ruby("test/ts_dbd.rb")
22
24
  end
23
25
 
26
+ desc 'Run full test suite'
24
27
  task :test => [:test_dbi, :test_dbd]
25
28
 
26
29
  build_dbi_tasks
data/lib/dbi.rb CHANGED
@@ -90,7 +90,7 @@ Deprecate.set_action(
90
90
 
91
91
  #++
92
92
  module DBI
93
- VERSION = "0.4.1"
93
+ VERSION = "0.4.2"
94
94
 
95
95
  module DBD # :nodoc:
96
96
  API_VERSION = "0.3"
@@ -107,6 +107,12 @@ module DBI
107
107
  @@trace_output = DEFAULT_TRACE_OUTPUT
108
108
  @@caseless_driver_name_map = nil
109
109
  @@convert_types = true
110
+ @@last_connection = nil
111
+
112
+ # Return the last connection attempted.
113
+ def self.last_connection
114
+ @@last_connection
115
+ end
110
116
 
111
117
  # Return the current status of type conversion at this level. This status
112
118
  # will be propogated to any new DatabaseHandles created.
@@ -139,7 +145,7 @@ module DBI
139
145
  dr, db_args = _get_full_driver(driver_url)
140
146
  dh = dr[0] # driver-handle
141
147
  dh.convert_types = @@convert_types
142
- dh.connect(db_args, user, auth, params, &p)
148
+ @@last_connection = dh.connect(db_args, user, auth, params, &p)
143
149
  end
144
150
 
145
151
  # Load a DBD and returns the DriverHandle object
@@ -255,7 +261,7 @@ module DBI
255
261
  begin
256
262
  require @@caseless_driver_name_map[dc] if @@caseless_driver_name_map[dc]
257
263
  rescue LoadError => e2
258
- raise e.class, "Could not find driver #{driver_name} or #{driver_name.downcase} (error: #{e1.message})"
264
+ raise e1.class, "Could not find driver #{driver_name} or #{driver_name.downcase} (error: #{e1.message})"
259
265
  end
260
266
  end
261
267
 
@@ -9,6 +9,7 @@ module DBI
9
9
  # database is not connected.
10
10
  class DatabaseHandle < Handle
11
11
 
12
+ attr_accessor :last_statement
12
13
  attr_accessor :raise_error
13
14
 
14
15
  # This is the driver name as supplied by the DBD's driver_name method.
@@ -49,6 +50,7 @@ module DBI
49
50
  #
50
51
  def prepare(stmt)
51
52
  sanity_check(stmt)
53
+ @last_statement = stmt
52
54
  sth = StatementHandle.new(@handle.prepare(stmt), false, true, @convert_types)
53
55
  # FIXME trace sth.trace(@trace_mode, @trace_output)
54
56
  sth.dbh = self
@@ -71,6 +73,7 @@ module DBI
71
73
  def execute(stmt, *bindvars)
72
74
  sanity_check(stmt)
73
75
 
76
+ @last_statement = stmt
74
77
  if @convert_types
75
78
  bindvars = DBI::Utils::ConvParam.conv_param(driver_name, *bindvars)
76
79
  end
@@ -99,6 +102,7 @@ module DBI
99
102
  def do(stmt, *bindvars)
100
103
  sanity_check(stmt)
101
104
 
105
+ @last_statement = stmt
102
106
  @handle.do(stmt, *DBI::Utils::ConvParam.conv_param(driver_name, *bindvars))
103
107
  end
104
108
 
@@ -131,6 +135,14 @@ module DBI
131
135
  return rows
132
136
  end
133
137
 
138
+ #
139
+ # Return the name of the database we are connected to.
140
+ #
141
+ def database_name
142
+ sanity_check
143
+ @handle.database_name
144
+ end
145
+
134
146
  #
135
147
  # Return the tables available to this DatabaseHandle as an array of strings.
136
148
  #
@@ -226,8 +226,18 @@ module DBI
226
226
  def clone
227
227
  Marshal.load(Marshal.dump(self))
228
228
  end
229
-
230
- alias dup clone
229
+
230
+ def dup
231
+ row = self.class.allocate
232
+ row.instance_variable_set :@column_types, @column_types
233
+ row.instance_variable_set :@convert_types, @convert_types
234
+ row.instance_variable_set :@column_map, @column_map
235
+ row.instance_variable_set :@column_names, @column_names
236
+ # this is the only one we actually dup...
237
+ row.instance_variable_set :@arr, arr = @arr.dup
238
+ row.instance_variable_set :@_dc_obj, arr
239
+ row
240
+ end
231
241
  end
232
242
 
233
243
  private
@@ -102,19 +102,77 @@ module DBI
102
102
  # Represents a SQL TIMESTAMP and returns DateTime. Falls back to Null.
103
103
  #
104
104
  class Timestamp < Null
105
+ def self.create(year, month, day, hour, min, sec, usec=0, of=0)
106
+ # DateTime will remove leap and leap-leap seconds
107
+ sec = 59 if sec > 59
108
+ # store this before we modify it
109
+ civil = year, month, day
110
+ time = hour, min, sec, usec
111
+ if month <= 2
112
+ month += 12
113
+ year -= 1
114
+ end
115
+ y = year + 4800
116
+ m = month - 3
117
+ jd = day + (153 * m + 2) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 32045
118
+ #fr = hour / 24.0 + min / 1440.0 + sec / 86400.0
119
+ # ridiculously, this line does the same thing but twice as fast... :/
120
+ fr = ::Time.gm(1970, 1, 1, hour, min, sec, usec).to_f / 86400
121
+ date = ::DateTime.new!(jd + fr - 0.5, of, ::DateTime::ITALY)
122
+ prefill_cache date, civil, time
123
+ date
124
+ end
125
+
126
+ if RUBY_VERSION =~ /^1\.8\./
127
+ def self.prefill_cache date, civil, time
128
+ time[3] /= 86400000000.0
129
+ date.instance_variable_set :"@__#{:civil.to_i}__", [civil]
130
+ date.instance_variable_set :"@__#{:time.to_i}__", [time]
131
+ end
132
+ else
133
+ def self.prefill_cache date, civil, time
134
+ time[3] /= 1000000.0
135
+ date.instance_variable_get(:@__ca__)[:civil.object_id] = civil
136
+ date.instance_variable_get(:@__ca__)[:time.object_id] = time
137
+ end
138
+ end
139
+
140
+ def self.parse_string str
141
+ # special casing the common formats here gives roughly an
142
+ # 8-fold speed boost over using Date._parse
143
+ case str
144
+ when /^(\d{4})-(\d{2})-(\d{2})(?: (\d{2}):(\d{2}):(\d{2})(\.\d+)?)?(?: ([+-]?\d{2}):?(\d{2}))?$/
145
+ parts = $~[1..-4].map { |s| s.to_i }
146
+ parts << $7.to_f * 1000000.0
147
+ parts << ($8 ? ($8.to_f * 60 + $9.to_i) / 1440 : 0)
148
+ else
149
+ parts = ::Date._parse(str).values_at(:year, :mon, :mday, :hour, :min, :sec, :sec_fraction, :offset)
150
+ # some defaults
151
+ today = nil
152
+ 8.times do |i|
153
+ next if parts[i]
154
+ today ||= ::Time.now.to_a.values_at(5, 4, 3) + [0, 0, 0, 0, 0]
155
+ parts[i] = today[i]
156
+ end
157
+ parts[6] *= 1000000.0
158
+ parts[7] /= 86400.0
159
+ end
160
+ parts
161
+ end
162
+
105
163
  def self.parse(obj)
106
- obj = super
107
- return obj unless obj
108
- case obj.class
164
+ case obj
109
165
  when ::DateTime
110
166
  return obj
111
167
  when ::Date
112
- return ::DateTime.parse(obj.to_s)
168
+ return create(obj.year, obj.month, obj.day, 0, 0, 0)
113
169
  when ::Time
114
- return ::DateTime.parse(obj.to_s)
170
+ return create(obj.year, obj.month, obj.day, obj.hour, obj.min, obj.sec, obj.usec, obj.utc_offset / 86400.0)
115
171
  else
116
- return ::DateTime.parse(obj.to_s) if obj.respond_to? :to_s
117
- return ::DateTime.parse(obj.to_str) if obj.respond_to? :to_str
172
+ obj = super
173
+ return obj unless obj
174
+ return create(*parse_string(obj.to_s)) if obj.respond_to? :to_s
175
+ return create(*parse_string(obj.to_str)) if obj.respond_to? :to_str
118
176
  return obj
119
177
  end
120
178
  end
@@ -13,127 +13,144 @@ require 'dbi'
13
13
  require 'test/unit'
14
14
 
15
15
  class TC_DBI < Test::Unit::TestCase
16
- def setup
17
- @db_error = DBI::DatabaseError.new("test", 1, "montana")
18
- @db_binary = DBI::Binary.new("test")
19
- @url_basic = 'dbi:foo:bar'
20
- @url_inter = 'dbi:foo:bar:host'
21
- @url_advan = 'dbi:foo:database=db;host=xx;port=99'
22
- end
23
-
24
- def test_dbi_version
25
- assert_equal("0.4.1", DBI::VERSION)
26
- end
27
-
28
- def test_dbd_module
29
- assert_equal("0.3", DBI::DBD::API_VERSION)
30
- end
31
-
32
- def test_fetch_scroll_constants
33
- assert_equal(1, DBI::SQL_FETCH_NEXT)
34
- assert_equal(2, DBI::SQL_FETCH_PRIOR)
35
- assert_equal(3, DBI::SQL_FETCH_FIRST)
36
- assert_equal(4, DBI::SQL_FETCH_LAST)
37
- assert_equal(5, DBI::SQL_FETCH_ABSOLUTE)
38
- assert_equal(6, DBI::SQL_FETCH_RELATIVE)
39
- end
40
-
41
- def test_sql_type_constants
42
- assert_equal(1, DBI::SQL_CHAR)
43
- assert_equal(2, DBI::SQL_NUMERIC)
44
- assert_equal(3, DBI::SQL_DECIMAL)
45
- assert_equal(4, DBI::SQL_INTEGER)
46
- assert_equal(5, DBI::SQL_SMALLINT)
47
- assert_equal(6, DBI::SQL_FLOAT)
48
- assert_equal(7, DBI::SQL_REAL)
49
- assert_equal(8, DBI::SQL_DOUBLE)
50
- assert_equal(9, DBI::SQL_DATE)
51
- assert_equal(10, DBI::SQL_TIME)
52
- assert_equal(11, DBI::SQL_TIMESTAMP)
53
- assert_equal(12, DBI::SQL_VARCHAR)
54
- assert_equal(100, DBI::SQL_OTHER)
55
- assert_equal(-1, DBI::SQL_LONGVARCHAR)
56
- assert_equal(-2, DBI::SQL_BINARY)
57
- assert_equal(-3, DBI::SQL_VARBINARY)
58
- assert_equal(-4, DBI::SQL_LONGVARBINARY)
59
- assert_equal(-5, DBI::SQL_BIGINT)
60
- assert_equal(-6, DBI::SQL_TINYINT)
61
- assert_equal(-7, DBI::SQL_BIT)
62
- assert_equal(-10, DBI::SQL_BLOB)
63
- assert_equal(-11, DBI::SQL_CLOB)
64
- end
65
-
66
- def test_sql_type_names
67
- assert_equal('BIT', DBI::SQL_TYPE_NAMES[DBI::SQL_BIT])
68
- assert_equal('TINYINT', DBI::SQL_TYPE_NAMES[DBI::SQL_TINYINT])
69
- assert_equal('SMALLINT', DBI::SQL_TYPE_NAMES[DBI::SQL_SMALLINT])
70
- assert_equal('INTEGER', DBI::SQL_TYPE_NAMES[DBI::SQL_INTEGER])
71
- assert_equal('BIGINT', DBI::SQL_TYPE_NAMES[DBI::SQL_BIGINT])
72
- assert_equal('FLOAT', DBI::SQL_TYPE_NAMES[DBI::SQL_FLOAT])
73
- assert_equal('REAL', DBI::SQL_TYPE_NAMES[DBI::SQL_REAL])
74
- assert_equal('DOUBLE', DBI::SQL_TYPE_NAMES[DBI::SQL_DOUBLE])
75
- assert_equal('NUMERIC', DBI::SQL_TYPE_NAMES[DBI::SQL_NUMERIC])
76
- assert_equal('DECIMAL', DBI::SQL_TYPE_NAMES[DBI::SQL_DECIMAL])
77
- assert_equal('CHAR', DBI::SQL_TYPE_NAMES[DBI::SQL_CHAR])
78
- assert_equal('VARCHAR', DBI::SQL_TYPE_NAMES[DBI::SQL_VARCHAR])
79
- assert_equal('LONG VARCHAR', DBI::SQL_TYPE_NAMES[DBI::SQL_LONGVARCHAR])
80
- assert_equal('DATE', DBI::SQL_TYPE_NAMES[DBI::SQL_DATE])
81
- assert_equal('TIME', DBI::SQL_TYPE_NAMES[DBI::SQL_TIME])
82
- assert_equal('TIMESTAMP', DBI::SQL_TYPE_NAMES[DBI::SQL_TIMESTAMP])
83
- assert_equal('BINARY', DBI::SQL_TYPE_NAMES[DBI::SQL_BINARY])
84
- assert_equal('VARBINARY', DBI::SQL_TYPE_NAMES[DBI::SQL_VARBINARY])
85
- assert_equal('LONG VARBINARY',
86
- DBI::SQL_TYPE_NAMES[DBI::SQL_LONGVARBINARY])
87
- assert_equal('BLOB', DBI::SQL_TYPE_NAMES[DBI::SQL_BLOB])
88
- assert_equal('CLOB', DBI::SQL_TYPE_NAMES[DBI::SQL_CLOB])
89
- assert_equal(nil, DBI::SQL_TYPE_NAMES[DBI::SQL_OTHER])
90
- end
91
-
92
- def test_dbi_exception_classes
93
- assert(DBI::Error)
94
- assert(DBI::Warning)
95
- assert(DBI::InterfaceError)
96
- assert(DBI::NotImplementedError)
97
- assert(DBI::DatabaseError)
98
- assert(DBI::DataError)
99
- assert(DBI::OperationalError)
100
- assert(DBI::IntegrityError)
101
- assert(DBI::InternalError)
102
- assert(DBI::ProgrammingError)
103
- assert(DBI::NotSupportedError)
104
- end
16
+ def setup
17
+ @db_error = DBI::DatabaseError.new("test", 1, "montana")
18
+ @db_binary = DBI::Binary.new("test")
19
+ @url_basic = 'dbi:foo:bar'
20
+ @url_inter = 'dbi:foo:bar:host'
21
+ @url_advan = 'dbi:foo:database=db;host=xx;port=99'
22
+ end
23
+
24
+ def test_dbi_version
25
+ assert_equal("0.4.2", DBI::VERSION)
26
+ end
27
+
28
+ def test_dbd_module
29
+ assert_equal("0.3", DBI::DBD::API_VERSION)
30
+ end
31
+
32
+ def test_fetch_scroll_constants
33
+ assert_equal(1, DBI::SQL_FETCH_NEXT)
34
+ assert_equal(2, DBI::SQL_FETCH_PRIOR)
35
+ assert_equal(3, DBI::SQL_FETCH_FIRST)
36
+ assert_equal(4, DBI::SQL_FETCH_LAST)
37
+ assert_equal(5, DBI::SQL_FETCH_ABSOLUTE)
38
+ assert_equal(6, DBI::SQL_FETCH_RELATIVE)
39
+ end
40
+
41
+ def test_sql_type_constants
42
+ assert_equal(1, DBI::SQL_CHAR)
43
+ assert_equal(2, DBI::SQL_NUMERIC)
44
+ assert_equal(3, DBI::SQL_DECIMAL)
45
+ assert_equal(4, DBI::SQL_INTEGER)
46
+ assert_equal(5, DBI::SQL_SMALLINT)
47
+ assert_equal(6, DBI::SQL_FLOAT)
48
+ assert_equal(7, DBI::SQL_REAL)
49
+ assert_equal(8, DBI::SQL_DOUBLE)
50
+ assert_equal(9, DBI::SQL_DATE)
51
+ assert_equal(10, DBI::SQL_TIME)
52
+ assert_equal(11, DBI::SQL_TIMESTAMP)
53
+ assert_equal(12, DBI::SQL_VARCHAR)
54
+ assert_equal(100, DBI::SQL_OTHER)
55
+ assert_equal(-1, DBI::SQL_LONGVARCHAR)
56
+ assert_equal(-2, DBI::SQL_BINARY)
57
+ assert_equal(-3, DBI::SQL_VARBINARY)
58
+ assert_equal(-4, DBI::SQL_LONGVARBINARY)
59
+ assert_equal(-5, DBI::SQL_BIGINT)
60
+ assert_equal(-6, DBI::SQL_TINYINT)
61
+ assert_equal(-7, DBI::SQL_BIT)
62
+ assert_equal(-10, DBI::SQL_BLOB)
63
+ assert_equal(-11, DBI::SQL_CLOB)
64
+ end
65
+
66
+ def test_sql_type_names
67
+ assert_equal('BIT', DBI::SQL_TYPE_NAMES[DBI::SQL_BIT])
68
+ assert_equal('TINYINT', DBI::SQL_TYPE_NAMES[DBI::SQL_TINYINT])
69
+ assert_equal('SMALLINT', DBI::SQL_TYPE_NAMES[DBI::SQL_SMALLINT])
70
+ assert_equal('INTEGER', DBI::SQL_TYPE_NAMES[DBI::SQL_INTEGER])
71
+ assert_equal('BIGINT', DBI::SQL_TYPE_NAMES[DBI::SQL_BIGINT])
72
+ assert_equal('FLOAT', DBI::SQL_TYPE_NAMES[DBI::SQL_FLOAT])
73
+ assert_equal('REAL', DBI::SQL_TYPE_NAMES[DBI::SQL_REAL])
74
+ assert_equal('DOUBLE', DBI::SQL_TYPE_NAMES[DBI::SQL_DOUBLE])
75
+ assert_equal('NUMERIC', DBI::SQL_TYPE_NAMES[DBI::SQL_NUMERIC])
76
+ assert_equal('DECIMAL', DBI::SQL_TYPE_NAMES[DBI::SQL_DECIMAL])
77
+ assert_equal('CHAR', DBI::SQL_TYPE_NAMES[DBI::SQL_CHAR])
78
+ assert_equal('VARCHAR', DBI::SQL_TYPE_NAMES[DBI::SQL_VARCHAR])
79
+ assert_equal('LONG VARCHAR', DBI::SQL_TYPE_NAMES[DBI::SQL_LONGVARCHAR])
80
+ assert_equal('DATE', DBI::SQL_TYPE_NAMES[DBI::SQL_DATE])
81
+ assert_equal('TIME', DBI::SQL_TYPE_NAMES[DBI::SQL_TIME])
82
+ assert_equal('TIMESTAMP', DBI::SQL_TYPE_NAMES[DBI::SQL_TIMESTAMP])
83
+ assert_equal('BINARY', DBI::SQL_TYPE_NAMES[DBI::SQL_BINARY])
84
+ assert_equal('VARBINARY', DBI::SQL_TYPE_NAMES[DBI::SQL_VARBINARY])
85
+ assert_equal('LONG VARBINARY',
86
+ DBI::SQL_TYPE_NAMES[DBI::SQL_LONGVARBINARY])
87
+ assert_equal('BLOB', DBI::SQL_TYPE_NAMES[DBI::SQL_BLOB])
88
+ assert_equal('CLOB', DBI::SQL_TYPE_NAMES[DBI::SQL_CLOB])
89
+ assert_equal(nil, DBI::SQL_TYPE_NAMES[DBI::SQL_OTHER])
90
+ end
91
+
92
+ def test_dbi_exception_classes
93
+ assert(DBI::Error)
94
+ assert(DBI::Warning)
95
+ assert(DBI::InterfaceError)
96
+ assert(DBI::NotImplementedError)
97
+ assert(DBI::DatabaseError)
98
+ assert(DBI::DataError)
99
+ assert(DBI::OperationalError)
100
+ assert(DBI::IntegrityError)
101
+ assert(DBI::InternalError)
102
+ assert(DBI::ProgrammingError)
103
+ assert(DBI::NotSupportedError)
104
+ end
105
105
 
106
106
  # This error class gets extra testing since it defines some custom
107
107
  # accessors.
108
108
  def test_dbi_database_error
109
- assert_respond_to(@db_error, :errstr)
110
- assert_respond_to(@db_error, :err)
111
- assert_respond_to(@db_error, :state)
112
- assert_equal("test", @db_error.errstr)
113
- assert_equal(1, @db_error.err)
114
- assert_equal("montana", @db_error.state)
109
+ assert_respond_to(@db_error, :errstr)
110
+ assert_respond_to(@db_error, :err)
111
+ assert_respond_to(@db_error, :state)
112
+ assert_equal("test", @db_error.errstr)
113
+ assert_equal(1, @db_error.err)
114
+ assert_equal("montana", @db_error.state)
115
115
  end
116
116
 
117
117
  def test_binary_datatype
118
- assert_respond_to(@db_binary, :data)
119
- assert_respond_to(@db_binary, :to_s)
120
- assert_equal("test", @db_binary.data)
121
- assert_equal("test", @db_binary.to_s)
118
+ assert_respond_to(@db_binary, :data)
119
+ assert_respond_to(@db_binary, :to_s)
120
+ assert_equal("test", @db_binary.data)
121
+ assert_equal("test", @db_binary.to_s)
122
122
  end
123
123
 
124
124
  def test_misc_constants
125
- assert_equal(2, DBI::DEFAULT_TRACE_MODE)
126
- assert_equal(STDERR, DBI::DEFAULT_TRACE_OUTPUT)
125
+ assert_equal(2, DBI::DEFAULT_TRACE_MODE)
126
+ assert_equal(STDERR, DBI::DEFAULT_TRACE_OUTPUT)
127
127
  end
128
128
 
129
- def test_connect
130
- assert_respond_to(DBI, :connect)
129
+ def test_last_connection
130
+ assert_respond_to(DBI, :last_connection)
131
131
  end
132
132
 
133
- def test_available_drivers
134
- assert_respond_to(DBI, :available_drivers)
133
+ def test_convert_types
134
+ assert_respond_to(DBI, :convert_types)
135
+ assert_respond_to(DBI, :convert_types=)
136
+ end
137
+
138
+ def test_connect
139
+ assert_respond_to(DBI, :connect)
135
140
  end
136
141
 
142
+ def test_available_drivers
143
+ assert_respond_to(DBI, :available_drivers)
144
+ assert_equal(
145
+ [
146
+ "dbi:Mysql:",
147
+ "dbi:ODBC:",
148
+ "dbi:Pg:",
149
+ "dbi:SQLite3:",
150
+ "dbi:SQLite:"
151
+ ], DBI.available_drivers.sort)
152
+ end
153
+
137
154
  # PRIVATE METHODS
138
155
  def test_parse_url
139
156
  assert_nothing_raised{ DBI.send(:parse_url, "dbi:foo:bar") }
@@ -160,17 +177,6 @@ class TC_DBI < Test::Unit::TestCase
160
177
  end
161
178
  end
162
179
 
163
- def test_available_drivers
164
- assert_equal(
165
- [
166
- "dbi:Mysql:",
167
- "dbi:ODBC:",
168
- "dbi:Pg:",
169
- "dbi:SQLite3:",
170
- "dbi:SQLite:"
171
- ], DBI.available_drivers.sort)
172
- end
173
-
174
180
  def teardown
175
181
  @db_error = nil
176
182
  @db_binary = nil
@@ -109,10 +109,10 @@ class TC_DBI_Type < Test::Unit::TestCase
109
109
  assert_equal(dt.to_s, klass.parse(dt).to_s)
110
110
 
111
111
  t = Time.now
112
- assert_equal(DateTime.parse(t.to_s), klass.parse(t))
112
+ assert_equal(DateTime.parse(t.to_s).to_s, klass.parse(t).to_s)
113
113
 
114
114
  d = Date.today
115
- assert_equal(DateTime.parse(d.to_s), klass.parse(d))
115
+ assert_equal(DateTime.parse(d.to_s).to_s, klass.parse(d).to_s)
116
116
 
117
117
  md = "10-11"
118
118
 
metadata CHANGED
@@ -1,100 +1,107 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: dbi
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.4.1
7
- date: 2008-11-28 00:00:00 -08:00
8
- summary: A vendor independent interface for accessing databases, similar to Perl's DBI
9
- require_paths:
10
- - lib
11
- email: ruby-dbi-users@rubyforge.org
12
- homepage: http://www.rubyforge.org/projects/ruby-dbi
13
- rubyforge_project: ruby-dbi
14
- description: A vendor independent interface for accessing databases, similar to Perl's DBI
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.8.0
24
- version:
4
+ version: 0.4.2
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Erik Hollensbe
31
8
  - Christopher Maujean
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-07-11 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: deprecated
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 2.0.0
25
+ version:
26
+ description: A vendor independent interface for accessing databases, similar to Perl's DBI
27
+ email: ruby-dbi-users@rubyforge.org
28
+ executables:
29
+ - dbi
30
+ extensions: []
31
+
32
+ extra_rdoc_files:
33
+ - README
34
+ - LICENSE
35
+ - ChangeLog
32
36
  files:
33
- - examples/test1.pl
34
37
  - examples/test1.rb
38
+ - examples/test1.pl
35
39
  - examples/xmltest.rb
36
40
  - bin/dbi
37
41
  - build/Rakefile.dbi.rb
38
42
  - lib/dbi.rb
39
- - lib/dbi/row.rb
40
- - lib/dbi/columninfo.rb
41
- - lib/dbi/sql/preparedstatement.rb
42
- - lib/dbi/typeutil.rb
43
- - lib/dbi/utils/time.rb
44
- - lib/dbi/utils/xmlformatter.rb
45
43
  - lib/dbi/utils/timestamp.rb
44
+ - lib/dbi/utils/xmlformatter.rb
46
45
  - lib/dbi/utils/date.rb
46
+ - lib/dbi/utils/time.rb
47
47
  - lib/dbi/utils/tableformatter.rb
48
- - lib/dbi/binary.rb
48
+ - lib/dbi/handles/database.rb
49
+ - lib/dbi/handles/driver.rb
50
+ - lib/dbi/handles/statement.rb
51
+ - lib/dbi/handles.rb
52
+ - lib/dbi/trace.rb
53
+ - lib/dbi/exceptions.rb
54
+ - lib/dbi/sql/preparedstatement.rb
55
+ - lib/dbi/base_classes.rb
49
56
  - lib/dbi/base_classes/database.rb
50
57
  - lib/dbi/base_classes/driver.rb
51
58
  - lib/dbi/base_classes/statement.rb
59
+ - lib/dbi/typeutil.rb
52
60
  - lib/dbi/sql_type_constants.rb
53
- - lib/dbi/handles.rb
54
- - lib/dbi/exceptions.rb
61
+ - lib/dbi/row.rb
55
62
  - lib/dbi/types.rb
56
- - lib/dbi/trace.rb
57
- - lib/dbi/base_classes.rb
63
+ - lib/dbi/binary.rb
58
64
  - lib/dbi/utils.rb
65
+ - lib/dbi/columninfo.rb
59
66
  - lib/dbi/sql.rb
60
- - lib/dbi/handles/database.rb
61
- - lib/dbi/handles/driver.rb
62
- - lib/dbi/handles/statement.rb
63
67
  - test/ts_dbi.rb
68
+ - test/dbi/tc_date.rb
64
69
  - test/dbi/tc_time.rb
65
- - test/dbi/tc_row.rb
66
- - test/dbi/tc_dbi.rb
67
- - test/dbi/tc_statementhandle.rb
68
70
  - test/dbi/tc_sqlbind.rb
69
- - test/dbi/tc_columninfo.rb
70
- - test/dbi/trace.rb
71
+ - test/dbi/tc_dbi.rb
72
+ - test/dbi/tc_row.rb
71
73
  - test/dbi/tc_timestamp.rb
74
+ - test/dbi/tc_statementhandle.rb
72
75
  - test/dbi/tc_types.rb
73
- - test/dbi/tc_date.rb
76
+ - test/dbi/tc_columninfo.rb
74
77
  - README
75
78
  - LICENSE
76
79
  - ChangeLog
77
- test_files:
78
- - test/ts_dbi.rb
80
+ has_rdoc: true
81
+ homepage: http://www.rubyforge.org/projects/ruby-dbi
82
+ post_install_message:
79
83
  rdoc_options: []
80
84
 
81
- extra_rdoc_files:
82
- - README
83
- - LICENSE
84
- - ChangeLog
85
- executables:
86
- - dbi
87
- extensions: []
88
-
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 1.8.0
92
+ version:
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ version:
89
99
  requirements: []
90
100
 
91
- dependencies:
92
- - !ruby/object:Gem::Dependency
93
- name: deprecated
94
- version_requirement:
95
- version_requirements: !ruby/object:Gem::Version::Requirement
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: 2.0.0
100
- version:
101
+ rubyforge_project: ruby-dbi
102
+ rubygems_version: 1.3.1
103
+ signing_key:
104
+ specification_version: 2
105
+ summary: A vendor independent interface for accessing databases, similar to Perl's DBI
106
+ test_files:
107
+ - test/ts_dbi.rb
@@ -1,26 +0,0 @@
1
- $;.unshift('lib')
2
- require "dbi/trace"
3
- require 'stringio'
4
- require "test/unit"
5
-
6
- $stringio = StringIO.new
7
-
8
- class TC_DBI_Trace < Test::Unit::TestCase
9
- def setup
10
- $stringio = StringIO.new
11
- end
12
- end
13
-
14
- class DBI::DBD::Dummy
15
- class Database < DBI::BaseDatabase
16
- DBI::BaseDatabase.instance_methods.each do |x|
17
- next if x.to_sym == :initialize
18
- define_method(x.to_sym) do |*args|
19
- $stringio << "[test] call:#{x} args:#{args.inspect}"
20
- end
21
- end
22
-
23
- def initialize
24
- end
25
- end
26
- end