Reference documentation and code samples for the activerecord-spanner-adapter class ActiveRecordSpannerAdapter::Connection.
Inherits
- Object
Methods
.database_path
def self.database_path(config).information_schema
def self.information_schema(config).reset_information_schemas!
def self.reset_information_schemas!()Clears the cached information about the underlying information schemas. Call this method if you drop and recreate a database with the same name to prevent the cached information to be used for the new database.
.spanners
def self.spanners(config)#abort_batch
def abort_batch()Aborts the current batch on this connection. This is a no-op if there is no batch on this connection.
#active?
def active?() -> Boolean- (Boolean)
#begin_transaction
def begin_transaction(isolation = nil)Transactions
#commit_transaction
def commit_transaction()#connect!
def connect!()#create_database
def create_database()Database Operations
#create_transaction_after_failed_first_statement
def create_transaction_after_failed_first_statement(original_error)Creates a transaction using a BeginTransaction RPC. This is used if the first statement of a transaction fails, as that also means that no transaction id was returned.
#current_transaction
def current_transaction()Returns the value of attribute current_transaction.
#current_transaction=
def current_transaction=(value)Sets the attribute current_transaction
#database
def database()#database_id
def database_id()Returns the value of attribute database_id.
#ddl_batch
def ddl_batch()Executes a set of DDL statements as one batch. This method raises an error if no block is given.
- (Google::Cloud::FailedPreconditionError)
connection.ddl_batch do connection.execute_ddl "CREATE TABLE `Users` (Id INT64, Name STRING(MAX)) PRIMARY KEY (Id)" connection.execute_ddl "CREATE INDEX Idx_Users_Name ON `Users` (Name)" end
#ddl_batch?
def ddl_batch?() -> BooleanReturns true if this connection is currently executing a DDL batch, and otherwise false.
- (Boolean)
#disconnect!
def disconnect!()#execute_ddl
def execute_ddl(statements, operation_id: nil, wait_until_done: true)#execute_query
def execute_query(sql, params: nil, types: nil, single_use_selector: nil, request_options: nil)DQL, DML Statements
#execute_sql_request
def execute_sql_request(sql, converted_params, types, selector, request_options = nil)rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
#initialize
def initialize(config) -> Connection- (Connection) — a new instance of Connection
#instance_id
def instance_id()Returns the value of attribute instance_id.
#isolation_level
def isolation_level()Returns the value of attribute isolation_level.
#isolation_level=
def isolation_level=(value)Sets the attribute isolation_level
#raise_aborted_err
def raise_aborted_err()#reset!
def reset!()#rollback_transaction
def rollback_transaction()#run_batch
def run_batch()Runs the current batch on this connection. This will raise a FailedPreconditionError if there is no active batch on this connection.
#session
def session()#session_not_found?
def session_not_found?(err) -> Boolean- (Boolean)
#spanner
def spanner()Returns the value of attribute spanner.
#start_batch_ddl
def start_batch_ddl()Starts a manual DDL batch. The batch must be ended by calling either run_batch or abort_batch.
begin connection.start_batch_ddl connection.execute_ddl "CREATE TABLE `Users` (Id INT64, Name STRING(MAX)) PRIMARY KEY (Id)" connection.execute_ddl "CREATE INDEX Idx_Users_Name ON `Users` (Name)" connection.run_batch rescue StandardError connection.abort_batch raise end
#transaction_not_found?
def transaction_not_found?(err) -> Boolean- (Boolean)
#transaction_selector
def transaction_selector()#truncate
def truncate(table_name)