Qore PgsqlSqlUtilBase Module Reference 1.8
Loading...
Searching...
No Matches
PgsqlSqlUtilBase::PgsqlTable Class Reference

provides the PostgreSQL-specific implementation of the SqlUtil::AbstractTable interface More...

#include <PgsqlSqlUtilBase.qm.dox.h>

Inheritance diagram for PgsqlSqlUtilBase::PgsqlTable:
[legend]

Public Member Methods

 constructor (AbstractDatasource nds, string nname, *hash opts)
 Creates the object from the arguments.
 
private doSelectOrderByWithOffsetSqlUnlockedImpl (reference< hash< QueryInfo > > info, reference< string > sql, list< auto > coll)
 processes a string for use in SQL select statements when there is an "order by" and "offset" argument
 
string getColumnSqlName (string col)
 returns the column name for use in SQL strings; subclasses can return a special string in case the column name is a reserved word
 
list< auto > getColumnSqlNames (softlist< auto > cols)
 returns a list of column names for use in SQL strings More...
 
hash< auto > getExpressionMap ()
 Returns the expression map for PostgreSQL.
 
string getSchemaName ()
 returns the schema name
 
string getSqlName ()
 returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
 
*string getTablespaceName ()
 returns the data tablespace name for the table or NOTHING if none is known
 
code getUpsertClosure (hash< auto > row, int upsert_strategy=UpsertAuto, *hash< auto > opt)
 returns a closure for performing upserts More...
 
bool hasArrayBind ()
 returns False because the pgsql driver does not support array binds / bulk DML operations
 
bool hasAtomicUpsert ()
 Returns True if the server supports atomic upsert/merge operations.
 

Public Attributes

const PgsqlCopMap
 column operator specializations for PostgreSQL
 
const PgsqlExpressionMap
 Expression map for PostgreSQL.
 
const PgsqlIopMap = ...
 a hash of default value operator descriptions for PostgreSQL
 
const PgsqlNameMap = ...
 maps from verbose type names to simple type names
 
const PgsqlTableDescriptionHashOptions = ...
 extends SqlUtil::AbstractTable::TableDescriptionHashOptions with "functions" More...
 
const PgsqlTruncDate = ...
 Map SqlUtil::cop_trunc_date() constants to PostgreSQL internal masks.
 
const PgsqlTypeMap = ...
 maps PostgreSQL type names to type configurations
 
const PgsqlUopMap = ...
 a hash of default update operator definitions for PostgreSQL
 
const QoreTypeMap = ...
 maps qore type names to PostgreSQL type names
 

Private Member Methods

 clearImpl ()
 clears PostgreSQL-specific table information
 
bool constraintsLinkedToIndexesImpl ()
 returns True if the database links constraints to indexes (ie dropping the constraint drops the index, etc)
 
 copyImpl (AbstractTable old)
 db-specific copy actions
 
 doSelectLimitOnlyUnlockedImpl (reference< hash< QueryInfo > > info, reference< string > sql)
 processes a string for use in SQL select statements when there is a "limit" argument, but no "orderby" or "offset" arguments
 
hash getColumnOperatorMapImpl ()
 returns the column operator map for this object
 
string getCreateSqlImpl (list l)
 returns a string that can be used to create the table in the database
 
string getCreateTableSqlImpl (*hash opt)
 returns a string that can be used to create the table in the database
 
hash getInsertOperatorMap ()
 returns the insert operator map for this object
 
AbstractDataProviderType getNumericTypeImpl (string native_type, bool nullable, *hash< auto > options)
 returns the type for number / numeric columns for the database so that data conversions can be handled properly
 
hash getRawUpdateOperatorMap ()
 returns the raw (default) update operator map for this object
 
AbstractSavepointHelper getSavepointHelperImpl (*string savepoint)
 get DB-specific savepoint helper More...
 
 getServerVersion ()
 Sets the internal PostgreSQL server version.
 
*string getSqlValueImpl (auto v)
 returns a string for use in SQL queries representing the DB-specific value of the argument More...
 
bool isDuplicateRowErrorImpl (hash< ExceptionInfo > ex)
 Returns True if the exception was raised because of a duplicate row / key error. More...
 
transient Mutex pg_state ()
 Lock for atomicity for setting state info.
 
bool supportsTablespacesImpl ()
 returns True if the database support tablespaces
 
auto tryExecArgsImpl (string sql, *softlist< auto > args)
 tries to execute a command so that if an error occurs the current transaction status is not lost
 
auto tryExecRawImpl (string sql, *softlist< auto > args)
 tries to execute a command so that if an error occurs the current transaction status is not lost
 
bool uniqueIndexCreatesConstraintImpl ()
 returns True if the database automatically creates a unique constraint when a unique index is created (ex: mysql)
 

Private Attributes

bool has_atomic_merge
 Set based on the postgreSQL server version.
 
string schema
 schema name for the table
 
int server_version
 PostgreSQL server full version code.
 
int server_version_major
 PostgreSQL server major version.
 
int server_version_minor
 PostgreSQL server minor version.
 
int server_version_sub
 PostgreSQL server version.
 
*string tablespace
 tablespace name for the table, if known
 
Functions triggerFunctions
 contains any trigger functions supporting triggers on the table
 

Detailed Description

provides the PostgreSQL-specific implementation of the SqlUtil::AbstractTable interface

Member Function Documentation

◆ getColumnSqlNames()

list< auto > PgsqlSqlUtilBase::PgsqlTable::getColumnSqlNames ( softlist< auto >  cols)

returns a list of column names for use in SQL strings

subclasses can process the argument list in case a column name is a reserved word

◆ getSavepointHelperImpl()

AbstractSavepointHelper PgsqlSqlUtilBase::PgsqlTable::getSavepointHelperImpl ( *string  savepoint)
privatevirtual

get DB-specific savepoint helper

Parameters
savepointthe savepoint string, if not given a unique savepoint string will be generated
Since
SqlUtil 1.6

Implements SqlUtil::AbstractTable.

◆ getSqlValueImpl()

*string PgsqlSqlUtilBase::PgsqlTable::getSqlValueImpl ( auto  v)
privatevirtual

returns a string for use in SQL queries representing the DB-specific value of the argument

returns NOTHING if the type cannot be converted to an SQL string

Implements SqlUtil::AbstractTable.

◆ getUpsertClosure()

code PgsqlSqlUtilBase::PgsqlTable::getUpsertClosure ( hash< auto >  row,
int  upsert_strategy = UpsertAuto,
*hash< auto >  opt 
)

returns a closure for performing upserts

if the upsert_strategy argument is UpsertInsertFirst or UpsertUpdateFirst, then this argument is ignored and a closure using an atomic merge/update statement is returned if the server version is >= 9.5, for earlier versions upsert operations are not atomic

◆ isDuplicateRowErrorImpl()

bool PgsqlSqlUtilBase::PgsqlTable::isDuplicateRowErrorImpl ( hash< ExceptionInfo >  ex)
privatevirtual

Returns True if the exception was raised because of a duplicate row / key error.

Since
PgsqlSqlUtilBase 1.5.2

Implements SqlUtil::AbstractTable.

Member Data Documentation

◆ PgsqlTableDescriptionHashOptions

const PgsqlSqlUtilBase::PgsqlTable::PgsqlTableDescriptionHashOptions = ...

extends SqlUtil::AbstractTable::TableDescriptionHashOptions with "functions"

for table functions required by triggers on the table