module ActiveRecord::ConnectionAdapters::SQLite3::DatabaseStatements

Public Instance Methods

explain(arel, binds = []) click to toggle source
# File lib/active_record/connection_adapters/sqlite3/database_statements.rb, line 18
def explain(arel, binds = [])
  sql = "EXPLAIN QUERY PLAN #{to_sql(arel, binds)}"
  SQLite3::ExplainPrettyPrinter.new.pp(exec_query(sql, "EXPLAIN", []))
end
high_precision_current_timestamp() click to toggle source
# File lib/active_record/connection_adapters/sqlite3/database_statements.rb, line 107
def high_precision_current_timestamp
  HIGH_PRECISION_CURRENT_TIMESTAMP
end

Private Instance Methods

build_fixture_statements(fixture_set) click to toggle source
# File lib/active_record/connection_adapters/sqlite3/database_statements.rb, line 139
def build_fixture_statements(fixture_set)
  fixture_set.flat_map do |table_name, fixtures|
    next if fixtures.empty?
    fixtures.map { |fixture| build_fixture_sql([fixture], table_name) }
  end.compact
end
build_truncate_statement(table_name) click to toggle source
# File lib/active_record/connection_adapters/sqlite3/database_statements.rb, line 146
def build_truncate_statement(table_name)
  "DELETE FROM #{quote_table_name(table_name)}"
end
execute_batch(statements, name = nil) click to toggle source
# File lib/active_record/connection_adapters/sqlite3/database_statements.rb, line 119
def execute_batch(statements, name = nil)
  statements = statements.map { |sql| transform_query(sql) }
  sql = combine_multi_statements(statements)

  check_if_write_query(sql)

  materialize_transactions
  mark_transaction_written_if_write(sql)

  log(sql, name) do
    ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
      @connection.execute_batch2(sql)
    end
  end
end
last_inserted_id(result) click to toggle source
# File lib/active_record/connection_adapters/sqlite3/database_statements.rb, line 135
def last_inserted_id(result)
  @connection.last_insert_row_id
end
reset_read_uncommitted() click to toggle source
# File lib/active_record/connection_adapters/sqlite3/database_statements.rb, line 112
def reset_read_uncommitted
  read_uncommitted = ActiveSupport::IsolatedExecutionState[:active_record_read_uncommitted]
  return unless read_uncommitted

  @connection.read_uncommitted = read_uncommitted
end