192 namespace PgsqlSqlUtil {
195 PgsqlTable
get_table(AbstractDatasource nds,
string nname, *
hash opts);
215 constructor(
string n_name,
string n_src);
224 string getCreateSql(*
hash opt);
227 string getDropSql(*
hash opt);
230 string getRenameSql(
string new_name);
248 constructor(
string n_name,
bool n_unique,
hash n_cols, *
string n_tablespace);
263 string getRenameSql(
string table_name,
string new_name);
271 constructor(
string n, Columns c, ForeignConstraintTarget t);
274 string getCreateSql(
string table_name, *
hash opt);
277 softlist getRenameSql(
string table_name,
string new_name);
280 string getCreateSql(
string name,
string table_name, *
hash opt);
288 constructor(
string n,
string n_src);
291 string getCreateSql(
string table_name, *
hash opt);
294 list getRenameSql(
string table_name,
string new_name);
297 string getCreateSql(
string name,
string table_name, *
hash opt);
311 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs);
314 string getNativeTypeString();
370 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs, softint n_scale);
373 string getNativeTypeString();
386 constructor(*
string ts);
389 bool setIndexBase(
string ix);
396 abstract AbstractIterator keyIterator();
399 getIndexSql(reference sql,
string name, *
hash opts);
412 constructor(
string n,
hash n_cols,
bool e =
True, *
string ts);
431 PgsqlColumn memberGate(
string k);
434 string getCreateSql(
string table_name, *
hash opts);
437 list getRenameSql(
string table_name,
string new_name);
440 string getCreateSql(
string name,
string table_name, *
hash opts);
451 constructor(
string n, *
hash c, *
string ts);
473 string getCreateSql(
string table_name, *
hash opts);
476 softlist getRenameSql(
string table_name,
string new_name);
521 softlist
getRenameSql(
string table_name,
string new_name);
534 constructor(
string n,
string n_src, *
string a);
571 constructor(
string n,
string n_src,
string n_trigger);
586 const PGSQL_TempSavepoint =
"qore_pgsql_tmp_savepoint";
590 constructor(AbstractDatasource nds, *
hash opts);
613 *AbstractSequence getSequenceImpl(
string name);
631 *AbstractFunction getFunctionImpl(
string name);
637 AbstractFunction getProcedureImpl(
string name);
641 static *
string getFunctionArgs(
string err, reference src);
686 list listSequencesImpl();
692 list listViewsImpl();
698 string getCreateSqlImpl(
list l);
702 static string getCreateSql(
list l);
754 static any
tryExecArgs(AbstractDatasource
ds,
string sql, *softlist args);
757 static any
tryExecRaw(AbstractDatasource
ds,
string sql);
784 "timestamp without time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
785 "timestamp": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
786 "timestamp with time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
787 "time without time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
788 "time": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
789 "time with time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
790 "interval": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
805 "character varying":
"varchar",
807 "timestamp without time zone":
"timestamp",
808 "time without time zone":
"time",
814 "float":
"double precision",
830 const PgsqlColumnDescOptions = AbstractTable::ColumnDescOptions;
832 const PgsqlIndexOptions = AbstractTable::IndexOptions;
834 const PgsqlConstraintOptions = AbstractTable::ConstraintOptions + PgsqlIndexOptions + (
838 const PgsqlTableCreationOptions = AbstractTable::TableCreationOptions + PgsqlConstraintOptions + (
842 const PgsqlAlignTableOptions = AbstractTable::AlignTableOptions + PgsqlTableCreationOptions;
849 "code":
string (*
string cve, *
string arg) {
850 string sql = cve +
" over (";
852 sql +=
sprintf(
"partition by %s", arg);
859 "code":
string (
string arg1, any arg) {
860 return sprintf(
"to_char(%s, 'YYYY')", arg1);
864 "code":
string (
string arg1, any arg) {
865 return sprintf(
"to_char(%s, 'YYYY-MM')", arg1);
869 "code":
string (
string arg1, any arg) {
870 return sprintf(
"to_char(%s, 'YYYY-MM-DD')", arg1);
874 "code":
string (
string arg1, any arg) {
875 return sprintf(
"to_char(%s, 'YYYY-MM-DD HH24')", arg1);
893 constructor(AbstractDatasource nds,
string nname, *
hash opts);
904 PgsqlFunction addTriggerFunction(
string tfname,
string src,
string trigger);
909 PgsqlFunction addTriggerFunctionUnlocked(
string tfname,
string src,
string trigger);
919 hash getTableCreationOptions();
925 hash getTableDescriptionHashOptions();
931 hash getColumnDescOptions();
937 hash getIndexOptions();
943 hash getConstraintOptions();
949 hash getAlignTableOptions();
962 bool checkExistenceImpl();
968 Columns describeImpl();
980 Indexes getIndexesImpl();
986 ForeignConstraints getForeignConstraintsImpl(*
hash opts);
992 Constraints getConstraintsImpl();
998 Triggers getTriggersImpl();
1004 string getCreateTableSqlImpl(*
hash opt);
1016 *
list getAlignSqlImpl(AbstractTable table, *
hash opt);
1022 string getCreateSqlImpl(
list l);
1028 string getRenameSqlImpl(
string new_name);
1034 AbstractColumn addColumnImpl(
string cname,
hash opt,
bool nullable =
True);
1040 AbstractPrimaryKey addPrimaryKeyImpl(
string cname,
hash ch, *
hash opt);
1046 AbstractIndex addIndexImpl(
string iname,
bool enabled,
hash ch, *
hash opt);
1052 AbstractForeignConstraint addForeignConstraintImpl(
string cname,
hash ch,
string table,
hash tch, *
hash opt);
1058 AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *
hash opt);
1064 AbstractUniqueConstraint addUniqueConstraintImpl(
string cname,
hash ch, *
hash opt);
1070 AbstractTrigger addTriggerImpl(
string tname,
string src, *
hash opt);
1076 bool tryInsertImpl(
string sql,
hash row);
1082 hash getQoreTypeMapImpl();
1088 hash getTypeMapImpl();
1114 softlist getDropSqlImpl();
1120 setupTableImpl(
hash desc, *
hash opt);
*string getTablespaceName()
returns the data tablespace name for the table or NOTHING if none is known
represents a PostgreSQL-specific check constraint
Definition: PgsqlSqlUtil.qm.dox.h:285
string sprintf(string fmt,...)
bool supportsSequencesImpl()
returns True if the database supports sequences
hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
provides the PostgreSQL-specific implementation of the AbstractDatabase interface ...
Definition: PgsqlSqlUtil.qm.dox.h:576
string getRenameSql(string new_name)
returns a string that can be used to rename the sequence in the database
any tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
list listProceduresImpl()
since PostgreSQL only supports functions, this method is identical to listFunctionsImpl() ...
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
represents a PostgreSQL-specific column
Definition: PgsqlSqlUtil.qm.dox.h:302
const PgsqlNameMap
maps from verbose type names to simple type names
Definition: PgsqlSqlUtil.qm.dox.h:804
doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh)
processes a string for use in SQL select statements when there is a "limit" argument, but no "orderby" or "offset" arguments
any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
represents a PostgreSQL-specific trigger
Definition: PgsqlSqlUtil.qm.dox.h:498
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
setName(string new_name)
sets the new name of the function
represents a PostgreSQL type
Definition: PgsqlSqlUtil.qm.dox.h:203
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
list listTablesImpl()
returns a list of string table names in the database
PgsqlColumn memberGate(string k)
returns the PgsqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception ...
string trigger
trigger name
Definition: PgsqlSqlUtil.qm.dox.h:567
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 ...
represents a PostgreSQL-specific index
Definition: PgsqlSqlUtil.qm.dox.h:238
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
const PgsqlTableDescriptionHashOptions
extends SqlUtil::AbstractTable::TableDescriptionHashOptions with "functions" for table functions requ...
Definition: PgsqlSqlUtil.qm.dox.h:826
number number(softnumber n)
represents a PostgreSQL-specific trigger function
Definition: PgsqlSqlUtil.qm.dox.h:562
int byte_size
byte size of the column
Definition: PgsqlSqlUtil.qm.dox.h:307
*string tablespace
the tablespace name of the index
Definition: PgsqlSqlUtil.qm.dox.h:243
doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch)
processes a string for use in SQL select statements when there is an "order by" and "offset" argument...
represents a PostgreSQL-specific numeric column
Definition: PgsqlSqlUtil.qm.dox.h:367
const QoreTypeMap
maps qore type names to postgresql type names
Definition: PgsqlSqlUtil.qm.dox.h:812
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 ...
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)
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_end)
creates the object from the arguments
string name
the name of the type
Definition: PgsqlSqlUtil.qm.dox.h:208
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from the database
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
bool supportsTypesImpl()
returns True if the database supports named types
any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
clearImpl()
clears PostgreSQL-specific table information
const PgsqlTypeMap
maps postgresql type names to type configurations
Definition: PgsqlSqlUtil.qm.dox.h:766
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: PgsqlSqlUtil.qm.dox.h:889
const PgsqlSchemaDescriptionOptions
PostgreSQL-specific schema description keys.
Definition: PgsqlSqlUtil.qm.dox.h:581
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
string src
the source of the type
Definition: PgsqlSqlUtil.qm.dox.h:211
represents a PostgreSQL-specific primary key constraint
Definition: PgsqlSqlUtil.qm.dox.h:445
string string(softstring str)
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
*string tablespace
tablespace name for the table, if known
Definition: PgsqlSqlUtil.qm.dox.h:883
bool supportsPackagesImpl()
returns True if the database supports packages
represents a PostgreSQL-specific foreign constraint
Definition: PgsqlSqlUtil.qm.dox.h:268
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
string getDropSql()
returns a string that can be used to drop the function from the database
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
constructor(string n_name, bool n_unique, hash n_cols, *string n_tablespace)
creates the object from the arguments
string schema
schema name for the table
Definition: PgsqlSqlUtil.qm.dox.h:886
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
const PgsqlCopMap
column operator specializations for PostgreSQL
Definition: PgsqlSqlUtil.qm.dox.h:845
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...
class for PostgreSQL sequences
Definition: PgsqlSqlUtil.qm.dox.h:481
list listFunctionsImpl()
returns a list of string function names in the database
bool supportsTablespacesImpl()
returns True if the database support tablespaces
copyImpl(AbstractTable old)
db-specific copy actions
any tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
PgsqlTable get_table(AbstractDatasource nds, string nname, *hash opts)
returns a PgsqlTable object corresponding to the arguments
provides the PostgreSQL-specific implementation of the SqlUtil::AbstractTable interface ...
Definition: PgsqlSqlUtil.qm.dox.h:761
*string getSqlValueImpl(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
softlist getRenameSql(string new_name)
returns a string that can be used to rename the function in the database
hash getColumnOperatorMap()
returns the column operator map for this object
PgsqlDatabase get_database(AbstractDatasource nds, *hash opts)
returns a PgsqlDatabase object corresponding to the arguments
represents a PostgreSQL-specific function
Definition: PgsqlSqlUtil.qm.dox.h:526