317 hash m_customCopMap = {};
355 doTableOptions(*hash<auto> nopts);
426 drop(*hash<auto> opt);
458 auto tryExecArgs(
string sql, *softlist<auto> args);
595 rename(
string new_name, *reference<string> sql, *
Tables table_cache);
599 doRenameIntern(
string new_name, *
Tables table_cache);
632 bool emptyUnlocked();
710 AbstractColumn addColumnUnlocked(
string cname, hash<auto> opt,
bool nullable =
True, *reference lsql,
bool do_exec =
True,
bool modify_table =
True);
828 validateOptionsIntern(
string err,
hash ropt, reference<hash> opt);
833 validateOptionsIntern(
string err,
hash ropt, reference<hash> opt,
string tag);
838 execSql(softlist lsql);
898 AbstractPrimaryKey addPrimaryKeyUnlocked(
string pkname, softlist cols, *hash<auto> opt, *reference<string> sql);
903 AbstractPrimaryKey addPrimaryKeyUnlockedIntern(
string pkname, softlist cols, *hash<auto> opt, *reference<string> sql);
928 list<auto> getDropAllConstraintsAndIndexesOnColumnSqlUnlocked(
string cname, *hash<auto> opt);
1027 AbstractUniqueConstraint addUniqueConstraintUnlocked(
string cname, softlist cols, *hash<auto> opt, *reference<string> sql);
1032 AbstractUniqueConstraint addUniqueConstraintUnlockedIntern(
string cname, softlist cols, *hash<auto> opt, *reference<string> sql);
1058 AbstractIndex addIndex(
string iname,
bool unique, softlist cols, *hash<auto> opt, *reference<string> sql);
1083 string getAddIndexSql(
string iname,
bool unique, softlist cols, *hash<auto> ixopt, *hash<auto> opt);
1087 AbstractIndex addIndexUnlocked(
string iname,
bool unique, softlist cols, *hash<auto> opt, *reference<string> sql);
1092 AbstractIndex addIndexUnlockedIntern(
string iname,
bool unique, softlist cols, *hash<auto> opt, *reference<string> sql);
1210 Columns getReferencedTableColumnsUnlocked(
string table, *
Tables cache,
string err =
'FOREIGN-CONSTRAINT-ERROR');
1215 AbstractForeignConstraint addForeignConstraintUnlocked(
string cname, softlist cols,
string table, *softlist tcols, *hash<auto> opt, *reference<string> sql);
1220 AbstractForeignConstraint addForeignConstraintUnlockedIntern(
string cname, softlist cols,
string table, *softlist tcols, *hash<auto> opt, *reference<string> sql);
1316 AbstractCheckConstraint addCheckConstraintUnlocked(
string cname,
string src, *hash<auto> opt, *reference<string> sql);
1321 AbstractCheckConstraint addCheckConstraintUnlockedIntern(
string cname,
string src, *hash<auto> opt, *reference<string> sql);
1465 AbstractTrigger addTriggerUnlocked(
string tname,
string src, *hash<auto> opt, *reference lsql);
1470 AbstractTrigger addTriggerUnlockedIntern(
string tname,
string src, *hash<auto> opt, *reference lsql);
1520 getAllConstraintsUnlocked(*hash<auto> opt);
1525 checkUniqueConstraintName(
string err,
string cname);
1530 checkUniqueConstraintNameValidateOptions(
string err,
string cname, hash<auto> ropt, reference<hash> opt);
1605 *hash<auto>
insertCommit(hash<auto> row, reference<string> sql);
1613 *hash<auto>
insertCommit(hash<auto> row, hash<auto> opt);
1622 *hash<auto>
insertCommit(hash<auto> row, reference<string> sql, hash<auto> opt);
1638 *hash<auto>
insert(hash<auto> row);
1646 *hash<auto>
insert(hash<auto> row, reference<string> sql);
1654 *hash<auto>
insert(hash<auto> row, hash<auto> opt);
1663 *hash<auto>
insert(hash<auto> row, reference<string> sql, hash<auto> opt);
1676 hash<SqlResultInfo>
insertWithInfo(hash<auto> row, *hash<auto> opt);
1680 deprecated *hash<auto>
insertNoCommit(hash<auto> row, *reference<string> sql, *hash<auto> opt);
1683 deprecated *hash<auto>
insertNoCommit(hash<auto> row, hash<auto> opt);
1686 *hash<auto> insertIntern(hash<auto> row, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
1691 hash<auto> getPlaceholdersAndValues(hash<auto> row);
1801 int insertFromSelectIntern(
list cols,
AbstractTable source, *hash<auto> sh, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
1894 int upsert(hash<auto> row,
int upsert_strategy =
UpsertAuto, *hash<auto> opt);
2062 *hash<auto> doDeleteOthersIntern(
hash pkh, *hash<auto> opt);
2427 Qore::SQL::AbstractSQLStatement getStatementIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt, *
bool no_exec, *reference<softlist<auto>> args);
2451 *hash<auto>
selectRow(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
2455 *hash<auto> selectRowIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
2486 hash<SqlResultInfo>
selectRowWithInfo(*hash<auto> select_hash, *hash<auto> opt);
2510 *list<auto>
selectRows(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
2514 *list<auto> selectRowsIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
2567 *hash<auto>
select(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
2571 *hash<auto> selectIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
2601 hash<SqlResultInfo>
selectWithInfo(*hash<auto> select_hash, *hash<auto> opt);
2623 *hash<auto>
selectRow(*hash<auto> sh, *hash<auto> opt);
2665 *hash<auto>
select(*hash<auto> sh, *hash<auto> opt);
2687 string getSelectSql(*hash<auto> sh, *reference<list<auto>> args);
2693 string getSelectSqlIntern(*hash<auto> qh, reference<list<auto>> args, *hash<auto> opt);
2696 string getSelectSqlUnlocked(*hash<auto> qh, reference<list<auto>> args, *hash<auto> opt);
2700 string getSelectSqlUnlockedIntern(*hash<auto> qh,
string from, reference<list<auto>> args, *hash<auto> ch, *hash<auto> opt);
2708 string getFromIntern(
string from, *hash<auto> qh);
2713 list<auto> getGroupByListUnlocked(hash<auto> qh, *hash<auto> jch, *hash<auto> ch, *hash<auto> psch,
list coll);
2718 list<auto> getOrderByListUnlocked(hash<auto> qh, *hash<auto> jch, *hash<auto> ch, *hash<auto> psch,
list coll);
2723 list<auto> getGroupOrderByListUnlocked(
string key, hash<auto> qh, *hash<auto> jch, *hash<auto> ch, *hash<auto> psch,
list coll);
2728 doForUpdate(reference<string> sql);
2733 string getSelectSqlName(*hash<auto> qh);
2738 string getColumnExpressionIntern(
auto cvc, *hash<auto> jch,
bool join, *hash<auto> ch, *hash<auto> psch);
2743 string doColumnOperatorIntern(
hash cvc, *hash<auto> jch,
bool join, *hash<auto> ch, *hash<auto> psch, *reference psch_ref);
2748 string doColumnOperatorIntern(
auto cop,
auto arg, *
string cve,
hash cm, *hash<auto> jch,
bool join, *hash<auto> ch, *hash<auto> psch, *reference psch_ref);
2753 string getColumnNameIntern(
string cv, *hash<auto> jch,
bool join, *hash<auto> ch, *hash<auto> psch);
2764 getSelectWhereSqlUnlocked(reference<string> sql, reference<list<auto>> args, *hash<auto> qh, *hash<auto> jch,
bool join =
False, *hash<auto> ch, *hash<auto> psch);
2769 *
string getWhereClause(*
hash cond, reference<list<auto>> args, *
string cprefix, *hash<auto> jch,
bool join =
False);
2774 *
string getWhereClause(
list cond, reference<list<auto>> args, *
string cprefix, *hash<auto> jch,
bool join =
False);
2779 *
string getWhereClauseUnlocked(
list cond, reference<list<auto>> args, *
string cprefix, *hash<auto> jch,
bool join =
False, *
hash pch, *hash<auto> psch);
2784 *
string getWhereClauseUnlocked(*
hash cond, reference<list<auto>> args, *
string cprefix, *hash<auto> jch,
bool join =
False, *
hash pch, *hash<auto> psch);
2789 *list<string> getWhereClauseIntern(*
hash cond, reference<list<auto>> args, *
string cprefix, *hash<auto> jch,
bool join =
False, *hash<auto> ch, *hash<auto> psch, *hash<auto> opt);
2794 string doWhereExpressionIntern(
string cn,
auto we, reference<list<auto>> args, *hash<auto> jch,
bool join =
False, *hash<auto> ch, *hash<auto> psch, *hash<auto> opt);
2798 string getOrClause(list<auto> arglist, reference<list<auto>> args, *hash<auto> jch,
bool join =
False, *hash<auto> ch, *hash<auto> psch);
2801 string getOrClause(hash<auto> arg, reference<list<auto>> args, *hash<auto> jch,
bool join =
False, *hash<auto> ch, *hash<auto> psch);
2805 doSelectOrderBySqlUnlocked(reference<string> sql, reference<list<auto>> args, *hash<auto> qh, *hash<auto> jch, *hash<auto> ch, *hash<auto> psch,
list coll);
2825 int delCommit(
hash cond, reference<string> sql, hash<auto> opt);
2860 int del(
hash cond, reference<string> sql, hash<auto> opt);
2864 int del(
hash cond, hash<auto> opt);
2868 int del(
hash cond, reference<string> sql);
2894 hash<SqlResultInfo>
delWithInfo(hash<auto> cond, *hash<auto> opt);
2901 int delIntern(*hash<auto> cond, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
2960 int update(
hash set,
hash cond, reference<string> sql, hash<auto> opt);
2998 hash<SqlResultInfo>
updateWithInfo(hash<auto>
set, hash<auto> cond, *hash<auto> opt);
3014 hash<SqlCommandInfo>
getUpdateSql(hash<auto>
set, *hash<auto> cond);
3024 int updateIntern(hash<auto>
set, *hash<auto> cond, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
3029 string getUpdateExpression(
string col, hash<UpdateOperatorInfo> uh);
3034 bool emptyDataIntern();
3039 Columns checkUpsertRow(hash<auto> row, reference<int> upsert_strategy);
3044 code getUpsertInsertFirst(
Columns cols,
hash example_row, *hash<auto> opt);
3049 code getUpsertUpdateFirst(
Columns cols,
hash example_row, *hash<auto> opt);
3054 code getUpsertSelectFirst(
Columns cols,
hash example_row, *hash<auto> opt);
3059 code getUpsertInsertOnly(
Columns cols,
hash example_row, *hash<auto> opt);
3064 code getUpsertUpdateOnly(
Columns cols,
hash example_row, *hash<auto> opt);
3069 Columns getUpsertColumns(reference<string> csrc);
3088 bool matchUniqueColumns(
Columns cols, hash<auto> row);
3093 string getUpsertSelectSql(hash<auto> row,
Columns cols, reference<list<string>> updc);
3098 string getUpsertInsertSql(hash<auto> row);
3103 string getUpsertUpdateSql(hash<auto> row,
Columns cols, reference updc, *hash<auto> opt);
3108 softbool tryUpdate(
string sql, hash<auto> row,
Columns cols,
list updc);
3113 checkValue(
string cname,
string argname, reference val,
string type);
3332 *hash<string, bool> getCheckOmissionOptions(*softlist<softstring> ol,
string err);
3363 list<auto> getAlignSqlUnlocked(
AbstractTable t, *hash<auto> opt);
3373 *list<AbstractColumnConstraint> getAllSupportingConstraints(
string ixname);
3526 string getPrimaryKeyColumn();
3544 *hash<auto>
find(hash<auto> row);
3578 *list<auto>
findAll(*hash<auto> cond);
3629 AbstractDataField
getColumnDataField(
string column_name, *hash<auto> options, *
string append_desc);
3653 AbstractDataProviderType
getColumnDataType(
string column_name, *hash<SqlUtilDataTypeOptionInfo> options);
3659 AbstractDataProviderType
getDbType(
string native_type, *
string qore_type,
bool nullable,
int max_size = -1, *hash<SqlUtilDataTypeOptionInfo> options);
3665 AbstractDataProviderType
getNumericType(
string type_name,
bool nullable, *hash<auto> options);
3916 string getCreateTableSqlUnlocked(*hash<auto> opt);
3921 *list<auto> getCreateIndexesSqlUnlocked(*hash<auto> opt,
bool cache =
True);
3926 *
string getCreatePrimaryKeySqlUnlocked(*hash<auto> opt,
bool cache =
True);
3931 *list<auto> getCreateConstraintsSqlUnlocked(*hash<auto> opt,
bool cache =
True);
3936 *list<auto> getCreateForeignConstraintsSqlUnlocked(*hash<auto> opt,
bool cache =
True);
3941 *list<auto> getCreateMiscSqlUnlocked(*hash<auto> opt,
bool cache =
True);
3946 *list<auto> getCreateTriggersSqlUnlocked(*hash<auto> opt,
bool cache =
True);
3951 list<auto> getCreateSqlUnlocked(*hash<auto> opt,
bool cache =
True);
3956 cacheUnlocked(*hash<auto> opt);
3961 auto execData(*hash<auto> opt,
string sql, *list<auto> args);
3966 execData(AbstractSQLStatement stmt, *hash<auto> opt, *list<auto> args);
3970 static AbstractTable getTable(AbstractDatasource nds,
string nname, *hash<auto>
opts);
3977 getColumnsUnlocked();
3982 getPrimaryKeyUnlocked();
3988 getIndexesUnlocked();
3993 getForeignConstraintsUnlocked(*hash<auto> opt);
4003 getConstraintsUnlocked();
4008 getTriggersUnlocked();
4019 softlist<auto> getDropSqlImpl();
4024 string getTruncateSqlImpl();
4047 preSetupTableImpl(reference desc, *hash<auto> opt);
4055 abstract AbstractDataProviderType
getNumericTypeImpl(
string type_name,
bool nullable, *hash<auto> options);
4059 abstract *hash<auto> doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
4063 abstract bool emptyImpl();
4095 abstract setupTableImpl(hash<auto> desc, *hash<auto> opt);
4099 abstract Columns describeImpl();
4105 abstract Indexes getIndexesImpl();
4114 abstract Triggers getTriggersImpl();
4118 abstract string getCreateTableSqlImpl(*hash<auto> opt);
4121 abstract *list<auto> getCreateMiscSqlImpl(*hash<auto> opt,
bool cache);
4124 abstract string getCreateSqlImpl(list<auto>
l);
4127 abstract string getRenameSqlImpl(
string new_name);
4130 abstract *list<auto> getAlignSqlImpl(
AbstractTable t, *hash<auto> opt);
4134 abstract AbstractColumn addColumnImpl(
string cname, hash<auto> opt,
bool nullable =
True);
4137 abstract AbstractPrimaryKey addPrimaryKeyImpl(
string cname, hash<auto> ch, *hash<auto> opt);
4140 abstract AbstractIndex addIndexImpl(
string iname,
bool enabled, hash<auto> ch, *hash<auto> opt);
4143 abstract AbstractForeignConstraint addForeignConstraintImpl(
string cname, hash<auto> ch,
string table, hash<auto> tch, *hash<auto> opt);
4153 abstract AbstractTrigger addTriggerImpl(
string tname,
string src, *hash<auto> opt);
const SelectOptions
default possible select options; can be extended by driver-specific modules
Definition: AbstractTable.qc.dox.h:79
Constraints getConstraints()
returns a Constraints object describing the non-foreign constraints on the table
hash< auto > getCacheOptions()
returns the cache options for this driver
*hash upsertFromIterator(Qore::AbstractIterator i, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
this method upserts or merges data from the given iterator argument (whose getValue() method must ret...
const UpsertAuto
Upsert option: if the target table is empty, use UpsertInsertFirst, otherwise use UpsertUpdateFirst...
Definition: AbstractTable.qc.dox.h:230
hash< auto > getColumnDescOptions()
returns the column description options for this driver
AbstractDataProviderType getDbType(string native_type, *string qore_type, bool nullable, int max_size=-1, *hash< SqlUtilDataTypeOptionInfo > options)
returns the DB type for the given column type
const TableOmissionOptions
alignment omission options
Definition: AbstractTable.qc.dox.h:83
AbstractDataField getColumnDataField(string column_name, *hash< auto > options, *string append_desc)
returns a field object for the given column
rename(string new_name, *reference< string > sql, *Tables table_cache)
renames the table
hash< SqlResultInfo > insertFromSelectWithInfo(list< auto > cols, AbstractTable source, hash< auto > select_hash, *hash< auto > opt)
inserts rows into a table based on a select statement from another table (which must be using the sam...
deprecated truncateNoCommit()
A legacy warpper for truncate()
abstract doSelectLimitOnlyUnlockedImpl(reference< string > sql, reference< list< auto >> args, *hash< auto > qh)
processes a string for use in SQL select statements when there is a "limit" argument, but no "orderby" or "offset" arguments
bool hasReturningImpl()
returns True if the current database driver supports the "returning" clause in insert statements...
int delCommit()
SqlUtil::AbstractTable::delCommit() variant
hash< auto > getInsertFromIteratorOptions()
returns the insert from iterator options for this driver
bool checkExistence()
returns True if the table exists in the database, False if not
the base abstract class for the table implementation
Definition: AbstractTable.qc.dox.h:30
bool hasReturning()
returns True if the current database driver supports the "returning" clause in insert statements...
deprecated *hash upsertFromSelectNoCommit(AbstractTable t, *hash< auto > sh, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
A legacy SqlUtil::AbstractTable::upsertFromSelect() wrapper.
const ForeignConstraintOptions
default foreign constraint options
Definition: AbstractTable.qc.dox.h:67
*hash upsertFromSelect(AbstractTable t, *hash< auto > sh, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
this method upserts or merges data from the given foreign table and select option hash into the curre...
hash< auto > getUpsertOptions()
returns the upsert options for this driver
const ColumnOptions
Column options; this is currently empty and can be extended in database-specific modules.
Definition: AbstractTable.qc.dox.h:144
the table container class stores a collection of tables in a schema
Definition: SqlUtil.qm.dox.h:5068
validateColumnOptions(string cname, reference< hash > opt, bool nullable)
validates column options
deprecated int upsertNoCommit(hash< auto > row, int upsert_strategy=UpsertAuto)
A legacy SqlUtil::AbstractTable::upsert() wrapper.
Qore::AbstractIterator getUniqueConstraintIterator()
returns an iterator for all unique constraints on the table (including the primary key if any) ...
drop(*hash< auto > opt)
drops the table from the database without any transaction management
hash< auto > getTableColumnDescOptions()
returns the table column description options for this driver
const UpsertResultLetterMap
maps upsert result codes to single letter symbols
Definition: AbstractTable.qc.dox.h:292
const UpsertStrategyMap
hash mapping upsert strategy codes to a text description
Definition: AbstractTable.qc.dox.h:249
int insertFromIteratorCommit(Qore::AbstractIterator i, *hash< auto > opt)
this method inserts data from the given iterator argument (whose getValue() method must return a hash...
*hash< auto > opts
option hash
Definition: AbstractSqlUtilBase.qc.dox.h:35
Qore::SQL::SQLStatement getRowIteratorNoExec(*hash< auto > sh, *reference< string > sql, *hash< auto > opt)
returns an SQLStatement object that will iterate the results of a select statement matching the argum...
list< auto > getModifyColumnSql(string cname, hash copt, bool nullable=True, *hash< auto > opt)
gets a list of SQL strings that can be used to modify an existing column in the table ...
const UR_Inserted
row was inserted
Definition: AbstractTable.qc.dox.h:264
list< auto > getColumnSqlNames(softlist cols)
returns a list of column names for use in SQL strings; subclasses can process the argument list in ca...
string getSqlValue(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument ...
deprecated int delNoCommit(*hash cond, *reference< string > sql)
A legacy SqlUtil::AbstractTable::del() wrapper.
list< auto > getDropAllConstraintsAndIndexesOnColumnSql(string cname, *hash< auto > opt)
gets a list of SQL strings to drop all constraints and indexes with the given column name; if the col...
code getBulkUpsertClosure(hash example_row, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
returns a closure that can be executed given a hash argument representing either a single row or a se...
the abstract base class for index information
Definition: SqlUtil.qm.dox.h:5517
Triggers getTriggers()
returns an object of class Triggers describing the triggers on the table
*list< auto > selectRows(*hash< auto > sh, *reference< string > sql, *hash< auto > opt)
returns a list of hashes representing the rows in the table that match the argument hash ...
auto tryExec(string sql)
executes some SQL with optional arguments so that if an error occurs the current transaction state is...
foreign constraint container class that throws an exception if an unknown constraint is accessed ...
Definition: SqlUtil.qm.dox.h:5856
const UpsertResultDescriptionMap
hash mapping upsert descriptions to codes
Definition: AbstractTable.qc.dox.h:288
const UR_Deleted
row was deleted (only possible with batch upsert methods such as AbstractTable::upsertFromIterator() ...
Definition: AbstractTable.qc.dox.h:276
const InsertFromIteratorOptions
default insert option keys
Definition: AbstractTable.qc.dox.h:182
int insertFromSelect(list cols, AbstractTable source, hash< auto > sh, reference< string > sql, hash< auto > opt)
inserts rows into a table based on a select statement from another table (which must be using the sam...
*hash< auto > getColumnOperatorMapImpl()
Reimplement in subclasses to provide driver specific column operators.
string getRenameSql(string new_name, *hash< auto > opt)
returns an SQL string that could be used to rename the table in the database
createCommit(*hash< auto > opt)
creates the table in the database; releases the transaction lock after creating the table ...
hash< auto > getInsertOptions()
returns the insert options for this driver
hash< auto > getWhereOperatorMap()
returns the "where" operator map for this object
hash< auto > getConstraintOptions()
returns the constraint options for this driver
AbstractColumn dropColumn(string cname, *reference lsql)
drops a column from the table
*hash< auto > insertCommit(hash< auto > row)
inserts a row into the table; the transaction is committed if successful, if an error occurs...
addCustomCopOperator(string name, hash< auto > operator)
register custom user column operator for this table object
beginTransaction()
begins a transaction on the underlying Qore::SQL::AbstractDatasource
constructor(AbstractDatasource nds, string nname, *hash nopts)
creates the object; private constructor
list< auto > getCreateSql(*hash< auto > opt)
returns a list of SQL strings that could be used to create the table and all known properties of the ...
truncateCommit()
truncates all the table data; releases the transaction lock after executing
hash< auto > getTableCreationOptions()
returns the table creation options for this driver
list< auto > getAlignSql(AbstractTable t, *hash< auto > opt)
returns a list of SQL strings required to align the table to the table given as an argument ...
hash< auto > getColumnOperatorMap()
returns the column operator map for this object
deprecated dropNoCommit(*hash< auto > opt)
A legacy wrapper for drop()
code getUpsertClosureWithValidation(hash example_row, int upsert_strategy=UpsertAuto, *hash< auto > opt)
returns a closure that can be executed given a hash argument representing a single row that will be u...
AbstractForeignConstraint addForeignConstraint(string cname, softlist cols, string table, *softlist tcols, *hash< auto > opt, *reference< string > sql)
adds a foreign constraint to the table; if the table is already known to be in the database...
hash< auto > getUpdateOperatorMap()
returns the update operator map for this object
dropCommit(*hash< auto > opt)
drops the table from the database; releases the transaction lock after dropping the table ...
*string getCreatePrimaryKeySql(*hash< auto > opt, bool cache=True)
returns an SQL string that could be used to create the primary key on the table
ForeignConstraints getForeignConstraints(*hash< auto > opt)
returns a ForeignConstraints object describing the foreign constraints that the table has on other ta...
abstract hash< auto > getTypeMapImpl()
returns the type name -> type description hash
const UpsertOptions
default upsert option keys
Definition: AbstractTable.qc.dox.h:174
hash< auto > getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
const CacheOptions
default cache options
Definition: AbstractTable.qc.dox.h:59
Qore::SQL::AbstractSQLStatement getStatementNoExec(*hash< auto > sh, *reference< string > sql, *hash< auto > opt)
returns an AbstractSQLStatement object that will iterate the results of a select statement matching t...
Columns describe()
returns an object of class Columns describing the table
int upsert(hash< auto > row, int upsert_strategy=UpsertAuto, *hash< auto > opt)
update or insert the data in the table according to the hash argument; the table must have a unique k...
string getAddForeignConstraintSql(string cname, softlist cols, string table, *softlist tcols, *hash fkopt, *hash< auto > opt)
returns an SQL string that can be used to add a foreign constraint to the table
ForeignConstraints foreignConstraints
foreign constraints description
Definition: AbstractTable.qc.dox.h:305
bool native_case
native case option
Definition: AbstractTable.qc.dox.h:311
string getCreateSqlString(*hash< auto > opt)
returns an SQL string that could be used to create the table and all known properties of the table ...
AbstractConstraint dropConstraint(string cname, *reference< string > sql)
drops a constraint from the table; this can be any constraint on the table, a primary key...
AbstractConstraint renameConstraint(string old_name, string new_name, reference lsql)
renames an existing constraint; this can be any constraint on the table, a primary key...
list< auto > getAddTriggerSql(string tname, string src, *hash topt, *hash< auto > opt)
returns a list of SQL strings that can be used to add a trigger to the table
hash< auto > getTriggerOptions()
returns the trigger options for this driver
hash< SqlResultInfo > selectRowsWithInfo(*hash< auto > select_hash, *hash< auto > opt)
returns a hash with a result key assigned to a list of hashes representing the rows in the table that...
base class for abstract SqlUtil classes
Definition: AbstractSqlUtilBase.qc.dox.h:28
const UpsertUpdateFirst
Upsert option: update first, if the update fails, then insert.
Definition: AbstractTable.qc.dox.h:214
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
string getRenameColumnSql(string old_name, string new_name, *hash< auto > opt)
gets an SQL string that can be used to rename an existing column in the table
auto tryExecRawImpl(string sql)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
the base class for foreign key constraint information
Definition: SqlUtil.qm.dox.h:5922
AbstractDataProviderType getColumnDataType(string column_name, *hash< SqlUtilDataTypeOptionInfo > options)
returns the data type for the given column
hash< SqlResultInfo > selectWithInfo(*hash< auto > select_hash, *hash< auto > opt)
returns a hash with a result key assigned to a hash of lists representing the columns and rows in the...
AbstractIndex renameIndex(string old_name, string new_name, reference< string > sql)
renames an existing index; if the table is already known to be in the database, then the changes are ...
string getDropIndexSql(string iname, *hash< auto > opt)
gets the SQL that can be used to drop an index from the table
abstract class for check constraints
Definition: SqlUtil.qm.dox.h:5709
hash< auto > getSqlDataCallbackOptions()
returns the sql data operation callback options for this driver
hash< SqlResultInfo > insertWithInfo(hash< auto > row, *hash< auto > opt)
Inserts a row and returns the result and also the SQL used.
string getAlignSqlString(AbstractTable t, *hash< auto > opt)
accepts an AbstractTable argument and returns an SQL string that could be executed to align the struc...
abstract hash< auto > getQoreTypeMapImpl()
returns the qore type -> column type map
*list< auto > getCreateMiscSql(*hash< auto > opt, bool cache=True)
returns a list of SQL strings that could be used to create other table attributes (such as comments...
Qore AbstractNumericDataType class definition.
Definition: AbstractNumericDataType.qc.dox.h:31
bool empty()
returns True if the table has no definitions, False if not
string name
the table's name
Definition: AbstractTable.qc.dox.h:297
trigger container class that throws an exception if an unknown trigger is accessed ...
Definition: SqlUtil.qm.dox.h:6138
AbstractUniqueConstraint addUniqueConstraint(string cname, softlist cols, *hash< auto > opt, *reference< string > sql)
adds a unique constraint to the table; if the table is known to be in the database already...
Indexes indexes
index descriptions
Definition: AbstractTable.qc.dox.h:303
hash< auto > getAlignTableOptions()
returns the align table options for this driver
AbstractColumn modifyColumn(string cname, hash< auto > opt, bool nullable=True, *reference lsql)
modifies an existing column in the table; if the table is already known to be in the database...
AbstractTrigger addTrigger(string tname, string src, *hash< auto > opt, *reference lsql)
adds a trigger to the table; if the table is already known to be in the database, then it is added in...
clearImpl()
clears any driver-specific table information
*list< auto > getCreateIndexesSql(*hash< auto > opt, bool cache=True)
returns a list of SQL strings that could be used to create indexes on the table or NOTHING if there a...
Abstract base class for savepoint helpers for epheremal transaction support.
Definition: AbstractSavepointHelper.qc.dox.h:33
const UR_Verified
row was updated unconditionally (not returned with UpsertSelectFirst)
Definition: AbstractTable.qc.dox.h:267
deprecated int insertFromSelectNoCommit(list cols, AbstractTable source, *hash< auto > sh, *reference< string > sql, *hash< auto > opt)
A legacy SqlUtil::AbstractTable::insertFromSelect() wrapper.
clear()
purges the current table definition
hash< auto > getInsertOperatorMap()
returns the insert operator map for this object
index container class that throws an exception if an unknown index is accessed
Definition: SqlUtil.qm.dox.h:5471
deprecated *hash upsertFromIteratorNoCommit(Qore::AbstractIterator i, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
A legacy SqlUtik::AbstractTable::upsertFromIterator() wrapper.
const TableOptions
table options
Definition: AbstractTable.qc.dox.h:41
AbstractSavepointHelper getSavepointHelper(*string savepoint)
get DB-specific savepoint helper
*list< auto > getCreateTriggersSql(*hash< auto > opt, bool cache=True)
returns a list of SQL strings that could be used to create triggers on the table or NOTHING if there ...
int insertFromIterator(Qore::AbstractIterator i, *hash< auto > opt)
this method inserts data from the given iterator argument (whose getValue() method must return a hash...
hash< auto > getDescriptionHash()
Returns a description hash of the table.
AbstractDataProviderType getNumericType(string type_name, bool nullable, *hash< auto > options)
returns the type for number / numeric columns for the database so that data conversions can be handle...
AbstractCheckConstraint addCheckConstraint(string cname, string src, *hash< auto > opt, *reference< string > sql)
adds a check constraint to the table; if the table is already known to be in the database, then it is added in the database also immediately; otherwise it is only added internally and can be created when create() is called for example
AbstractPrimaryKey primaryKey
primary key description
Definition: AbstractTable.qc.dox.h:301
bool manual
manual edits
Definition: AbstractTable.qc.dox.h:315
abstract AbstractDataProviderType getNumericTypeImpl(string type_name, bool nullable, *hash< auto > options)
returns the type for number / numeric columns for the database so that data conversions can be handle...
const AlignTableOptions
table alignment options
Definition: AbstractTable.qc.dox.h:102
AbstractPrimaryKey getPrimaryKey()
returns an object of class AbstractPrimaryKey describing the primary key of the table ...
bool emptyData()
returns True if the table has no data rows, False if not
string getBaseType()
returns the base type of the underlying object (normally "table", some DB-specific implementations ma...
softlist< auto > getDropSql(*hash< auto > opt)
returns the sql required to drop the table; reimplement in subclasses if necessary ...
*list< auto > getCreateForeignConstraintsSql(*hash< auto > opt, bool cache=True)
returns a list of SQL strings that could be used to create foreign constraints on the table or NOTHIN...
abstract bool hasArrayBind()
returns True if the underlying DB driver supports bulk DML operations
hash< SqlResultInfo > getStatementNoExecWithInfo(*hash< auto > select_hash, *hash< auto > opt)
returns a result hash including an AbstractSQLStatement object that will iterate the results of a sel...
Triggers triggers
trigger descriptions
Definition: AbstractTable.qc.dox.h:309
string getDesc()
returns a descriptive string of the datasource (without the password) and the table name (with a poss...
abstract *string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
int del()
SqlUtil::AbstractTable::del() variant
*hash upsertFromSelectCommit(AbstractTable t, *hash< auto > sh, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
this method upserts or merges data from the given foreign table and select option hash into the curre...
string getDropConstraintSql(string cname, *hash< auto > opt)
gets the SQL that can be used to drop a constraint from the table; this can be any constraint on the ...
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifier for schema, etc)
*hash find(auto id)
finds a row in the table with the given primary key value; if no row matches the primary key value pa...
string getCreateTableSql(*hash< auto > opt)
returns an SQL string that could be used to create the basic table structure without indexes and cons...
string getAddCheckConstraintSql(string cname, string src, *hash copt, *hash< auto > opt)
returns an SQL string that can be used to add a check constraint to the table
hash< auto > getSelectOptions()
returns the select options for this driver
Columns columns
column description object
Definition: AbstractTable.qc.dox.h:299
AbstractTrigger dropTrigger(string tname, *reference< string > sql)
drops the given trigger from the table; if the table is known to be in the database already...
abstract doSelectOrderByWithOffsetSqlUnlockedImpl(reference< string > sql, reference< list< auto >> args, *hash< auto > qh, *hash< auto > jch, *hash< auto > ch, *hash< auto > psch, list coll)
processes a string for use in SQL select statements when there is an "order by" and "offset" argument...
the API for a constraint with columns
Definition: SqlUtil.qm.dox.h:5762
int insertFromSelectCommit(list cols, AbstractTable source, hash< auto > sh, reference< string > sql, hash< auto > opt)
inserts rows into a table based on a select statement from another table (which must be using the sam...
abstract bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
deprecated int insertFromIteratorNoCommit(Qore::AbstractIterator i, *hash< auto > opt)
A legacy SqlUtil::AbstractTable::insertFromIterator() wrapper.
const SqlDataCallbackOptions
generic SQL data operation callbacks
Definition: AbstractTable.qc.dox.h:151
copy(AbstractTable old)
copies the object
hash< SqlResultInfo > getStatementWithInfo(*hash< auto > select_hash, *hash< auto > opt)
returns a result hash including an AbstractSQLStatement object that will iterate the results of a sel...
bool asteriskRequiresPrefix()
returns True if the database requires a wildcard "*" to be prefixed with the table name when it appea...
const UpsertResultMap
hash mapping upsert results to a description
Definition: AbstractTable.qc.dox.h:282
*list< auto > findAll(*hash< auto > cond)
finds all rows in the table with the given column values; a list of hashes is returned representing t...
AbstractPrimaryKey addPrimaryKey(string pkname, softlist cols, *hash< auto > opt, *reference< string > sql)
adds a primary key to the table; if the table is already known to be in the database, then it is added in the database also immediately; otherwise it is only added internally and can be created when create() is called for example
hash< SqlResultInfo > selectRowWithInfo(*hash< auto > select_hash, *hash< auto > opt)
returns a hash with a result representing the row in the table that matches the argument hash; if mor...
bool bindEmptyStringsAsNull()
returns True if the DB treats empty strings as NULL, False if not; by default this method returns Fal...
hash< SqlCommandInfo > getUpdateSql(hash< auto > set, *hash< auto > cond)
Returns the SQL for the given update parameters.
auto tryExecRaw(string sql)
executes some SQL so that if an error occurs the current transaction state is not lost ...
auto tryExecArgs(string sql, *softlist< auto > args)
executes some SQL with optional arguments so that if an error occurs the current transaction state is...
abstract copyImpl(AbstractTable old)
db-specific copy actions
Constraints constraints
constraint descriptions
Definition: AbstractTable.qc.dox.h:307
*hash< auto > insert(hash< auto > row)
inserts a row into the table without any transaction management; a transaction will be in progress af...
int update(hash set, hash cond, reference< string > sql, hash< auto > opt)
updates rows in the table matching an optional condition and returns the count of rows updated; no tr...
create(*hash< auto > opt)
creates the table with all associated properties (indexes, constraints, etc) without any transaction ...
abstract bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
AbstractIndex addIndex(string iname, bool unique, softlist cols, *hash< auto > opt, *reference< string > sql)
adds an index to the table; if the table is already known to be in the database, then it is added in ...
string getAddIndexSql(string iname, bool unique, softlist cols, *hash< auto > ixopt, *hash< auto > opt)
returns an SQL string that can be used to add an index to the table
hash< auto > hash(object obj)
const InsertOptions
generic SQL insert options
Definition: AbstractTable.qc.dox.h:164
setupTable(hash< auto > desc, *hash< auto > opt)
creates the object from a table description hash
hash< SqlResultInfo > delWithInfo(hash< auto > cond, *hash< auto > opt)
deletes rows in the table matching the condition and returns the count of rows deleted; no transactio...
const TriggerOptions
default trigger options
Definition: AbstractTable.qc.dox.h:73
deprecated int updateNoCommit(hash set, *hash cond, *reference< string > sql)
A legacy SqlUtil::AbstractTable::update() wrapper.
deprecated *hash< auto > insertNoCommit(hash< auto > row, *reference< string > sql, *hash< auto > opt)
A legacy wrapper for SqlUtil::AbstractTable::insert()
*hash< auto > selectRow(*hash< auto > sh, *reference< string > sql, *hash< auto > opt)
returns a hash representing the row in the table that matches the argument hash; if more than one row...
softint rowCount()
returns the number of rows in the table
rollback()
rolls back the current transaction on the underlying Qore::SQL::AbstractDatasource ...
hash< auto > getForeignConstraintOptions()
return the foreign constraint options for this driver
code getUpsertClosure(hash< auto > row, int upsert_strategy=UpsertAuto, *hash< auto > opt)
returns a closure that can be executed given a hash argument representing a single row that will be u...
const UpsertUpdateOnly
Upsert option: update if the row exists, otherwise ignore.
Definition: AbstractTable.qc.dox.h:244
column container class that throws an exception if an unknown column is accessed
Definition: SqlUtil.qm.dox.h:5256
the base class for triggers
Definition: SqlUtil.qm.dox.h:6120
int updateCommit(hash set, hash cond, reference< string > sql, hash< auto > opt)
updates rows in the table matching an optional condition and returns the count of rows updated; the t...
setDatasource(AbstractDatasource nds)
changes the datasource for the table; if the inDb flag is True, then it is set to False by calling th...
Indexes getIndexes()
returns an object of class Indexes describing the indexes on the table
const UR_Unchanged
row was unchanged (only possible with UpsertSelectFirst, UpsertInsertOnly, and UpsertUpdateOnly) ...
Definition: AbstractTable.qc.dox.h:273
AbstractPrimaryKey dropPrimaryKey(*reference lsql)
drops the primary key from the table; if the table is known to be in the database already...
AbstractColumn addColumn(string cname, hash< auto > opt, bool nullable=True, *reference lsql)
adds a column to the table; if the table is already known to be in the database, then it is added in ...
const UR_Updated
row was updated because it was different (only possible with UpsertSelectFirst)
Definition: AbstractTable.qc.dox.h:270
the base class for column information
Definition: SqlUtil.qm.dox.h:5338
truncate()
truncates all the table data without any transaction management
*hash< string, AbstractDataField > getRecordType()
returns a record description for the table
const UpsertInsertOnly
Upsert option: insert if the row does not exist, otherwise ignore.
Definition: AbstractTable.qc.dox.h:237
Qore::SQL::SQLStatement getRowIterator(*hash< auto > sh, *reference< string > sql, *hash< auto > opt)
returns an SQLStatement object that will iterate the results of a select statement matching the argum...
string getName()
returns the name of the table
transient Mutex l()
mutex for atomic actions
represents a database table; this class embeds an AbstractTable object that is created automatically ...
Definition: Table.qc.dox.h:44
const IndexOptions
default index options
Definition: AbstractTable.qc.dox.h:50
hash< SqlResultInfo > updateWithInfo(hash< auto > set, hash< auto > cond, *hash< auto > opt)
updates rows in the table matching an optional condition and returns an info hash with the count of r...
AbstractIndex dropIndex(string iname, *reference< string > sql)
drops the given index from the table; if the table is known to be in the database already...
const UpsertSelectFirst
Upsert option: select first, if the row is unchanged, do nothing, if it doesn't exist, insert, otherwise update.
Definition: AbstractTable.qc.dox.h:223
AbstractForeignConstraint dropForeignConstraint(string cname, *reference< string > sql)
drops a foreign constraint from the table; if the table is known to be in the database already...
AbstractTable getSubtableFromString(string table, *hash< auto > opt)
Returns the given table from the argument, using any "tablecode" option if present.
const UpsertInsertFirst
Upsert option: insert first, if the insert fails, then update.
Definition: AbstractTable.qc.dox.h:206
abstract bool tryInsertImpl(string sql, hash< auto > row)
tries to insert a row, if there is a duplicate key, then it returns False, if successful, returns True
*hash upsertFromIteratorCommit(Qore::AbstractIterator i, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
this method upserts or merges data from the given iterator argument (whose getValue() method must ret...
*list< auto > getCreateConstraintsSql(*hash< auto > opt, bool cache=True)
returns a list of SQL strings that could be used to create non-foreign constraints on the table or NO...
const ColumnDescOptions
Column description options.
Definition: AbstractTable.qc.dox.h:133
int upsertCommit(hash< auto > row, int upsert_strategy=UpsertAuto, *hash< auto > opt)
update or insert the data in the table according to the hash argument; the table must have a unique k...
bool inDb()
returns True if the table has been read from or created in the database, False if not ...
Qore::SQL::AbstractSQLStatement getStatement(*hash< auto > sh, *reference< string > sql, *hash< auto > opt)
returns an AbstractSQLStatement object that will iterate the results of a select statement matching t...
*hash< auto > select(*hash< auto > sh, *reference< string > sql, *hash< auto > opt)
returns a hash of lists representing the columns and rows in the table that match the argument hash ...
abstract bool isDuplicateRowErrorImpl(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
const TableDescriptionHashOptions
Table description options.
Definition: AbstractTable.qc.dox.h:117
AbstractColumn renameColumn(string old_name, string new_name, reference< string > sql)
renames an existing column; if the table is already known to be in the database, then the changes are...
list< auto > getDropPrimaryKeySql(*hash< auto > opt)
gets a list of SQL strings that can be used to drop the primary key from the table ...
commit()
commits the current transaction on the underlying Qore::SQL::AbstractDatasource
*AbstractUniqueConstraint findUniqueConstraint(string name)
returns the given AbstractUniqueConstraint object if defined for the table (also includes the primary...
const TableCreationOptions
table creation options
Definition: AbstractTable.qc.dox.h:90
deprecated createNoCommit(*hash< auto > opt)
A legacy wrapper for create()
string getSqlFromList(list< auto > l)
returns an SQL string corresponding to the list of commands in the argument
string getSelectSql(*hash< auto > sh, *reference< list< auto >> args)
returns the SQL string to be executed corresponding to the argument hash with an output parameter for...
hash< auto > getTableDescriptionHashOptions()
returns the table description hash<auto> options for this driver
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 ...
abstract bool checkExistenceImpl()
returns True if the table exists in the DB, False if not
bool isDuplicateRowError(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
list< auto > getDropTriggerSql(string tname, *hash< auto > opt)
returns SQL that can be used to drop the given trigger from the table
list< auto > getDropColumnSql(string cname, *hash< auto > opt)
returns the SQL that can be used to drop a column from the table
string getTruncateSql(*hash< auto > opt)
gets the SQL that can be used to truncate the table
*hash< auto > findSingle(*hash< auto > cond)
finds a single row in the table that match the row condition passed; multiple rows may match...
string getAddUniqueConstraintSql(string cname, softlist cols, *hash ukopt, *hash< auto > opt)
returns an SQL string that can be used to add a unique constraint to the table
*string getDropConstraintIfExistsSql(string cname, *hash< auto > opt, *reference< AbstractConstraint > cref)
gets the SQL that can be used to drop a constraint from the table if it exists, otherwise returns NOT...
represents a primary key
Definition: SqlUtil.qm.dox.h:5845
cache(*hash< auto > opts)
reads in all attributes of the table from the database
hash< auto > getIndexOptions()
returns the index options for this driver
string join(string str,...)
hash< string, Columns > getAllUpsertColumns(*hash< auto > row)
returns a hash with a single value\
const UpsertStrategyDescriptionMap
hash mapping upsert strategy descriptions to upsert strategy codes
Definition: AbstractTable.qc.dox.h:255
*hash< auto > getPseudoColumnHash()
returns a hash of valid pseudocolumns
const ConstraintOptions
default constraint options
Definition: AbstractTable.qc.dox.h:56
list< auto > getAddColumnSql(string cname, hash copt, bool nullable=True, *hash< auto > opt)
returns a list of SQL strings that can be use to add a column to the table
abstract AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
hash< auto > getColumnOptions()
returns the column options for this driver
represents a unique column constraint
Definition: SqlUtil.qm.dox.h:5836
const AdditionalColumnDescOptions
additional column description keys valid when describing columns in a table description hash ...
Definition: AbstractTable.qc.dox.h:140
hash< auto > getTableOptions()
returns the table options for this driver
abstract base class for constraints
Definition: SqlUtil.qm.dox.h:5647
abstract bool supportsTablespacesImpl()
returns True if the database support tablespaces
string getAddPrimaryKeySql(string pkname, softlist cols, *hash pkopt, *hash< auto > opt)
returns the SQL that can be used to add a primary key to the table
AbstractForeignConstraint removeForeignConstraint(string cname)
removes the named foreign constraint from the table; no SQL is executed in any case, only the named foreign constraint is removed from the table definition
constraint container class that throws an exception if an unknown constraint is accessed ...
Definition: SqlUtil.qm.dox.h:5605