All Classes Namespaces Functions Variables Groups Pages
PgsqlSqlUtil.qm.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
// @file PgsqlSqlUtil.qm Qore user module for working with PostgreSQL SQL data
/* PgsqlSqlUtil.qm Copyright (C) 2013 - 2016 Qore Technologies, sro
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
// minimum qore version
// requires the SqlUtil module
// don't use "$" signs for variables and class members, assume local variable scope
// require type definitions everywhere
// enable all warnings
// version history is included below in the docs
namespace PgsqlSqlUtil {
PgsqlTable get_table(AbstractDatasource nds, string nname, *hash opts);
PgsqlDatabase get_database(AbstractDatasource nds, *hash opts);
parse_schema_name(string nname, reference schema, reference name);
class PgsqlType {
public:
public :
string name;
string src;
public:
constructor(string n_name, string n_src);
list getTypeList();
list getModifySql(PgsqlType old, *hash opt);
string getCreateSql(*hash opt);
string getDropSql(*hash opt);
string getDropSqlForce();
string getRenameSql(string new_name);
bool equal(PgsqlType type);
};
class PgsqlIndex : public SqlUtil::AbstractIndex {
public:
public :
*string tablespace;
public:
constructor(string n_name, bool n_unique, hash n_cols, *string n_tablespace) ;
string getCreateSql(string table_name, *hash opt);
private bool equalImpl(AbstractIndex ix);
string getRenameSql(string table_name, string new_name);
};
class PgsqlForeignConstraint : public SqlUtil::AbstractForeignConstraint {
public:
constructor(string n, Columns c, ForeignConstraintTarget t) ;
string getCreateSql(string table_name, *hash opt);
softlist getRenameSql(string table_name, string new_name);
string getCreateSql(string name, string table_name, *hash opt);
};
class PgsqlCheckConstraint : public SqlUtil::AbstractCheckConstraint {
public:
constructor(string n, string n_src) ;
string getCreateSql(string table_name, *hash opt);
list getRenameSql(string table_name, string new_name);
string getCreateSql(string name, string table_name, *hash opt);
};
class PgsqlColumn : public SqlUtil::AbstractColumn {
public:
public :
int byte_size;
public:
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs) ;
string getNativeTypeString();
list getAddColumnSql(AbstractTable t);
list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
string getRenameSql(AbstractTable t, string new_name);
private bool equalImpl(AbstractColumn c);
};
class PgsqlNumericColumn : public PgsqlColumn,public SqlUtil::NumericColumnInfo {
public:
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint n_scale) ;
string getNativeTypeString();
};
class PgsqlUniqueConstraintCommon : public SqlUtil::AbstractUniqueConstraint {
public:
private :
*string tablespace;
public:
constructor(*string ts);
*string getTablespace();
setTablespace(*string ts);
bool setIndexBase(string ix);
clearIndex();
abstract AbstractIterator keyIterator();
getIndexSql(reference sql, string name, *hash opts);
};
class PgsqlUniqueConstraint : public SqlUtil::AbstractUniqueConstraint,public PgsqlUniqueConstraintCommon {
public:
private :
bool enabled;
public:
constructor(string n, hash n_cols, bool e = True, *string ts) ;
PgsqlColumn memberGate(string k);
string getCreateSql(string table_name, *hash opts);
list getRenameSql(string table_name, string new_name);
string getCreateSql(string name, string table_name, *hash opts);
bool isEnabled();
};
class PgsqlPrimaryKey : public SqlUtil::AbstractPrimaryKey,public PgsqlUniqueConstraintCommon {
public:
constructor();
constructor(string n, *hash c, *string ts) ;
PgsqlColumn memberGate(string k);
string getCreateSql(string table_name, *hash opts);
softlist getRenameSql(string table_name, string new_name);
};
class PgsqlSequence : public SqlUtil::AbstractSequence {
public:
constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
string getCreateSql(*hash opt);
string getRenameSql(string new_name);
};
class PgsqlView : public SqlUtil::AbstractView {
public:
public :
*string viewowner;
public:
constructor(string n_name, string n_src, *string n_schemaname,
*string n_viewowner)
;
string getCreateSql(*hash opt);
softlist getRenameSql(string new_name);
};
class PgsqlTrigger : public SqlUtil::AbstractTrigger {
public:
constructor(string n, string n_src) ;
softlist getCreateSql(string table_name, *hash opt);
softlist getDropSql(string table_name);
private bool equalImpl(AbstractFunctionBase t);
softlist getRenameSql(string table_name, string new_name);
};
class PgsqlFunction : public SqlUtil::AbstractFunction {
public:
public :
*string args;
public:
constructor(string n, string n_src, *string a) ;
softlist getCreateSql(*hash opt);
string getDropSql();
private bool equalImpl(AbstractFunctionBase t);
softlist getRenameSql(string new_name);
setName(string new_name);
};
class PgsqlTriggerFunction : public PgsqlFunction {
public:
public :
string trigger;
public:
constructor(string n, string n_src, string n_trigger) ;
};
class PgsqlDatabase : public SqlUtil::AbstractDatabase {
public:
public :
const PgsqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + (
"types": Type::Hash,
"type_map": Type::Hash,
);
const PGSQL_TempSavepoint = "qore_pgsql_tmp_savepoint";
const PgsqlReclaimSpaceOptions = ReclaimSpaceOptions + (
"full" : Type::Boolean,
"analyze" : Type::Boolean,
);
public:
constructor(AbstractDatasource nds, *hash opts) ;
private list featuresImpl();
PgsqlType makeType(string name, string src, *hash opts);
*PgsqlType getType(string name);
private PgsqlSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
private *AbstractSequence getSequenceImpl(string name);
private *AbstractView getViewImpl(string name);
private PgsqlFunction makeFunctionImpl(string name, string src, *hash opts);
private PgsqlFunction makeProcedureImpl(string name, string src, *hash opts);
private *AbstractFunction getFunctionImpl(string name);
private AbstractFunction getProcedureImpl(string name);
static *string getFunctionArgs(string err, reference src);
static PgsqlFunction processFunction(hash row, bool native_case);
private list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
private list getAlignSqlImpl(hash schema_hash, *hash opt);
private list listTablesImpl();
private list listFunctionsImpl();
private list listProceduresImpl();
private list listSequencesImpl();
private list listViewsImpl();
list listMaterializedViews();
ListIterator materializedViewIterator();
list listTypes();
ListIterator typeIterator();
private string getCreateSqlImpl(list l);
static string getCreateSql(list l);
private hash getSchemaDescriptionOptions();
private hash getReclaimSpaceOptions();
private softint getNextSequenceValueImpl(string name);
private softint getCurrentSequenceValueImpl(string name);
private bool supportsSequencesImpl();
private bool supportsTypesImpl();
private bool supportsPackagesImpl();
private bool rebuildIndexImpl(string name, *hash options);
private computeStatisticsImpl(*hash options);
private reclaimSpaceImpl(*hash options);
private any tryExecArgsImpl(string sql, *softlist args);
private any tryExecRawImpl(string sql, *softlist args);
static any tryExecArgs(AbstractDatasource ds, string sql, *softlist args);
static any tryExecRaw(AbstractDatasource ds, string sql);
};
class PgsqlTable : public SqlUtil::AbstractTable {
public:
public :
const PgsqlTypeMap = (
"abstime": ("qore": Type::Date,),
"bigint": ("qore": Type::Int,),
"bigserial": ("qore": Type::Int,),
"bit": ("qore": Type::Binary, "size": SZ_OPT,),
"bit varying": ("qore": Type::Binary, "size": SZ_OPT,),
"bool": ("qore": Type::Boolean,),
"boolean": ("qore": Type::Boolean,),
"bytea": ("qore": Type::Binary,),
"char": ("qore": Type::String, "size": SZ_OPT,),
"character": ("qore": Type::String, "size": SZ_OPT,),
"character varying": ("qore": Type::String, "size": SZ_OPT,),
"cidr": ("qore": Type::String,),
"date": ("qore": Type::Date,),
"decimal": ("qore": Type::Number, "size": SZ_NUM,),
"double precision": ("qore": Type::Float,),
"float": ("qore": Type::Float,),
"inet": ("qore": Type::String,),
"int": ("qore": Type::Int,),
"integer": ("qore": Type::Int,),
"interval": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
"macaddr": ("qore": Type::String,),
"money": ("qore": Type::Number,),
"numeric": ("qore": Type::Number, "size": SZ_NUM,),
"oid": ("qore": Type::Int,),
"real": ("qore": Type::Float,),
"reltime": ("qore": Type::Date,),
"serial": ("qore": Type::Int,),
"smallint": ("qore": Type::Int,),
"smallserial": ("qore": Type::Int,),
"text": ("qore": Type::String,),
"time": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
"time with time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
"time without time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
"timetz": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
"timestamp": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
"timestamp with time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
"timestamp without time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
"timestamptz": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
"varbit": ("qore": Type::Binary, "size": SZ_OPT,),
"varchar": ("qore": Type::String, "size": SZ_OPT,),
);
const PgsqlNameMap = (
"bit varying": "varbit",
"character": "char",
"character varying": "varchar",
"char varying": "varchar",
"double precision": "float",
"time with time zone": "timetz",
"time without time zone": "time",
"timestamp with time zone": "timestamptz",
"timestamp without time zone": "timestamp",
);
const QoreTypeMap = (
"integer": "bigint",
"float": "double precision",
"number": "numeric",
"string": "varchar",
"date": "timestamp",
"binary": "bytea",
"bool": "boolean",
SqlUtil::CHAR: "char",
SqlUtil::CLOB: "text",
SqlUtil::BLOB: "bytea",
);
const PgsqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions + (
"functions": Type::Hash,
);
const PgsqlColumnDescOptions = AbstractTable::ColumnDescOptions;
const PgsqlIndexOptions = AbstractTable::IndexOptions;
const PgsqlConstraintOptions = AbstractTable::ConstraintOptions + PgsqlIndexOptions + (
"index": Type::String,
);
const PgsqlTableCreationOptions = AbstractTable::TableCreationOptions + PgsqlConstraintOptions + (
"omit_trigger_functions": Type::Boolean,
);
const PgsqlAlignTableOptions = AbstractTable::AlignTableOptions + PgsqlTableCreationOptions;
const PgsqlCopMap = DefaultCopMap + (
COP_CAST: (
"code": string (string cve, list args) {
string name = QoreTypeMap{args[0]} ?? args[0];
hash desc = PgsqlTypeMap{name};
string sql = sprintf ("cast (%s as %s", cve, name);
switch (name);
sql += ")";
return sql;
},
),
COP_OVER: (
"argcolumn": True,
"argoptional": True,
"code": string (*string cve, *string arg) {
string sql = cve + " over (";
if (arg)
sql += sprintf("partition by %s", arg);
sql += ")";
return sql;
},
),
COP_YEAR: (
"code": string (string arg1, any arg) {
return sprintf("to_char(%s, 'YYYY')", arg1);
}
),
COP_YEAR_MONTH: (
"code": string (string arg1, any arg) {
return sprintf("to_char(%s, 'YYYY-MM')", arg1);
}
),
COP_YEAR_DAY: (
"code": string (string arg1, any arg) {
return sprintf("to_char(%s, 'YYYY-MM-DD')", arg1);
}
),
COP_YEAR_HOUR: (
"code": string (string arg1, any arg) {
return sprintf("to_char(%s, 'YYYY-MM-DD HH24')", arg1);
}
),
COP_SEQ: (
"nocolumn": True,
"withalias": True,
"code": string (*string cve, hash arg, reference psch) {
string sql = sprintf("nextval('%s')", arg.seq);
if (arg.as);
return sql;
}
),
COP_SEQ_CURRVAL: (
"nocolumn": True,
"withalias": True,
"code": string (*string cve, hash arg, reference psch) {
string sql = sprintf("currval('%s')", arg.seq);
if (arg.as);
return sql;
}
),
);
const PgsqlIopMap = DefaultIopMap + (
IOP_SEQ: (
"arg": Type::String,
"placeholder": "nextval(%v)",
),
IOP_SEQ_CURRVAL: (
"arg": Type::String,
"placeholder": "currval(%v)",
),
);
const PgsqlUopMap = DefaultUopMap + (
COP_SEQ: (
"nocolumn": True,
"code": string (*string cve, string arg) {
return sprintf("nextval('%s')", arg);
}
),
COP_SEQ_CURRVAL: (
"nocolumn": True,
"withalias": True,
"code": string (*string cve, string arg) {
return sprintf("currval('%s')", arg);
}
),
);
public:
private :
*string tablespace;
string schema;
Functions triggerFunctions;
public:
constructor(AbstractDatasource nds, string nname, *hash opts) ;
string getSchemaName();
*string getTablespaceName();
PgsqlFunction addTriggerFunction(string tfname, string src, string trigger);
bool hasArrayBind();
private PgsqlFunction addTriggerFunctionUnlocked(string tfname, string src, string trigger);
string getSqlName();
private hash getTableCreationOptions();
private hash getTableDescriptionHashOptions();
private hash getColumnDescOptions();
private hash getIndexOptions();
private hash getConstraintOptions();
private hash getAlignTableOptions();
private hash getColumnOperatorMap();
private hash getInsertOperatorMap();
private hash getRawUpdateOperatorMap();
private bool checkExistenceImpl();
private Columns describeImpl();
private PgsqlPrimaryKey getPrimaryKeyImpl();
private Indexes getIndexesImpl();
private ForeignConstraints getForeignConstraintsImpl(*hash opts);
private Constraints getConstraintsImpl();
private Triggers getTriggersImpl();
private string getCreateTableSqlImpl(*hash opt);
private *list getCreateMiscSqlImpl(*hash opt, bool cache);
private *list getAlignSqlImpl(AbstractTable table, *hash opt);
private string getCreateSqlImpl(list l);
private string getRenameSqlImpl(string new_name);
private AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
private AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
private AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
private AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch, *hash opt);
private AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
private AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
private AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
private bool tryInsertImpl(string sql, hash row);
private hash getQoreTypeMapImpl();
private hash getTypeMapImpl();
private *string getSqlValueImpl(any v);
private bool emptyImpl();
private clearImpl();
private softlist getDropSqlImpl();
private setupTableImpl(hash desc, *hash opt);
private bool constraintsLinkedToIndexesImpl();
private bool uniqueIndexCreatesConstraintImpl();
private bool supportsTablespacesImpl();
private doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh);
private doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch, *hash psch, list coll);
private any tryExecArgsImpl(string sql, *softlist args);
private any tryExecRawImpl(string sql, *softlist args);
private copyImpl(AbstractTable old);
private *hash doReturningImpl(hash opt, reference sql, list args);
private list getGroupOrderByListUnlocked(string key, hash qh, *hash jch, *hash ch, *hash psch, list coll);
};
};
SqlUtil::AbstractConstraint::name
string name
PgsqlSqlUtil::PgsqlTable::PgsqlIopMap
const PgsqlIopMap
a hash of default value operator descriptions for PostgreSQL
Definition: PgsqlSqlUtil.qm.dox.h:982
PgsqlSqlUtil::PgsqlDatabase::PgsqlReclaimSpaceOptions
const PgsqlReclaimSpaceOptions
Options for reclaimSpace()
Definition: PgsqlSqlUtil.qm.dox.h:668
PgsqlSqlUtil::PgsqlView::viewowner
*string viewowner
Owner of the view.
Definition: PgsqlSqlUtil.qm.dox.h:563
PgsqlSqlUtil::PgsqlUniqueConstraint
class modeling a unique constraint
Definition: PgsqlSqlUtil.qm.dox.h:442
Date
const Date
PgsqlSqlUtil::PgsqlUniqueConstraint::isEnabled
bool isEnabled()
returns True if the constraint is enabled, False if not
PgsqlSqlUtil::PgsqlDatabase::supportsPackagesImpl
private bool supportsPackagesImpl()
returns True if the database supports packages
COP_SEQ
const COP_SEQ
PgsqlSqlUtil::PgsqlTable::getTablespaceName
*string getTablespaceName()
returns the data tablespace name for the table or NOTHING if none is known
Hash
const Hash
PgsqlSqlUtil::PgsqlView
represents a PostgreSQL view
Definition: PgsqlSqlUtil.qm.dox.h:557
String
const String
DefaultIopMap
const DefaultIopMap
PgsqlSqlUtil::PgsqlDatabase::tryExecArgsImpl
private any tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
PgsqlSqlUtil::PgsqlCheckConstraint
represents a PostgreSQL-specific check constraint
Definition: PgsqlSqlUtil.qm.dox.h:307
sprintf
string sprintf(string fmt,...)
PgsqlSqlUtil::PgsqlDatabase::listTypes
list listTypes()
returns a list of string type names in the database
SqlUtil::AbstractTable
DefaultCopMap
const DefaultCopMap
PgsqlSqlUtil::PgsqlTable::hasArrayBind
bool hasArrayBind()
returns False because the pgsql driver does not support array binds / bulk DML operations ...
PgsqlSqlUtil::PgsqlDatabase::listProceduresImpl
private list listProceduresImpl()
since PostgreSQL only supports functions, this method is identical to listFunctionsImpl() ...
PgsqlSqlUtil::PgsqlDatabase
provides the PostgreSQL-specific implementation of the AbstractDatabase interface ...
Definition: PgsqlSqlUtil.qm.dox.h:655
PgsqlSqlUtil::PgsqlTable::supportsTablespacesImpl
private bool supportsTablespacesImpl()
returns True if the database support tablespaces
PgsqlSqlUtil::PgsqlTable::uniqueIndexCreatesConstraintImpl
private bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
PgsqlSqlUtil::PgsqlSequence::getRenameSql
string getRenameSql(string new_name)
returns a string that can be used to rename the sequence in the database
PgsqlSqlUtil::PgsqlTable::constraintsLinkedToIndexesImpl
private bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
SqlUtil::AbstractTable::cache
cache(*hash opts)
PgsqlSqlUtil::PgsqlSequence::getCreateSql
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
PgsqlSqlUtil::PgsqlCheckConstraint::constructor
constructor(string n, string n_src)
creates the constraint from the supplied arguments
PgsqlSqlUtil::PgsqlUniqueConstraint::memberGate
PgsqlColumn memberGate(string k)
returns the PgsqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception ...
PgsqlSqlUtil::PgsqlTable::getRawUpdateOperatorMap
private hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
PgsqlSqlUtil::PgsqlIndex::getCreateSql
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
SqlUtil::AbstractIndex
PgsqlSqlUtil::PgsqlColumn
represents a PostgreSQL-specific column
Definition: PgsqlSqlUtil.qm.dox.h:327
PgsqlSqlUtil::PgsqlTable::PgsqlNameMap
const PgsqlNameMap
maps from verbose type names to simple type names
Definition: PgsqlSqlUtil.qm.dox.h:870
PgsqlSqlUtil::PgsqlTrigger::equalImpl
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
COP_OVER
const COP_OVER
PgsqlSqlUtil::PgsqlDatabase::materializedViewIterator
ListIterator materializedViewIterator()
returns an iterator listing the string materialized view names in the database
PgsqlSqlUtil::PgsqlUniqueConstraintCommon::setTablespace
setTablespace(*string ts)
sets or clears the tablespace name
PgsqlSqlUtil::PgsqlType::getDropSqlForce
string getDropSqlForce()
returns a string that can be used to drop a type and all dependencies
PgsqlSqlUtil::PgsqlUniqueConstraintCommon::setIndexBase
bool setIndexBase(string ix)
sets the supporting index name
PgsqlSqlUtil::PgsqlTrigger
represents a PostgreSQL-specific trigger
Definition: PgsqlSqlUtil.qm.dox.h:583
PgsqlSqlUtil::PgsqlFunction::getCreateSql
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
PgsqlSqlUtil::PgsqlFunction::setName
setName(string new_name)
sets the new name of the function
PgsqlSqlUtil::PgsqlType
represents a PostgreSQL type
Definition: PgsqlSqlUtil.qm.dox.h:215
PgsqlSqlUtil::PgsqlTable::clearImpl
private clearImpl()
clears PostgreSQL-specific table information
PgsqlSqlUtil::PgsqlTable::getCreateSqlImpl
private string getCreateSqlImpl(list l)
returns a string that can be used to create the table in the database
COP_SEQ_CURRVAL
const COP_SEQ_CURRVAL
SqlUtil::NumericColumnInfo
True
const True
PgsqlSqlUtil::PgsqlTable::getColumnOperatorMap
private hash getColumnOperatorMap()
returns the column operator map for this object
PgsqlSqlUtil::PgsqlPrimaryKey::memberGate
PgsqlColumn memberGate(string k)
returns the PgsqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception ...
SqlUtil::CHAR
const CHAR
PgsqlSqlUtil::PgsqlTriggerFunction::trigger
string trigger
trigger name
Definition: PgsqlSqlUtil.qm.dox.h:646
PgsqlSqlUtil::PgsqlFunction::equalImpl
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractSequence
PgsqlSqlUtil::PgsqlDatabase::tryExecArgs
static any tryExecArgs(AbstractDatasource ds, string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
PgsqlSqlUtil::PgsqlIndex
represents a PostgreSQL-specific index
Definition: PgsqlSqlUtil.qm.dox.h:259
PgsqlSqlUtil::PgsqlPrimaryKey::getRenameSql
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the constraint
PgsqlSqlUtil::PgsqlTable::PgsqlTableDescriptionHashOptions
const PgsqlTableDescriptionHashOptions
extends SqlUtil::AbstractTable::TableDescriptionHashOptions with &quot;functions&quot; for table functions requ...
Definition: PgsqlSqlUtil.qm.dox.h:897
PgsqlSqlUtil::PgsqlType::getRenameSql
string getRenameSql(string new_name)
returns a string that can be used to rename a type
number
number number(softnumber n)
COP_YEAR_HOUR
const COP_YEAR_HOUR
PgsqlSqlUtil::PgsqlTriggerFunction
represents a PostgreSQL-specific trigger function
Definition: PgsqlSqlUtil.qm.dox.h:641
PgsqlSqlUtil::PgsqlTable::tryExecArgsImpl
private any tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
IOP_SEQ_CURRVAL
const IOP_SEQ_CURRVAL
PgsqlSqlUtil::PgsqlColumn::constructor
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs)
creates the column from the supplied arguments
PgsqlSqlUtil::PgsqlType::getCreateSql
string getCreateSql(*hash opt)
returns a string that can be used to create the type in the database
PgsqlSqlUtil::PgsqlColumn::byte_size
int byte_size
byte size of the column
Definition: PgsqlSqlUtil.qm.dox.h:332
PgsqlSqlUtil::PgsqlView::getCreateSql
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
PgsqlSqlUtil::PgsqlIndex::tablespace
*string tablespace
the tablespace name of the index
Definition: PgsqlSqlUtil.qm.dox.h:264
SqlUtil::AbstractForeignConstraint
PgsqlSqlUtil::PgsqlNumericColumn
represents a PostgreSQL-specific numeric column
Definition: PgsqlSqlUtil.qm.dox.h:391
SqlUtil::AbstractSqlUtilBase::l
Mutex l()
SqlUtil::AbstractCheckConstraint
list
list list(...)
PgsqlSqlUtil::PgsqlUniqueConstraintCommon::getIndexSql
getIndexSql(reference sql, string name, *hash opts)
adds index options onto the sql creation string
PgsqlSqlUtil::PgsqlPrimaryKey::getCreateSql
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
Float
const Float
PgsqlSqlUtil::PgsqlTable::getInsertOperatorMap
private hash getInsertOperatorMap()
returns the insert operator map for this object
PgsqlSqlUtil::PgsqlTable::QoreTypeMap
const QoreTypeMap
maps qore type names to PostgreSQL type names
Definition: PgsqlSqlUtil.qm.dox.h:883
SqlUtil::AbstractTable::name
string name
PgsqlSqlUtil::PgsqlTable::doSelectOrderByWithOffsetSqlUnlockedImpl
private doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch, *hash psch, list coll)
processes a string for use in SQL select statements when there is an &quot;order by&quot; and &quot;offset&quot; argument...
PgsqlSqlUtil::PgsqlDatabase::computeStatisticsImpl
private computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics() ...
PgsqlSqlUtil::PgsqlColumn::getNativeTypeString
string getNativeTypeString()
returns a string giving the native type of the column
PgsqlSqlUtil::PgsqlDatabase::tryExecRaw
static any tryExecRaw(AbstractDatasource ds, string sql)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
PgsqlSqlUtil::PgsqlUniqueConstraintCommon::constructor
constructor(*string ts)
creates the constraint with an optional tablespace name
PgsqlSqlUtil::PgsqlTable::getSchemaName
string getSchemaName()
returns the schema name
Boolean
const Boolean
PgsqlSqlUtil::PgsqlTable::getSqlName
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
PgsqlSqlUtil::PgsqlDatabase::tryExecRawImpl
private any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
SZ_NUM
const SZ_NUM
PgsqlSqlUtil::PgsqlSequence::constructor
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_end)
creates the object from the arguments
PgsqlSqlUtil::PgsqlType::name
string name
the name of the type
Definition: PgsqlSqlUtil.qm.dox.h:220
PgsqlSqlUtil::PgsqlTrigger::getDropSql
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from the database
PgsqlSqlUtil::PgsqlTrigger::getCreateSql
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
Binary
const Binary
PgsqlSqlUtil::PgsqlTable::doSelectLimitOnlyUnlockedImpl
private doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh)
processes a string for use in SQL select statements when there is a &quot;limit&quot; argument, but no &quot;orderby&quot; or &quot;offset&quot; arguments
PgsqlSqlUtil::PgsqlDatabase::getCreateSql
static string getCreateSql(list l)
returns a string that can be used to create the schema in the database
PgsqlSqlUtil::PgsqlDatabase::supportsSequencesImpl
private bool supportsSequencesImpl()
returns True if the database supports sequences
PgsqlSqlUtil::PgsqlColumn::getRenameSql
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
PgsqlSqlUtil::PgsqlDatabase::getCurrentSequenceValueImpl
private softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
PgsqlSqlUtil::PgsqlUniqueConstraint::enabled
bool enabled
True if the constraint is enabled, False if not
Definition: PgsqlSqlUtil.qm.dox.h:447
PgsqlSqlUtil::PgsqlTable::PgsqlTypeMap
const PgsqlTypeMap
maps PostgreSQL type names to type configurations
Definition: PgsqlSqlUtil.qm.dox.h:826
PgsqlSqlUtil::PgsqlIndex::getRenameSql
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
PgsqlSqlUtil::PgsqlPrimaryKey::constructor
constructor()
creates an empty primary key object
COP_YEAR_MONTH
const COP_YEAR_MONTH
PgsqlSqlUtil::PgsqlTable::tryExecRawImpl
private any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
PgsqlSqlUtil::PgsqlDatabase::getCreateSqlImpl
private string getCreateSqlImpl(list l)
returns a string that can be used to create the schema in the database
PgsqlSqlUtil::PgsqlTable::triggerFunctions
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: PgsqlSqlUtil.qm.dox.h:1020
PgsqlSqlUtil::PgsqlTable::getSqlValueImpl
private *string getSqlValueImpl(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
PgsqlSqlUtil::PgsqlUniqueConstraintCommon
common base class for unique constraints
Definition: PgsqlSqlUtil.qm.dox.h:404
PgsqlSqlUtil::PgsqlDatabase::PgsqlSchemaDescriptionOptions
const PgsqlSchemaDescriptionOptions
PostgreSQL-specific schema description keys.
Definition: PgsqlSqlUtil.qm.dox.h:660
SqlUtil::BLOB
const BLOB
PgsqlSqlUtil::PgsqlDatabase::supportsTypesImpl
private bool supportsTypesImpl()
returns True if the database supports named types
PgsqlSqlUtil::PgsqlTrigger::getRenameSql
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
type
string type(any arg)
SqlUtil::CLOB
const CLOB
PgsqlSqlUtil::PgsqlDatabase::typeIterator
ListIterator typeIterator()
returns an iterator listing the string type names in the database
PgsqlSqlUtil::PgsqlType::src
string src
the source of the type
Definition: PgsqlSqlUtil.qm.dox.h:223
PgsqlSqlUtil::PgsqlPrimaryKey
represents a PostgreSQL-specific primary key constraint
Definition: PgsqlSqlUtil.qm.dox.h:496
SqlUtil::AbstractSqlUtilBase::ds
AbstractDatasource ds
PgsqlSqlUtil::PgsqlType::constructor
constructor(string n_name, string n_src)
creates the type from the supplied arguments
SqlUtil::AbstractFunction
PgsqlSqlUtil::PgsqlForeignConstraint::getCreateSql
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
SqlUtil::AbstractView
SqlUtil::AbstractSqlUtilBase::opts
*hash opts
SqlUtil::AbstractDatabase::native_case
bool native_case
PgsqlSqlUtil::PgsqlColumn::equalImpl
private bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
PgsqlSqlUtil::PgsqlIndex::equalImpl
private bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
PgsqlSqlUtil::PgsqlView::getRenameSql
softlist getRenameSql(string new_name)
returns a string that can be used to rename the view in the database
Int
const Int
PgsqlSqlUtil::PgsqlDatabase::listTablesImpl
private list listTablesImpl()
returns a list of string table names in the database
COP_YEAR
const COP_YEAR
string
string string(softstring str, *string enc)
PgsqlSqlUtil::PgsqlTable::PgsqlUopMap
const PgsqlUopMap
a hash of default update operator definitions for PostgreSQL
Definition: PgsqlSqlUtil.qm.dox.h:994
PgsqlSqlUtil::PgsqlTable::tablespace
*string tablespace
tablespace name for the table, if known
Definition: PgsqlSqlUtil.qm.dox.h:1014
PgsqlSqlUtil::PgsqlDatabase::listMaterializedViews
list listMaterializedViews()
returns a list of string materialized view names in the database
SqlUtil::AbstractTrigger
PgsqlSqlUtil::PgsqlDatabase::getNextSequenceValueImpl
private softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
PgsqlSqlUtil::PgsqlForeignConstraint
represents a PostgreSQL-specific foreign constraint
Definition: PgsqlSqlUtil.qm.dox.h:287
PgsqlSqlUtil::PgsqlCheckConstraint::getCreateSql
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
SqlUtil::AbstractColumn
COP_CAST
const COP_CAST
DefaultUopMap
const DefaultUopMap
COP_YEAR_DAY
const COP_YEAR_DAY
PgsqlSqlUtil::PgsqlColumn::getAddColumnSql
list getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table ...
PgsqlSqlUtil::PgsqlUniqueConstraintCommon::getTablespace
*string getTablespace()
returns the tablespace name used for this constraint, if known
PgsqlSqlUtil::PgsqlView::constructor
constructor(string n_name, string n_src, *string n_schemaname, *string n_viewowner)
creates the object from the arguments
PgsqlSqlUtil::PgsqlNumericColumn::constructor
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint n_scale)
creates the column from the supplied arguments
PgsqlSqlUtil::PgsqlFunction::getDropSql
string getDropSql()
returns a string that can be used to drop the function from the database
PgsqlSqlUtil::PgsqlType::getDropSql
string getDropSql(*hash opt)
returns a string that can be used to drop a type
PgsqlSqlUtil::PgsqlUniqueConstraint::constructor
constructor(string n, hash n_cols, bool e=True, *string ts)
creates the object with the given attributes
PgsqlSqlUtil::PgsqlTable::getCreateTableSqlImpl
private string getCreateTableSqlImpl(*hash opt)
returns a string that can be used to create the table in the database
PgsqlSqlUtil::PgsqlTrigger::constructor
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
PgsqlSqlUtil::PgsqlIndex::constructor
constructor(string n_name, bool n_unique, hash n_cols, *string n_tablespace)
creates the object from the arguments
PgsqlSqlUtil::PgsqlTable::schema
string schema
schema name for the table
Definition: PgsqlSqlUtil.qm.dox.h:1017
PgsqlSqlUtil::PgsqlUniqueConstraint::getCreateSql
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
hash
hash hash(object obj)
PgsqlSqlUtil::PgsqlTable::PgsqlCopMap
const PgsqlCopMap
column operator specializations for PostgreSQL
Definition: PgsqlSqlUtil.qm.dox.h:916
PgsqlSqlUtil::PgsqlForeignConstraint::constructor
constructor(string n, Columns c, ForeignConstraintTarget t)
creates the constraint from the supplied arguments
PgsqlSqlUtil::PgsqlColumn::getModifySqlImpl
list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt)
returns a list of sql strings that can be used to modify the column to the new definition; if the col...
SZ_OPT
const SZ_OPT
PgsqlSqlUtil::PgsqlUniqueConstraintCommon::tablespace
*string tablespace
any tablespace for the unique key index
Definition: PgsqlSqlUtil.qm.dox.h:409
PgsqlSqlUtil::PgsqlDatabase::rebuildIndexImpl
private bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
PgsqlSqlUtil::PgsqlSequence
class for PostgreSQL sequences
Definition: PgsqlSqlUtil.qm.dox.h:540
PgsqlSqlUtil::PgsqlUniqueConstraintCommon::keyIterator
abstract AbstractIterator keyIterator()
returns an iterator for keys iterating a list of string key names
IOP_SEQ
const IOP_SEQ
SqlUtil::AbstractDatabase
PgsqlSqlUtil::get_table
PgsqlTable get_table(AbstractDatasource nds, string nname, *hash opts)
returns a PgsqlTable object corresponding to the arguments
PgsqlSqlUtil::PgsqlTable
provides the PostgreSQL-specific implementation of the SqlUtil::AbstractTable interface ...
Definition: PgsqlSqlUtil.qm.dox.h:821
SqlUtil::AbstractPrimaryKey
PgsqlSqlUtil::PgsqlDatabase::getSchemaDescriptionOptions
private hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
PgsqlSqlUtil::PgsqlFunction::getRenameSql
softlist getRenameSql(string new_name)
returns a string that can be used to rename the function in the database
PgsqlSqlUtil::PgsqlDatabase::reclaimSpaceImpl
private reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
Number
const Number
PgsqlSqlUtil::get_database
PgsqlDatabase get_database(AbstractDatasource nds, *hash opts)
returns a PgsqlDatabase object corresponding to the arguments
PgsqlSqlUtil::PgsqlFunction
represents a PostgreSQL-specific function
Definition: PgsqlSqlUtil.qm.dox.h:608
PgsqlSqlUtil::PgsqlTable::copyImpl
private copyImpl(AbstractTable old)
db-specific copy actions
PgsqlSqlUtil::PgsqlType::equal
bool equal(PgsqlType type)
returns True if the types are equal
PgsqlSqlUtil::PgsqlDatabase::getReclaimSpaceOptions
private hash getReclaimSpaceOptions()
returns driver-specific options to the base abstract class
SqlUtil::AbstractUniqueConstraint
SqlUtil::AbstractDatabase::ReclaimSpaceOptions
const ReclaimSpaceOptions
PgsqlSqlUtil::PgsqlUniqueConstraintCommon::clearIndex
clearIndex()
clears any index base for the constraint
PgsqlSqlUtil::PgsqlNumericColumn::getNativeTypeString
string getNativeTypeString()
returns a string giving the native type of the column
PgsqlSqlUtil::PgsqlDatabase::listFunctionsImpl
private list listFunctionsImpl()
returns a list of string function names in the database