Marten::DB::Connection::Base
Abstract base class for a database connection.
A database connection provides the main interface allowing to interact with the underlying database. Subclasses must define a set of function allowing to define backend-specifics such as statements, operators, etc.
Constructors
Instance methods
Allows to conveniently build a SQL statement by yielding an array of nillable strings.
Returns the batch size to use when inserting multiple rows in a specific table.
Allows to insert multiple rows in a specific table and returns the primary key values for the inserted rows.
This method allow inserting individual rows defined in values in the table_name table. When
pk_column_to_fetch is specified, the primary key values for the inserted rows will be returned. Note that
this method can return nil if the underlying database does not support returning primary key values for bulk
inserts.
Returns a distinct clause to remove duplicates from a query's results.
If column names are specified, only these specific columns will be checked to identify duplicates.
Allows to insert a new row in a specific table.
Returns the left operand to use for specific query predicate.
Most of the time the initial ID will be left intact but depending on the connection implementation and the considered predicate type (eg. "istartswith"), specific SQL functions could be applied on the column ID.
Returns a compatible value to use in the context of a LIMIT statement for the database at hand.
Returns the maximum size for table names, column names or index / constraint names.
Registers a proc to be called when the current transaction is committed to the databse.
This method has no effect if it is called outside of a transaction block.
Registers a proc to be called when the current transaction is rolled back.
This method has no effect if it is called outside of a transaction block.
Provides a database entrypoint to the block.
If this method is called in an existing transaction, the connection associated with this transaction will be used instead.
Returns the parameterized identifier for an ordered argument.
This method takes the number of the argument which is aimed to be part of an array of ordered SQL arguments.
Allows to quote a specific name (such as a table name or column ID) for the database at hand.
Escapes special characters from a pattern aimed at being used in the context of a LIKE statement.
Returns a boolean indicating whether the database supports the logical XOR operator.
Returns true if the current database was explicitly configured for the test environment.
The only way this method can return true is when the database name was explicitly set in a configuration targetting the test environment.
Open a transaction.
Atomicity will be ensured for the database operations performed inside the block. Note that any existing transaction will be used in case of nested calls to this method.