class PLSQL::Connection
Constants
- RUBY_TEMP_TABLE_PREFIX
Attributes
Public Instance Methods
Set autocommit mode (true or false)
# File lib/plsql/connection.rb, line 91 def autocommit=(value) raise NoMethodError, "Not implemented for this raw driver" end
Current autocommit mode (true or false)
# File lib/plsql/connection.rb, line 86 def autocommit? raise NoMethodError, "Not implemented for this raw driver" end
Returns array with major and minor version of database (e.g. [10, 2])
# File lib/plsql/connection.rb, line 191 def database_version raise NoMethodError, "Not implemented for this raw driver" end
Drop all ruby temporary tables that are used for calling packages with table parameter types defined in packages
# File lib/plsql/connection.rb, line 214 def drop_all_ruby_temporary_tables select_all("SELECT table_name FROM user_tables WHERE temporary='Y' AND table_name LIKE :table_name", RUBY_TEMP_TABLE_PREFIX.upcase+'%').each do |row| exec "TRUNCATE TABLE #{row[0]}" exec "DROP TABLE #{row[0]}" end end
Drop ruby temporary tables created in current session that are used for calling packages with table parameter types defined in packages
# File lib/plsql/connection.rb, line 223 def drop_session_ruby_temporary_tables select_all("SELECT table_name FROM user_tables WHERE temporary='Y' AND table_name LIKE :table_name", RUBY_TEMP_TABLE_PREFIX.upcase+"#{session_id}_%").each do |row| exec "TRUNCATE TABLE #{row[0]}" exec "DROP TABLE #{row[0]}" end end
Is it JDBC connection
# File lib/plsql/connection.rb, line 66 def jdbc? @raw_driver == :jdbc end
Is it OCI8 connection
# File lib/plsql/connection.rb, line 61 def oci? @raw_driver == :oci end
Set number of rows to be prefetched. This can reduce the number of network round trips when fetching many rows. The default value is one. (If ActiveRecord oracle_enhanced connection is used then default is 100)
# File lib/plsql/connection.rb, line 97 def prefetch_rows=(value) raise NoMethodError, "Not implemented for this raw driver" end
Returns OCI8 or JDBC connection
# File lib/plsql/connection.rb, line 52 def raw_connection if @activerecord_class @activerecord_class.connection.raw_connection else @raw_connection end end
Returns session ID
# File lib/plsql/connection.rb, line 196 def session_id @session_id ||= select_first("SELECT TO_NUMBER(USERENV('SESSIONID')) FROM dual")[0] end
Set time zone (default taken from TZ environment variable)
# File lib/plsql/connection.rb, line 201 def set_time_zone(time_zone=nil) time_zone ||= ENV['TZ'] exec("alter session set time_zone = '#{time_zone}'") if time_zone end
Returns session time zone
# File lib/plsql/connection.rb, line 207 def time_zone select_first("SELECT SESSIONTIMEZONE FROM dual")[0] end