AbstractAdapter
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 448 def initialize(connection, logger, config) @config = config spec = adapter_spec config unless connection connection_class = jdbc_connection_class spec connection = connection_class.new config end super(connection, logger) extend spec if spec connection.adapter = self JndiConnectionPoolCallbacks.prepare(self, connection) end
we need to do it this way, to allow Rails stupid tests to always work even if we define a new execute method. Instead of mixing in a new execute, an _execute should be mixed in.
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 567 def _execute(sql, name = nil) if JdbcConnection::select?(sql) @connection.execute_query(sql) elsif JdbcConnection::insert?(sql) @connection.execute_insert(sql) else @connection.execute_update(sql) end end
Locate specialized adapter specification if one exists based on config data
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 468 def adapter_spec(config) dialect = (config[:dialect] || config[:driver]).to_s ::JdbcSpec.constants.map { |name| ::JdbcSpec.const_get name }.each do |constant| if constant.respond_to? :adapter_matcher spec = constant.adapter_matcher(dialect, config) return spec if spec end end nil end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 601 def begin_db_transaction @connection.begin end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 605 def commit_db_transaction @connection.commit end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 539 def disconnect! @connection.disconnect! end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 558 def execute(sql, name = nil) log(sql, name) do _execute(sql,name) end end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 597 def indexes(table_name, name = nil, schema_name = nil) @connection.indexes(table_name, name, schema_name) end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 588 def jdbc_columns(table_name, name = nil) @connection.columns(table_name.to_s) end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 461 def jdbc_connection_class(spec) connection_class = spec.jdbc_connection_class if spec && spec.respond_to?(:jdbc_connection_class) connection_class = ::ActiveRecord::ConnectionAdapters::JdbcConnection unless connection_class connection_class end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 582 def jdbc_insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) id = execute(sql, name = nil) id_value || id end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 543 def jdbc_select_all(sql, name = nil) select(sql, name) end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 479 def modify_types(tp) tp end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 499 def native_sql_to_type(tp) if /^(.*?)\(([0-9]+)\)/ =~ tp tname = $1 limit = $2.to_i ntype = native_database_types if ntype[:primary_key] == tp return :primary_key,nil else ntype.each do |name,val| if name == :primary_key next end if val[:name].downcase == tname.downcase && (val[:limit].nil? || val[:limit].to_i == limit) return name,limit end end end elsif /^(.*?)/ =~ tp tname = $1 ntype = native_database_types if ntype[:primary_key] == tp return :primary_key,nil else ntype.each do |name,val| if val[:name].downcase == tname.downcase && val[:limit].nil? return name,nil end end end else return :string,255 end return nil,nil end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 617 def pk_and_sequence_for(table) result_set = @connection.connection.get_meta_data.get_primary_keys(nil, nil, table) if result_set.next keys = [result_set.getString("COLUMN_NAME"), nil] end keys.blank? ? nil : keys ensure result_set.close end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 534 def reconnect! @connection.reconnect! @connection end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 609 def rollback_db_transaction @connection.rollback end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 554 def select_one(sql, name = nil) select(sql, name).first end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 548 def select_rows(sql, name = nil) rows = [] select(sql, name).each {|row| rows << row.values } rows end
# File lib/active_record/connection_adapters/jdbc_adapter.rb, line 487 def supports_migrations? true end
Generated with the Darkfish Rdoc Generator 2.