Closed doloopwhile closed 6 years ago
Thank you! I have not noticed it.
Your patch won't work in the following case.
cursor = conn.parse('select empno, ename from emp')
cursor.define(1, Integer)
cursor.exec
cursor.get_col_names # => NoMethodError: undefined method `name' for nil:NilClass
It will be fixed with the following patch. I'll check this patch tomorrow.
--- a/lib/oci8/cursor.rb
+++ b/lib/oci8/cursor.rb
@@ -125,7 +125,8 @@ class OCI8
case type
when :select_stmt
__execute(0)
- define_columns()
+ define_columns() if @column_metadata.size == 0
+ @column_metadata.size
else
__execute(1)
row_count
@doloopwhile Thank you! I fixed it by 7dd7642.
Hello.
It looks needless to me that
__paramGet(i)
is called for every call ofexec
(viadefine_columns
).BTW, I am using ruby-oci8 with activerecord-oracle_enhanced-adapter. When one query is executed repeatedly with different bind parameters, activerecord-oracle_enhanced-adapter keeps one cursor for the query and call
exec
(and__paramsGet
) of the cursor. I encoutered a problem that__paramsGet
becomes very slow as it is called. I hope that this pull request fixes the problem.