Class: PLSQL::JDBCConnection::CallableStatement
- Inherits:
-
Object
- Object
- PLSQL::JDBCConnection::CallableStatement
- Defined in:
- lib/plsql/jdbc_connection.rb
Overview
:nodoc:
Instance Method Summary collapse
- #[](key) ⇒ Object
- #bind_param(arg, value, metadata) ⇒ Object
- #close ⇒ Object
- #exec ⇒ Object
-
#initialize(conn, sql) ⇒ CallableStatement
constructor
A new instance of CallableStatement.
Constructor Details
#initialize(conn, sql) ⇒ CallableStatement
Returns a new instance of CallableStatement.
93 94 95 96 97 98 99 100 |
# File 'lib/plsql/jdbc_connection.rb', line 93 def initialize(conn, sql) @sql = sql @connection = conn @params = sql.scan(/\:\w+/) @out_types = {} @out_index = {} @statement = @connection.prepare_call(sql) end |
Instance Method Details
#[](key) ⇒ Object
122 123 124 |
# File 'lib/plsql/jdbc_connection.rb', line 122 def [](key) @connection.ora_value_to_ruby_value(@connection.get_bind_variable(@statement, @out_index[key], @out_types[key])) end |
#bind_param(arg, value, metadata) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/plsql/jdbc_connection.rb', line 102 def bind_param(arg, value, ) type, length = @connection.plsql_to_ruby_data_type() ora_value = @connection.ruby_value_to_ora_value(value, type, ) @connection.set_bind_variable(@statement, arg, ora_value, type, length, ) if [:in_out] =~ /OUT/ @out_types[arg] = type || ora_value.class @out_index[arg] = bind_param_index(arg) if ['TABLE','VARRAY','OBJECT'].include?([:data_type]) @statement.registerOutParameter(@out_index[arg], @connection.get_java_sql_type(ora_value,type), [:sql_type_name]) else @statement.registerOutParameter(@out_index[arg],@connection.get_java_sql_type(ora_value,type)) end end end |
#close ⇒ Object
126 127 128 |
# File 'lib/plsql/jdbc_connection.rb', line 126 def close @statement.close end |
#exec ⇒ Object
118 119 120 |
# File 'lib/plsql/jdbc_connection.rb', line 118 def exec @statement.execute end |