class Marten::DB::Connection::PostgreSQL

Defined in:

marten/db/connection/postgresql.cr

Instance Method Summary

Instance methods inherited from class Marten::DB::Connection::Base

alias : String alias, build_sql(&) build_sql, bulk_batch_size(records_count : Int32, values_count : Int32) : Int32 bulk_batch_size, bulk_insert(table_name : String, values : Array(Hash(String, ::DB::Any)), pk_column_to_fetch : String | Nil = nil) : Array(::DB::Any) | Nil bulk_insert, distinct_clause_for(columns : Array(String)) : String distinct_clause_for, id : String id, insert(table_name : String, values : Hash(String, ::DB::Any), pk_column_to_fetch : String | Nil = nil) : ::DB::Any insert, left_operand_for(id : String, predicate) : String left_operand_for, limit_value(value : Int | Nil) : Int32 | Int64 | Nil | UInt32 | UInt64 limit_value, max_name_size : Int32 max_name_size, observe_transaction_commit(block : -> Nil) observe_transaction_commit, observe_transaction_rollback(block : -> Nil) observe_transaction_rollback, open(&) open, operator_for(predicate) : String operator_for, parameter_id_for_ordered_argument(number : Int) : String parameter_id_for_ordered_argument, quote(name : String | Symbol) : String quote, quote_char : Char quote_char, sanitize_like_pattern(pattern : String) : String sanitize_like_pattern, scheme : String scheme, test_database? test_database?, transaction(&) transaction, update(table_name : String, values : Hash(String, ::DB::Any), pk_column_name : String, pk_value : ::DB::Any) : Nil update

Constructor methods inherited from class Marten::DB::Connection::Base

new(config : Conf::GlobalSettings::Database) new

Instance Method Detail

def bulk_batch_size(records_count : Int32, values_count : Int32) : Int32 #
Description copied from class Marten::DB::Connection::Base

Returns the batch size to use when inserting multiple rows in a specific table.


[View source]
def bulk_insert(table_name : String, values : Array(Hash(String, ::DB::Any)), pk_column_to_fetch : String | Nil = nil) : Array(::DB::Any) | Nil #
Description copied from class Marten::DB::Connection::Base

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.


[View source]
def distinct_clause_for(columns : Array(String)) : String #
Description copied from class Marten::DB::Connection::Base

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.


[View source]
def insert(table_name : String, values : Hash(String, ::DB::Any), pk_column_to_fetch : String | Nil = nil) : ::DB::Any #
Description copied from class Marten::DB::Connection::Base

Allows to insert a new row in a specific table.


[View source]
def left_operand_for(id : String, predicate) : String #
Description copied from class Marten::DB::Connection::Base

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.


[View source]
def limit_value(value : Int | Nil) : Int32 | Int64 | Nil | UInt32 | UInt64 #
Description copied from class Marten::DB::Connection::Base

Returns a compatible value to use in the context of a LIMIT statement for the database at hand.


[View source]
def max_name_size : Int32 #
Description copied from class Marten::DB::Connection::Base

Returns the maximum size for table names, column names or index / constraint names.


[View source]
def operator_for(predicate) : String #
Description copied from class Marten::DB::Connection::Base

Returns the operator to use for a specific query predicate.


[View source]
def parameter_id_for_ordered_argument(number : Int) : String #
Description copied from class Marten::DB::Connection::Base

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.


[View source]
def quote_char : Char #
Description copied from class Marten::DB::Connection::Base

Returns the quote character to use to quote table names, columns, etc.


[View source]
def scheme : String #
Description copied from class Marten::DB::Connection::Base

Returns the scheme to consider for the underlying database backend.


[View source]
def update(table_name : String, values : Hash(String, ::DB::Any), pk_column_name : String, pk_value : ::DB::Any) : Nil #
Description copied from class Marten::DB::Connection::Base

Allows to update an existing row in a specific table.


[View source]