[ruby-oci8-commit] [333] trunk/ruby-oci8: * lib/dbd/OCI8.rb: fix DBI::DBD::OCI8::BindType:: DBIStatementHandle
nobody at rubyforge.org
nobody at rubyforge.org
Sat Apr 11 22:51:50 EDT 2009
Revision: 333
Author: kubo
Date: 2009-04-11 22:51:49 -0400 (Sat, 11 Apr 2009)
Log Message:
-----------
* lib/dbd/OCI8.rb: fix DBI::DBD::OCI8::BindType::DBIStatementHandle
to pass a newly added sanity check in dbi 0.4.1.
(reported by Dirk Herzhauser)
* test/test_all.rb: fix to use dbi installed as a rubygem.
Modified Paths:
--------------
trunk/ruby-oci8/ChangeLog
trunk/ruby-oci8/lib/dbd/OCI8.rb
trunk/ruby-oci8/test/test_all.rb
Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog 2009-04-12 02:36:39 UTC (rev 332)
+++ trunk/ruby-oci8/ChangeLog 2009-04-12 02:51:49 UTC (rev 333)
@@ -1,3 +1,9 @@
+2009-04-12 KUBO Takehiro <kubo at jiubao.org>
+ * lib/dbd/OCI8.rb: fix DBI::DBD::OCI8::BindType::DBIStatementHandle
+ to pass a newly added sanity check in dbi 0.4.1.
+ (reported by Dirk Herzhauser)
+ * test/test_all.rb: fix to use dbi installed as a rubygem.
+
2009-04-04 KUBO Takehiro <kubo at jiubao.org>
* ext/oci8/bind.c: fix an error when executing "select NULL from dual".
http://rubyforge.org/forum/forum.php?thread_id=32468&forum_id=1078
Modified: trunk/ruby-oci8/lib/dbd/OCI8.rb
===================================================================
--- trunk/ruby-oci8/lib/dbd/OCI8.rb 2009-04-12 02:36:39 UTC (rev 332)
+++ trunk/ruby-oci8/lib/dbd/OCI8.rb 2009-04-12 02:51:49 UTC (rev 333)
@@ -402,6 +402,21 @@
end
end
+# DBI_STMT_NEW_ARGS is DBI::StatementHandle.new's arguments except +handle+.
+#
+# FYI: DBI::StatementHandle.new method signatures are follows:
+# 0.2.2: handle, fetchable=false, prepared=true
+# 0.4.0: handle, fetchable=false, prepared=true, convert_types=true
+# 0.4.1: handle, fetchable=false, prepared=true, convert_types=true, executed=false
+begin
+ DBI::StatementHandle.new(nil, false, true, true, true)
+ # dbi 0.4.1
+ DBI_STMT_NEW_ARGS = [true, true, true, true] # :nodoc:
+rescue ArgumentError
+ # dbi 0.4.0 or lower
+ DBI_STMT_NEW_ARGS = [true] # :nodoc:
+end
+
if defined? ::OCI8::BindType::Base
##
## ruby-oci8 2.0 bind classes.
@@ -491,7 +506,7 @@
val = super
return nil if val.nil?
stmt = DBI::DBD::OCI8::Statement.new(val)
- DBI::StatementHandle.new(stmt, true, false)
+ DBI::StatementHandle.new(stmt, *DBI_STMT_NEW_ARGS)
end
end
end # BindType
@@ -560,7 +575,7 @@
return val if val.nil?
cur = ::OCI8::Cursor.new(@env, @svc, @ctx, val)
stmt = DBI::DBD::OCI8::Statement.new(cur)
- DBI::StatementHandle.new(stmt, true, false)
+ DBI::StatementHandle.new(stmt, *DBI_STMT_NEW_ARGS)
end
end
end
Modified: trunk/ruby-oci8/test/test_all.rb
===================================================================
--- trunk/ruby-oci8/test/test_all.rb 2009-04-12 02:36:39 UTC (rev 332)
+++ trunk/ruby-oci8/test/test_all.rb 2009-04-12 02:51:49 UTC (rev 333)
@@ -24,11 +24,15 @@
# Ruby/DBI
begin
require 'dbi'
- is_dbi_loaded = true
rescue LoadError
- is_dbi_loaded = false
+ begin
+ require 'rubygems'
+ require 'dbi'
+ rescue LoadError
+ dbi_not_found = false
+ end
end
-if is_dbi_loaded
+unless dbi_not_found
require "#{srcdir}/test_dbi"
if $test_clob
require "#{srcdir}/test_dbi_clob"
More information about the ruby-oci8-commit
mailing list