AbstractTable.qc.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
namespace SqlUtil {
class AbstractTable : public AbstractSqlUtilBase {
public:
const TableOptions = {
"native_case": Type::Boolean,
"table_cache": "Tables",
};
const IndexOptions = {
"index_tablespace": Type::String,
"replace": Type::Boolean,
};
const ConstraintOptions = IndexOptions;
const CacheOptions = {
"table_cache": "Tables",
};
const ForeignConstraintOptions = ConstraintOptions + {
"table_cache": "Tables",
};
const TriggerOptions = AbstractDatabase::CreationOptions;
const SelectOptions = {
"alias": Type::String,
"comment": Type::String,
"hint": Type::String,
"columns": Type::NothingType,
"where": "hash/list",
"orderby": "softstringinthashlist",
"desc": Type::Boolean,
"limit": Type::Int,
"offset": Type::Int,
"join": Type::Hash,
"groupby": "softstringinthashlist",
"having": Type::Hash,
"superquery": Type::Hash,
"forupdate": Type::Boolean,
};
const TableOmissionOptions = {
"indexes": True,
"foreign_constraints": True,
"triggers": True,
};
const TableCreationOptions = IndexOptions + AbstractDatabase::CreationOptions + {
"omit": "softstringlist",
};
const AlignTableOptions = TableCreationOptions + {
"column_map": Type::Hash,
"index_map": Type::Hash,
"constraint_map": Type::Hash,
"trigger_map": Type::Hash,
"db_table_cache": "Tables",
"force": Type::Boolean,
};
const TableDescriptionHashOptions = {
"columns": Type::Hash,
"primary_key": Type::Hash,
"indexes": Type::Hash,
"triggers": Type::Hash,
"foreign_constraints": Type::Hash,
"unique_constraints": Type::Hash,
//"check_constraints": Type::Hash,
"table_cache": "Tables",
};
const ColumnDescOptions = {
"qore_type": Type::String,
"native_type": Type::String,
"size": Type::Int,
"scale": Type::Int,
"default_value": Type::NothingType,
"default_value_native": Type::Boolean,
"comment": Type::String,
"notnull": Type::Boolean,
"driver": Type::Hash,
};
const AdditionalColumnDescOptions = {
"notnull": Type::Boolean,
};
const ColumnOptions = {};
const SqlDataCallbackOptions = {
"sqlarg_callback": "code",
"tablecode": "code",
};
const InsertOptions = SqlDataCallbackOptions + {
"returning": "stringhashlist",
};
const UpsertOptions = {
"info_callback": "code",
"commit_block": Type::Int,
"delete_others": Type::Boolean,
"omit_update": "softstringlist",
};
const InsertFromIteratorOptions = SqlDataCallbackOptions + {
"info_callback": "code",
"commit_block": Type::Int,
};
const UpsertInsertFirst = 1;
const UpsertUpdateFirst = 2;
const UpsertSelectFirst = 3;
const UpsertAuto = 4;
const UpsertInsertOnly = 5;
const UpsertUpdateOnly = 6;
const UpsertStrategyMap = {
UpsertInsertFirst: "UpsertInsertFirst",
UpsertUpdateFirst: "UpsertUpdateFirst",
UpsertSelectFirst: "UpsertSelectFirst",
UpsertAuto: "UpsertAuto",
UpsertInsertOnly: "UpsertInsertOnly",
UpsertUpdateOnly: "UpsertUpdateOnly",
};
const UpsertStrategyDescriptionMap = {
"UpsertInsertFirst": UpsertInsertFirst,
"UpsertUpdateFirst": UpsertUpdateFirst,
"UpsertSelectFirst": UpsertSelectFirst,
"UpsertAuto": UpsertAuto,
"UpsertInsertOnly": UpsertInsertOnly,
"UpsertUpdateOnly": UpsertUpdateOnly,
};
const UR_Inserted = 1;
const UR_Verified = 2;
const UR_Updated = 3;
const UR_Unchanged = 4;
const UR_Deleted = 5;
const UpsertResultMap = {
UR_Inserted: "inserted",
UR_Verified: "verified",
UR_Updated: "updated",
UR_Unchanged: "unchanged",
UR_Deleted: "deleted",
};
const UpsertResultDescriptionMap = {
"inserted": UR_Inserted,
"verified": UR_Verified,
"updated": UR_Updated,
"unchanged": UR_Unchanged,
"deleted": UR_Deleted,
};
const UpsertResultLetterMap = {
UR_Inserted: "I",
UR_Verified: "V",
UR_Updated: "U",
UR_Unchanged: ".",
UR_Deleted: "X",
};
protected:
string name;
Columns columns;
AbstractPrimaryKey primaryKey;
Indexes indexes;
ForeignConstraints foreignConstraints;
Constraints constraints;
Triggers triggers;
bool native_case = False;
bool inDb = False;
bool manual = False;
hash m_customCopMap = {};
public:
protected:
constructor(AbstractDatasource nds, string nname, *hash nopts) ;
public:
copy(AbstractTable old);
setDatasource(AbstractDatasource nds);
protected:
doTableOptions(*hash<auto> nopts);
public:
beginTransaction();
commit();
rollback();
bool inDb();
Qore::AbstractIterator getUniqueConstraintIterator();
dropCommit(*hash<auto> opt);
drop(*hash<auto> opt);
deprecated dropNoCommit(*hash<auto> opt);
auto tryExec(string sql);
auto tryExecArgs(string sql, *softlist<auto> args);
auto tryExecRaw(string sql);
softlist<auto> getDropSql(*hash<auto> opt);
truncateCommit();
truncate();
deprecated truncateNoCommit();
string getTruncateSql(*hash<auto> opt);
createCommit(*hash<auto> opt);
create(*hash<auto> opt);
deprecated createNoCommit(*hash<auto> opt);
rename(string new_name, *reference<string> sql, *Tables table_cache);
protected:
doRenameIntern(string new_name, *Tables table_cache);
public:
bool emptyData();
bool empty();
protected:
bool emptyUnlocked();
public:
setupTable(hash<auto> desc, *hash<auto> opt);
AbstractColumn addColumn(string cname, hash<auto> opt, bool nullable = True, *reference lsql);
list<auto> getAddColumnSql(string cname, hash<auto> copt, bool nullable = True, *hash<auto> opt);
private AbstractColumn addColumnUnlocked(string cname, hash<auto> opt, bool nullable = True, *reference lsql,
bool do_exec = True, bool modify_table = True) {
if (!columns)
columns = new Columns();
else if (columns.hasKey(cname))
throw "COLUMN-ERROR", sprintf("%s column %y: this column already exists", getDesc(), cname);
if (!opt.native_type && !opt.qore_type)
throw "COLUMN-ERROR", sprintf("%s column %y: no native_type or qore_type keys in column option hash: %y",
getDesc(), cname, opt);
validateColumnOptions(cname, \opt, nullable);
// get the new column object
AbstractColumn c = addColumnImpl(cname, opt, nullable);
// add column in table if the table is already known to be in the database
lsql = c.getAddColumnSql(self);
if (do_exec)
execSql(lsql);
// add the column to the internal column representation
if (modify_table)
addColumnToTableUnlocked(c);
return c;
}
protected:
addColumnToTableUnlocked(AbstractColumn c);
public:
AbstractColumn modifyColumn(string cname, hash<auto> opt, bool nullable = True, *reference lsql);
list<auto> getModifyColumnSql(string cname, hash<auto> copt, bool nullable = True, *hash<auto> opt);
AbstractColumn renameColumn(string old_name, string new_name, reference<string> sql);
string getRenameColumnSql(string old_name, string new_name, *hash<auto> opt);
protected:
AbstractColumn renameColumnIntern(AbstractColumn c, string new_name);
public:
protected:
validateOptionsIntern(string err, hash<auto> ropt, reference<hash<auto>> opt);
public:
protected:
validateOptionsIntern(string err, hash<auto> ropt, reference<hash<auto>> opt, string tag);
public:
protected:
execSql(softlist lsql);
public:
AbstractPrimaryKey addPrimaryKey(string pkname, softlist cols, *hash<auto> opt, *reference<string> sql);
string getAddPrimaryKeySql(string pkname, softlist cols, *hash pkopt, *hash<auto> opt);
protected:
setPrimaryKeyUnlocked(AbstractPrimaryKey pk);
public:
protected:
AbstractPrimaryKey addPrimaryKeyUnlocked(string pkname, softlist cols, *hash<auto> opt, *reference<string> sql);
public:
protected:
AbstractPrimaryKey addPrimaryKeyUnlockedIntern(string pkname, softlist cols, *hash<auto> opt, *reference<string> sql);
public:
list<auto> getDropAllConstraintsAndIndexesOnColumnSql(string cname, *hash<auto> opt);
protected:
list<auto> getDropAllConstraintsAndIndexesOnColumnSqlUnlocked(string cname, *hash<auto> opt);
public:
list<auto> getDropPrimaryKeySql(*hash<auto> opt);
AbstractPrimaryKey dropPrimaryKey(*reference lsql);
AbstractUniqueConstraint addUniqueConstraint(string cname, softlist cols, *hash<auto> opt, *reference<string> sql);
string getAddUniqueConstraintSql(string cname, softlist cols, *hash ukopt, *hash<auto> opt);
protected:
AbstractUniqueConstraint addUniqueConstraintUnlocked(string cname, softlist cols, *hash<auto> opt, *reference<string> sql);
public:
protected:
AbstractUniqueConstraint addUniqueConstraintUnlockedIntern(string cname, softlist cols, *hash<auto> opt, *reference<string> sql);
public:
AbstractIndex addIndex(string iname, bool unique, softlist cols, *hash<auto> opt, *reference<string> sql);
string getAddIndexSql(string iname, bool unique, softlist cols, *hash<auto> ixopt, *hash<auto> opt);
protected:
AbstractIndex addIndexUnlocked(string iname, bool unique, softlist cols, *hash<auto> opt, *reference<string> sql);
public:
protected:
AbstractIndex addIndexUnlockedIntern(string iname, bool unique, softlist cols, *hash<auto> opt, *reference<string> sql);
public:
AbstractIndex renameIndex(string old_name, string new_name, reference<string> sql);
AbstractIndex dropIndex(string iname, *reference<string> sql);
string getDropIndexSql(string iname, *hash<auto> opt);
AbstractForeignConstraint addForeignConstraint(string cname, softlist cols, string table, *softlist tcols, *hash<auto> opt, *reference<string> sql);
string getAddForeignConstraintSql(string cname, softlist cols, string table, *softlist tcols, *hash fkopt, *hash<auto> opt);
protected:
Columns getReferencedTableColumnsUnlocked(string table, *Tables cache, string err = 'FOREIGN-CONSTRAINT-ERROR');
public:
protected:
AbstractForeignConstraint addForeignConstraintUnlocked(string cname, softlist cols, string table, *softlist tcols, *hash<auto> opt, *reference<string> sql);
public:
protected:
AbstractForeignConstraint addForeignConstraintUnlockedIntern(string cname, softlist cols, string table, *softlist tcols, *hash<auto> opt, *reference<string> sql);
public:
AbstractForeignConstraint dropForeignConstraint(string cname, *reference<string> sql);
AbstractForeignConstraint removeForeignConstraint(string cname);
AbstractCheckConstraint addCheckConstraint(string cname, string src, *hash<auto> opt, *reference<string> sql);
string getAddCheckConstraintSql(string cname, string src, *hash copt, *hash<auto> opt);
protected:
AbstractCheckConstraint addCheckConstraintUnlocked(string cname, string src, *hash<auto> opt, *reference<string> sql);
public:
protected:
AbstractCheckConstraint addCheckConstraintUnlockedIntern(string cname, string src, *hash<auto> opt, *reference<string> sql);
public:
AbstractConstraint renameConstraint(string old_name, string new_name, reference lsql);
string getDropConstraintSql(string cname, *hash<auto> opt);
*string getDropConstraintIfExistsSql(string cname, *hash<auto> opt, *reference<AbstractConstraint> cref);
protected:
AbstractConstraint findDropConstraintUnlocked(string cname, reference<code> rmv);
public:
AbstractConstraint dropConstraint(string cname, *reference<string> sql);
AbstractTrigger addTrigger(string tname, string src, *hash<auto> opt, *reference lsql);
list<auto> getAddTriggerSql(string tname, string src, *hash topt, *hash<auto> opt);
protected:
AbstractTrigger addTriggerUnlocked(string tname, string src, *hash<auto> opt, *reference lsql);
public:
protected:
AbstractTrigger addTriggerUnlockedIntern(string tname, string src, *hash<auto> opt, *reference lsql);
public:
AbstractTrigger dropTrigger(string tname, *reference<string> sql);
list<auto> getDropTriggerSql(string tname, *hash<auto> opt);
protected:
getAllConstraintsUnlocked(*hash<auto> opt);
public:
protected:
checkUniqueConstraintName(string err, string cname);
public:
protected:
checkUniqueConstraintNameValidateOptions(string err, string cname, hash<auto> ropt, reference<hash> opt);
public:
protected:
validateColumnOptions(string cname, reference<hash> opt, bool nullable);
public:
AbstractColumn dropColumn(string cname, *reference lsql);
list<auto> getDropColumnSql(string cname, *hash<auto> opt);
*hash<auto> insertCommit(hash<auto> row);
*hash<auto> insertCommit(hash<auto> row, reference<string> sql);
*hash<auto> insertCommit(hash<auto> row, hash<auto> opt);
*hash<auto> insertCommit(hash<auto> row, reference<string> sql, hash<auto> opt);
*hash<auto> insert(hash<auto> row);
*hash<auto> insert(hash<auto> row, reference<string> sql);
*hash<auto> insert(hash<auto> row, hash<auto> opt);
*hash<auto> insert(hash<auto> row, reference<string> sql, hash<auto> opt);
hash<SqlResultInfo> insertWithInfo(hash<auto> row, *hash<auto> opt);
deprecated *hash<auto> insertNoCommit(hash<auto> row, *reference<string> sql, *hash<auto> opt);
deprecated *hash<auto> insertNoCommit(hash<auto> row, hash<auto> opt);
private *hash<auto> insertIntern(hash<auto> row, *reference<string> sql, *hash<auto> opt,
*reference<softlist<auto>> args) {
// check data callback options if any
validateOptionsIntern("OPTION-ERROR", getInsertOptions(), \opt);
// issue #3352: do not execute runtime DML while holding the lock
{
l.lock();
on_exit l.unlock();
getColumnsUnlocked();
}
sql = sprintf("insert into %s (", getSqlName());
foreach string k in (keys row);
hash vh = getPlaceholdersAndValues(row);
sql += (foldl $1 + "," + $2, (map getColumnSqlName($1), keys row));
sql += ") values (";
sql += (foldl $1 + "," + $2, vh.placeholders);
sql += ")";
args = vh.values;
// check for a bulk insert in case the driver does not support array binding
if (!hasArrayBind());
if (opt.returning)
return doReturningImpl(opt, \sql, args);
execData(opt, sql, args);
}
protected:
hash<auto> getPlaceholdersAndValues(hash<auto> row);
public:
bool hasReturning();
int insertFromSelectCommit(list cols, AbstractTable source, hash<auto> sh, reference<string> sql, hash<auto> opt);
int insertFromSelectCommit(list cols, AbstractTable source);
int insertFromSelectCommit(list cols, AbstractTable source, hash<auto> sh);
int insertFromSelectCommit(list cols, AbstractTable source, hash<auto> sh, reference<string> sql);
int insertFromSelectCommit(list cols, AbstractTable source, hash<auto> sh, hash<auto> opt);
int insertFromSelect(list cols, AbstractTable source, hash<auto> sh, reference<string> sql, hash<auto> opt);
int insertFromSelect(list cols, AbstractTable source);
int insertFromSelect(list cols, AbstractTable source, hash<auto> sh);
int insertFromSelect(list cols, AbstractTable source, hash<auto> sh, reference<string> sql);
int insertFromSelect(list cols, AbstractTable source, hash<auto> sh, hash<auto> opt);
hash<SqlResultInfo> insertFromSelectWithInfo(list<auto> cols, AbstractTable source, hash<auto> select_hash,
*hash<auto> opt) {
hash<SqlResultInfo> rv();
rv.result = insertFromSelectIntern(cols, source, select_hash, \rv.sql, opt, \rv.args);
return rv;
}
deprecated int insertFromSelectNoCommit(list cols, AbstractTable source, *hash<auto> sh, *reference<string> sql,
*hash<auto> opt) {
return insertFromSelectIntern(cols, source, sh, \sql, opt);
}
private int insertFromSelectIntern(list cols, AbstractTable source, *hash<auto> sh, *reference<string> sql,
*hash<auto> opt, *reference<softlist<auto>> args) {
string ssql = source.getSelectSql(sh, \args);
// issue #3352: do not execute runtime DML while holding the lock
{
l.lock();
on_exit l.unlock();
getColumnsUnlocked();
}
sql = sprintf("insert into %s (", getSqlName());
foreach string k in (cols);
sql += (foldl $1 + "," + $2, getColumnSqlNames(cols));
sql += ") " + ssql;
return execData(opt, sql, args);
}
int insertFromIteratorCommit(Qore::AbstractIterator i, *hash<auto> opt);
int insertFromIterator(Qore::AbstractIterator i, *hash<auto> opt);
deprecated int insertFromIteratorNoCommit(Qore::AbstractIterator i, *hash<auto> opt);
protected:
int insertFromIteratorIntern(Qore::AbstractIterator i, *hash<auto> opt);
public:
int upsertCommit(hash<auto> row, int upsert_strategy = UpsertAuto, *hash<auto> opt);
int upsert(hash<auto> row, int upsert_strategy = UpsertAuto, *hash<auto> opt);
deprecated int upsertNoCommit(hash<auto> row, int upsert_strategy = UpsertAuto);
code getUpsertClosure(hash<auto> row, int upsert_strategy = UpsertAuto, *hash<auto> opt);
code getBulkUpsertClosure(hash<auto> example_row, int upsert_strategy = AbstractTable::UpsertAuto, *hash<auto> opt);
code getUpsertClosureWithValidation(hash<auto> example_row, int upsert_strategy = UpsertAuto, *hash<auto> opt);
*hash<string, int> upsertFromIteratorCommit(Qore::AbstractIterator i,
int upsert_strategy = AbstractTable::UpsertAuto, *hash<auto> opt) {
on_success ds.commit();
on_error ds.rollback();
return upsertFromIteratorIntern(i, upsert_strategy, opt);
}
*hash<string, int> upsertFromIterator(Qore::AbstractIterator i, int upsert_strategy = AbstractTable::UpsertAuto,
*hash<auto> opt) {
return upsertFromIteratorIntern(i, upsert_strategy, opt - "commit_block");
}
deprecated *hash<string, int> upsertFromIteratorNoCommit(Qore::AbstractIterator i,
int upsert_strategy = AbstractTable::UpsertAuto, *hash<auto> opt) {
return upsertFromIteratorIntern(i, upsert_strategy, opt - "commit_block");
}
private *hash<string, int> upsertFromIteratorIntern(Qore::AbstractIterator i,
int upsert_strategy = AbstractTable::UpsertAuto, *hash<auto> opt) {
// check upsert options
validateOptionsIntern("OPTION-ERROR", getUpsertOptions(), \opt);
// try to get initial row
if (!i.next());
// result hash
hash<string, int> rh;
// primary key value hash for "delete_others"
hash<string, bool> pkh;
hash<auto> row = i.getValue();
code upsert = getUpsertClosure(row, upsert_strategy, opt);
opt.change_count = 0;
do {
int code = upsert(row);
++rh{AbstractTable::UpsertResultMap{code}};
if (opt.info_callback) {
opt.info_callback(getSqlName(), row, code);
}
if (code != UR_Unchanged && opt.commit_block) {
if (++opt.change_count >= opt.commit_block) {
ds.commit();
opt.change_count = 0;
}
}
// save primary key value in primary key hash if "delete_others" is set
if (opt.delete_others) {
pkh{foldl $1 + "-" + $2, (map row.$1.toString(), primaryKey.keyIterator())} = True;
}
} while (i.next() && (row = i.getValue()));
if (opt.delete_others);
return rh;
}
protected:
*hash<string, int> doDeleteOthersIntern(hash<auto> pkh, *hash<auto> opt);
public:
*hash<string, int> upsertFromSelectCommit(AbstractTable t, *hash<auto> sh,
int upsert_strategy = AbstractTable::UpsertAuto, *hash<auto> opt) {
on_success { ds.commit(); t.commit(); }
on_error { ds.rollback(); t.rollback(); }
return upsertFromSelect(t, sh, upsert_strategy, opt);
}
*hash<string, int> upsertFromSelectCommit(Table t, *hash<auto> sh,
int upsert_strategy = AbstractTable::UpsertAuto, *hash<auto> opt) {
on_success { ds.commit(); t.commit(); }
on_error { ds.rollback(); t.rollback(); }
return upsertFromIteratorIntern(t.getStatement(sh), upsert_strategy, opt);
}
*hash<string, int> upsertFromSelect(AbstractTable t, *hash<auto> sh,
int upsert_strategy = AbstractTable::UpsertAuto, *hash<auto> opt) {
return upsertFromIteratorIntern(t.getStatement(sh), upsert_strategy, opt - "commit_block");
}
deprecated *hash<string, int> upsertFromSelectNoCommit(AbstractTable t, *hash<auto> sh,
int upsert_strategy = AbstractTable::UpsertAuto, *hash<auto> opt) {
return upsertFromIteratorIntern(t.getStatement(sh), upsert_strategy, opt - "commit_block");
}
deprecated *hash<string, int> upsertFromSelect(Table t, *hash<auto> sh,
int upsert_strategy = AbstractTable::UpsertAuto, *hash<auto> opt) {
return upsertFromIteratorIntern(t.getStatement(sh), upsert_strategy, opt - "commit_block");
}
deprecated *hash<string, int> upsertFromSelectNoCommit(Table t, *hash<auto> sh,
int upsert_strategy = AbstractTable::UpsertAuto, *hash<auto> opt) {
return upsertFromIteratorIntern(t.getStatement(sh), upsert_strategy, opt - "commit_block");
}
softint rowCount();
Qore::SQL::SQLStatement getRowIterator(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
Qore::SQL::SQLStatement getRowIteratorNoExec(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
Qore::SQL::SQLStatement getRowIterator(*hash<auto> sh, *hash<auto> opt);
Qore::SQL::AbstractSQLStatement getStatement(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
Qore::SQL::AbstractSQLStatement getStatement(*hash<auto> sh, *hash<auto> opt);
hash<SqlResultInfo> getStatementWithInfo(*hash<auto> select_hash, *hash<auto> opt);
Qore::SQL::AbstractSQLStatement getStatementNoExec(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
hash<SqlResultInfo> getStatementNoExecWithInfo(*hash<auto> select_hash, *hash<auto> opt);
Qore::SQL::AbstractSQLStatement getStatementNoExec(*hash<auto> sh, *hash<auto> opt);
protected:
Qore::SQL::AbstractSQLStatement getStatementIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt, *bool no_exec, *reference<softlist<auto>> args);
public:
*hash<auto> selectRow(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
private *hash<auto> selectRowIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt,
*reference<softlist<auto>> args) {
validateOptionsIntern("OPTION-ERROR", getSelectOptions(), \sh);
// check data callback options if any
validateOptionsIntern("OPTION-ERROR", getSqlDataCallbackOptions(), \opt);
sql = getSelectSqlUnlocked(sh, \args, opt);
if (opt.sqlarg_callback);
bool rollback_on_error = False;
if (sh.forupdate);
on_error if (rollback_on_error)
ds.rollback();
return ds.vselectRow(sql, args);
}
hash<SqlResultInfo> selectRowWithInfo(*hash<auto> select_hash, *hash<auto> opt);
*list<auto> selectRows(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
private *list<auto> selectRowsIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt,
*reference<softlist<auto>> args) {
validateOptionsIntern("OPTION-ERROR", getSelectOptions(), \sh);
// check data callback options if any
validateOptionsIntern("OPTION-ERROR", getSqlDataCallbackOptions(), \opt);
sql = getSelectSqlUnlocked(sh, \args, opt);
if (opt.sqlarg_callback)
opt.sqlarg_callback(sql, args);
bool rollback_on_error = False;
if (sh.forupdate);
on_error if (rollback_on_error)
ds.rollback();
return ds.vselectRows(sql, args);
}
hash<SqlResultInfo> selectRowsWithInfo(*hash<auto> select_hash, *hash<auto> opt);
*hash<auto> select(*hash<auto> sh, *reference<string> sql, *hash<auto> opt);
protected:
*hash<auto> selectIntern(*hash<auto> sh, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
public:
hash<SqlResultInfo> selectWithInfo(*hash<auto> select_hash, *hash<auto> opt);
*hash<auto> selectRow(*hash<auto> sh, *hash<auto> opt);
*list<auto> selectRows(*hash<auto> sh, *hash<auto> opt);
*hash<auto> select(*hash<auto> sh, *hash<auto> opt);
string getSelectSql(*hash<auto> sh, *reference<list<auto>> args);
*AbstractUniqueConstraint matchAnyUnique(softlist<auto> cols);
string getSelectSqlIntern(*hash<auto> qh, reference<list<auto>> args, *hash<auto> opt);
string getSelectSqlUnlocked(*hash<auto> qh, reference<list<auto>> args, *hash<auto> opt);
// column & table information must be retrieved before calling this method
string getSelectSqlUnlockedIntern(*hash<auto> qh, string from, reference<list<auto>> args,
*hash<string, bool> subquery_column_map, *hash<auto> opt, *hash<auto> pseudo_column_map) {
hash<QueryInfo> info = <QueryInfo>{
"table": self,
// make sure query_hash stays "hash<auto>"
"query_hash": {} + qh,
"subquery_column_map": subquery_column_map,
"query_options": opt,
"pseudo_column_map": pseudo_column_map ?? ({} + getPseudoColumnHash()),
"expression_map": getExpressionMap(),
# backwards-compatibility
"where_operator_map": getWhereOperatorMap(),
"column_operator_map": getColumnOperatorMap(),
"args": args ?? (),
};
on_success args = info.args;
if (exists info.query_hash.offset);
// do not overwrite args; could be used in a subquery
if (!exists args);
// resolve any table names in joins first
map info.query_hash.join{$1.key}.table = getSubtableFromString($1.value.table, opt),
info.query_hash.join.pairIterator(), $1.value.table.typeCode() == NT_STRING;
// make a hash of aliases to tables when using joins
info.join_map = cast<hash<string, AbstractTable>>(
map {$1.alias ?? $1.table.getName() : $1.table}, info.query_hash.join.iterator()
);
// issue #1909: add an alias for the main table if present
if (info.query_hash.alias);
// if we have a "superquery" argument, then we need to track which columns are in this subquery in
// subquery_column_map
string cstr;
// make query
list<auto> coll = ();
if (info.query_hash.columns);
else {
cstr = "*";
}
string sql = sprintf("select %s from %s", cstr, getFromIntern(from, info.query_hash));
if (info.query_hash.alias);
// process join specifications
foreach auto js in (info.query_hash.join.iterator());
getSelectWhereSqlUnlocked(\info, \sql);
if (info.query_hash.groupby);
if (info.query_hash.having);
if (info.query_hash.orderby);
else if (info.query_hash.limit);
//printf("SQL: %s\nargs: %y\n", sql, args);
if (info.query_hash.forupdate && !info.query_hash.superquery);
// issue #4206: splice comments and hints into the SQL query string last
if (info.query_hash.comment || info.query_hash.hint);
if (info.query_hash.superquery);
return sql;
}
AbstractTable getSubtableFromString(string table, *hash<auto> opt);
string getExpressionArg(reference<hash<QueryInfo>> info, int role, auto arg,
AbstractDataProviderType expected_type) {
if (arg instanceof hash<DataProviderFieldReference>);
if (arg instanceof hash<DataProviderExpression>);
info.args += arg;
return "%v";
}
protected:
string getFromIntern(string from, *hash<auto> qh);
public:
protected:
list<auto> getGroupByListUnlocked(hash<QueryInfo> info, list<auto> coll);
public:
protected:
list<auto> getOrderByListUnlocked(hash<QueryInfo> info, list<auto> coll);
public:
protected:
list<auto> getGroupOrderByListUnlocked(hash<QueryInfo> info, string key, list<auto> coll);
public:
protected:
doForUpdate(reference<string> sql);
public:
protected:
string getSelectSqlName(*hash<auto> qh);
public:
protected:
string getColumnExpressionIntern(reference<hash<QueryInfo>> info, auto cvc);
public:
protected:
string doColumnOperatorIntern(reference<hash<QueryInfo>> info, hash<auto> cvc);
public:
protected:
string doColumnOperatorIntern(reference<hash<QueryInfo>> info, auto cop, auto arg, *string cve);
public:
protected:
string getColumnNameIntern(hash<QueryInfo> info, string column_name);
public:
protected:
bool asteriskRequiresPrefix();
public:
protected:
getSelectWhereSqlUnlocked(reference<hash<QueryInfo>> info, reference<string> sql);
public:
private *string getWhereClause(*hash<auto> cond, reference<list<auto>> args, *string cprefix,
*hash<string, AbstractTable> join_map) {
hash<QueryInfo> info = <QueryInfo>{
"table": self,
"query_hash": {
"where": cond,
},
"args": args ?? (),
"join_map": join_map,
"pseudo_column_map": {} + getPseudoColumnHash(),
"expression_map": getExpressionMap(),
// backwards-compatibility
"where_operator_map": getWhereOperatorMap(),
"column_operator_map": getColumnOperatorMap(),
};
on_success args = info.args;
l.lock();
on_exit l.unlock();
return getWhereClauseUnlocked(\info, info.query_hash."where", cprefix);
}
private *string getWhereExpressionUnlocked(reference<hash<QueryInfo>> info, hash<DataProviderExpression> cond,
*string cprefix) {
string sql = getExpressionUnlockedIntern(\info, ER_Search, cond, AbstractDataProviderTypeMap."bool");
if (sql);
}
private *string getExpressionUnlockedIntern(reference<hash<QueryInfo>> info, int role,
hash<DataProviderExpression> cond, AbstractDataProviderType expected_type) {
*hash<auto> exp = info.expression_map{cond.exp};
if (!exp);
AbstractDataProvider::verifyExpression(role, exp.exp, LC_All, expected_type, cond);
return exp.code(\info, role, cond.args);
}
protected:
*string getWhereClauseUnlocked(reference<hash<QueryInfo>> info, *hash<auto> cond, *string cprefix);
public:
protected:
*list<string> getWhereClauseIntern(reference<hash<QueryInfo>> info, *hash<auto> cond, *string cprefix);
public:
protected:
string doWhereExpressionIntern(reference<hash<QueryInfo>> info, string cn, auto we);
public:
string getOrClause(reference<hash<QueryInfo>> info, list<auto> arglist);
string getOrClause(reference<hash<QueryInfo>> info, hash<auto> arg);
protected:
doSelectOrderBySqlUnlocked(hash<QueryInfo> info, reference<string> sql, list<auto> coll);
public:
int delCommit(hash<auto> cond, reference<string> sql, hash<auto> opt);
int delCommit(hash<auto> cond, hash<auto> opt);
int delCommit(hash<auto> cond, reference<string> sql);
int delCommit(hash<auto> cond);
int delCommit();
int del(hash<auto> cond, reference<string> sql, hash<auto> opt);
int del(hash<auto> cond, hash<auto> opt);
int del(hash<auto> cond, reference<string> sql);
int del(hash<auto> cond);
int del();
hash<SqlResultInfo> delWithInfo(hash<auto> cond, *hash<auto> opt);
deprecated int delNoCommit(*hash<auto> cond, *reference<string> sql);
protected:
int delIntern(*hash<auto> cond, *reference<string> sql, *hash<auto> opt, *reference<softlist<auto>> args);
public:
int updateCommit(hash<auto> set, hash<auto> cond, reference<string> sql, hash<auto> opt);
int updateCommit(hash<auto> set, hash<auto> cond, reference<string> sql);
int updateCommit(hash<auto> set, hash<auto> cond, hash<auto> opt);
int updateCommit(hash<auto> set, hash<auto> cond);
int updateCommit(hash<auto> set);
int update(hash<auto> set, hash<auto> cond, reference<string> sql, hash<auto> opt);
int update(hash<auto> set, hash<auto> cond, reference<string> sql);
int update(hash<auto> set, hash<auto> cond, hash<auto> opt);
int update(hash<auto> set, hash<auto> cond);
int update(hash<auto> set);
hash<SqlResultInfo> updateWithInfo(hash<auto> set, hash<auto> cond, *hash<auto> opt);
hash<SqlCommandInfo> getUpdateSql(hash<auto> set, *hash<auto> cond);
deprecated int updateNoCommit(hash<auto> set, *hash<auto> cond, *reference<string> sql);
deprecated int updateNoCommit(hash<auto> set, *hash<auto> cond, *hash<auto> opt);
private int updateIntern(hash<auto> set, *hash<auto> cond, *reference<string> sql, *hash<auto> opt,
*reference<softlist<auto>> args) {
hash<SqlCommandInfo> update_hash = getUpdateSql(set, cond);
sql = update_hash.sql;
args = update_hash.args;
//printf("update_hash: %y\n", update_hash);
return execData(opt, update_hash.sql, update_hash.args);
}
protected:
string getUpdateExpression(string col, hash<UpdateOperatorInfo> uh);
public:
protected:
bool emptyDataIntern();
public:
protected:
Columns checkUpsertRow(hash<auto> row, reference<int> upsert_strategy);
public:
protected:
code getUpsertInsertFirst(Columns cols, hash<auto> example_row, *hash<auto> opt);
public:
protected:
code getUpsertUpdateFirst(Columns cols, hash<auto> example_row, *hash<auto> opt);
public:
protected:
code getUpsertSelectFirst(Columns cols, hash<auto> example_row, *hash<auto> opt);
public:
protected:
code getUpsertInsertOnly(Columns cols, hash<auto> example_row, *hash<auto> opt);
public:
protected:
code getUpsertUpdateOnly(Columns cols, hash<auto> example_row, *hash<auto> opt);
public:
protected:
Columns getUpsertColumns(reference<string> csrc);
public:
protected:
hash<string, Columns> getAllUpsertColumns(*hash<auto> row);
public:
protected:
bool matchUniqueColumns(Columns cols, hash<auto> row);
public:
protected:
string getUpsertSelectSql(hash<auto> row, Columns cols, reference<list<string>> updc);
public:
protected:
string getUpsertInsertSql(hash<auto> row);
public:
protected:
string getUpsertUpdateSql(hash<auto> row, Columns cols, reference updc, *hash<auto> opt);
public:
protected:
softbool tryUpdate(string sql, hash<auto> row, Columns cols, list updc);
public:
protected:
checkValue(string cname, string argname, reference val, string type);
public:
string getSqlFromList(list<auto> l);
string getSqlValue(auto v);
string getName();
cache(*hash<auto> opts);
clear();
hash<auto> getDescriptionHash();
Columns describe();
AbstractPrimaryKey getPrimaryKey();
*AbstractUniqueConstraint findUniqueConstraint(string name);
*AbstractUniqueConstraint findUniqueConstraintUnlocked(string name);
Indexes getIndexes();
ForeignConstraints getForeignConstraints(*hash<auto> opt);
Constraints getConstraints();
Triggers getTriggers();
string getRenameSql(string new_name, *hash<auto> opt);
string getCreateSqlString(*hash<auto> opt);
list<auto> getCreateSql(*hash<auto> opt);
string getCreateTableSql(*hash<auto> opt);
bool checkExistence();
protected:
*hash<string, bool> getCheckOmissionOptions(*softlist<softstring> ol, string err);
public:
list<auto> getAlignSql(AbstractTable t, *hash<auto> opt);
protected:
list<auto> getAlignSqlUnlocked(AbstractTable t, *hash<auto> opt);
public:
protected:
*AbstractColumnSupportingConstraint getSupportingConstraint(string ixname);
public:
protected:
*list<AbstractColumnConstraint> getAllSupportingConstraints(string ixname);
public:
protected:
renameIndexUnlocked(AbstractIndex ix, string new_name);
public:
string getAlignSqlString(AbstractTable t, *hash<auto> opt);
*list<auto> getCreateIndexesSql(*hash<auto> opt, bool cache = True);
*string getCreatePrimaryKeySql(*hash<auto> opt, bool cache = True);
*list<auto> getCreateForeignConstraintsSql(*hash<auto> opt, bool cache = True);
*list<auto> getCreateConstraintsSql(*hash<auto> opt, bool cache = True);
*list<auto> getCreateMiscSql(*hash<auto> opt, bool cache = True);
*list<auto> getCreateTriggersSql(*hash<auto> opt, bool cache = True);
*hash find(auto id);
*list find(list<auto> ids);
protected:
string getPrimaryKeyColumn();
public:
*hash<auto> find(hash<auto> row);
*hash<auto> findSingle(*hash<auto> cond);
*list<auto> findAll(*hash<auto> cond);
string getDesc();
string getBaseType();
string getSqlName();
string getColumnSqlName(string col);
list<auto> getColumnSqlNames(softlist cols);
bool bindEmptyStringsAsNull();
*hash<string, AbstractDataField> getRecordType();
AbstractDataField getColumnDataField(string column_name, *hash<auto> options, *string append_desc);
AbstractDataField getColumnDataField(AbstractColumn column, *hash<SqlUtilDataTypeOptionInfo> options, *string append_desc);
AbstractDataProviderType getColumnDataType(string column_name, *hash<SqlUtilDataTypeOptionInfo> options);
AbstractDataProviderType getDbType(string native_type, *string qore_type, bool nullable, int max_size = -1, *hash<SqlUtilDataTypeOptionInfo> options);
AbstractDataProviderType getNumericType(string type_name, bool nullable, *hash<auto> options);
AbstractSavepointHelper getSavepointHelper(*string savepoint);
hash<auto> getExpressionMap();
hash<auto> getWhereOperatorMap();
abstract bool hasArrayBind();
protected:
hash<auto> getTableOptions();
public:
protected:
hash<auto> getForeignConstraintOptions();
public:
protected:
hash<auto> getConstraintOptions();
public:
protected:
hash<auto> getCacheOptions();
public:
protected:
hash<auto> getTableCreationOptions();
public:
protected:
hash<auto> getAlignTableOptions();
public:
protected:
hash<auto> getTableDescriptionHashOptions();
public:
protected:
hash<auto> getColumnOptions();
public:
protected:
hash<auto> getColumnDescOptions();
public:
protected:
hash<auto> getTableColumnDescOptions();
public:
protected:
hash<auto> getIndexOptions();
public:
protected:
hash<auto> getTriggerOptions();
public:
protected:
hash<auto> getSelectOptions();
public:
protected:
hash<auto> getUpsertOptions();
public:
protected:
hash<auto> getInsertOptions();
public:
protected:
hash<auto> getInsertFromIteratorOptions();
public:
protected:
hash<auto> getSqlDataCallbackOptions();
public:
protected:
hash<auto> getColumnOperatorMap();
public:
protected:
*hash<auto> getColumnOperatorMapImpl();
public:
addCustomCopOperator(string name, hash<auto> operator);
bool isDuplicateRowError(hash<ExceptionInfo> ex);
protected:
hash<auto> getInsertOperatorMap();
public:
protected:
hash<auto> getUpdateOperatorMap();
public:
protected:
hash<auto> getRawUpdateOperatorMap();
public:
protected:
*hash<auto> getPseudoColumnHash();
public:
protected:
string getCreateTableSqlUnlocked(*hash<auto> opt);
public:
protected:
*list<auto> getCreateIndexesSqlUnlocked(*hash<auto> opt, bool cache = True);
public:
protected:
*string getCreatePrimaryKeySqlUnlocked(*hash<auto> opt, bool cache = True);
public:
protected:
*list<auto> getCreateConstraintsSqlUnlocked(*hash<auto> opt, bool cache = True);
public:
protected:
*list<auto> getCreateForeignConstraintsSqlUnlocked(*hash<auto> opt, bool cache = True);
public:
protected:
*list<auto> getCreateMiscSqlUnlocked(*hash<auto> opt, bool cache = True);
public:
protected:
*list<auto> getCreateTriggersSqlUnlocked(*hash<auto> opt, bool cache = True);
public:
protected:
list<auto> getCreateSqlUnlocked(*hash<auto> opt, bool cache = True);
public:
protected:
cacheUnlocked(*hash<auto> opt);
public:
protected:
auto execData(*hash<auto> opt, string sql, *list<auto> args);
public:
protected:
execData(AbstractSQLStatement stmt, *hash<auto> opt, *list<auto> args);
public:
static AbstractTable getTable(AbstractDatasource nds, string nname, *hash<auto> opts);
static AbstractTable getTable(string dsstr, string nname, *hash<auto> opts);
static AbstractTable getTable(hash<auto> dsh, string nname, *hash<auto> opts);
protected:
getColumnsUnlocked();
public:
protected:
getPrimaryKeyUnlocked();
public:
// also loads primary key and constraints (for unique constraints)
protected:
getIndexesUnlocked();
public:
protected:
getForeignConstraintsUnlocked(*hash<auto> opt);
public:
protected:
addSourceConstraint(string table_name, AbstractForeignConstraint fk);
public:
protected:
getConstraintsUnlocked();
public:
protected:
getTriggersUnlocked();
public:
protected:
bool hasReturningImpl();
public:
protected:
softlist<auto> getDropSqlImpl();
public:
protected:
string getTruncateSqlImpl();
public:
protected:
auto tryExecArgsImpl(string sql, *softlist<auto> args);
public:
protected:
auto tryExecRawImpl(string sql);
public:
protected:
clearImpl();
public:
protected:
preSetupTableImpl(reference desc, *hash<auto> opt);
public:
protected:
abstract AbstractDataProviderType getNumericTypeImpl(string type_name, bool nullable, *hash<auto> options);
public:
protected:
abstract *hash<auto> doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
public:
protected:
abstract bool emptyImpl();
public:
protected:
abstract *string getSqlValueImpl(auto v);
public:
protected:
abstract bool checkExistenceImpl();
public:
protected:
abstract bool supportsTablespacesImpl();
public:
protected:
abstract bool constraintsLinkedToIndexesImpl();
public:
protected:
abstract bool uniqueIndexCreatesConstraintImpl();
public:
protected:
abstract setupTableImpl(hash<auto> desc, *hash<auto> opt);
public:
protected:
abstract Columns describeImpl();
public:
protected:
abstract AbstractPrimaryKey getPrimaryKeyImpl();
public:
protected:
abstract Indexes getIndexesImpl();
public:
protected:
abstract ForeignConstraints getForeignConstraintsImpl(*hash<auto> opt);
public:
protected:
abstract Constraints getConstraintsImpl();
public:
protected:
abstract Triggers getTriggersImpl();
public:
protected:
abstract string getCreateTableSqlImpl(*hash<auto> opt);
public:
protected:
abstract *list<auto> getCreateMiscSqlImpl(*hash<auto> opt, bool cache);
public:
protected:
abstract string getCreateSqlImpl(list<auto> l);
public:
protected:
abstract string getRenameSqlImpl(string new_name);
public:
protected:
abstract *list<auto> getAlignSqlImpl(AbstractTable t, *hash<auto> opt);
public:
protected:
abstract AbstractColumn addColumnImpl(string cname, hash<auto> opt, bool nullable = True);
public:
protected:
abstract AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash<auto> ch, *hash<auto> opt);
public:
protected:
abstract AbstractIndex addIndexImpl(string iname, bool enabled, hash<auto> ch, *hash<auto> opt);
public:
protected:
abstract AbstractForeignConstraint addForeignConstraintImpl(string cname, hash<auto> ch, string table, hash<auto> tch, *hash<auto> opt);
public:
protected:
abstract AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash<auto> opt);
public:
protected:
abstract AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash<auto> ch, *hash<auto> opt);
public:
protected:
abstract AbstractTrigger addTriggerImpl(string tname, string src, *hash<auto> opt);
public:
protected:
abstract bool tryInsertImpl(string sql, hash<auto> row);
public:
protected:
abstract hash<auto> getQoreTypeMapImpl();
public:
protected:
abstract hash<auto> getTypeMapImpl();
public:
private abstract doSelectOrderByWithOffsetSqlUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql,
list<auto> coll);
protected:
abstract doSelectLimitOnlyUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql);
public:
protected:
abstract copyImpl(AbstractTable old);
public:
protected:
abstract AbstractSavepointHelper getSavepointHelperImpl(*string savepoint);
public:
protected:
abstract bool isDuplicateRowErrorImpl(hash<ExceptionInfo> ex);
public:
};
};
Qore::AbstractIterator
Qore::AbstractIterator::getValue
abstract auto getValue()
Qore::AbstractIterator::next
abstract bool next()
Qore::SQL::AbstractSQLStatement
Qore::SQL::SQLStatement
SqlUtil::AbstractCheckConstraint
abstract class for check constraints
Definition: SqlUtil.qm.dox.h:6713
SqlUtil::AbstractColumn
the base class for column information
Definition: SqlUtil.qm.dox.h:6342
SqlUtil::AbstractColumn::getAddColumnSql
abstract list< auto > getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table
SqlUtil::AbstractColumnSupportingConstraint
the API for a constraint with columns
Definition: SqlUtil.qm.dox.h:6766
SqlUtil::AbstractConstraint
abstract base class for constraints
Definition: SqlUtil.qm.dox.h:6651
SqlUtil::AbstractDatabase::CreationOptions
const CreationOptions
default generic creation options
Definition: AbstractDatabase.qc.dox.h:118
SqlUtil::AbstractForeignConstraint
the base class for foreign key constraint information
Definition: SqlUtil.qm.dox.h:6926
SqlUtil::AbstractHashContainer::hasKey
bool hasKey(string k)
Returns True if the key exists in the contained hash (may or may not be assigned a value),...
SqlUtil::AbstractHashContainer::keyIterator
Qore::AbstractIterator keyIterator()
Returns a HashKeyIterator object for the contained hash.
SqlUtil::AbstractIndex
the abstract base class for index information
Definition: SqlUtil.qm.dox.h:6521
SqlUtil::AbstractPrimaryKey
represents a primary key
Definition: SqlUtil.qm.dox.h:6849
SqlUtil::AbstractSavepointHelper
Abstract base class for savepoint helpers for epheremal transaction support.
Definition: AbstractSavepointHelper.qc.dox.h:33
SqlUtil::AbstractSqlUtilBase
base class for abstract SqlUtil classes
Definition: AbstractSqlUtilBase.qc.dox.h:28
SqlUtil::AbstractSqlUtilBase::l
transient Mutex l()
mutex for atomic actions
SqlUtil::AbstractSqlUtilBase::ds
transient AbstractDatasource ds
the connection to the database server
Definition: AbstractSqlUtilBase.qc.dox.h:37
SqlUtil::AbstractSqlUtilBase::opts
*hash< auto > opts
option hash
Definition: AbstractSqlUtilBase.qc.dox.h:35
SqlUtil::AbstractTable
the base abstract class for the table implementation
Definition: AbstractTable.qc.dox.h:30
SqlUtil::AbstractTable::constraintsLinkedToIndexesImpl
abstract bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
SqlUtil::AbstractTable::TableOptions
const TableOptions
table options
Definition: AbstractTable.qc.dox.h:41
SqlUtil::AbstractTable::dropCommit
dropCommit(*hash< auto > opt)
drops the table from the database; releases the transaction lock after dropping the table
SqlUtil::AbstractTable::isDuplicateRowError
bool isDuplicateRowError(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
SqlUtil::AbstractTable::selectRows
*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
SqlUtil::AbstractTable::tryExecRawImpl
auto tryExecRawImpl(string sql)
tries to execute a command so that if an error occurs the current transaction status is not lost
SqlUtil::AbstractTable::del
int del(hash< auto > cond, reference< string > sql)
SqlUtil::AbstractTable::del() variant
SqlUtil::AbstractTable::modifyColumn
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,...
SqlUtil::AbstractTable::constructor
constructor(AbstractDatasource nds, string nname, *hash nopts)
creates the object; private constructor
SqlUtil::AbstractTable::dropPrimaryKey
AbstractPrimaryKey dropPrimaryKey(*reference lsql)
drops the primary key from the table; if the table is known to be in the database already,...
SqlUtil::AbstractTable::getNumericTypeImpl
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...
SqlUtil::AbstractTable::rowCount
softint rowCount()
returns the number of rows in the table
SqlUtil::AbstractTable::getSqlValueImpl
abstract *string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
SqlUtil::AbstractTable::ColumnOptions
const ColumnOptions
Column options; this is currently empty and can be extended in database-specific modules.
Definition: AbstractTable.qc.dox.h:192
SqlUtil::AbstractTable::UR_Updated
const UR_Updated
row was updated because it was different (only possible with UpsertSelectFirst)
Definition: AbstractTable.qc.dox.h:339
SqlUtil::AbstractTable::getIndexOptions
hash< auto > getIndexOptions()
returns the index options for this driver
SqlUtil::AbstractTable::selectRow
*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
SqlUtil::AbstractTable::getColumnDescOptions
hash< auto > getColumnDescOptions()
returns the column description options for this driver
SqlUtil::AbstractTable::describe
Columns describe()
returns an object of class Columns describing the table
SqlUtil::AbstractTable::TableOmissionOptions
const TableOmissionOptions
alignment omission options
Definition: AbstractTable.qc.dox.h:103
SqlUtil::AbstractTable::addCustomCopOperator
addCustomCopOperator(string name, hash< auto > operator)
register custom user column operator for this table object
SqlUtil::AbstractTable::getDropPrimaryKeySql
list< auto > getDropPrimaryKeySql(*hash< auto > opt)
gets a list of SQL strings that can be used to drop the primary key from the table
SqlUtil::AbstractTable::insertFromSelectCommit
int insertFromSelectCommit(list cols, AbstractTable source, hash< auto > sh, hash< auto > opt)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
SqlUtil::AbstractTable::getDropTriggerSql
list< auto > getDropTriggerSql(string tname, *hash< auto > opt)
returns SQL that can be used to drop the given trigger from the table
SqlUtil::AbstractTable::hasReturningImpl
bool hasReturningImpl()
returns True if the current database driver supports the "returning" clause in insert statements,...
SqlUtil::AbstractTable::checkExistenceImpl
abstract bool checkExistenceImpl()
returns True if the table exists in the DB, False if not
SqlUtil::AbstractTable::insertCommit
*hash< auto > insertCommit(hash< auto > row, reference< string > sql, hash< auto > opt)
SqlUtil::AbstractTable::insertCommit() variant
SqlUtil::AbstractTable::renameConstraint
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,...
SqlUtil::AbstractTable::doSelectLimitOnlyUnlockedImpl
abstract doSelectLimitOnlyUnlockedImpl(reference< hash< QueryInfo >> info, reference< string > sql)
processes a string for use in SQL select statements when there is a "limit" argument,...
SqlUtil::AbstractTable::rename
rename(string new_name, *reference< string > sql, *Tables table_cache)
renames the table
SqlUtil::AbstractTable::insertNoCommit
deprecated *hash< auto > insertNoCommit(hash< auto > row, *reference< string > sql, *hash< auto > opt)
A legacy wrapper for SqlUtil::AbstractTable::insert()
SqlUtil::AbstractTable::UpsertUpdateFirst
const UpsertUpdateFirst
Upsert option: update first, if the update fails, then insert.
Definition: AbstractTable.qc.dox.h:271
SqlUtil::AbstractTable::setupTable
setupTable(hash< auto > desc, *hash< auto > opt)
creates the object from a table description hash
SqlUtil::AbstractTable::getColumnDataField
AbstractDataField getColumnDataField(string column_name, *hash< auto > options, *string append_desc)
returns a field object for the given column
SqlUtil::AbstractTable::copy
copy(AbstractTable old)
copies the object
SqlUtil::AbstractTable::UpsertStrategyMap
const UpsertStrategyMap
hash mapping upsert strategy codes to a text description
Definition: AbstractTable.qc.dox.h:306
SqlUtil::AbstractTable::del
int del(hash< auto > cond)
SqlUtil::AbstractTable::del() variant
SqlUtil::AbstractTable::insert
*hash< auto > insert(hash< auto > row)
inserts a row into the table without any transaction management; a transaction will be in progress af...
SqlUtil::AbstractTable::upsertCommit
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...
SqlUtil::AbstractTable::dropColumn
AbstractColumn dropColumn(string cname, *reference lsql)
drops a column from the table
SqlUtil::AbstractTable::getDropIndexSql
string getDropIndexSql(string iname, *hash< auto > opt)
gets the SQL that can be used to drop an index from the table
SqlUtil::AbstractTable::dropNoCommit
deprecated dropNoCommit(*hash< auto > opt)
A legacy wrapper for drop()
SqlUtil::AbstractTable::constraints
Constraints constraints
constraint descriptions
Definition: AbstractTable.qc.dox.h:391
SqlUtil::AbstractTable::createNoCommit
deprecated createNoCommit(*hash< auto > opt)
A legacy wrapper for create()
SqlUtil::AbstractTable::getStatement
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...
SqlUtil::AbstractTable::getDropSql
softlist< auto > getDropSql(*hash< auto > opt)
returns the sql required to drop the table; reimplement in subclasses if necessary
SqlUtil::AbstractTable::insertFromSelect
int insertFromSelect(list cols, AbstractTable source)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
SqlUtil::AbstractTable::getDesc
string getDesc()
returns a descriptive string of the datasource (without the password) and the table name (with a poss...
SqlUtil::AbstractTable::UpsertResultLetterMap
const UpsertResultLetterMap
maps upsert result codes to single letter symbols
Definition: AbstractTable.qc.dox.h:371
SqlUtil::AbstractTable::getPrimaryKey
AbstractPrimaryKey getPrimaryKey()
returns an object of class AbstractPrimaryKey describing the primary key of the table
SqlUtil::AbstractTable::insertFromSelectCommit
int insertFromSelectCommit(list cols, AbstractTable source)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
SqlUtil::AbstractTable::UpsertOptions
const UpsertOptions
default upsert option keys
Definition: AbstractTable.qc.dox.h:225
SqlUtil::AbstractTable::getModifyColumnSql
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
SqlUtil::AbstractTable::select
*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
SqlUtil::AbstractTable::update
int update(hash< auto > set, hash< auto > cond)
A SqlUtil::AbstractTable::update() variant.
SqlUtil::AbstractTable::tryExecArgs
auto tryExecArgs(string sql, *softlist< auto > args)
executes some SQL with optional arguments so that if an error occurs the current transaction state is...
SqlUtil::AbstractTable::getCreateTriggersSql
*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 ...
SqlUtil::AbstractTable::delCommit
int delCommit()
SqlUtil::AbstractTable::delCommit() variant
SqlUtil::AbstractTable::getInsertOptions
hash< auto > getInsertOptions()
returns the insert options for this driver
SqlUtil::AbstractTable::upsertFromSelectCommit
*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
SqlUtil::AbstractTable::getStatementNoExec
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...
SqlUtil::AbstractTable::getSqlDataCallbackOptions
hash< auto > getSqlDataCallbackOptions()
returns the sql data operation callback options for this driver
SqlUtil::AbstractTable::addUniqueConstraint
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,...
SqlUtil::AbstractTable::UpsertInsertOnly
const UpsertInsertOnly
Upsert option: insert if the row does not exist, otherwise ignore.
Definition: AbstractTable.qc.dox.h:294
SqlUtil::AbstractTable::getTableCreationOptions
hash< auto > getTableCreationOptions()
returns the table creation options for this driver
SqlUtil::AbstractTable::UpsertInsertFirst
const UpsertInsertFirst
Upsert option: insert first, if the insert fails, then update.
Definition: AbstractTable.qc.dox.h:263
SqlUtil::AbstractTable::getUpdateOperatorMap
hash< auto > getUpdateOperatorMap()
returns the update operator map for this object
SqlUtil::AbstractTable::selectRows
*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
SqlUtil::AbstractTable::addColumn
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 ...
SqlUtil::AbstractTable::update
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...
SqlUtil::AbstractTable::getAddColumnSql
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
SqlUtil::AbstractTable::getSqlName
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifier for schema,...
SqlUtil::AbstractTable::ColumnDescOptions
const ColumnDescOptions
Column description options.
Definition: AbstractTable.qc.dox.h:171
SqlUtil::AbstractTable::getAddUniqueConstraintSql
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
SqlUtil::AbstractTable::upsertFromSelect
*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
SqlUtil::AbstractTable::UR_Verified
const UR_Verified
row was updated unconditionally (not returned with UpsertSelectFirst)
Definition: AbstractTable.qc.dox.h:336
SqlUtil::AbstractTable::getStatementNoExec
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...
SqlUtil::AbstractTable::getCreateSql
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 ...
SqlUtil::AbstractTable::inDb
bool inDb
in database
Definition: AbstractTable.qc.dox.h:397
SqlUtil::AbstractTable::getTableDescriptionHashOptions
hash< auto > getTableDescriptionHashOptions()
returns the table description hash<auto> options for this driver
SqlUtil::AbstractTable::update
int update(hash< auto > set, hash< auto > cond, reference< string > sql)
A SqlUtil::AbstractTable::update() variant.
SqlUtil::AbstractTable::name
string name
the table's name
Definition: AbstractTable.qc.dox.h:381
SqlUtil::AbstractTable::upsertFromSelectNoCommit
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
SqlUtil::AbstractTable::delWithInfo
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...
SqlUtil::AbstractTable::IndexOptions
const IndexOptions
default index options
Definition: AbstractTable.qc.dox.h:52
SqlUtil::AbstractTable::upsertFromSelect
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
SqlUtil::AbstractTable::getStatementNoExecWithInfo
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...
SqlUtil::AbstractTable::selectWithInfo
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...
SqlUtil::AbstractTable::getCreateTableSql
string getCreateTableSql(*hash< auto > opt)
returns an SQL string that could be used to create the basic table structure without indexes and cons...
SqlUtil::AbstractTable::find
*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...
SqlUtil::AbstractTable::updateWithInfo
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...
SqlUtil::AbstractTable::getAddCheckConstraintSql
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
SqlUtil::AbstractTable::getCreateConstraintsSql
*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...
SqlUtil::AbstractTable::getColumnSqlName
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
SqlUtil::AbstractTable::insertWithInfo
hash< SqlResultInfo > insertWithInfo(hash< auto > row, *hash< auto > opt)
Inserts a row and returns the result and also the SQL used.
SqlUtil::AbstractTable::addIndex
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 ...
SqlUtil::AbstractTable::hasReturning
bool hasReturning()
returns True if the current database driver supports the "returning" clause in insert statements,...
SqlUtil::AbstractTable::getUpsertClosureWithValidation
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...
SqlUtil::AbstractTable::getUpsertOptions
hash< auto > getUpsertOptions()
returns the upsert options for this driver
SqlUtil::AbstractTable::getDropConstraintSql
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 ...
SqlUtil::AbstractTable::upsertNoCommit
deprecated int upsertNoCommit(hash< auto > row, int upsert_strategy=UpsertAuto)
A legacy SqlUtil::AbstractTable::upsert() wrapper.
SqlUtil::AbstractTable::bindEmptyStringsAsNull
bool bindEmptyStringsAsNull()
returns True if the DB treats empty strings as NULL, False if not; by default this method returns Fal...
SqlUtil::AbstractTable::getWhereOperatorMap
hash< auto > getWhereOperatorMap()
returns the "where" operator map for this object
SqlUtil::AbstractTable::getDropAllConstraintsAndIndexesOnColumnSql
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...
SqlUtil::AbstractTable::UpsertUpdateOnly
const UpsertUpdateOnly
Upsert option: update if the row exists, otherwise ignore.
Definition: AbstractTable.qc.dox.h:301
SqlUtil::AbstractTable::selectRowWithInfo
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...
SqlUtil::AbstractTable::SqlDataCallbackOptions
const SqlDataCallbackOptions
generic SQL data operation callbacks
Definition: AbstractTable.qc.dox.h:199
SqlUtil::AbstractTable::getUpdateSql
hash< SqlCommandInfo > getUpdateSql(hash< auto > set, *hash< auto > cond)
Returns the SQL for the given update parameters.
SqlUtil::AbstractTable::tryExec
auto tryExec(string sql)
executes some SQL with optional arguments so that if an error occurs the current transaction state is...
SqlUtil::AbstractTable::getInsertOperatorMap
hash< auto > getInsertOperatorMap()
returns the insert operator map for this object
SqlUtil::AbstractTable::getCacheOptions
hash< auto > getCacheOptions()
returns the cache options for this driver
SqlUtil::AbstractTable::insertCommit
*hash< auto > insertCommit(hash< auto > row, reference< string > sql)
SqlUtil::AbstractTable::insertCommit() variant
SqlUtil::AbstractTable::InsertOptions
const InsertOptions
generic SQL insert options
Definition: AbstractTable.qc.dox.h:214
SqlUtil::AbstractTable::upsertFromIterator
*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
SqlUtil::AbstractTable::getColumnDataField
AbstractDataField getColumnDataField(AbstractColumn column, *hash< SqlUtilDataTypeOptionInfo > options, *string append_desc)
returns a field object for the given column
SqlUtil::AbstractTable::insertFromIteratorNoCommit
deprecated int insertFromIteratorNoCommit(Qore::AbstractIterator i, *hash< auto > opt)
A legacy SqlUtil::AbstractTable::insertFromIterator() wrapper.
SqlUtil::AbstractTable::getCreateMiscSql
*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,...
SqlUtil::AbstractTable::isDuplicateRowErrorImpl
abstract bool isDuplicateRowErrorImpl(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
SqlUtil::AbstractTable::renameIndex
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 ...
SqlUtil::AbstractTable::delCommit
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...
SqlUtil::AbstractTable::getAllUpsertColumns
hash< string, Columns > getAllUpsertColumns(*hash< auto > row)
returns a hash with a single value\
SqlUtil::AbstractTable::delCommit
int delCommit(hash< auto > cond, hash< auto > opt)
SqlUtil::AbstractTable::delCommit() variant
SqlUtil::AbstractTable::copyImpl
abstract copyImpl(AbstractTable old)
db-specific copy actions
SqlUtil::AbstractTable::dropConstraint
AbstractConstraint dropConstraint(string cname, *reference< string > sql)
drops a constraint from the table; this can be any constraint on the table, a primary key,...
SqlUtil::AbstractTable::getRenameSql
string getRenameSql(string new_name, *hash< auto > opt)
returns an SQL string that could be used to rename the table in the database
SqlUtil::AbstractTable::getColumnOperatorMapImpl
*hash< auto > getColumnOperatorMapImpl()
Reimplement in subclasses to provide driver specific column operators.
SqlUtil::AbstractTable::delCommit
int delCommit(hash< auto > cond)
SqlUtil::AbstractTable::delCommit() variant
SqlUtil::AbstractTable::getRecordType
*hash< string, AbstractDataField > getRecordType()
returns a record description for the table
SqlUtil::AbstractTable::insert
*hash< auto > insert(hash< auto > row, hash< auto > opt)
SqlUtil::AbstractTable::insert() variant
SqlUtil::AbstractTable::tryExecArgsImpl
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
SqlUtil::AbstractTable::removeForeignConstraint
AbstractForeignConstraint removeForeignConstraint(string cname)
removes the named foreign constraint from the table; no SQL is executed in any case,...
SqlUtil::AbstractTable::CacheOptions
const CacheOptions
default cache options
Definition: AbstractTable.qc.dox.h:63
SqlUtil::AbstractTable::getAddIndexSql
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
SqlUtil::AbstractTable::native_case
bool native_case
native case option
Definition: AbstractTable.qc.dox.h:395
SqlUtil::AbstractTable::insertFromIterator
int insertFromIterator(Qore::AbstractIterator i, *hash< auto > opt)
this method inserts data from the given iterator argument (whose getValue() method must return a hash...
SqlUtil::AbstractTable::getUpsertClosure
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...
SqlUtil::AbstractTable::getInsertFromIteratorOptions
hash< auto > getInsertFromIteratorOptions()
returns the insert from iterator options for this driver
SqlUtil::AbstractTable::insertFromSelectCommit
int insertFromSelectCommit(list cols, AbstractTable source, hash< auto > sh, reference< string > sql)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
SqlUtil::AbstractTable::asteriskRequiresPrefix
bool asteriskRequiresPrefix()
returns True if the database requires a wildcard "*" to be prefixed with the table name when it appea...
SqlUtil::AbstractTable::getDbType
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
SqlUtil::AbstractTable::emptyData
bool emptyData()
returns True if the table has no data rows, False if not
SqlUtil::AbstractTable::updateCommit
int updateCommit(hash< auto > set, hash< auto > cond, hash< auto > opt)
A SqlUtil::AbstractTable::updateCommit() variant.
SqlUtil::AbstractTable::findSingle
*hash< auto > findSingle(*hash< auto > cond)
finds a single row in the table that match the row condition passed; multiple rows may match,...
SqlUtil::AbstractTable::drop
drop(*hash< auto > opt)
drops the table from the database without any transaction management
SqlUtil::AbstractTable::getNumericType
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...
SqlUtil::AbstractTable::insertFromSelectNoCommit
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
SqlUtil::AbstractTable::uniqueIndexCreatesConstraintImpl
abstract bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
SqlUtil::AbstractTable::getTypeMapImpl
abstract hash< auto > getTypeMapImpl()
returns the type name -> type description hash
SqlUtil::AbstractTable::updateCommit
int updateCommit(hash< auto > set, hash< auto > cond)
A SqlUtil::AbstractTable::updateCommit() variant.
SqlUtil::AbstractTable::insertFromSelectCommit
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...
SqlUtil::AbstractTable::updateNoCommit
deprecated int updateNoCommit(hash< auto > set, *hash< auto > cond, *hash< auto > opt)
A legacy SqlUtil::AbstractTable::update() wrapper.
SqlUtil::AbstractTable::columns
Columns columns
column description object
Definition: AbstractTable.qc.dox.h:383
SqlUtil::AbstractTable::getIndexes
Indexes getIndexes()
returns an object of class Indexes describing the indexes on the table
SqlUtil::AbstractTable::getAddTriggerSql
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
SqlUtil::AbstractTable::getCreatePrimaryKeySql
*string getCreatePrimaryKeySql(*hash< auto > opt, bool cache=True)
returns an SQL string that could be used to create the primary key on the table
SqlUtil::AbstractTable::getCreateIndexesSql
*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...
SqlUtil::AbstractTable::getConstraintOptions
hash< auto > getConstraintOptions()
returns the constraint options for this driver
SqlUtil::AbstractTable::getName
string getName()
returns the name of the table
SqlUtil::AbstractTable::select
*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
SqlUtil::AbstractTable::dropForeignConstraint
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,...
SqlUtil::AbstractTable::find
*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...
SqlUtil::AbstractTable::getTriggers
Triggers getTriggers()
returns an object of class Triggers describing the triggers on the table
SqlUtil::AbstractTable::selectRow
*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...
SqlUtil::AbstractTable::getStatement
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...
SqlUtil::AbstractTable::upsertFromIteratorNoCommit
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
SqlUtil::AbstractTable::getColumnSqlNames
list< auto > getColumnSqlNames(softlist cols)
returns a list of column names for use in SQL strings; subclasses can process the argument list in ca...
SqlUtil::AbstractTable::foreignConstraints
ForeignConstraints foreignConstraints
foreign constraints description
Definition: AbstractTable.qc.dox.h:389
SqlUtil::AbstractTable::clearImpl
clearImpl()
clears any driver-specific table information
SqlUtil::AbstractTable::insertCommit
*hash< auto > insertCommit(hash< auto > row, hash< auto > opt)
SqlUtil::AbstractTable::insertCommit() variant
SqlUtil::AbstractTable::SelectOptions
const SelectOptions
default possible select options; can be extended by driver-specific modules
Definition: AbstractTable.qc.dox.h:85
SqlUtil::AbstractTable::upsert
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...
SqlUtil::AbstractTable::UpsertAuto
const UpsertAuto
Upsert option: if the target table is empty, use UpsertInsertFirst, otherwise use UpsertUpdateFirst.
Definition: AbstractTable.qc.dox.h:287
SqlUtil::AbstractTable::del
int del(hash< auto > cond, hash< auto > opt)
SqlUtil::AbstractTable::del() variant
SqlUtil::AbstractTable::setDatasource
setDatasource(AbstractDatasource nds)
changes the datasource for the table; if the inDb flag is True, then it is set to False by calling th...
SqlUtil::AbstractTable::getRowIterator
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...
SqlUtil::AbstractTable::cache
cache(*hash< auto > opts)
reads in all attributes of the table from the database
SqlUtil::AbstractTable::truncateCommit
truncateCommit()
truncates all the table data; releases the transaction lock after executing
SqlUtil::AbstractTable::upsertFromSelectCommit
*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
SqlUtil::AbstractTable::updateNoCommit
deprecated int updateNoCommit(hash< auto > set, *hash< auto > cond, *reference< string > sql)
A legacy SqlUtil::AbstractTable::update() wrapper.
SqlUtil::AbstractTable::insertFromIteratorCommit
int insertFromIteratorCommit(Qore::AbstractIterator i, *hash< auto > opt)
this method inserts data from the given iterator argument (whose getValue() method must return a hash...
SqlUtil::AbstractTable::del
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...
SqlUtil::AbstractTable::getForeignConstraintOptions
hash< auto > getForeignConstraintOptions()
return the foreign constraint options for this driver
SqlUtil::AbstractTable::ConstraintOptions
const ConstraintOptions
default constraint options
Definition: AbstractTable.qc.dox.h:60
SqlUtil::AbstractTable::createCommit
createCommit(*hash< auto > opt)
creates the table in the database; releases the transaction lock after creating the table
SqlUtil::AbstractTable::getBaseType
string getBaseType()
returns the base type of the underlying object (normally "table", some DB-specific implementations ma...
SqlUtil::AbstractTable::insertNoCommit
deprecated *hash< auto > insertNoCommit(hash< auto > row, hash< auto > opt)
A legacy wrapper for SqlUtil::AbstractTable::insert()
SqlUtil::AbstractTable::TableDescriptionHashOptions
const TableDescriptionHashOptions
Table description options.
Definition: AbstractTable.qc.dox.h:147
SqlUtil::AbstractTable::UpsertStrategyDescriptionMap
const UpsertStrategyDescriptionMap
hash mapping upsert strategy descriptions to upsert strategy codes
Definition: AbstractTable.qc.dox.h:318
SqlUtil::AbstractTable::update
int update(hash< auto > set)
A SqlUtil::AbstractTable::update() variant.
SqlUtil::AbstractTable::update
int update(hash< auto > set, hash< auto > cond, hash< auto > opt)
A SqlUtil::AbstractTable::update() variant.
SqlUtil::AbstractTable::clear
clear()
purges the current table definition
SqlUtil::AbstractTable::getColumnOptions
hash< auto > getColumnOptions()
returns the column options for this driver
SqlUtil::AbstractTable::getAlignSql
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
SqlUtil::AbstractTable::UpsertResultDescriptionMap
const UpsertResultDescriptionMap
hash mapping upsert descriptions to codes
Definition: AbstractTable.qc.dox.h:362
SqlUtil::AbstractTable::updateCommit
int updateCommit(hash< auto > set, hash< auto > cond, reference< string > sql)
A SqlUtil::AbstractTable::updateCommit() variant.
SqlUtil::AbstractTable::upsertFromIteratorCommit
*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
SqlUtil::AbstractTable::getTableColumnDescOptions
hash< auto > getTableColumnDescOptions()
returns the table column description options for this driver
SqlUtil::AbstractTable::getPseudoColumnHash
*hash< auto > getPseudoColumnHash()
returns a hash of valid pseudocolumns
SqlUtil::AbstractTable::doSelectOrderByWithOffsetSqlUnlockedImpl
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
SqlUtil::AbstractTable::getAddPrimaryKeySql
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
SqlUtil::AbstractTable::updateCommit
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...
SqlUtil::AbstractTable::insert
*hash< auto > insert(hash< auto > row, reference< string > sql, hash< auto > opt)
SqlUtil::AbstractTable::insert() variant
SqlUtil::AbstractTable::getConstraints
Constraints getConstraints()
returns a Constraints object describing the non-foreign constraints on the table
SqlUtil::AbstractTable::hasArrayBind
abstract bool hasArrayBind()
returns True if the underlying DB driver supports bulk DML operations
SqlUtil::AbstractTable::validateColumnOptions
validateColumnOptions(string cname, reference< hash > opt, bool nullable)
validates column options
SqlUtil::AbstractTable::truncateNoCommit
deprecated truncateNoCommit()
A legacy warpper for truncate()
SqlUtil::AbstractTable::getDescriptionHash
hash< auto > getDescriptionHash()
Returns a description hash of the table.
SqlUtil::AbstractTable::commit
commit()
commits the current transaction on the underlying Qore::SQL::AbstractDatasource
SqlUtil::AbstractTable::getColumnOperatorMap
hash< auto > getColumnOperatorMap()
returns the column operator map for this object
SqlUtil::AbstractTable::getRawUpdateOperatorMap
hash< auto > getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
SqlUtil::AbstractTable::UpsertSelectFirst
const UpsertSelectFirst
Upsert option: select first, if the row is unchanged, do nothing, if it doesn't exist,...
Definition: AbstractTable.qc.dox.h:280
SqlUtil::AbstractTable::checkExistence
bool checkExistence()
returns True if the table exists in the database, False if not
SqlUtil::AbstractTable::findAll
*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...
SqlUtil::AbstractTable::insertFromSelectCommit
int insertFromSelectCommit(list cols, AbstractTable source, hash< auto > sh)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
SqlUtil::AbstractTable::getExpressionMap
hash< auto > getExpressionMap()
Returns the expression map for this database server.
SqlUtil::AbstractTable::getSubtableFromString
AbstractTable getSubtableFromString(string table, *hash< auto > opt)
Returns the given table from the argument, using any "tablecode" option if present.
SqlUtil::AbstractTable::TableCreationOptions
const TableCreationOptions
table creation options
Definition: AbstractTable.qc.dox.h:113
SqlUtil::AbstractTable::UR_Deleted
const UR_Deleted
row was deleted (only possible with batch upsert methods such as AbstractTable::upsertFromIterator() ...
Definition: AbstractTable.qc.dox.h:345
SqlUtil::AbstractTable::delCommit
int delCommit(hash< auto > cond, reference< string > sql)
SqlUtil::AbstractTable::delCommit() variant
SqlUtil::AbstractTable::insertFromSelect
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...
SqlUtil::AbstractTable::triggers
Triggers triggers
trigger descriptions
Definition: AbstractTable.qc.dox.h:393
SqlUtil::AbstractTable::renameColumn
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...
SqlUtil::AbstractTable::getSavepointHelperImpl
abstract AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
SqlUtil::AbstractTable::updateCommit
int updateCommit(hash< auto > set)
A SqlUtil::AbstractTable::updateCommit() variant.
SqlUtil::AbstractTable::getColumnDataType
AbstractDataProviderType getColumnDataType(string column_name, *hash< SqlUtilDataTypeOptionInfo > options)
returns the data type for the given column
SqlUtil::AbstractTable::primaryKey
AbstractPrimaryKey primaryKey
primary key description
Definition: AbstractTable.qc.dox.h:385
SqlUtil::AbstractTable::inDb
bool inDb()
returns True if the table has been read from or created in the database, False if not
SqlUtil::AbstractTable::getRowIterator
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...
SqlUtil::AbstractTable::insertFromSelect
int insertFromSelect(list cols, AbstractTable source, hash< auto > sh, reference< string > sql)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
SqlUtil::AbstractTable::dropIndex
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,...
SqlUtil::AbstractTable::getTableOptions
hash< auto > getTableOptions()
returns the table options for this driver
SqlUtil::AbstractTable::getDropColumnSql
list< auto > getDropColumnSql(string cname, *hash< auto > opt)
returns the SQL that can be used to drop a column from the table
SqlUtil::AbstractTable::addForeignConstraint
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,...
SqlUtil::AbstractTable::upsertFromSelectNoCommit
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
SqlUtil::AbstractTable::getAlignTableOptions
hash< auto > getAlignTableOptions()
returns the align table options for this driver
SqlUtil::AbstractTable::addPrimaryKey
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,...
SqlUtil::AbstractTable::beginTransaction
beginTransaction()
begins a transaction on the underlying Qore::SQL::AbstractDatasource
SqlUtil::AbstractTable::selectRowsWithInfo
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...
SqlUtil::AbstractTable::supportsTablespacesImpl
abstract bool supportsTablespacesImpl()
returns True if the database support tablespaces
SqlUtil::AbstractTable::getSelectOptions
hash< auto > getSelectOptions()
returns the select options for this driver
SqlUtil::AbstractTable::getStatementWithInfo
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...
SqlUtil::AbstractTable::rollback
rollback()
rolls back the current transaction on the underlying Qore::SQL::AbstractDatasource
SqlUtil::AbstractTable::getTruncateSql
string getTruncateSql(*hash< auto > opt)
gets the SQL that can be used to truncate the table
SqlUtil::AbstractTable::getSqlFromList
string getSqlFromList(list< auto > l)
returns an SQL string corresponding to the list of commands in the argument
SqlUtil::AbstractTable::insert
*hash< auto > insert(hash< auto > row, reference< string > sql)
SqlUtil::AbstractTable::insert() variant
SqlUtil::AbstractTable::getRenameColumnSql
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
SqlUtil::AbstractTable::getTriggerOptions
hash< auto > getTriggerOptions()
returns the trigger options for this driver
SqlUtil::AbstractTable::addCheckConstraint
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,...
SqlUtil::AbstractTable::getForeignConstraints
ForeignConstraints getForeignConstraints(*hash< auto > opt)
returns a ForeignConstraints object describing the foreign constraints that the table has on other ta...
SqlUtil::AbstractTable::getSqlValue
string getSqlValue(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument
SqlUtil::AbstractTable::TriggerOptions
const TriggerOptions
default trigger options
Definition: AbstractTable.qc.dox.h:79
SqlUtil::AbstractTable::AlignTableOptions
const AlignTableOptions
table alignment options
Definition: AbstractTable.qc.dox.h:126
SqlUtil::AbstractTable::insertFromSelect
int insertFromSelect(list cols, AbstractTable source, hash< auto > sh, hash< auto > opt)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
SqlUtil::AbstractTable::getBulkUpsertClosure
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...
SqlUtil::AbstractTable::tryExecRaw
auto tryExecRaw(string sql)
executes some SQL so that if an error occurs the current transaction state is not lost
SqlUtil::AbstractTable::findUniqueConstraint
*AbstractUniqueConstraint findUniqueConstraint(string name)
returns the given AbstractUniqueConstraint object if defined for the table (also includes the primary...
SqlUtil::AbstractTable::getQoreTypeMapImpl
abstract hash< auto > getQoreTypeMapImpl()
returns the qore type -> column type map
SqlUtil::AbstractTable::getCreateSqlString
string getCreateSqlString(*hash< auto > opt)
returns an SQL string that could be used to create the table and all known properties of the table
SqlUtil::AbstractTable::del
int del()
SqlUtil::AbstractTable::del() variant
SqlUtil::AbstractTable::UpsertResultMap
const UpsertResultMap
hash mapping upsert results to a description
Definition: AbstractTable.qc.dox.h:351
SqlUtil::AbstractTable::getSavepointHelper
AbstractSavepointHelper getSavepointHelper(*string savepoint)
get DB-specific savepoint helper
SqlUtil::AbstractTable::truncate
truncate()
truncates all the table data without any transaction management
SqlUtil::AbstractTable::dropTrigger
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,...
SqlUtil::AbstractTable::getDropConstraintIfExistsSql
*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...
SqlUtil::AbstractTable::getAlignSqlString
string getAlignSqlString(AbstractTable t, *hash< auto > opt)
accepts an AbstractTable argument and returns an SQL string that could be executed to align the struc...
SqlUtil::AbstractTable::addTrigger
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...
SqlUtil::AbstractTable::getSelectSql
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...
SqlUtil::AbstractTable::getRowIteratorNoExec
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...
SqlUtil::AbstractTable::manual
bool manual
manual edits
Definition: AbstractTable.qc.dox.h:399
SqlUtil::AbstractTable::find
*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...
SqlUtil::AbstractTable::UR_Inserted
const UR_Inserted
row was inserted
Definition: AbstractTable.qc.dox.h:333
SqlUtil::AbstractTable::ForeignConstraintOptions
const ForeignConstraintOptions
default foreign constraint options
Definition: AbstractTable.qc.dox.h:72
SqlUtil::AbstractTable::AdditionalColumnDescOptions
const AdditionalColumnDescOptions
additional column description keys valid when describing columns in a table description hash
Definition: AbstractTable.qc.dox.h:187
SqlUtil::AbstractTable::InsertFromIteratorOptions
const InsertFromIteratorOptions
default insert option keys
Definition: AbstractTable.qc.dox.h:237
SqlUtil::AbstractTable::getAddForeignConstraintSql
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
SqlUtil::AbstractTable::empty
bool empty()
returns True if the table has no definitions, False if not
SqlUtil::AbstractTable::delNoCommit
deprecated int delNoCommit(*hash< auto > cond, *reference< string > sql)
A legacy SqlUtil::AbstractTable::del() wrapper.
SqlUtil::AbstractTable::getUniqueConstraintIterator
Qore::AbstractIterator getUniqueConstraintIterator()
returns an iterator for all unique constraints on the table (including the primary key if any)
SqlUtil::AbstractTable::UR_Unchanged
const UR_Unchanged
row was unchanged (only possible with UpsertSelectFirst, UpsertInsertOnly, and UpsertUpdateOnly)
Definition: AbstractTable.qc.dox.h:342
SqlUtil::AbstractTable::insertFromSelectWithInfo
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
SqlUtil::AbstractTable::getCreateForeignConstraintsSql
*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...
SqlUtil::AbstractTable::indexes
Indexes indexes
index descriptions
Definition: AbstractTable.qc.dox.h:387
SqlUtil::AbstractTable::insertCommit
*hash< auto > insertCommit(hash< auto > row)
inserts a row into the table; the transaction is committed if successful, if an error occurs,...
SqlUtil::AbstractTable::insertFromSelect
int insertFromSelect(list cols, AbstractTable source, hash< auto > sh)
SqlUtil::AbstractTable::insertFromSelectCommit() variant
SqlUtil::AbstractTable::tryInsertImpl
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,...
SqlUtil::AbstractTable::create
create(*hash< auto > opt)
creates the table with all associated properties (indexes, constraints, etc) without any transaction ...
SqlUtil::AbstractTrigger
the base class for triggers
Definition: SqlUtil.qm.dox.h:7124
SqlUtil::AbstractUniqueConstraint
represents a unique column constraint
Definition: SqlUtil.qm.dox.h:6840
SqlUtil::Columns
column container class that throws an exception if an unknown column is accessed
Definition: SqlUtil.qm.dox.h:6260
SqlUtil::Constraints
constraint container class that throws an exception if an unknown constraint is accessed
Definition: SqlUtil.qm.dox.h:6609
SqlUtil::ForeignConstraints
foreign constraint container class that throws an exception if an unknown constraint is accessed
Definition: SqlUtil.qm.dox.h:6860
SqlUtil::Indexes
index container class that throws an exception if an unknown index is accessed
Definition: SqlUtil.qm.dox.h:6475
SqlUtil::Table
represents a database table; this class embeds an AbstractTable object that is created automatically ...
Definition: Table.qc.dox.h:44
SqlUtil::Tables
the table container class stores a collection of tables in a schema
Definition: SqlUtil.qm.dox.h:6072
SqlUtil::Triggers
trigger container class that throws an exception if an unknown trigger is accessed
Definition: SqlUtil.qm.dox.h:7142
True
const True
False
const False
exp
number exp(number n)
exists
bool exists(...)
sprintf
string sprintf(string fmt,...)
NothingType
const NothingType
Hash
const Hash
String
const String
Boolean
const Boolean
Int
const Int
NT_STRING
const NT_STRING
hash
hash< auto > hash(object obj)
type
string type(auto arg)
list
list< auto > list(...)
SqlUtil
Qore AbstractDatabase class definition.
Definition: AbstractDatabase.qc.dox.h:26
SqlUtil::QueryInfo
Query information.
Definition: SqlUtil.qm.dox.h:2663