class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
Constants
- ColumnMethods
- OID
AR expects
OID
to be available on the adapter- Table
- TableDefinition
Public Class Methods
new(connection, logger = nil, config = {})
click to toggle source
Calls superclass method
ArJdbc::Abstract::StatementCache::new
# File lib/arjdbc/postgresql/adapter.rb, line 753 def initialize(connection, logger = nil, config = {}) # @local_tz is initialized as nil to avoid warnings when connect tries to use it @local_tz = nil super # configure_connection happens in super @table_alias_length = nil initialize_type_map(@type_map = Type::HashLookupTypeMap.new) @use_insert_returning = @config.key?(:insert_returning) ? self.class.type_cast_config_to_boolean(@config[:insert_returning]) : nil end
Public Instance Methods
exec_query(sql, name = nil, binds = [], prepare: false)
click to toggle source
Calls superclass method
ArJdbc::Abstract::DatabaseStatements#exec_query
# File lib/arjdbc/postgresql/adapter.rb, line 781 def exec_query(sql, name = nil, binds = [], prepare: false) super rescue ActiveRecord::StatementInvalid => e raise unless e.cause.message.include?('cached plan must not change result type'.freeze) if open_transactions > 0 # In a transaction, have to fail it - See AR code for details raise ActiveRecord::PreparedStatementCacheExpired.new(e.cause.message) else # Not in a transaction, clear the prepared statement and try again delete_cached_statement(sql) retry end end
jdbc_connection_class(spec)
click to toggle source
# File lib/arjdbc/postgresql/adapter.rb, line 804 def jdbc_connection_class(spec) ::ArJdbc::PostgreSQL.jdbc_connection_class end
update_table_definition(table_name, base)
click to toggle source
# File lib/arjdbc/postgresql/adapter.rb, line 800 def update_table_definition(table_name, base) Table.new(table_name, base) end
Private Instance Methods
cached_statement_key(sql)
click to toggle source
Prepared statements aren't schema aware so we need to make sure we store different PreparedStatement objects for different schemas
# File lib/arjdbc/postgresql/adapter.rb, line 812 def cached_statement_key(sql) "#{schema_search_path}-#{sql}" end