42 "native_case": Type::Boolean,
43 "table_cache":
"Tables",
53 "index_tablespace": Type::String,
54 "replace": Type::Boolean,
64 "table_cache":
"Tables",
73 "table_cache":
"Tables",
86 "alias": Type::String,
87 "comment": Type::String,
89 "columns": Type::NothingType,
91 "orderby":
"softstringinthashlist",
92 "desc": Type::Boolean,
96 "groupby":
"softstringinthashlist",
98 "superquery": Type::Hash,
99 "forupdate": Type::Boolean,
105 "foreign_constraints": True,
114 "omit":
"softstringlist",
127 "column_map": Type::Hash,
128 "index_map": Type::Hash,
129 "constraint_map": Type::Hash,
130 "trigger_map": Type::Hash,
131 "db_table_cache":
"Tables",
132 "force": Type::Boolean,
148 "columns": Type::Hash,
149 "primary_key": Type::Hash,
150 "indexes": Type::Hash,
151 "triggers": Type::Hash,
152 "foreign_constraints": Type::Hash,
153 "unique_constraints": Type::Hash,
155 "table_cache":
"Tables",
172 "qore_type": Type::String,
173 "native_type": Type::String,
176 "default_value": Type::NothingType,
177 "default_value_native": Type::Boolean,
178 "comment": Type::String,
179 "notnull": Type::Boolean,
180 "driver": Type::Hash,
188 "notnull": Type::Boolean,
200 "sqlarg_callback":
"code",
215 "returning":
"stringhashlist",
226 "info_callback":
"code",
227 "commit_block": Type::Int,
228 "delete_others": Type::Boolean,
229 "omit_update":
"softstringlist",
238 "info_callback":
"code",
239 "commit_block": Type::Int,
401 hash m_customCopMap = {};
439 doTableOptions(*hash<auto> nopts);
683 doRenameIntern(
string new_name, *
Tables table_cache);
716 bool emptyUnlocked();
790 list<auto>
getAddColumnSql(
string cname, hash<auto> copt,
bool nullable = True, *hash<auto> opt);
793 private AbstractColumn addColumnUnlocked(
string cname, hash<auto> opt,
bool nullable = True, *reference lsql,
794 bool do_exec = True,
bool modify_table = True) {
798 throw "COLUMN-ERROR", sprintf(
"%s column %y: this column already exists",
getDesc(), cname);
800 if (!opt.native_type && !opt.qore_type)
801 throw "COLUMN-ERROR", sprintf(
"%s column %y: no native_type or qore_type keys in column option hash: %y",
816 addColumnToTableUnlocked(c);
935 validateOptionsIntern(
string err, hash<auto> ropt, reference<hash<auto>> opt);
940 validateOptionsIntern(
string err, hash<auto> ropt, reference<hash<auto>> opt,
string tag);
945 execSql(softlist lsql);
1005 AbstractPrimaryKey addPrimaryKeyUnlocked(
string pkname, softlist cols, *hash<auto> opt, *reference<string> sql);
1010 AbstractPrimaryKey addPrimaryKeyUnlockedIntern(
string pkname, softlist cols, *hash<auto> opt, *reference<string> sql);
1035 list<auto> getDropAllConstraintsAndIndexesOnColumnSqlUnlocked(
string cname, *hash<auto> opt);
1134 AbstractUniqueConstraint addUniqueConstraintUnlocked(
string cname, softlist cols, *hash<auto> opt, *reference<string> sql);
1139 AbstractUniqueConstraint addUniqueConstraintUnlockedIntern(
string cname, softlist cols, *hash<auto> opt, *reference<string> sql);
1190 string getAddIndexSql(
string iname,
bool unique, softlist cols, *hash<auto> ixopt, *hash<auto> opt);
1194 AbstractIndex addIndexUnlocked(
string iname,
bool unique, softlist cols, *hash<auto> opt, *reference<string> sql);
1199 AbstractIndex addIndexUnlockedIntern(
string iname,
bool unique, softlist cols, *hash<auto> opt, *reference<string> sql);
1317 Columns getReferencedTableColumnsUnlocked(
string table, *
Tables cache,
string err =
'FOREIGN-CONSTRAINT-ERROR');
1322 AbstractForeignConstraint addForeignConstraintUnlocked(
string cname, softlist cols,
string table, *softlist tcols, *hash<auto> opt, *reference<string> sql);
1327 AbstractForeignConstraint addForeignConstraintUnlockedIntern(
string cname, softlist cols,
string table, *softlist tcols, *hash<auto> opt, *reference<string> sql);
1423 AbstractCheckConstraint addCheckConstraintUnlocked(
string cname,
string src, *hash<auto> opt, *reference<string> sql);
1428 AbstractCheckConstraint addCheckConstraintUnlockedIntern(
string cname,
string src, *hash<auto> opt, *reference<string> sql);
1572 AbstractTrigger addTriggerUnlocked(
string tname,
string src, *hash<auto> opt, *reference lsql);
1577 AbstractTrigger addTriggerUnlockedIntern(
string tname,
string src, *hash<auto> opt, *reference lsql);
1627 getAllConstraintsUnlocked(*hash<auto> opt);
1632 checkUniqueConstraintName(
string err,
string cname);
1637 checkUniqueConstraintNameValidateOptions(
string err,
string cname, hash<auto> ropt, reference<hash> opt);
1729 *hash<auto>
insertCommit(hash<auto> row, reference<string> sql, hash<auto> opt);
1753 *hash<auto>
insert(hash<auto> row, reference<string> sql);
1761 *hash<auto>
insert(hash<auto> row, hash<auto> opt);
1770 *hash<auto>
insert(hash<auto> row, reference<string> sql, hash<auto> opt);
1787 deprecated *hash<auto>
insertNoCommit(hash<auto> row, *reference<string> sql, *hash<auto> opt);
1792 private *hash<auto> insertIntern(hash<auto> row, *reference<string> sql, *hash<auto> opt,
1793 *reference<softlist<auto>> args) {
1802 getColumnsUnlocked();
1804 sql = sprintf(
"insert into %s (",
getSqlName());
1805 foreach string k in (keys row);
1807 hash vh = getPlaceholdersAndValues(row);
1810 sql +=
") values (";
1811 sql += (foldl $1 +
"," + $2, vh.placeholders);
1821 return doReturningImpl(opt, \sql, args);
1823 execData(opt, sql, args);
1827 hash<auto> getPlaceholdersAndValues(hash<auto> row);
1932 hash<SqlResultInfo> rv();
1933 rv.result = insertFromSelectIntern(cols, source, select_hash, \rv.sql, opt, \rv.args);
1940 return insertFromSelectIntern(cols, source, sh, \sql, opt);
1943 private int insertFromSelectIntern(list cols,
AbstractTable source, *hash<auto> sh, *reference<string> sql,
1944 *hash<auto> opt, *reference<softlist<auto>> args) {
1952 getColumnsUnlocked();
1955 sql = sprintf(
"insert into %s (",
getSqlName());
1957 foreach string k in (cols);
1963 return execData(opt, sql, args);
2177 on_success
ds.commit();
2178 on_error
ds.rollback();
2180 return upsertFromIteratorIntern(i, upsert_strategy, opt);
2218 return upsertFromIteratorIntern(i, upsert_strategy, opt -
"commit_block");
2224 return upsertFromIteratorIntern(i, upsert_strategy, opt -
"commit_block");
2237 hash<string, int> rh;
2240 hash<string, bool> pkh;
2245 opt.change_count = 0;
2249 if (opt.info_callback) {
2254 if (++opt.change_count >= opt.commit_block) {
2256 opt.change_count = 0;
2261 if (opt.delete_others) {
2266 if (opt.delete_others);
2273 *hash<string, int> doDeleteOthersIntern(hash<auto> pkh, *hash<auto> opt);
2342 on_success {
ds.commit(); t.
commit(); }
2351 on_success {
ds.commit(); t.commit(); }
2352 on_error {
ds.rollback(); t.rollback(); }
2354 return upsertFromIteratorIntern(t.getStatement(sh), upsert_strategy, opt);
2400 return upsertFromIteratorIntern(t.
getStatement(sh), upsert_strategy, opt -
"commit_block");
2406 return upsertFromIteratorIntern(t.
getStatement(sh), upsert_strategy, opt -
"commit_block");
2412 return upsertFromIteratorIntern(t.getStatement(sh), upsert_strategy, opt -
"commit_block");
2418 return upsertFromIteratorIntern(t.getStatement(sh), upsert_strategy, opt -
"commit_block");
2683 *hash<auto> opt, *
bool no_exec, *reference<softlist<auto>> args) {
2686 sql = getSelectSqlIntern(sh, \args, opt);
2688 AbstractSQLStatement stmt =
ds.getSQLStatement();
2692 execData(stmt, opt, args);
2720 *hash<auto>
selectRow(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
2723 private *hash<auto> selectRowIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt,
2724 *reference<softlist<auto>> args) {
2729 sql = getSelectSqlUnlocked(sh, \args, opt);
2731 if (opt.sqlarg_callback);
2734 bool rollback_on_error = False;
2737 on_error
if (rollback_on_error)
2739 return ds.vselectRow(sql, args);
2793 *list<auto>
selectRows(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
2796 private *list<auto> selectRowsIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt,
2797 *reference<softlist<auto>> args) {
2802 sql = getSelectSqlUnlocked(sh, \args, opt);
2804 if (opt.sqlarg_callback)
2805 opt.sqlarg_callback(sql, args);
2807 bool rollback_on_error = False;
2810 on_error
if (rollback_on_error)
2813 return ds.vselectRows(sql, args);
2865 *hash<auto>
select(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
2869 *hash<auto> selectIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
2963 *hash<auto>
select(*hash<auto> sh, *hash<auto> opt);
2991 string getSelectSqlIntern(*hash<auto> qh, reference<list<auto>> args, *hash<auto> opt);
2994 string getSelectSqlUnlocked(*hash<auto> qh, reference<list<auto>> args, *hash<auto> opt);
2998 string getSelectSqlUnlockedIntern(*hash<auto> qh,
string from, reference<list<auto>> args,
2999 *hash<string, bool> subquery_column_map, *hash<auto> opt, *hash<auto> pseudo_column_map) {
3003 "query_hash": {} + qh,
3004 "subquery_column_map": subquery_column_map,
3005 "query_options": opt,
3009 # backwards-compatibility
3014 on_success args = info.args;
3016 if (exists info.query_hash.offset);
3024 info.query_hash.join.pairIterator(), $1.value.table.typeCode() ==
NT_STRING;
3027 info.join_map = cast<hash<string, AbstractTable>>(
3028 map {$1.alias ?? $1.table.getName() : $1.table}, info.query_hash.join.iterator()
3032 if (info.query_hash.alias);
3040 list<auto> coll = ();
3041 if (info.query_hash.columns);
3046 string sql =
sprintf(
"select %s from %s", cstr, getFromIntern(from, info.query_hash));
3047 if (info.query_hash.alias);
3051 foreach auto js in (info.query_hash.join.iterator());
3054 getSelectWhereSqlUnlocked(\info, \sql);
3056 if (info.query_hash.groupby);
3059 if (info.query_hash.having);
3062 if (info.query_hash.orderby);
3063 else if (info.query_hash.limit);
3068 if (info.query_hash.forupdate && !info.query_hash.superquery);
3072 if (info.query_hash.comment || info.query_hash.hint);
3075 if (info.query_hash.superquery);
3085 string getExpressionArg(reference<hash<QueryInfo>> info,
int role,
auto arg,
3086 AbstractDataProviderType expected_type) {
3087 if (arg instanceof hash<DataProviderFieldReference>);
3089 if (arg instanceof hash<DataProviderExpression>);
3097 string getFromIntern(
string from, *hash<auto> qh);
3102 list<auto> getGroupByListUnlocked(hash<QueryInfo> info, list<auto> coll);
3107 list<auto> getOrderByListUnlocked(hash<QueryInfo> info, list<auto> coll);
3112 list<auto> getGroupOrderByListUnlocked(hash<QueryInfo> info,
string key, list<auto> coll);
3117 doForUpdate(reference<string> sql);
3122 string getSelectSqlName(*hash<auto> qh);
3127 string getColumnExpressionIntern(reference<hash<QueryInfo>> info,
auto cvc);
3132 string doColumnOperatorIntern(reference<hash<QueryInfo>> info, hash<auto> cvc);
3137 string doColumnOperatorIntern(reference<hash<QueryInfo>> info,
auto cop,
auto arg, *
string cve);
3142 string getColumnNameIntern(hash<QueryInfo> info,
string column_name);
3153 getSelectWhereSqlUnlocked(reference<hash<QueryInfo>> info, reference<string> sql);
3157 private *
string getWhereClause(*hash<auto> cond, reference<list<auto>> args, *
string cprefix,
3158 *hash<string, AbstractTable> join_map) {
3166 "join_map": join_map,
3174 on_success args = info.args;
3177 return getWhereClauseUnlocked(\info, info.query_hash.
"where", cprefix);
3180 private *
string getWhereExpressionUnlocked(reference<hash<QueryInfo>> info, hash<DataProviderExpression> cond,
3187 private *
string getExpressionUnlockedIntern(reference<hash<QueryInfo>> info,
int role,
3188 hash<DataProviderExpression> cond, AbstractDataProviderType expected_type) {
3189 *hash<auto>
exp = info.expression_map{cond.exp};
3193 AbstractDataProvider::verifyExpression(role,
exp.exp, LC_All, expected_type, cond);
3194 return exp.code(\info, role, cond.args);
3198 *
string getWhereClauseUnlocked(reference<hash<QueryInfo>> info, *hash<auto> cond, *
string cprefix);
3203 *list<string> getWhereClauseIntern(reference<hash<QueryInfo>> info, *hash<auto> cond, *
string cprefix);
3208 string doWhereExpressionIntern(reference<hash<QueryInfo>> info,
string cn,
auto we);
3212 string getOrClause(reference<hash<QueryInfo>> info, list<auto> arglist);
3215 string getOrClause(reference<hash<QueryInfo>> info, hash<auto> arg);
3219 doSelectOrderBySqlUnlocked(hash<QueryInfo> info, reference<string> sql, list<auto> coll);
3240 int delCommit(hash<auto> cond, reference<string> sql, hash<auto> opt);
3275 int del(hash<auto> cond, reference<string> sql, hash<auto> opt);
3279 int del(hash<auto> cond, hash<auto> opt);
3283 int del(hash<auto> cond, reference<string> sql);
3316 int delIntern(*hash<auto> cond, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
3338 int updateCommit(hash<auto> set, hash<auto> cond, reference<string> sql, hash<auto> opt);
3375 int update(hash<auto> set, hash<auto> cond, reference<string> sql, hash<auto> opt);
3379 int update(hash<auto> set, hash<auto> cond, reference<string> sql);
3383 int update(hash<auto> set, hash<auto> cond, hash<auto> opt);
3413 hash<SqlResultInfo>
updateWithInfo(hash<auto> set, hash<auto> cond, *hash<auto> opt);
3433 deprecated
int updateNoCommit(hash<auto> set, *hash<auto> cond, *reference<string> sql);
3438 private int updateIntern(hash<auto> set, *hash<auto> cond, *reference<string> sql, *hash<auto> opt,
3439 *reference<softlist<auto>> args) {
3440 hash<SqlCommandInfo> update_hash =
getUpdateSql(set, cond);
3441 sql = update_hash.sql;
3442 args = update_hash.args;
3444 return execData(opt, update_hash.sql, update_hash.args);
3448 string getUpdateExpression(
string col, hash<UpdateOperatorInfo> uh);
3453 bool emptyDataIntern();
3458 Columns checkUpsertRow(hash<auto> row, reference<int> upsert_strategy);
3463 code getUpsertInsertFirst(
Columns cols, hash<auto> example_row, *hash<auto> opt);
3468 code getUpsertUpdateFirst(
Columns cols, hash<auto> example_row, *hash<auto> opt);
3473 code getUpsertSelectFirst(
Columns cols, hash<auto> example_row, *hash<auto> opt);
3478 code getUpsertInsertOnly(
Columns cols, hash<auto> example_row, *hash<auto> opt);
3483 code getUpsertUpdateOnly(
Columns cols, hash<auto> example_row, *hash<auto> opt);
3488 Columns getUpsertColumns(reference<string> csrc);
3507 bool matchUniqueColumns(
Columns cols, hash<auto> row);
3512 string getUpsertSelectSql(hash<auto> row,
Columns cols, reference<list<string>> updc);
3517 string getUpsertInsertSql(hash<auto> row);
3522 string getUpsertUpdateSql(hash<auto> row,
Columns cols, reference updc, *hash<auto> opt);
3527 softbool tryUpdate(
string sql, hash<auto> row,
Columns cols, list updc);
3532 checkValue(
string cname,
string argname, reference val,
string type);
3751 *hash<string, bool> getCheckOmissionOptions(*softlist<softstring> ol,
string err);
3782 list<auto> getAlignSqlUnlocked(
AbstractTable t, *hash<auto> opt);
3792 *list<AbstractColumnConstraint> getAllSupportingConstraints(
string ixname);
3945 string getPrimaryKeyColumn();
4072 AbstractDataProviderType
getColumnDataType(
string column_name, *hash<SqlUtilDataTypeOptionInfo> options);
4084 AbstractDataProviderType
getDbType(
string native_type, *
string qore_type,
bool nullable,
int max_size = -1,
4085 *hash<SqlUtilDataTypeOptionInfo> options) {
4086 hash<auto> type_options;
4087 if (nullable && options.mandatory);
4089 if (nullable && native_type[0] !=
'*');
4091 if (options.maxlen && (max_size < 0 || max_size > options.maxlen));
4102 AbstractDataProviderType
getNumericType(
string type_name,
bool nullable, *hash<auto> options);
4359 string getCreateTableSqlUnlocked(*hash<auto> opt);
4364 *list<auto> getCreateIndexesSqlUnlocked(*hash<auto> opt,
bool cache = True);
4369 *
string getCreatePrimaryKeySqlUnlocked(*hash<auto> opt,
bool cache = True);
4374 *list<auto> getCreateConstraintsSqlUnlocked(*hash<auto> opt,
bool cache = True);
4379 *list<auto> getCreateForeignConstraintsSqlUnlocked(*hash<auto> opt,
bool cache = True);
4384 *list<auto> getCreateMiscSqlUnlocked(*hash<auto> opt,
bool cache = True);
4389 *list<auto> getCreateTriggersSqlUnlocked(*hash<auto> opt,
bool cache = True);
4394 list<auto> getCreateSqlUnlocked(*hash<auto> opt,
bool cache = True);
4399 cacheUnlocked(*hash<auto> opt);
4404 auto execData(*hash<auto> opt,
string sql, *list<auto> args);
4409 execData(AbstractSQLStatement stmt, *hash<auto> opt, *list<auto> args);
4413 static AbstractTable getTable(AbstractDatasource nds,
string nname, *hash<auto>
opts);
4420 getColumnsUnlocked();
4425 getPrimaryKeyUnlocked();
4431 getIndexesUnlocked();
4436 getForeignConstraintsUnlocked(*hash<auto> opt);
4446 getConstraintsUnlocked();
4451 getTriggersUnlocked();
4462 softlist<auto> getDropSqlImpl();
4467 string getTruncateSqlImpl();
4490 preSetupTableImpl(reference desc, *hash<auto> opt);
4498 abstract AbstractDataProviderType
getNumericTypeImpl(
string type_name,
bool nullable, *hash<auto> options);
4502 abstract *hash<auto> doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
4506 abstract
bool emptyImpl();
4538 abstract setupTableImpl(hash<auto> desc, *hash<auto> opt);
4542 abstract
Columns describeImpl();
4548 abstract
Indexes getIndexesImpl();
4557 abstract
Triggers getTriggersImpl();
4561 abstract
string getCreateTableSqlImpl(*hash<auto> opt);
4564 abstract *list<auto> getCreateMiscSqlImpl(*hash<auto> opt,
bool cache);
4567 abstract
string getCreateSqlImpl(list<auto>
l);
4570 abstract
string getRenameSqlImpl(
string new_name);
4573 abstract *list<auto> getAlignSqlImpl(
AbstractTable t, *hash<auto> opt);
4577 abstract
AbstractColumn addColumnImpl(
string cname, hash<auto> opt,
bool nullable = True);
4580 abstract
AbstractPrimaryKey addPrimaryKeyImpl(
string cname, hash<auto> ch, *hash<auto> opt);
4583 abstract
AbstractIndex addIndexImpl(
string iname,
bool enabled, hash<auto> ch, *hash<auto> opt);
4586 abstract
AbstractForeignConstraint addForeignConstraintImpl(
string cname, hash<auto> ch,
string table, hash<auto> tch, *hash<auto> opt);
4596 abstract
AbstractTrigger addTriggerImpl(
string tname,
string src, *hash<auto> opt);
abstract class for check constraints
Definition: SqlUtil.qm.dox.h:6735
the base class for column information
Definition: SqlUtil.qm.dox.h:6364
abstract list< auto > getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table
the API for a constraint with columns
Definition: SqlUtil.qm.dox.h:6788
abstract base class for constraints
Definition: SqlUtil.qm.dox.h:6673
const CreationOptions
default generic creation options
Definition: AbstractDatabase.qc.dox.h:118
the base class for foreign key constraint information
Definition: SqlUtil.qm.dox.h:6948
bool hasKey(string k)
Returns True if the key exists in the contained hash (may or may not be assigned a value),...
Qore::AbstractIterator keyIterator()
Returns a HashKeyIterator object for the contained hash.
the abstract base class for index information
Definition: SqlUtil.qm.dox.h:6543
represents a primary key
Definition: SqlUtil.qm.dox.h:6871
Abstract base class for savepoint helpers for epheremal transaction support.
Definition: AbstractSavepointHelper.qc.dox.h:33
base class for abstract SqlUtil classes
Definition: AbstractSqlUtilBase.qc.dox.h:28
transient Mutex l()
mutex for atomic actions
transient AbstractDatasource ds
the connection to the database server
Definition: AbstractSqlUtilBase.qc.dox.h:37
*hash< auto > opts
option hash
Definition: AbstractSqlUtilBase.qc.dox.h:35
the base abstract class for the table implementation
Definition: AbstractTable.qc.dox.h:30
list< auto > getDropColumnSql(string cname, *hash< auto > opt)
returns the SQL that can be used to drop a column from the table
abstract bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
*hash< auto > insertCommit(hash< auto > row, reference< string > sql)
SqlUtil::AbstractTable::insertCommit() variant
const TableOptions
table options
Definition: AbstractTable.qc.dox.h:41
dropCommit(*hash< auto > opt)
drops the table from the database; releases the transaction lock after dropping the table
bool isDuplicateRowError(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
auto tryExecRawImpl(string sql)
tries to execute a command so that if an error occurs the current transaction status is not lost
int del(hash< auto > cond, reference< string > sql)
SqlUtil::AbstractTable::del() variant
*hash< auto > find(hash< auto > row)
finds a row in the table with the given primary key value given as a hash; if no row matches the prim...
*hash< auto > insertCommit(hash< auto > row)
inserts a row into the table; the transaction is committed if successful, if an error occurs,...
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,...
constructor(AbstractDatasource nds, string nname, *hash nopts)
creates the object; private constructor
AbstractPrimaryKey dropPrimaryKey(*reference lsql)
drops the primary key from the table; if the table is known to be in the database already,...
*hash< string, int > 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...
Definition: AbstractTable.qc.dox.h:2398
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...
softint rowCount()
returns the number of rows in the table
abstract *string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
const ColumnOptions
Column options; this is currently empty and can be extended in database-specific modules.
Definition: AbstractTable.qc.dox.h:192
abstract hash< auto > getQoreTypeMapImpl()
returns the qore type -> column type map
deprecated *hash< string, int > upsertFromSelectNoCommit(AbstractTable t, *hash< auto > sh, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
A legacy SqlUtil::AbstractTable::upsertFromSelect() wrapper.
Definition: AbstractTable.qc.dox.h:2404
hash< auto > getTableOptions()
returns the table options for this driver
*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...
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...
Columns describe()
returns an object of class Columns describing the table
const TableOmissionOptions
alignment omission options
Definition: AbstractTable.qc.dox.h:103
addCustomCopOperator(string name, hash< auto > operator)
register custom user column operator for this table object
int insertFromSelectCommit(list cols, AbstractTable source, hash< auto > sh, hash< auto > opt)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
list< auto > getDropPrimaryKeySql(*hash< auto > opt)
gets a list of SQL strings that can be used to drop the primary key from the table
bool hasReturningImpl()
returns True if the current database driver supports the "returning" clause in insert statements,...
abstract bool checkExistenceImpl()
returns True if the table exists in the DB, False if not
hash< SqlCommandInfo > getUpdateSql(hash< auto > set, *hash< auto > cond)
Returns the SQL for the given update parameters.
*hash< auto > getPseudoColumnHash()
returns a hash of valid pseudocolumns
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,...
hash< auto > getDescriptionHash()
Returns a description hash of the table.
rename(string new_name, *reference< string > sql, *Tables table_cache)
renames the table
deprecated *hash< string, int > upsertFromIteratorNoCommit(Qore::AbstractIterator i, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
A legacy SqlUtik::AbstractTable::upsertFromIterator() wrapper.
Definition: AbstractTable.qc.dox.h:2222
setupTable(hash< auto > desc, *hash< auto > opt)
creates the object from a table description hash
AbstractDataField getColumnDataField(string column_name, *hash< auto > options, *string append_desc)
returns a field object for the given column
*hash< auto > insert(hash< auto > row, reference< string > sql, hash< auto > opt)
SqlUtil::AbstractTable::insert() variant
copy(AbstractTable old)
copies the object
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...
int del(hash< auto > cond)
SqlUtil::AbstractTable::del() variant
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...
AbstractColumn dropColumn(string cname, *reference lsql)
drops a column from the table
string getDropIndexSql(string iname, *hash< auto > opt)
gets the SQL that can be used to drop an index from the table
hash< auto > getTableCreationOptions()
returns the table creation options for this driver
deprecated dropNoCommit(*hash< auto > opt)
A legacy wrapper for drop()
Constraints constraints
constraint descriptions
Definition: AbstractTable.qc.dox.h:391
deprecated createNoCommit(*hash< auto > opt)
A legacy wrapper for create()
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...
int insertFromSelect(list cols, AbstractTable source)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
string getDesc()
returns a descriptive string of the datasource (without the password) and the table name (with a poss...
const UpsertResultLetterMap
maps upsert result codes to single letter symbols
Definition: AbstractTable.qc.dox.h:371
AbstractPrimaryKey getPrimaryKey()
returns an object of class AbstractPrimaryKey describing the primary key of the table
int insertFromSelectCommit(list cols, AbstractTable source)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
const UpsertOptions
default upsert option keys
Definition: AbstractTable.qc.dox.h:225
int update(hash< auto > set, hash< auto > cond)
A SqlUtil::AbstractTable::update() variant.
auto tryExecArgs(string sql, *softlist< auto > args)
executes some SQL with optional arguments so that if an error occurs the current transaction state is...
list< auto > getColumnSqlNames(softlist cols)
returns a list of column names for use in SQL strings; subclasses can process the argument list in ca...
list< auto > getDropTriggerSql(string tname, *hash< auto > opt)
returns SQL that can be used to drop the given trigger from the table
int delCommit()
SqlUtil::AbstractTable::delCommit() variant
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...
*hash< string, int > upsertFromSelectCommit(AbstractTable t, *hash< auto > sh, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
Upserts or merges data from the given foreign table and select option hash into the current table.
Definition: AbstractTable.qc.dox.h:2340
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,...
hash< SqlResultInfo > insertWithInfo(hash< auto > row, *hash< auto > opt)
Inserts a row and returns the result and also the SQL used.
*hash< string, AbstractDataField > getRecordType()
returns a record description for the table
list< auto > getAddColumnSql(string cname, hash< auto > copt, bool nullable=True, *hash< auto > opt)
returns a list of SQL strings that can be use to add a column to the table
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 ...
int update(hash< auto > set, hash< auto > 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...
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifier for schema,...
const ColumnDescOptions
Column description options.
Definition: AbstractTable.qc.dox.h:171
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
hash< auto > getInsertFromIteratorOptions()
returns the insert from iterator options for this driver
Qore::SQL::AbstractSQLStatement getStatementNoExec(*hash< auto > sh, *hash< auto > opt)
returns an AbstractSQLStatement object that will iterate the results of a select statement matching t...
bool inDb
in database
Definition: AbstractTable.qc.dox.h:397
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 > insert(hash< auto > row, reference< string > sql)
SqlUtil::AbstractTable::insert() variant
int update(hash< auto > set, hash< auto > cond, reference< string > sql)
A SqlUtil::AbstractTable::update() variant.
string name
the table's name
Definition: AbstractTable.qc.dox.h:381
*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 ...
const IndexOptions
default index options
Definition: AbstractTable.qc.dox.h:52
string getCreateTableSql(*hash< auto > opt)
returns an SQL string that could be used to create the basic table structure without indexes and cons...
*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 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 > insert(hash< auto > row, hash< auto > opt)
SqlUtil::AbstractTable::insert() variant
hash< auto > getCacheOptions()
returns the cache options for this driver
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
*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
*hash< string, int > upsertFromSelectCommit(Table t, *hash< auto > sh, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
SqlUtil::AbstractTable::upsertFromSelectCommit() variant
Definition: AbstractTable.qc.dox.h:2349
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 ...
bool hasReturning()
returns True if the current database driver supports the "returning" clause in insert statements,...
code getUpsertClosureWithValidation(hash< auto > 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...
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 ...
deprecated int upsertNoCommit(hash< auto > row, int upsert_strategy=UpsertAuto)
A legacy SqlUtil::AbstractTable::upsert() wrapper.
bool bindEmptyStringsAsNull()
returns True if the DB treats empty strings as NULL, False if not; by default this method returns Fal...
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 > 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
Definition: AbstractTable.qc.dox.h:4084
*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,...
const SqlDataCallbackOptions
generic SQL data operation callbacks
Definition: AbstractTable.qc.dox.h:199
auto tryExec(string sql)
executes some SQL with optional arguments so that if an error occurs the current transaction state is...
const InsertOptions
generic SQL insert options
Definition: AbstractTable.qc.dox.h:214
AbstractDataField getColumnDataField(AbstractColumn column, *hash< SqlUtilDataTypeOptionInfo > options, *string append_desc)
returns a field object for the given column
deprecated int insertFromIteratorNoCommit(Qore::AbstractIterator i, *hash< auto > opt)
A legacy SqlUtil::AbstractTable::insertFromIterator() wrapper.
abstract bool isDuplicateRowErrorImpl(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
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 ...
int delCommit(hash< auto > cond, reference< string > sql, hash< auto > opt)
deletes rows in the table matching the condition and returns the count of rows deleted; the transacti...
abstract private doSelectOrderByWithOffsetSqlUnlockedImpl(reference< hash< QueryInfo > > info, reference< string > sql, list< auto > coll)
processes a string for use in SQL select statements when there is an "order by" and "offset" argument
hash< auto > getSelectOptions()
returns the select options for this driver
int delCommit(hash< auto > cond, hash< auto > opt)
SqlUtil::AbstractTable::delCommit() variant
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 ...
abstract copyImpl(AbstractTable old)
db-specific copy actions
deprecated *hash< auto > insertNoCommit(hash< auto > row, *reference< string > sql, *hash< auto > opt)
A legacy wrapper for SqlUtil::AbstractTable::insert()
AbstractConstraint dropConstraint(string cname, *reference< string > sql)
drops a constraint from the table; this can be any constraint on the table, a primary key,...
string getRenameSql(string new_name, *hash< auto > opt)
returns an SQL string that could be used to rename the table in the database
int delCommit(hash< auto > cond)
SqlUtil::AbstractTable::delCommit() variant
hash< auto > getTriggerOptions()
returns the trigger options for this driver
hash< auto > getUpsertOptions()
returns the upsert options for this driver
hash< auto > getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
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
hash< string, Columns > getAllUpsertColumns(*hash< auto > row)
returns a hash with a single value\
AbstractForeignConstraint removeForeignConstraint(string cname)
removes the named foreign constraint from the table; no SQL is executed in any case,...
const CacheOptions
default cache options
Definition: AbstractTable.qc.dox.h:63
*hash< auto > insertCommit(hash< auto > row, reference< string > sql, hash< auto > opt)
SqlUtil::AbstractTable::insertCommit() variant
*hash< auto > findSingle(*hash< auto > cond)
finds a single row in the table that match the row condition passed; multiple rows may match,...
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
bool native_case
native case option
Definition: AbstractTable.qc.dox.h:395
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< 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...
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...
*hash< auto > insert(hash< auto > row)
inserts a row into the table without any transaction management; a transaction will be in progress af...
hash< auto > getColumnOptions()
returns the column options for this driver
int insertFromSelectCommit(list cols, AbstractTable source, hash< auto > sh, reference< string > sql)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
bool asteriskRequiresPrefix()
returns True if the database requires a wildcard "*" to be prefixed with the table name when it appea...
bool emptyData()
returns True if the table has no data rows, False if not
*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
int updateCommit(hash< auto > set, hash< auto > cond, hash< auto > opt)
A SqlUtil::AbstractTable::updateCommit() variant.
drop(*hash< auto > opt)
drops the table from the database without any transaction management
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...
deprecated int insertFromSelectNoCommit(list cols, AbstractTable source, *hash< auto > sh, *reference< string > sql, *hash< auto > opt)
A legacy SqlUtil::AbstractTable::insertFromSelect() wrapper.
Definition: AbstractTable.qc.dox.h:1938
*hash< string, int > 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...
Definition: AbstractTable.qc.dox.h:2175
abstract bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
int updateCommit(hash< auto > set, hash< auto > cond)
A SqlUtil::AbstractTable::updateCommit() variant.
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...
hash< auto > getTableDescriptionHashOptions()
returns the table description hash<auto> options for this driver
deprecated int updateNoCommit(hash< auto > set, *hash< auto > cond, *hash< auto > opt)
A legacy SqlUtil::AbstractTable::update() wrapper.
Columns columns
column description object
Definition: AbstractTable.qc.dox.h:383
Indexes getIndexes()
returns an object of class Indexes describing the indexes on 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
string getName()
returns the name of the table
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,...
hash< auto > getInsertOptions()
returns the insert options for this driver
*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
*list< auto > selectRows(*hash< auto > sh, *hash< auto > opt)
returns a list of hashes representing the rows in the table that match the argument hash
Triggers getTriggers()
returns an object of class Triggers describing the triggers on the table
Qore::SQL::AbstractSQLStatement getStatement(*hash< auto > sh, *hash< auto > opt)
returns an AbstractSQLStatement object that will iterate the results of a select statement matching t...
ForeignConstraints foreignConstraints
foreign constraints description
Definition: AbstractTable.qc.dox.h:389
clearImpl()
clears any driver-specific table information
const SelectOptions
default possible select options; can be extended by driver-specific modules
Definition: AbstractTable.qc.dox.h:85
*hash< auto > getColumnOperatorMapImpl()
Reimplement in subclasses to provide driver specific column operators.
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...
int del(hash< auto > cond, hash< auto > opt)
SqlUtil::AbstractTable::del() variant
setDatasource(AbstractDatasource nds)
changes the datasource for the table; if the inDb flag is True, then it is set to False by calling th...
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...
cache(*hash< auto > opts)
reads in all attributes of the table from the database
truncateCommit()
truncates all the table data; releases the transaction lock after executing
deprecated int updateNoCommit(hash< auto > set, *hash< auto > cond, *reference< string > sql)
A legacy SqlUtil::AbstractTable::update() wrapper.
int insertFromIteratorCommit(Qore::AbstractIterator i, *hash< auto > opt)
this method inserts data from the given iterator argument (whose getValue() method must return a hash...
int del(hash< auto > cond, reference< string > sql, hash< auto > opt)
deletes rows in the table matching the condition and returns the count of rows deleted; no transactio...
const ConstraintOptions
default constraint options
Definition: AbstractTable.qc.dox.h:60
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...
hash< auto > getUpdateOperatorMap()
returns the update operator map for this object
hash< auto > getIndexOptions()
returns the index options for this driver
createCommit(*hash< auto > opt)
creates the table in the database; releases the transaction lock after creating the table
*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...
deprecated *hash< string, int > upsertFromSelect(Table t, *hash< auto > sh, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
SqlUtil::AbstractTable::upsertFromSelect() variant
Definition: AbstractTable.qc.dox.h:2410
string getBaseType()
returns the base type of the underlying object (normally "table", some DB-specific implementations ma...
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...
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...
const TableDescriptionHashOptions
Table description options.
Definition: AbstractTable.qc.dox.h:147
hash< auto > getTableColumnDescOptions()
returns the table column description options for this driver
int update(hash< auto > set)
A SqlUtil::AbstractTable::update() variant.
int update(hash< auto > set, hash< auto > cond, hash< auto > opt)
A SqlUtil::AbstractTable::update() variant.
clear()
purges the current table definition
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...
const UpsertResultDescriptionMap
hash mapping upsert descriptions to codes
Definition: AbstractTable.qc.dox.h:362
int updateCommit(hash< auto > set, hash< auto > cond, reference< string > sql)
A SqlUtil::AbstractTable::updateCommit() variant.
deprecated *hash< auto > insertNoCommit(hash< auto > row, hash< auto > opt)
A legacy wrapper for SqlUtil::AbstractTable::insert()
hash< auto > getConstraintOptions()
returns the constraint options for this driver
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
*hash< string, int > 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...
Definition: AbstractTable.qc.dox.h:2216
int updateCommit(hash< auto > set, hash< auto > 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...
hash< auto > getAlignTableOptions()
returns the align table options for this driver
Constraints getConstraints()
returns a Constraints object describing the non-foreign constraints on the table
abstract bool hasArrayBind()
returns True if the underlying DB driver supports bulk DML operations
validateColumnOptions(string cname, reference< hash > opt, bool nullable)
validates column options
deprecated truncateNoCommit()
A legacy warpper for truncate()
commit()
commits the current transaction on the underlying Qore::SQL::AbstractDatasource
bool checkExistence()
returns True if the table exists in the database, False if not
softlist< auto > getDropSql(*hash< auto > opt)
returns the sql required to drop the table; reimplement in subclasses if necessary
int insertFromSelectCommit(list cols, AbstractTable source, hash< auto > sh)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
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...
AbstractTable getSubtableFromString(string table, *hash< auto > opt)
Returns the given table from the argument, using any "tablecode" option if present.
const TableCreationOptions
table creation options
Definition: AbstractTable.qc.dox.h:113
int delCommit(hash< auto > cond, reference< string > sql)
SqlUtil::AbstractTable::delCommit() variant
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...
Triggers triggers
trigger descriptions
Definition: AbstractTable.qc.dox.h:393
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...
abstract AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
int updateCommit(hash< auto > set)
A SqlUtil::AbstractTable::updateCommit() variant.
AbstractDataProviderType getColumnDataType(string column_name, *hash< SqlUtilDataTypeOptionInfo > options)
returns the data type for the given column
hash< auto > getInsertOperatorMap()
returns the insert operator map for this object
AbstractPrimaryKey primaryKey
primary key description
Definition: AbstractTable.qc.dox.h:385
bool inDb()
returns True if the table has been read from or created in the database, False if not
Qore::SQL::SQLStatement getRowIterator(*hash< auto > sh, *hash< auto > opt)
returns an SQLStatement object that will iterate the results of a select statement matching the argum...
int insertFromSelect(list cols, AbstractTable source, hash< auto > sh, reference< string > sql)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
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,...
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< 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...
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,...
abstract hash< auto > getTypeMapImpl()
returns the type name -> type description hash
beginTransaction()
begins a transaction on the underlying Qore::SQL::AbstractDatasource
abstract bool supportsTablespacesImpl()
returns True if the database support tablespaces
hash< auto > getColumnOperatorMap()
returns the column operator map for this object
rollback()
rolls back the current transaction on the underlying Qore::SQL::AbstractDatasource
string getTruncateSql(*hash< auto > opt)
gets the SQL that can be used to truncate the table
*hash< auto > insertCommit(hash< auto > row, hash< auto > opt)
SqlUtil::AbstractTable::insertCommit() variant
string getSqlFromList(list< auto > l)
returns an SQL string corresponding to the list of commands in the argument
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
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,...
ForeignConstraints getForeignConstraints(*hash< auto > opt)
returns a ForeignConstraints object describing the foreign constraints that the table has on other ta...
string getSqlValue(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument
const TriggerOptions
default trigger options
Definition: AbstractTable.qc.dox.h:79
const AlignTableOptions
table alignment options
Definition: AbstractTable.qc.dox.h:126
int insertFromSelect(list cols, AbstractTable source, hash< auto > sh, hash< auto > opt)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
code getBulkUpsertClosure(hash< auto > 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...
auto tryExecRaw(string sql)
executes some SQL so that if an error occurs the current transaction state is not lost
*AbstractUniqueConstraint findUniqueConstraint(string name)
returns the given AbstractUniqueConstraint object if defined for the table (also includes the primary...
string getCreateSqlString(*hash< auto > opt)
returns an SQL string that could be used to create the table and all known properties of the table
int del()
SqlUtil::AbstractTable::del() variant
const UpsertResultMap
hash mapping upsert results to a description
Definition: AbstractTable.qc.dox.h:351
AbstractSavepointHelper getSavepointHelper(*string savepoint)
get DB-specific savepoint helper
hash< auto > getSqlDataCallbackOptions()
returns the sql data operation callback options for this driver
truncate()
truncates all the table data without any transaction management
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,...
AbstractDataProviderType getDbType(AbstractColumn column, *hash< SqlUtilDataTypeOptionInfo > options)
returns the DB type for the given column type
*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...
string getAlignSqlString(AbstractTable t, *hash< auto > opt)
accepts an AbstractTable argument and returns an SQL string that could be executed to align the struc...
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...
*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...
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...
bool manual
manual edits
Definition: AbstractTable.qc.dox.h:399
*list find(list< auto > ids)
finds rows in the table with the given primary key values; if no row matches any primary key value pa...
deprecated *hash< string, int > upsertFromSelectNoCommit(Table t, *hash< auto > sh, int upsert_strategy=AbstractTable::UpsertAuto, *hash< auto > opt)
A legacy SqlUtil::AbstractTable::upsertFromSelect() wrapper.
Definition: AbstractTable.qc.dox.h:2416
hash< auto > getForeignConstraintOptions()
return the foreign constraint options for this driver
const ForeignConstraintOptions
default foreign constraint options
Definition: AbstractTable.qc.dox.h:72
const AdditionalColumnDescOptions
additional column description keys valid when describing columns in a table description hash
Definition: AbstractTable.qc.dox.h:187
const InsertFromIteratorOptions
default insert option keys
Definition: AbstractTable.qc.dox.h:237
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
bool empty()
returns True if the table has no definitions, False if not
deprecated int delNoCommit(*hash< auto > cond, *reference< string > sql)
A legacy SqlUtil::AbstractTable::del() wrapper.
Qore::AbstractIterator getUniqueConstraintIterator()
returns an iterator for all unique constraints on the table (including the primary key if any)
hash< auto > getExpressionMap()
Returns the expression map for this database server.
*hash< auto > select(*hash< auto > sh, *hash< auto > opt)
returns a hash of lists representing the columns and rows in the table that match the argument hash
Indexes indexes
index descriptions
Definition: AbstractTable.qc.dox.h:387
*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...
int insertFromSelect(list cols, AbstractTable source, hash< auto > sh)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
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...
Definition: AbstractTable.qc.dox.h:1930
hash< auto > getWhereOperatorMap()
returns the "where" operator map for this object
abstract doSelectLimitOnlyUnlockedImpl(reference< hash< QueryInfo > > info, reference< string > sql)
processes a string for use in SQL select statements when there is a "limit" argument,...
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,...
create(*hash< auto > opt)
creates the table with all associated properties (indexes, constraints, etc) without any transaction ...
*hash< auto > selectRow(*hash< auto > sh, *hash< auto > opt)
returns a hash representing the row in the table that matches the argument hash; if more than one row...
list< auto > getModifyColumnSql(string cname, hash< auto > 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
the base class for triggers
Definition: SqlUtil.qm.dox.h:7146
represents a unique column constraint
Definition: SqlUtil.qm.dox.h:6862
column container class that throws an exception if an unknown column is accessed
Definition: SqlUtil.qm.dox.h:6282
constraint container class that throws an exception if an unknown constraint is accessed
Definition: SqlUtil.qm.dox.h:6631
foreign constraint container class that throws an exception if an unknown constraint is accessed
Definition: SqlUtil.qm.dox.h:6882
index container class that throws an exception if an unknown index is accessed
Definition: SqlUtil.qm.dox.h:6497
represents a database table; this class embeds an AbstractTable object that is created automatically ...
Definition: Table.qc.dox.h:44
the table container class stores a collection of tables in a schema
Definition: SqlUtil.qm.dox.h:6094
trigger container class that throws an exception if an unknown trigger is accessed
Definition: SqlUtil.qm.dox.h:7164
string sprintf(string fmt,...)
const UpsertUpdateFirst
Upsert option: update first, if the update fails, then insert.
Definition: AbstractTable.qc.dox.h:271
const UpsertStrategyMap
hash mapping upsert strategy codes to a text description
Definition: AbstractTable.qc.dox.h:306
const UpsertInsertOnly
Upsert option: insert if the row does not exist, otherwise ignore.
Definition: AbstractTable.qc.dox.h:294
const UpsertInsertFirst
Definition: AbstractTable.qc.dox.h:263
const UpsertUpdateOnly
Upsert option: update if the row exists, otherwise ignore.
Definition: AbstractTable.qc.dox.h:301
const UpsertAuto
Upsert option: if the target table is empty, use UpsertInsertFirst, otherwise use UpsertUpdateFirst.
Definition: AbstractTable.qc.dox.h:287
const UpsertStrategyDescriptionMap
hash mapping upsert strategy descriptions to upsert strategy codes
Definition: AbstractTable.qc.dox.h:318
const UpsertSelectFirst
Upsert option: select first, if the row is unchanged, do nothing, if it doesn't exist,...
Definition: AbstractTable.qc.dox.h:280
const UR_Updated
row was updated because it was different (only possible with UpsertSelectFirst)
Definition: AbstractTable.qc.dox.h:339
const UR_Verified
row was updated unconditionally (not returned with UpsertSelectFirst)
Definition: AbstractTable.qc.dox.h:336
const UR_Deleted
row was deleted (only possible with batch upsert methods such as AbstractTable::upsertFromIterator() ...
Definition: AbstractTable.qc.dox.h:345
const UR_Inserted
Definition: AbstractTable.qc.dox.h:333
const UR_Unchanged
row was unchanged (only possible with UpsertSelectFirst, UpsertInsertOnly, and UpsertUpdateOnly)
Definition: AbstractTable.qc.dox.h:342
const AbstractDataProviderTypeMap
Qore AbstractDatabase class definition.
Definition: AbstractDatabase.qc.dox.h:26
Query information.
Definition: SqlUtil.qm.dox.h:2685