Class: PLSQL::JDBCConnection::Cursor
- Inherits:
-
Object
- Object
- PLSQL::JDBCConnection::Cursor
- Defined in:
- lib/plsql/jdbc_connection.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #bind_param(key, value, type = nil, length = nil, in_out = 'IN') ⇒ Object
- #close ⇒ Object
- #exec ⇒ Object
-
#initialize(sql, conn) ⇒ Cursor
constructor
A new instance of Cursor.
Constructor Details
#initialize(sql, conn) ⇒ Cursor
Returns a new instance of Cursor.
77 78 79 80 81 82 83 84 |
# File 'lib/plsql/jdbc_connection.rb', line 77 def initialize(sql, conn) @sql = sql @connection = conn @params = sql.scan(/\:\w+/) @out_types = {} @out_index = {} @statement = @connection.prepare_call(sql) end |
Instance Method Details
#[](key) ⇒ Object
99 100 101 |
# File 'lib/plsql/jdbc_connection.rb', line 99 def [](key) @connection.get_bind_variable(@statement, @out_index[key], @out_types[key]) end |
#bind_param(key, value, type = nil, length = nil, in_out = 'IN') ⇒ Object
86 87 88 89 90 91 92 93 |
# File 'lib/plsql/jdbc_connection.rb', line 86 def bind_param(key, value, type=nil, length=nil, in_out='IN') @connection.set_bind_variable(@statement, key, value, type, length) if in_out =~ /OUT/ @out_types[key] = type || value.class @out_index[key] = bind_param_index(key) @statement.registerOutParameter(@out_index[key],@connection.get_java_sql_type(value,type)) end end |
#close ⇒ Object
103 104 105 |
# File 'lib/plsql/jdbc_connection.rb', line 103 def close @statement.close end |
#exec ⇒ Object
95 96 97 |
# File 'lib/plsql/jdbc_connection.rb', line 95 def exec @statement.execute end |