Class: Avmtrf1::Oracle::Connection::Base
- Inherits:
-
Object
- Object
- Avmtrf1::Oracle::Connection::Base
- Defined in:
- lib/avmtrf1/oracle/connection/base.rb
Constant Summary collapse
- DEFAULT_PORT =
1521
Instance Method Summary collapse
-
#initialize(connection_string) ⇒ Base
constructor
A new instance of Base.
- #query(sql, &block) ⇒ Object
- #unique_value(sql) ⇒ Object
Constructor Details
#initialize(connection_string) ⇒ Base
Returns a new instance of Base.
11 12 13 14 |
# File 'lib/avmtrf1/oracle/connection/base.rb', line 11 def initialize(connection_string) ENV['NLS_LANG'] = 'BRAZILIAN PORTUGUESE_BRAZIL.WE8ISO8859P1' @connection = OCI8.new(connection_string) end |
Instance Method Details
#query(sql, &block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/avmtrf1/oracle/connection/base.rb', line 22 def query(sql, &block) if block query_with_block(sql, block) else query_without_block(sql) end end |
#unique_value(sql) ⇒ Object
16 17 18 19 20 |
# File 'lib/avmtrf1/oracle/connection/base.rb', line 16 def unique_value(sql) connection.exec(sql) do |row| return row.first end end |