SqlUtil.qm.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
/* SqlUtil.qm Copyright (C) 2013 - 2022 Qore Technologies, s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
// minimum required Qore version
// requires the Util module
// requires the DataProvider module
// don't use "$" signs for variables and class members, assume local variable scope
// require type definitions everywhere
// enable all warnings
// version history is included below in the docs
namespace SqlUtil {
public struct GenericColumnInfo {
string qore_type;
string native_type;
softint size;
softint scale;
auto default_value;
bool default_value_native = False;
*string comment;
bool notnull = False;
hash<string, hash> driver;
*bool auto_increment;
};
public struct OperatorInfo {
string op;
auto arg;
};
public struct ColumnOperatorInfo {
string cop;
auto column;
auto arg;
};
public struct InsertOperatorInfo {
string _iop;
any arg;
};
public struct UpdateOperatorInfo {
string uop;
auto arg;
*hash nest;
};
public struct JoinOperatorInfo {
string jop;
auto table;
*string alias;
*hash jcols;
*hash cond;
*string ta;
*hash<auto> opt;
};
public struct SqlUtilDataTypeOptionInfo {
*string date_format;
*TimeZone data_timezone;
*TimeZone db_timezone;
*string number_format;
*softbool mandatory;
*softint maxlen;
};
public struct SqlCommandInfo {
string sql;
list<auto> args;
};
const DB_FUNCTIONS = "functions";
const DB_MVIEWS = "materialized views";
const DB_PACKAGES = "packages";
const DB_PROCEDURES = "procedures";
const DB_SEQUENCES = "sequences";
const DB_TABLES = "tables";
const DB_TYPES = "named types";
const DB_VIEWS = "views";
const DB_SYNONYMS = "synonyms";
/* @defgroup SqlTypeConstants SQL Type Constants
These constants can be used for the \c "qore_type" values when creating columns to specify additional SQL column types
*/
const VARCHAR = "string";
const NUMERIC = "number";
const CHAR = "char";
const BLOB = "blob";
const CLOB = "clob";
const SZ_NONE = 0;
const SZ_MAND = 1;
const SZ_OPT = 2;
const SZ_NUM = 3;
const COP_AS = "as";
const COP_CAST = "cast";
const COP_PREPEND = "prepend";
const COP_APPEND = "append";
const COP_VALUE = "value";
const COP_UPPER = "upper";
const COP_LOWER = "lower";
const COP_DISTINCT = "distinct";
const COP_MIN = "min";
const COP_MAX = "max";
const COP_AVG = "avg";
const COP_SUM = "sum";
const COP_COUNT = "count";
const COP_OVER = "over";
const COP_MINUS = "minus";
const COP_PLUS = "plus";
const COP_DIVIDE = "divide";
const COP_MULTIPLY = "multiply";
const COP_YEAR = "year";
const COP_YEAR_MONTH = "year_month";
const COP_YEAR_DAY = "year_day";
const COP_YEAR_HOUR = "year_hour";
const COP_SEQ = "seq";
const COP_SEQ_CURRVAL = "seq_currval";
const COP_COALESCE = "coalesce";
const COP_SUBSTR = "substr";
const COP_LENGTH = "length";
const COP_TRUNC_DATE = "truncate_date";
const COP_CUME_DIST = "cume_dist";
const COP_DENSE_RANK = "dense_rank";
const COP_FIRST_VALUE = "first_value";
const COP_LAST_VALUE = "last_value";
const COP_NTILE = "ntile";
const COP_PERCENT_RANK = "percent_rank";
const COP_RANK = "rank";
const COP_ROW_NUMBER = "row_number";
public struct QueryInfo {
object table;
*hash<auto> query_hash;
*hash<auto> query_options;
*hash<string, AbstractTable> join_map;
*hash<string, bool> subquery_column_map;
*hash<auto> pseudo_column_map;
*hash<auto> expression_map;
*hash<auto> where_operator_map;
*hash<auto> column_operator_map;
list<auto> args;
};
const DefaultCopMap = ...;
hash<ColumnOperatorInfo> make_cop(string cop, auto column, auto arg);
hash<ColumnOperatorInfo> cop_as(auto column, string arg);
hash<ColumnOperatorInfo> cop_cast(auto column, string arg, auto arg1, auto arg2);
hash<ColumnOperatorInfo> cop_prepend(auto column, string arg);
hash<ColumnOperatorInfo> cop_append(auto column, string arg);
hash<ColumnOperatorInfo> cop_value(auto arg);
hash<ColumnOperatorInfo> cop_upper(auto column);
hash<ColumnOperatorInfo> cop_lower(auto column);
hash<ColumnOperatorInfo> cop_distinct(auto column);
hash<ColumnOperatorInfo> cop_min(auto column);
hash<ColumnOperatorInfo> cop_max(auto column);
hash<ColumnOperatorInfo> cop_avg(auto column);
hash<ColumnOperatorInfo> cop_sum(auto column);
hash<ColumnOperatorInfo> cop_count(auto column = '');
hash<ColumnOperatorInfo> cop_over(auto column, *string partitionby, *string orderby);
hash<ColumnOperatorInfo> cop_minus(auto column1, auto column2);
hash<ColumnOperatorInfo> cop_plus(auto column1, auto column2);
hash<ColumnOperatorInfo> cop_divide(auto column1, auto column2);
hash<ColumnOperatorInfo> cop_multiply(auto column1, auto column2);
hash<ColumnOperatorInfo> cop_year(auto column);
hash<ColumnOperatorInfo> cop_year_month(auto column);
hash<ColumnOperatorInfo> cop_year_day(auto column);
hash<ColumnOperatorInfo> cop_year_hour(auto column);
hash<ColumnOperatorInfo> cop_seq(string seq, *string as);
hash<ColumnOperatorInfo> cop_seq_currval(string seq, *string as);
hash<ColumnOperatorInfo> cop_coalesce(auto col1, auto col2);
hash<ColumnOperatorInfo> cop_substr(auto column, int start, *int count);
hash<ColumnOperatorInfo> cop_length(auto column);
hash<ColumnOperatorInfo> cop_trunc_date(auto column, string mask);
hash<ColumnOperatorInfo> cop_cume_dist();
hash<ColumnOperatorInfo> cop_dense_rank();
hash<ColumnOperatorInfo> cop_first_value(any column);
hash<ColumnOperatorInfo> cop_last_value(any column);
hash<ColumnOperatorInfo> cop_ntile(int value);
hash<ColumnOperatorInfo> cop_percent_rank();
hash<ColumnOperatorInfo> cop_rank();
hash<ColumnOperatorInfo> cop_row_number();
const DT_YEAR = "Y";
const DT_MONTH = "M";
const DT_DAY = "D";
const DT_HOUR = "H";
const DT_MINUTE = "m";
const DT_SECOND = "S";
// let's simulate and enum here'
const DT_ALL_VALUES = ( DT_YEAR, DT_MONTH, DT_DAY, DT_HOUR, DT_MINUTE, DT_SECOND );
const DefaultUopMap = ...;
hash<UpdateOperatorInfo> make_uop(string uop, auto arg, *hash<UpdateOperatorInfo> nest);
hash<UpdateOperatorInfo> uop_prepend(string arg, *hash<UpdateOperatorInfo> nest);
hash<UpdateOperatorInfo> uop_append(string arg, *hash<UpdateOperatorInfo> nest);
hash<UpdateOperatorInfo> uop_upper(*hash<UpdateOperatorInfo> nest);
hash<UpdateOperatorInfo> uop_lower(*hash<UpdateOperatorInfo> nest);
hash<UpdateOperatorInfo> uop_substr(int start, *int count, *hash<UpdateOperatorInfo> nest);
hash<UpdateOperatorInfo> uop_plus(auto arg, *hash<UpdateOperatorInfo> nest);
hash<UpdateOperatorInfo> uop_minus(auto arg, *hash<UpdateOperatorInfo> nest);
hash<UpdateOperatorInfo> uop_multiply(auto arg, *hash<UpdateOperatorInfo> nest);
hash<UpdateOperatorInfo> uop_divide(auto arg, *hash<UpdateOperatorInfo> nest);
hash<UpdateOperatorInfo> uop_seq(string seq);
hash<UpdateOperatorInfo> uop_seq_currval(string seq);
const JOP_INNER = "inner";
const JOP_LEFT = "left";
const JOP_RIGHT = "right";
const JopMap = {
JOP_INNER: "inner",
JOP_LEFT: "left outer",
JOP_RIGHT: "right outer",
};
hash<string, hash<JoinOperatorInfo>> make_jop(string jop, AbstractTable table, *string alias, *hash jcols, *hash cond, *string ta, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> make_jop(string jop, string table_name, *string alias, *hash jcols, *hash cond, *string ta, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_inner(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_inner(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_inner(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_inner(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_inner(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_inner_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_left(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_left(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_left(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_left(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_left(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_left_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_right(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_right(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_right(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_right(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_right(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
hash<string, hash<JoinOperatorInfo>> join_right_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
const OP_LIKE = "like";
const OP_LT = "<";
const OP_LE = "<=";
const OP_GT = ">";
const OP_GE = ">=";
const OP_NE = "!=";
const OP_EQ = "=";
const OP_CLT = "C<";
const OP_CLE = "C<=";
const OP_CGT = "C>";
const OP_CGE = "C>=";
const OP_CNE = "C!=";
const OP_CEQ = "C=";
const OP_BETWEEN = "between";
const OP_IN = "in";
const OP_NOT = "not";
const OP_SUBSTR = "substr";
const OP_OR = "or";
const OP_IN_SELECT = "in_select";
const DefaultExpressionMap = {
// first the "AND" and "OR" "operators"
DP_OP_AND: {
"exp": AbstractDataProvider::GenericExpressions{DP_OP_AND},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return "("
+ (foldl $1 + " and " + $2,
(map info.table.getExpressionArg(\info, role, $1, AbstractDataProviderTypeMap."bool"), args))
+ ")";
},
},
DP_OP_OR: {
"exp": AbstractDataProvider::GenericExpressions{DP_OP_OR},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return "("
+ (foldl $1 + " or " + $2,
(map info.table.getExpressionArg(\info, role, $1, AbstractDataProviderTypeMap."bool"), args))
+ ")";
},
},
OP_LIKE: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": "like",
"name": "like",
"desc": "The value to bind as the 'like' value (ex: '%some string%')",
"symbol": "like",
"args": (
DataProviderSignatureStringType,
DataProviderSignatureStringValueType,
),
"return_type": AbstractDataProviderTypeMap."bool",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("%s like %s",
info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."string"),
info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."string"));
},
},
OP_LT: {
"exp": AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_LT},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("%s < %s",
info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any"),
info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any"));
},
},
OP_LE: {
"exp": AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_LE},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("%s <= %s",
info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any"),
info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any"));
},
},
OP_GT: {
"exp": AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_GT},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("%s > %s",
info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any"),
info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any"));
},
},
OP_GE: {
"exp": AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_GE},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("%s >= %s",
info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any"),
info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any"));
},
},
OP_NE: {
"exp": AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_NE},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
bool null0 = (args[0] === NULL || !exists args[0]);
bool null1 = (args[1] === NULL || !exists args[1]);
if (null0 && null1) {
return "1 = 0";
}
if (null0) {
return sprintf("%s is not null",
info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any"));
}
if (null1) {
return sprintf("%s is not null",
info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any"));
}
string exp0 = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any");
string exp1 = info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any");
return sprintf("%s != %s", exp0, exp1);
},
},
OP_EQ: {
"exp": AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_EQ},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
bool null0 = (args[0] === NULL || !exists args[0]);
bool null1 = (args[1] === NULL || !exists args[1]);
if (null0 && null1) {
return "1 = 1";
}
if (null0) {
return sprintf("%s is null",
info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any"));
}
if (null1) {
return sprintf("%s is null",
info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any"));
}
string exp0 = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any");
string exp1 = info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any");
return sprintf("%s = %s", exp0, exp1);
},
},
OP_BETWEEN: {
"exp": AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_BETWEEN},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("%s between %s and %s",
info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any"),
info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any"),
info.table.getExpressionArg(\info, role, args[2], AbstractDataProviderTypeMap."any"));
},
},
OP_IN: {
"exp": AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_IN},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string exp0 = info.table.getExpressionArg(\info, role, shift args, AbstractDataProviderTypeMap."any");
*string ins = (foldl $1 + "," + $2, (map info.table.getExpressionArg(\info, role, $1,
AbstractDataProviderTypeMap."any"), args));
return exists ins ? sprintf("%s in (%s)", exp0, ins) : "1 != 1";
},
},
OP_NOT: {
"exp": AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_NOT},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("not (%s)", info.table.getExpressionArg(\info, role, args[0],
AbstractDataProviderTypeMap."bool"));
},
},
OP_SUBSTR: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": "substr",
"name": "substr",
"desc": "returns a substring from a string; args: string, int start char, [int length]",
"symbol": "substr",
"args": (
DataProviderSignatureStringType,
DataProviderSignatureIntValueType,
DataProviderSignatureOptionalIntValueType,
),
"return_type": AbstractDataProviderTypeMap."string",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string exp0 = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."string");
string exp1 = info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."int");
if (!exists args[2]) {
return sprintf("substring(%s from %s)", exp0, exp1);
}
return sprintf("substring(%s from %s for %s)", exp0, exp1,
info.table.getExpressionArg(\info, role, args[2], AbstractDataProviderTypeMap."int"));
},
},
OP_IN_SELECT: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": "in_select",
"name": "in_select",
"desc": "check if a value is in a sub-select; args: value, table name for the subselect, subselect "
"query hash",
"symbol": "in_select",
"args": (
DataProviderSignatureAnyType, # any value, expression, or field reference
DataProviderSignatureStringValueType, # table name
DataProviderSignatureHashValueType, # query hash
),
"return_type": AbstractDataProviderTypeMap."bool",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string exp0 = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any");
object subtable = info.table.getSubtableFromString(args[1], info.query_options);
list<auto> subargs;
string subsql = subtable.getSelectSql(args[2], \subargs);
args += subargs;
return sprintf("%s in (%s)", exp0, subsql);
},
},
COP_AS: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": "as",
"name": "as",
"desc": "aliases a result; args: expression or value, string label",
"symbol": "as",
"role": ER_Field,
"args": (
DataProviderSignatureAnyType,
DataProviderSignatureStringValueType,
),
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string exp = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any");
string arg = args[1];
info.pseudo_column_map{arg} = exp;
return sprintf("%s as %s", exp, info.table.getColumnSqlName(arg));
},
},
COP_PREPEND: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_PREPEND,
"name": COP_PREPEND,
"desc": "prepends a string to another string; args: string to be prepended, string to prepend to the "
"first string",
"symbol": COP_PREPEND,
"args": (
DataProviderSignatureStringType,
DataProviderSignatureStringType,
),
"return_type": AbstractDataProviderTypeMap."string",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string exp0 = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."string");
string exp1 = info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."string");
return sprintf("%s || %s", exp1, exp0);
},
},
COP_APPEND: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_APPEND,
"name": COP_APPEND,
"desc": "appends or catenates a string to another string; args: string to be appended, string to "
"append or concatenate to the first string",
"symbol": COP_APPEND,
"args": (
DataProviderSignatureStringType,
DataProviderSignatureStringType,
),
"return_type": AbstractDataProviderTypeMap."string",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string exp0 = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."string");
string exp1 = info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."string");
return sprintf("%s || %s", exp0, exp1);
},
},
COP_UPPER: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_UPPER,
"name": COP_UPPER,
"desc": "converts a string to all upper case; arg: string",
"symbol": COP_UPPER,
"args": (
DataProviderSignatureStringType,
),
"return_type": AbstractDataProviderTypeMap."string",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("upper(%s)", info.table.getExpressionArg(\info, role, args[0],
AbstractDataProviderTypeMap."string"));
},
},
COP_LOWER: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_LOWER,
"name": COP_LOWER,
"desc": "converts a string to all lower case; arg: string",
"symbol": COP_LOWER,
"args": (
DataProviderSignatureStringType,
),
"return_type": AbstractDataProviderTypeMap."string",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("lower(%s)", info.table.getExpressionArg(\info, role, args[0],
AbstractDataProviderTypeMap."string"));
},
},
COP_DISTINCT: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_DISTINCT,
"name": COP_DISTINCT,
"desc": "indicates that only records with distinct values of the given field should be returned",
"symbol": COP_DISTINCT,
"role": ER_Field,
"args": (
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, *list<auto> args) {
return sprintf("distinct %s", info.table.getExpressionArg(\info, role, args[0],
AbstractDataProviderTypeMap."any"));
},
},
COP_MIN: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_MIN,
"name": COP_MIN,
"desc": "Returns the minimum value in the group",
"symbol": COP_MIN,
"role": ER_Field,
"args": (
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, *list<auto> args) {
return sprintf("min(%s)", info.table.getExpressionArg(\info, role, args[0],
AbstractDataProviderTypeMap."any"));
},
"group": True,
},
COP_MAX: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_MAX,
"name": COP_MAX,
"desc": "Returns the maximum value in the group",
"symbol": COP_MAX,
"role": ER_Field,
"args": (
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, *list<auto> args) {
return sprintf("max(%s)", info.table.getExpressionArg(\info, role, args[0],
AbstractDataProviderTypeMap."any"));
},
"group": True,
},
COP_AVG: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_AVG,
"name": COP_AVG,
"desc": "Returns the average of the given values in the group",
"symbol": COP_AVG,
"role": ER_Field,
"args": (
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, *list<auto> args) {
return sprintf("avg(%s)", info.table.getExpressionArg(\info, role, args[0],
AbstractDataProviderTypeMap."any"));
},
"group": True,
},
COP_SUM: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_SUM,
"name": COP_SUM,
"desc": "Returns the sum of the given values",
"symbol": COP_SUM,
"role": ER_Field,
"args": (
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, *list<auto> args) {
return sprintf("sum(%s)", info.table.getExpressionArg(\info, role, args[0],
AbstractDataProviderTypeMap."any"));
},
"group": True,
},
COP_COUNT: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_COUNT,
"name": COP_COUNT,
"desc": "Count the number of rows in the group",
"symbol": COP_COUNT,
"role": ER_Field,
"args": (
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."int",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, *list<auto> args) {
if (exists args[0] && args[0] != NULL) {
return sprintf("count(%s)", info.table.getExpressionArg(\info, role, args[0],
AbstractDataProviderTypeMap."any"));
}
return "count(1)";
},
},
COP_MINUS: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_MINUS,
"name": COP_MINUS,
"desc": "Subtracts one number from another",
"symbol": COP_MINUS,
"args": (
DataProviderSignatureAnyType,
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string exp0 = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any");
string exp1 = info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any");
return sprintf("%s - %s", exp0, exp1);
},
},
COP_PLUS: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_PLUS,
"name": COP_PLUS,
"desc": "Adds two numbers",
"symbol": COP_PLUS,
"args": (
DataProviderSignatureAnyType,
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string exp0 = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any");
string exp1 = info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any");
return sprintf("%s + %s", exp0, exp1);
},
},
COP_DIVIDE: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_DIVIDE,
"name": COP_DIVIDE,
"desc": "Divides one number by another",
"symbol": COP_DIVIDE,
"args": (
DataProviderSignatureAnyType,
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string exp0 = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any");
string exp1 = info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any");
return sprintf("%s / %s", exp0, exp1);
},
},
COP_MULTIPLY: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_MULTIPLY,
"name": COP_MULTIPLY,
"desc": "Multiplies two numbers",
"symbol": COP_MULTIPLY,
"args": (
DataProviderSignatureAnyType,
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string exp0 = info.table.getExpressionArg(\info, role, args[0], AbstractDataProviderTypeMap."any");
string exp1 = info.table.getExpressionArg(\info, role, args[1], AbstractDataProviderTypeMap."any");
return sprintf("%s * %s", exp0, exp1);
},
},
COP_COALESCE: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_COALESCE,
"name": COP_COALESCE,
"desc": "Returns the value of the first expression with a value",
"symbol": COP_COALESCE,
"args": (
DataProviderSignatureAnyType,
),
"varargs": True,
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("coalesce(%s)", (foldl $1 + "," + $2,
(map info.table.getExpressionArg(\info, role, $1, AbstractDataProviderTypeMap."any"), args)));
}
},
COP_LENGTH: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_LENGTH,
"name": COP_LENGTH,
"desc": "Returns the length of the argument",
"symbol": COP_LENGTH,
"args": (
DataProviderSignatureAnyType,
),
"return_type": AbstractDataProviderTypeMap."int",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("length(%s)", info.table.getExpressionArg(\info, role, args[0],
AbstractDataProviderTypeMap."any"));
},
},
COP_SEQ: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_SEQ,
"name": COP_SEQ,
"desc": "returns the next value in the given sequence; args: sequence name",
"symbol": COP_SEQ,
"args": (
DataProviderSignatureStringValueType,
),
"return_type": AbstractDataProviderTypeMap."int",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
throw "SEQUENCE-ERROR", sprintf("cannot select sequence %y because this database does not support "
"sequences", args[0]);
}
},
COP_SEQ_CURRVAL: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_SEQ_CURRVAL,
"name": COP_SEQ_CURRVAL,
"desc": "returns the current value in the given sequence; args: sequence name",
"symbol": COP_SEQ_CURRVAL,
"args": (
DataProviderSignatureStringValueType,
),
"return_type": AbstractDataProviderTypeMap."int",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
throw "SEQUENCE-ERROR", sprintf("cannot select the current value of sequence %y because this "
"database does not support sequences", args[0]);
}
},
COP_OVER: {
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_OVER,
"name": COP_OVER,
"desc": "returns the output of the SQL window given by the arguments; args: *string partiion by, "
"*string order by",
"symbol": COP_OVER,
"args": (
DataProviderSignatureFieldType,
DataProviderSignatureOptionalStringValueType,
DataProviderSignatureOptionalStringValueType,
),
"role": ER_Field,
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
string column_name = args[0];
*string partitionby = args[1];
*string orderby = args[2];
if (!exists partitionby && exists orderby) {
throw "OVER-ERROR", "Argument 2 (partition by) must be given in case of usage of argument 3 "
"(order by)";
}
string sql = column_name + " over (";
Columns cols;
if (exists partitionby) {
if (!info.pseudo_column_map{partitionby}) {
cols = info.table.describe();
if (!exists cols{partitionby}) {
throw "OVER-ERROR", sprintf("Argument 2 (partition by) %y is not an alias or an "
"accessible column", partitionby);
}
}
sql += sprintf("partition by %s", partitionby);
}
if (exists orderby) {
if (!info.pseudo_column_map{orderby}) {
if (!cols) {
cols = info.table.describe();
if (!exists cols{orderby}) {
throw "OVER-ERROR", sprintf("Argument 3 (order by) %y is not an alias or an "
"accessible column", orderby);
}
}
}
sql += sprintf(" order by %s", orderby);
}
sql += ")";
return sql;
}
},
COP_DENSE_RANK: (
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_DENSE_RANK,
"name": COP_DENSE_RANK,
"desc": "Returns the rank of a row in an ordered group of rows as a number",
"symbol": COP_DENSE_RANK,
"args": (),
"role": ER_Field,
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return "dense_rank()";
},
),
COP_FIRST_VALUE: (
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_FIRST_VALUE,
"name": COP_FIRST_VALUE,
"desc": "Returns the first value in an ordered group of rows",
"symbol": COP_FIRST_VALUE,
"args": (
DataProviderSignatureFieldType,
),
"role": ER_Field,
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("first_value(%s)", args[0]);
},
),
COP_LAST_VALUE: (
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_LAST_VALUE,
"name": COP_LAST_VALUE,
"desc": "Returns the last value in an ordered group of rows",
"symbol": COP_LAST_VALUE,
"args": (
DataProviderSignatureFieldType,
),
"role": ER_Field,
"return_type": AbstractDataProviderTypeMap."any",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("last_value(%s)", args[0]);
},
),
COP_NTILE: (
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_NTILE,
"name": COP_NTILE,
"desc": "Returns the group number of an ordered group of rows",
"symbol": COP_NTILE,
"args": (
DataProviderSignatureIntValueType,
),
"role": ER_Field,
"return_type": AbstractDataProviderTypeMap."int",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return sprintf("ntile(%d)", args[0]);
},
),
COP_PERCENT_RANK: (
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_PERCENT_RANK,
"name": COP_PERCENT_RANK,
"desc": "Returns the percent rank of a row in an ordered group of rows",
"symbol": COP_PERCENT_RANK,
"args": (),
"role": ER_Field,
"return_type": AbstractDataProviderTypeMap."int",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return "percent_rank()";
},
),
COP_RANK: (
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_PERCENT_RANK,
"name": COP_PERCENT_RANK,
"desc": "Returns the row number of a row in an ordered group of rows",
"symbol": COP_PERCENT_RANK,
"args": (),
"role": ER_Field,
"return_type": AbstractDataProviderTypeMap."int",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return "rank()";
},
),
COP_ROW_NUMBER: (
"exp": <DataProviderExpressionInfo>{
"type": DET_Operator,
"label": COP_ROW_NUMBER,
"name": COP_ROW_NUMBER,
"desc": "Returns the row number of a result set",
"symbol": COP_ROW_NUMBER,
"args": (),
"role": ER_Field,
"return_type": AbstractDataProviderTypeMap."int",
},
"code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
return "row_number()";
},
),
};
const DefaultOpMap = {
OP_LIKE: {
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
info.args += arg;
return sprintf("%s like %v", cn);
},
"name": "like",
"args": (DataProviderSignatureStringType, DataProviderSignatureStringValueType),
"return_type": AbstractDataProviderTypeMap."bool",
"desc": "The value to bind as the 'like' value (ex: '%some string%')",
},
OP_LT: AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_LT} + (
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
info.args += arg;
return sprintf("%s < %v", cn);
},
),
OP_LE: AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_LE} + (
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
info.args += arg;
return sprintf("%s <= %v", cn);
},
),
OP_GT: AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_GT} + (
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
info.args += arg;
return sprintf("%s > %v", cn);
},
),
OP_GE: AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_GE} + (
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
info.args += arg;
return sprintf("%s >= %v", cn);
},
),
OP_NE: AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_NE} + (
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
if (arg === NULL || !exists arg)
return sprintf("%s is not null", cn);
info.args += arg;
return sprintf("(%s != %v or %s is null)", cn, cn);
},
),
OP_EQ: AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_EQ} + (
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
if (arg === NULL || !exists arg)
return sprintf("%s is null", cn);
info.args += arg;
return sprintf("%s = %v", cn);
},
),
OP_BETWEEN: AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_BETWEEN} + (
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
info.args += arg[0];
info.args += arg[1];
return sprintf("%s between %v and %v", cn);
},
),
OP_IN: AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_IN} + (
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
*string ins = (foldl $1 + "," + $2, (map info.table.getSqlValue($1), arg));
return exists ins ? sprintf("%s in (%s)", cn, ins) : "1 != 1";
},
),
OP_IN_SELECT: {
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg,
*hash<auto> opt) {
object subtable;
if (arg.table.typeCode() == NT_STRING) {
subtable = info.table.getSubtableFromString(arg.table, opt);
} else {
subtable = arg.table;
}
list<auto> subargs;
string subsql = subtable.getSelectSql(arg.select_hash, \subargs);
info.args += subargs;
return sprintf("%s in (%s)", cn, subsql);
},
"withopt": True,
},
OP_NOT: AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_NOT} + (
"recursive": True,
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
return sprintf("not (%s)", cn);
},
),
OP_CLT: (
"argcolumn": True,
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
return sprintf("%s < %s", cn, arg);
},
"name": "column <",
"type": AbstractDataProviderType::get(StringType),
"desc": "a column name for less than comparisons; if the field value is less than the column argument's "
"value, then the operation returns true; the other column must have a compatible type",
),
OP_CLE: (
"argcolumn": True,
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
return sprintf("%s <= %s", cn, arg);
},
"name": "column <=",
"type": AbstractDataProviderType::get(StringType),
"desc": "a column name for less than or equals comparisons; if the field value is less than or equal to "
"the column argument's, then the operation returns true; the other column must have a compatible type",
),
OP_CGT: (
"argcolumn": True,
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
return sprintf("%s > %s", cn, arg);
},
"name": "column >",
"type": AbstractDataProviderType::get(StringType),
"desc": "a column name for less than comparisons; if the field value is less than the column argument's, "
"then the operation returns true; the other column must have a compatible type",
),
OP_CGE: (
"argcolumn": True,
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
return sprintf("%s >= %s", cn, arg);
},
"name": "column >=",
"type": AbstractDataProviderType::get(StringType),
"desc": "a column name for greater than or equals comparisons; if the field value is greater than or "
"equal to the column argument's, then the operation returns true; the other column must have a "
"compatible type",
),
OP_CNE: (
"argcolumn": True,
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
return sprintf("%s != %s", cn, arg);
},
"name": "column !=",
"type": AbstractDataProviderType::get(StringType),
"desc": "a column name for not=equals comparisons; the other column must have a compatible type",
),
OP_CEQ: (
"argcolumn": True,
"code": string sub (reference<hash<QueryInfo>> info, string cn, string arg) {
return sprintf("%s = %s", cn, arg);
},
"name": "column =",
"type": AbstractDataProviderType::get(StringType),
"desc": "a value for equality comparisons; the other column must have a compatible type",
),
OP_SUBSTR: (
"code": string sub (reference<hash<QueryInfo>> info, string cn, auto arg) {
info.args += arg[0]; // start
if (!exists arg[1]) {
info.args += arg[2]; # text
return sprintf("substring(%s from %v) = %v", cn);
}
info.args += arg[1]; # count
info.args += arg[2]; # text
return sprintf("substring(%s from %v for %v) = %v", cn);
},
),
OP_OR: (
"code": string sub (reference<hash<QueryInfo>> info, string cn, list<auto> arg) {
return info.table.getOrClause(\info, arg);
},
),
};
hash<OperatorInfo> make_op(string op, auto arg);
hash<OperatorInfo> op_like(string str);
hash<OperatorInfo> op_lt(auto arg);
hash<OperatorInfo> op_le(auto arg);
hash<OperatorInfo> op_gt(auto arg);
hash<OperatorInfo> op_ge(auto arg);
hash<OperatorInfo> op_ne(auto arg);
hash<OperatorInfo> op_eq(auto arg);
hash<OperatorInfo> op_between(auto l, auto r);
hash<OperatorInfo> op_in();
hash<OperatorInfo> op_in_select(string table, hash<auto> select_hash);
hash<OperatorInfo> op_in_select(AbstractTable table, hash<auto> select_hash);
hash<OperatorInfo> op_in_select(Table table, hash<auto> select_hash);
hash<OperatorInfo> op_in(list<auto> args);
hash<OperatorInfo> op_not(hash arg);
hash<OperatorInfo> op_clt(string arg);
hash<OperatorInfo> op_cle(string arg);
hash<OperatorInfo> op_cgt(string arg);
hash<OperatorInfo> op_cge(string arg);
hash<OperatorInfo> op_cne(string arg);
hash<OperatorInfo> op_ceq(string arg);
hash<OperatorInfo> op_substr(int start, *int count, string text);
hash<OperatorInfo> op_substr(int start, string text);
hash<string, hash<OperatorInfo>> wop_or(hash h1, hash h2);
const IOP_SEQ = "seq";
const IOP_SEQ_CURRVAL = "seq_currval";
const DefaultIopMap = {};
hash<InsertOperatorInfo> make_iop(string iop, auto arg);
hash<InsertOperatorInfo> iop_seq(string arg);
hash<InsertOperatorInfo> iop_seq_currval(string arg);
const SqlUtilDrivers = ...;
// private variable to store the closure used to deserialize datasources (if any)
extern code ds_get;
// private variable to store the closure used to serialize datasources (if any)
extern code ds_do;
sqlutil_register_ds_deserializer(*code new_ds_get);
sqlutil_register_ds_serializer(*code new_ds_do);
// private function used to deserialize datasources
AbstractDatasource sqlutil_get_ds(string type, string config);
// private function used to serialize datasources
hash<auto> sqlutil_ds(AbstractDatasource ds);
class AbstractHashContainer : public Serializable {
public:
protected:
*hash h;
public:
constructor(*hash nh);
constructor(AbstractHashContainer old);
copy(AbstractHashContainer old);
auto memberGate(string k);
clear();
abstract auto take(string k);
renameKey(string old_name, string new_name);
*hash<auto> getHash();
bool matchKeys(hash h1);
bool matchKeys(list<auto> l);
bool matchKeys(AbstractHashContainer c);
bool partialMatchKeys(hash h1);
bool partialMatchKeys(list<auto> l);
bool partialMatchKeys(AbstractHashContainer c);
bool val();
list<string> keys();
list<auto> values();
Qore::AbstractIterator iterator();
Qore::AbstractIterator keyIterator();
Qore::AbstractIterator pairIterator();
bool empty();
int size();
bool hasKey(string k);
bool hasKeyValue(string k);
*string firstKey();
*string lastKey();
abstract string getElementName();
};
class AbstractListContainer : public Serializable {
public:
protected:
softlist l;
public:
constructor(softlist nl);
abstract auto get(softint i);
add(auto val);
auto take(int i);
list<auto> getList();
bool val();
Qore::ListIterator iterator();
bool empty();
int size();
abstract string getElementName();
protected:
checkIndex(int i);
public:
};
class Tables : public AbstractHashContainer {
public:
constructor();
constructor(AbstractDatasource ds, hash tables, *hash<auto> opt);
constructor(AbstractDatasource ds);
add(string k, Table val);
add(string k, AbstractTable val);
add(Table val);
add(AbstractTable val);
AbstractTable take(string k);
populate(AbstractDatasource ds, hash<auto> tables, *hash<auto> opt);
populate(AbstractDatasource ds);
*list<auto> getDropAllForeignConstraintsOnTableSql(string name, *hash<auto> opt);
AbstractTable memberGate(string k);
string getElementName();
*AbstractTable getIfExists(AbstractDatasource ds, string name);
AbstractTable get(AbstractDatasource ds, string name);
*string getRenameTableIfExistsSql(string old_name, string new_name, *hash<auto> opts);
bool tableRenamed(string old_name, string new_name, string old_sql_name);
protected:
tableRenamedIntern(string old_name, string new_name, string oldsn);
public:
*string getDropConstraintIfExistsSql(string tname, string cname, *hash<auto> opts);
list<auto> getCreateList();
Qore::AbstractIterator createIterator();
list<auto> getDropList();
Qore::AbstractIterator dropIterator();
protected:
getDependencies(reference<hash> tdh, reference<hash> sdh, *reference<hash> th);
public:
};
class Columns : public AbstractHashContainer {
public:
constructor(*hash c) ;
constructor(Columns old) ;
add(string k, AbstractColumn val);
AbstractColumn take(string k);
AbstractColumn memberGate(string k);
Columns subset(softlist l);
string getElementName();
bool equal(Columns cols);
AbstractIterator getSqlColumnNameIterator();
};
class AbstractDdlObject : public Serializable {
public:
string name;
string ddl_name;
protected:
constructor();
public:
constructor(string name);
abstract string getDdlName(string name);
};
class AbstractColumn : public AbstractDdlObject {
public:
string native_type;
*string qore_type;
int size;
bool nullable;
*string def_val;
*string comment;
*int scale;
const DefaultVarcharSize = 80;
protected:
constructor();
public:
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string c, *int scale)
;
hash<GenericColumnInfo> getDescriptionHash();
string getNativeTypeString();
string getCreateSql(AbstractTable t);
abstract list<auto> getAddColumnSql(AbstractTable t);
string getDropSql(string table_name);
list<auto> getModifySql(AbstractTable t, AbstractColumn c, *hash<auto> opt);
abstract string getRenameSql(AbstractTable t, string new_name);
bool equal(AbstractColumn c);
protected:
abstract bool equalImpl(AbstractColumn c);
public:
protected:
abstract list<auto> getModifySqlImpl(AbstractTable t, AbstractColumn c, *hash<auto> opt);
public:
};
class Indexes : public AbstractHashContainer {
public:
constructor(*hash c) ;
add(string k, AbstractIndex val);
*AbstractIndex findEqual(AbstractIndex ix);
AbstractIndex take(string k);
*AbstractIndex tryTake(string k);
AbstractIndex memberGate(string k);
string getElementName();
};
class AbstractIndex : public Serializable {
public:
string name;
bool unique;
Columns columns;
protected:
*AbstractColumnSupportingConstraint constraint;
*AbstractForeignConstraint foreign_constraint;
public:
constructor(string n, bool u, hash c);
string getName();
bool hasColumn(string cname);
abstract string getCreateSql(string table_name, *hash<auto> opt);
string getDropSql(string table_name);
bool equal(AbstractIndex ix);
bool equalExceptName(AbstractIndex ix);
abstract bool equalImpl(AbstractIndex ix);
abstract string getRenameSql(string table_name, string new_name);
setSupportingConstraint(AbstractColumnSupportingConstraint c);
setSupportingConstraint();
*AbstractColumnSupportingConstraint getSupportingConstraint();
setSupportingConstraint(AbstractForeignConstraint c);
setForeignConstraint();
*AbstractForeignConstraint getForeignConstraint();
*list<AbstractColumnConstraint> getAllSupportingConstraints();
list<auto> getRecreateSql(AbstractDatasource ds, string table_name, *hash<auto> opt);
};
class Constraints : public AbstractHashContainer {
public:
constructor(*hash c) ;
add(string k, AbstractConstraint val);
AbstractConstraint take(string k);
*AbstractUniqueConstraint findEqualUniqueConstraint(AbstractUniqueConstraint uk);
AbstractConstraint memberGate(string k);
string getElementName();
};
class AbstractConstraint : public Serializable {
public:
protected:
string name;
public:
constructor(string n);
string getName();
rename(string n);
abstract string getCreateSql(string table_name, *hash<auto> opt);
string getDropSql(string table_name);
abstract list<auto> getRenameSql(string table_name, string new_name);
string getDisableSql(string table_name);
string getEnableSql(string table_name, *hash<auto> opt);
bool equal(AbstractConstraint c);
protected:
abstract bool equalImpl(AbstractConstraint c);
public:
abstract bool setIndexBase(string ix);
abstract clearIndex();
bool hasColumn(string cname);
};
class AbstractCheckConstraint : public AbstractConstraint {
public:
string src;
constructor(string n, string n_src) ;
protected:
bool equalImpl(AbstractConstraint c);
public:
bool setIndexBase(string ix);
clearIndex();
};
class AbstractColumnConstraint : public AbstractConstraint,public Columns {
public:
protected:
*string index;
public:
constructor(string name, *hash<auto> cols, *string index) ;
constructor(string name, Columns cols, *string index) ;
bool setIndexBase(string ix);
clearIndex();
};
class AbstractColumnSupportingConstraint : public AbstractColumnConstraint {
public:
protected:
*hash<string, hash<string, AbstractForeignConstraint>> sourceConstraints;
public:
constructor(string name, *hash<auto> cols, *string index) ;
constructor(string name, Columns cols, *string index) ;
Qore::AbstractIterator getSourceConstraintIterator();
hash<auto> getDisableReenableSql(AbstractDatasource ds, string table_name, *hash<auto> opts);
findMatchingIndex(*Indexes indexes);
addSourceConstraint(string tname, AbstractForeignConstraint fk);
removeSourceConstraint(string tname, list<auto> cols);
renameSourceConstraintTable(string old_name, string new_name);
bool hasColumn(string cname);
*string getIndex();
protected:
bool equalImpl(AbstractConstraint c);
public:
abstract string getCreateSql(string table_name, *hash<auto> opts);
};
class AbstractUniqueConstraint : public AbstractColumnSupportingConstraint {
public:
constructor(string n, *hash<auto> c, *string n_index) ;
};
class AbstractPrimaryKey : public AbstractUniqueConstraint {
public:
constructor() ;
constructor(string n, *hash<auto> c) ;
};
class ForeignConstraints : public AbstractHashContainer {
public:
constructor(*hash<auto> c) ;
add(string k, AbstractForeignConstraint val);
AbstractForeignConstraint take(string k);
*AbstractForeignConstraint findEqual(AbstractForeignConstraint fk);
AbstractForeignConstraint memberGate(string k);
*hash<auto> findConstraintOn(string table, softlist<auto> cols);
string getElementName();
};
class ForeignConstraintTarget : public Serializable {
public:
string table;
Columns columns;
constructor(string t, Columns c);
bool equal(ForeignConstraintTarget targ);
};
class AbstractForeignConstraint : public AbstractColumnConstraint {
public:
ForeignConstraintTarget target;
constructor(string name, Columns cols, ForeignConstraintTarget t) ;
protected:
bool equalImpl(AbstractConstraint con);
public:
};
class AbstractSequence : public Serializable {
public:
string name;
number start;
number increment;
*number max;
constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_max);
abstract string getCreateSql(*hash<auto> opt);
string getDropSql(*hash<auto> opt);
abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
};
class AbstractView : public Serializable {
public:
// ! potential object schema
*string schema;
string name;
string src;
bool updatable;
constructor(string n_name, string n_src);
abstract string getCreateSql(*hash<auto> opt);
string getDropSql(*hash<auto> opt);
abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
};
class AbstractFunctionBase : public Serializable {
public:
string name;
string type;
string src;
constructor(string n, string n_type, string n_src);
string getType();
string getDropSql(*hash<auto> opt);
bool equal(AbstractFunctionBase t);
string getNormalizedSource(string src);
protected:
abstract bool equalImpl(AbstractFunctionBase t);
public:
};
class AbstractFunction : public AbstractFunctionBase {
public:
constructor(string n, string n_type, string n_src) ;
abstract list<auto> getCreateSql(*hash<auto> opt);
abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
setName(string new_name);
};
class Functions : public AbstractHashContainer {
public:
constructor(*hash c) ;
add(string k, AbstractFunction val);
AbstractFunction take(string k);
AbstractFunction memberGate(string k);
string getElementName();
};
class AbstractTrigger : public AbstractFunctionBase {
public:
constructor(string n, string n_src) ;
abstract list<auto> getCreateSql(string table_name, *hash<auto> opt);
abstract softlist<auto> getRenameSql(string table_name, string new_name);
abstract list<auto> getDropSql(string table_name);
};
class Triggers : public AbstractHashContainer {
public:
constructor(*hash c) ;
add(string k, AbstractTrigger val);
AbstractTrigger take(string k);
AbstractTrigger memberGate(string k);
string getElementName();
};
};
Qore::AbstractIterator
Qore::ListIterator
SqlUtil::AbstractCheckConstraint
abstract class for check constraints
Definition: SqlUtil.qm.dox.h:6713
SqlUtil::AbstractCheckConstraint::src
string src
the source of the check clause
Definition: SqlUtil.qm.dox.h:6717
SqlUtil::AbstractCheckConstraint::equalImpl
bool equalImpl(AbstractConstraint c)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractCheckConstraint::constructor
constructor(string n, string n_src)
creates the object and sets its name and the check clause source
SqlUtil::AbstractCheckConstraint::setIndexBase
bool setIndexBase(string ix)
returns True if the object supports an index property and is set, False if not
SqlUtil::AbstractCheckConstraint::clearIndex
clearIndex()
clears any index base for the constraint
SqlUtil::AbstractColumnConstraint
the API for a constraint with columns
Definition: SqlUtil.qm.dox.h:6739
SqlUtil::AbstractColumnConstraint::index
*string index
the index supporting the constraint
Definition: SqlUtil.qm.dox.h:6744
SqlUtil::AbstractColumnConstraint::constructor
constructor(string name, Columns cols, *string index)
creates the object from the name and a Columns object
SqlUtil::AbstractColumnConstraint::clearIndex
clearIndex()
clears any index base for the constraint
SqlUtil::AbstractColumnConstraint::constructor
constructor(string name, *hash< auto > cols, *string index)
creates the object from the name and a hash of column information
SqlUtil::AbstractColumnConstraint::setIndexBase
bool setIndexBase(string ix)
returns True if the object supports an index property and is set, False if not
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::AbstractColumn::equalImpl
abstract bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractColumn::getRenameSql
abstract string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
SqlUtil::AbstractColumn::native_type
string native_type
the native type name of the column
Definition: SqlUtil.qm.dox.h:6346
SqlUtil::AbstractColumn::comment
*string comment
comment on the column
Definition: SqlUtil.qm.dox.h:6361
SqlUtil::AbstractColumn::def_val
*string def_val
default value for column
Definition: SqlUtil.qm.dox.h:6358
SqlUtil::AbstractColumn::getModifySql
list< auto > getModifySql(AbstractTable t, AbstractColumn c, *hash< auto > opt)
returns a list of sql strings that can be used to modify the column to the new definition; if the col...
SqlUtil::AbstractColumn::constructor
constructor()
empty constructor for subclasses
SqlUtil::AbstractColumn::getDescriptionHash
hash< GenericColumnInfo > getDescriptionHash()
Returns a description hash of the column.
SqlUtil::AbstractColumn::getModifySqlImpl
abstract list< auto > getModifySqlImpl(AbstractTable t, AbstractColumn c, *hash< auto > opt)
returns a list of sql strings that can be used to modify the column to the new definition
SqlUtil::AbstractColumn::qore_type
*string qore_type
the equivalent qore type name of the column if known
Definition: SqlUtil.qm.dox.h:6349
SqlUtil::AbstractColumn::getCreateSql
string getCreateSql(AbstractTable t)
returns an sql string that can be used to add the column to a table
SqlUtil::AbstractColumn::nullable
bool nullable
True if the column can hold a NULL value, False if not
Definition: SqlUtil.qm.dox.h:6355
SqlUtil::AbstractColumn::equal
bool equal(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractColumn::DefaultVarcharSize
const DefaultVarcharSize
Default VARCHAR column size.
Definition: SqlUtil.qm.dox.h:6367
SqlUtil::AbstractColumn::getNativeTypeString
string getNativeTypeString()
returns the string describing the native type that can be used in SQL
SqlUtil::AbstractColumn::size
int size
the size of the column
Definition: SqlUtil.qm.dox.h:6352
SqlUtil::AbstractColumn::scale
*int scale
the scale for numeric columns
Definition: SqlUtil.qm.dox.h:6364
SqlUtil::AbstractColumn::getDropSql
string getDropSql(string table_name)
returns a string that can be used to drop the column from the table
SqlUtil::AbstractColumnSupportingConstraint
the API for a constraint with columns
Definition: SqlUtil.qm.dox.h:6766
SqlUtil::AbstractColumnSupportingConstraint::getSourceConstraintIterator
Qore::AbstractIterator getSourceConstraintIterator()
returns an iterator through all known source foreign constraints on the current table
SqlUtil::AbstractColumnSupportingConstraint::addSourceConstraint
addSourceConstraint(string tname, AbstractForeignConstraint fk)
adds a foreign constraint source to the unique constraint
SqlUtil::AbstractColumnSupportingConstraint::sourceConstraints
*hash< string, hash< string, AbstractForeignConstraint > > sourceConstraints
a hash of ForeignConstraintSources, keyed by table name, the value is a hash of foreign constraints k...
Definition: SqlUtil.qm.dox.h:6771
SqlUtil::AbstractColumnSupportingConstraint::constructor
constructor(string name, Columns cols, *string index)
creates the object from the name and a Columns object
SqlUtil::AbstractColumnSupportingConstraint::renameSourceConstraintTable
renameSourceConstraintTable(string old_name, string new_name)
renames a table in a source constraint
SqlUtil::AbstractColumnSupportingConstraint::getCreateSql
abstract string getCreateSql(string table_name, *hash< auto > opts)
returns a string that can be used to create the constraint in the database
SqlUtil::AbstractColumnSupportingConstraint::findMatchingIndex
findMatchingIndex(*Indexes indexes)
find an index that matches the constraint and marks both objects as related
SqlUtil::AbstractColumnSupportingConstraint::getIndex
*string getIndex()
returns the name of the associated index, if any
SqlUtil::AbstractColumnSupportingConstraint::getDisableReenableSql
hash< auto > getDisableReenableSql(AbstractDatasource ds, string table_name, *hash< auto > opts)
returns lists of SQL strings to disable this constraint plus any dependent constraints and another li...
SqlUtil::AbstractColumnSupportingConstraint::removeSourceConstraint
removeSourceConstraint(string tname, list< auto > cols)
removes a source constraint
SqlUtil::AbstractColumnSupportingConstraint::equalImpl
bool equalImpl(AbstractConstraint c)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractColumnSupportingConstraint::constructor
constructor(string name, *hash< auto > cols, *string index)
creates the object from the name and a hash of column information
SqlUtil::AbstractColumnSupportingConstraint::hasColumn
bool hasColumn(string cname)
returns True if the constraint references the named column
SqlUtil::AbstractConstraint
abstract base class for constraints
Definition: SqlUtil.qm.dox.h:6651
SqlUtil::AbstractConstraint::setIndexBase
abstract bool setIndexBase(string ix)
returns True if the object supports an index property and is set, False if not
SqlUtil::AbstractConstraint::getDisableSql
string getDisableSql(string table_name)
returns a string that can be used to temporarily disable the constraint from the database; if disabli...
SqlUtil::AbstractConstraint::getName
string getName()
returns the constraint name
SqlUtil::AbstractConstraint::constructor
constructor(string n)
creates the object and sets its name
SqlUtil::AbstractConstraint::getRenameSql
abstract list< auto > getRenameSql(string table_name, string new_name)
returns a list of SQL strings that can be used to rename the constraint in the database
SqlUtil::AbstractConstraint::hasColumn
bool hasColumn(string cname)
returns True if the constraint references the named column
SqlUtil::AbstractConstraint::rename
rename(string n)
renames the constraint
SqlUtil::AbstractConstraint::clearIndex
abstract clearIndex()
clears any index base for the constraint
SqlUtil::AbstractConstraint::getDropSql
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
SqlUtil::AbstractConstraint::name
string name
the name of the constraint
Definition: SqlUtil.qm.dox.h:6658
SqlUtil::AbstractConstraint::equalImpl
abstract bool equalImpl(AbstractConstraint c)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractConstraint::equal
bool equal(AbstractConstraint c)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractConstraint::getEnableSql
string getEnableSql(string table_name, *hash< auto > opt)
returns a string that can be used to enable the constraint in the database; if disabling constraints ...
SqlUtil::AbstractConstraint::getCreateSql
abstract string getCreateSql(string table_name, *hash< auto > opt)
returns a string that can be used to create the constraint in the database
SqlUtil::AbstractDdlObject
the base class for named objects
Definition: SqlUtil.qm.dox.h:6316
SqlUtil::AbstractDdlObject::constructor
constructor()
empty constructor for subclasses
SqlUtil::AbstractDdlObject::getDdlName
abstract string getDdlName(string name)
returns the column name with quoting in case the column name is a reserved word
SqlUtil::AbstractDdlObject::ddl_name
string ddl_name
the name of the object for DDL (in case it's a reserved word)
Definition: SqlUtil.qm.dox.h:6323
SqlUtil::AbstractDdlObject::name
string name
the name of the object
Definition: SqlUtil.qm.dox.h:6320
SqlUtil::AbstractDdlObject::constructor
constructor(string name)
creates the object from the name
SqlUtil::AbstractForeignConstraint
the base class for foreign key constraint information
Definition: SqlUtil.qm.dox.h:6926
SqlUtil::AbstractForeignConstraint::equalImpl
bool equalImpl(AbstractConstraint con)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractForeignConstraint::target
ForeignConstraintTarget target
a ForeignConstraintTarget object to describe the target table and columns
Definition: SqlUtil.qm.dox.h:6930
SqlUtil::AbstractFunctionBase
base class for function or objects with code
Definition: SqlUtil.qm.dox.h:7015
SqlUtil::AbstractFunctionBase::getNormalizedSource
string getNormalizedSource(string src)
returns normalized source for comparisons
SqlUtil::AbstractFunctionBase::name
string name
the name of the object
Definition: SqlUtil.qm.dox.h:7019
SqlUtil::AbstractFunctionBase::equalImpl
abstract bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractFunctionBase::constructor
constructor(string n, string n_type, string n_src)
creates the object from the arguments passed
SqlUtil::AbstractFunctionBase::getDropSql
string getDropSql(*hash< auto > opt)
returns a string that can be used to drop the function from the database
SqlUtil::AbstractFunctionBase::equal
bool equal(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractFunctionBase::src
string src
the source of the object
Definition: SqlUtil.qm.dox.h:7025
SqlUtil::AbstractFunctionBase::type
string type
the type of object
Definition: SqlUtil.qm.dox.h:7022
SqlUtil::AbstractFunctionBase::getType
string getType()
returns the type of object
SqlUtil::AbstractFunction
base class for functions
Definition: SqlUtil.qm.dox.h:7060
SqlUtil::AbstractFunction::getRenameSql
abstract softlist< auto > getRenameSql(string new_name, *hash< auto > opt)
returns a list of strings that can be used to rename the function in the database
SqlUtil::AbstractFunction::setName
setName(string new_name)
sets the new name of the object
SqlUtil::AbstractFunction::getCreateSql
abstract list< auto > getCreateSql(*hash< auto > opt)
returns a list of SQL strings that can be used to create the function in the database
SqlUtil::AbstractFunction::constructor
constructor(string n, string n_type, string n_src)
creates the object from the arguments passed
SqlUtil::AbstractHashContainer
abstract container class that throws an exception if an unknown key is accessed
Definition: SqlUtil.qm.dox.h:5702
SqlUtil::AbstractHashContainer::values
list< auto > values()
Returns a list of values of the contained hash.
SqlUtil::AbstractHashContainer::partialMatchKeys
bool partialMatchKeys(hash h1)
returns True if the hash argument has at least the same keys (in any order, can have more keys),...
SqlUtil::AbstractHashContainer::pairIterator
Qore::AbstractIterator pairIterator()
Returns a HashPairIterator object for the contained hash.
SqlUtil::AbstractHashContainer::hasKeyValue
bool hasKeyValue(string k)
Returns True if the key exists in the contained hash and is assigned a value, False if not.
SqlUtil::AbstractHashContainer::take
abstract auto take(string k)
removes the given key from the contained hash and returns the value
SqlUtil::AbstractHashContainer::keys
list< string > keys()
Returns a list of key names of the contained hash.
SqlUtil::AbstractHashContainer::partialMatchKeys
bool partialMatchKeys(list< auto > l)
returns True if the list<auto> argument has at least the same keys (in any order, can have more keys)...
SqlUtil::AbstractHashContainer::firstKey
*string firstKey()
Returns the first key name in the contained hash or NOTHING if the contained hash has no keys.
SqlUtil::AbstractHashContainer::partialMatchKeys
bool partialMatchKeys(AbstractHashContainer c)
returns True if the container argument has at least the same keys (in any order, can have more keys),...
SqlUtil::AbstractHashContainer::iterator
Qore::AbstractIterator iterator()
Returns a HashIterator object for the contained hash.
SqlUtil::AbstractHashContainer::memberGate
auto memberGate(string k)
returns the value of the given key in the contained hash if it exists, otherwise throws a KEY-ERROR e...
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::getHash
*hash< auto > getHash()
returns the hash contained by this object
SqlUtil::AbstractHashContainer::renameKey
renameKey(string old_name, string new_name)
renames the given key; maintains the key order
SqlUtil::AbstractHashContainer::lastKey
*string lastKey()
Returns the last key name in the contained hash or NOTHING if the contained hash has no keys.
SqlUtil::AbstractHashContainer::clear
clear()
purges the contained data
SqlUtil::AbstractHashContainer::matchKeys
bool matchKeys(hash h1)
returns True if the hash argument has the same keys (in any order), False if not
SqlUtil::AbstractHashContainer::h
*hash h
the data to be contained
Definition: SqlUtil.qm.dox.h:5709
SqlUtil::AbstractHashContainer::getElementName
abstract string getElementName()
must return the name of the contained element
SqlUtil::AbstractHashContainer::keyIterator
Qore::AbstractIterator keyIterator()
Returns a HashKeyIterator object for the contained hash.
SqlUtil::AbstractHashContainer::size
int size()
Returns the number of keys in the contained hash.
SqlUtil::AbstractHashContainer::constructor
constructor(*hash nh)
creates the object with the hash argument passed
SqlUtil::AbstractHashContainer::matchKeys
bool matchKeys(list< auto > l)
returns True if the list<auto> argument has the same list of key strings as the keys in the object (i...
SqlUtil::AbstractHashContainer::constructor
constructor(AbstractHashContainer old)
creates a copy of the object
SqlUtil::AbstractHashContainer::empty
bool empty()
returns True if the container is empty, False if not
SqlUtil::AbstractHashContainer::matchKeys
bool matchKeys(AbstractHashContainer c)
returns True if the container argument has the same keys (in any order), False if not
SqlUtil::AbstractHashContainer::val
bool val()
Returns False if the contained hash has no keys, True if it does.
SqlUtil::AbstractHashContainer::copy
copy(AbstractHashContainer old)
creates a "deep copy" of the object
SqlUtil::AbstractIndex
the abstract base class for index information
Definition: SqlUtil.qm.dox.h:6521
SqlUtil::AbstractIndex::equalExceptName
bool equalExceptName(AbstractIndex ix)
returns True if the argument is equal to the current index with the exception of the name,...
SqlUtil::AbstractIndex::hasColumn
bool hasColumn(string cname)
returns True if the constraint references the named column
SqlUtil::AbstractIndex::foreign_constraint
*AbstractForeignConstraint foreign_constraint
Any foreign constraint that this index supports.
Definition: SqlUtil.qm.dox.h:6538
SqlUtil::AbstractIndex::equalImpl
abstract bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
SqlUtil::AbstractIndex::setForeignConstraint
setForeignConstraint()
clears the supporting constraint
SqlUtil::AbstractIndex::getSupportingConstraint
*AbstractColumnSupportingConstraint getSupportingConstraint()
returns the supporting constraint, if any
SqlUtil::AbstractIndex::getAllSupportingConstraints
*list< AbstractColumnConstraint > getAllSupportingConstraints()
returns all supporting constraints, if any
SqlUtil::AbstractIndex::getCreateSql
abstract string getCreateSql(string table_name, *hash< auto > opt)
returns a string that can be used to create the index in the database
SqlUtil::AbstractIndex::name
string name
the name of the index
Definition: SqlUtil.qm.dox.h:6525
SqlUtil::AbstractIndex::getForeignConstraint
*AbstractForeignConstraint getForeignConstraint()
returns the supporting constraint, if any
SqlUtil::AbstractIndex::constructor
constructor(string n, bool u, hash c)
creates the object from the name, a unique flag, and a hash of column information
SqlUtil::AbstractIndex::setSupportingConstraint
setSupportingConstraint(AbstractForeignConstraint c)
tags the index with a column supporting constraint (unique or fk constraint, etc) that the index supp...
SqlUtil::AbstractIndex::setSupportingConstraint
setSupportingConstraint(AbstractColumnSupportingConstraint c)
tags the index with a column supporting constraint (unique or fk constraint, etc) that the index supp...
SqlUtil::AbstractIndex::unique
bool unique
True if the index is a unique index, False if not
Definition: SqlUtil.qm.dox.h:6528
SqlUtil::AbstractIndex::constraint
*AbstractColumnSupportingConstraint constraint
the AbstractColumnSupportingConstraint that this index supports, if any
Definition: SqlUtil.qm.dox.h:6535
SqlUtil::AbstractIndex::getName
string getName()
returns the index name
SqlUtil::AbstractIndex::setSupportingConstraint
setSupportingConstraint()
clears the supporting constraint
SqlUtil::AbstractIndex::equal
bool equal(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
SqlUtil::AbstractIndex::getDropSql
string getDropSql(string table_name)
returns a string that can be used to drop the index from the database
SqlUtil::AbstractIndex::getRenameSql
abstract string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
SqlUtil::AbstractIndex::getRecreateSql
list< auto > getRecreateSql(AbstractDatasource ds, string table_name, *hash< auto > opt)
returns a list of strings to drop and recreate the current index; if there are dependent constraints,...
SqlUtil::AbstractIndex::columns
Columns columns
an object of class Columns representing the columns in the index
Definition: SqlUtil.qm.dox.h:6531
SqlUtil::AbstractListContainer
abstract container class that throws an exception if an unknown key is accessed
Definition: SqlUtil.qm.dox.h:5983
SqlUtil::AbstractListContainer::empty
bool empty()
returns True if the container is empty, False if not
SqlUtil::AbstractListContainer::getList
list< auto > getList()
returns the list contained by this object
SqlUtil::AbstractListContainer::get
abstract auto get(softint i)
returns the value of the given element in the contained list if it exists, otherwise throws an ELEMEN...
SqlUtil::AbstractListContainer::take
auto take(int i)
removes the given element from the contained list and returns the value
SqlUtil::AbstractListContainer::add
add(auto val)
adds the given value to the list
SqlUtil::AbstractListContainer::val
bool val()
Returns False if the contained list is empty, True if not.
SqlUtil::AbstractListContainer::getElementName
abstract string getElementName()
must return the name of the contained element
SqlUtil::AbstractListContainer::constructor
constructor(softlist nl)
creates the object with the list<auto> argument passed
SqlUtil::AbstractListContainer::iterator
Qore::ListIterator iterator()
Returns a ListIterator object for the contained list.
SqlUtil::AbstractListContainer::size
int size()
Returns the number of elements in the contained list.
SqlUtil::AbstractPrimaryKey
represents a primary key
Definition: SqlUtil.qm.dox.h:6849
SqlUtil::AbstractSequence
base class for sequences
Definition: SqlUtil.qm.dox.h:6943
SqlUtil::AbstractSequence::max
*number max
the ending number
Definition: SqlUtil.qm.dox.h:6956
SqlUtil::AbstractSequence::name
string name
the name of the sequence
Definition: SqlUtil.qm.dox.h:6947
SqlUtil::AbstractSequence::getDropSql
string getDropSql(*hash< auto > opt)
returns a string that can be used to drop the sequence from the database
SqlUtil::AbstractSequence::getRenameSql
abstract softlist< auto > getRenameSql(string new_name, *hash< auto > opt)
returns a list of strings that can be used to rename the sequence in the database
SqlUtil::AbstractSequence::getCreateSql
abstract string getCreateSql(*hash< auto > opt)
returns a string that can be used to create the sequence in the database
SqlUtil::AbstractSequence::start
number start
the starting number
Definition: SqlUtil.qm.dox.h:6950
SqlUtil::AbstractSequence::increment
number increment
the increment
Definition: SqlUtil.qm.dox.h:6953
SqlUtil::AbstractSequence::constructor
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_max)
creates the object from the arguments
SqlUtil::AbstractTable
the base abstract class for the table implementation
Definition: AbstractTable.qc.dox.h:30
SqlUtil::AbstractTrigger
the base class for triggers
Definition: SqlUtil.qm.dox.h:7124
SqlUtil::AbstractTrigger::constructor
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
SqlUtil::AbstractTrigger::getCreateSql
abstract list< auto > getCreateSql(string table_name, *hash< auto > opt)
returns a string that can be used to create the trigger in the database
SqlUtil::AbstractTrigger::getRenameSql
abstract softlist< auto > getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
SqlUtil::AbstractTrigger::getDropSql
abstract list< auto > getDropSql(string table_name)
returns a string that can be used to drop the trigger in the database
SqlUtil::AbstractUniqueConstraint
represents a unique column constraint
Definition: SqlUtil.qm.dox.h:6840
SqlUtil::AbstractUniqueConstraint::constructor
constructor(string n, *hash< auto > c, *string n_index)
creates the object from the name an a hash of column information
SqlUtil::AbstractView
base class for views
Definition: SqlUtil.qm.dox.h:6979
SqlUtil::AbstractView::getRenameSql
abstract softlist< auto > getRenameSql(string new_name, *hash< auto > opt)
returns a list with command(s) that can be used to rename the view in the database
SqlUtil::AbstractView::updatable
bool updatable
Flag showing if is the view updatable with DML commands.
Definition: SqlUtil.qm.dox.h:6992
SqlUtil::AbstractView::name
string name
the name of the sequence
Definition: SqlUtil.qm.dox.h:6986
SqlUtil::AbstractView::constructor
constructor(string n_name, string n_src)
creates the object from the arguments
SqlUtil::AbstractView::src
string src
the source code
Definition: SqlUtil.qm.dox.h:6989
SqlUtil::AbstractView::getDropSql
string getDropSql(*hash< auto > opt)
returns a string that can be used to drop the view from the database
SqlUtil::AbstractView::getCreateSql
abstract string getCreateSql(*hash< auto > opt)
returns a string that can be used to create the view in the database
SqlUtil::Columns
column container class that throws an exception if an unknown column is accessed
Definition: SqlUtil.qm.dox.h:6260
SqlUtil::Columns::equal
bool equal(Columns cols)
returns True if the argument has the same columns in the same order as the current object,...
SqlUtil::Columns::add
add(string k, AbstractColumn val)
adds the given value to the hash with the given key name
SqlUtil::Columns::subset
Columns subset(softlist l)
returns a subset of the current columns according to the list<auto> argument
SqlUtil::Columns::getElementName
string getElementName()
returns "column" since this object stores column objects
SqlUtil::Columns::getSqlColumnNameIterator
AbstractIterator getSqlColumnNameIterator()
returns an iterator for column SQL names
SqlUtil::Columns::memberGate
AbstractColumn memberGate(string k)
returns the AbstractColumn object corresponding to the key given or throws a KEY-ERROR exception
SqlUtil::Columns::take
AbstractColumn take(string k)
removes the given key from the contained hash and returns the value
SqlUtil::Columns::constructor
constructor(Columns old)
creates a copy of the object
SqlUtil::Columns::constructor
constructor(*hash c)
creates the object from the argument
SqlUtil::Constraints
constraint container class that throws an exception if an unknown constraint is accessed
Definition: SqlUtil.qm.dox.h:6609
SqlUtil::Constraints::memberGate
AbstractConstraint memberGate(string k)
returns the AbstractConstraint object corresponding to the key given or throws a KEY-ERROR exception
SqlUtil::Constraints::take
AbstractConstraint take(string k)
removes the given key from the contained hash and returns the value
SqlUtil::Constraints::findEqualUniqueConstraint
*AbstractUniqueConstraint findEqualUniqueConstraint(AbstractUniqueConstraint uk)
finds a unique constraint with the same columns as the unique constraint passed
SqlUtil::Constraints::add
add(string k, AbstractConstraint val)
adds the given value to the hash with the given key name
SqlUtil::Constraints::getElementName
string getElementName()
must return the name of the contained element
SqlUtil::ForeignConstraintTarget
a class describing a foreign constraint target
Definition: SqlUtil.qm.dox.h:6907
SqlUtil::ForeignConstraintTarget::constructor
constructor(string t, Columns c)
creates the object and sets the target table name and the target columns
SqlUtil::ForeignConstraintTarget::equal
bool equal(ForeignConstraintTarget targ)
returns True if the argument is equal to the current object, False if not
SqlUtil::ForeignConstraintTarget::columns
Columns columns
columns in the target table
Definition: SqlUtil.qm.dox.h:6914
SqlUtil::ForeignConstraintTarget::table
string table
the name of the target table
Definition: SqlUtil.qm.dox.h:6911
SqlUtil::ForeignConstraints
foreign constraint container class that throws an exception if an unknown constraint is accessed
Definition: SqlUtil.qm.dox.h:6860
SqlUtil::ForeignConstraints::take
AbstractForeignConstraint take(string k)
removes the given key from the contained hash and returns the value
SqlUtil::ForeignConstraints::findEqual
*AbstractForeignConstraint findEqual(AbstractForeignConstraint fk)
find an index with columns equal to the index passed
SqlUtil::ForeignConstraints::findConstraintOn
*hash< auto > findConstraintOn(string table, softlist< auto > cols)
returns either a hash of AbstractColumn information or NOTHING if no foreign constraint can be found ...
SqlUtil::ForeignConstraints::add
add(string k, AbstractForeignConstraint val)
adds the given value to the hash with the given key name
SqlUtil::ForeignConstraints::getElementName
string getElementName()
returns "foreign constraint" for the type of object encapsulated
SqlUtil::ForeignConstraints::memberGate
AbstractForeignConstraint memberGate(string k)
returns the AbstractForeignConstraint object corresponding to the key given or throws a KEY-ERROR exc...
SqlUtil::Functions
function container class that throws an exception if an unknown function is accessed
Definition: SqlUtil.qm.dox.h:7086
SqlUtil::Functions::add
add(string k, AbstractFunction val)
adds the given value to the hash with the given key name
SqlUtil::Functions::take
AbstractFunction take(string k)
removes the given key from the contained hash and returns the value
SqlUtil::Functions::getElementName
string getElementName()
must return the name of the contained element
SqlUtil::Functions::memberGate
AbstractFunction memberGate(string k)
returns the AbstractFunction object corresponding to the key given or throws a KEY-ERROR exception
SqlUtil::Indexes
index container class that throws an exception if an unknown index is accessed
Definition: SqlUtil.qm.dox.h:6475
SqlUtil::Indexes::getElementName
string getElementName()
must return the name of the contained element
SqlUtil::Indexes::take
AbstractIndex take(string k)
removes the given key from the contained hash and returns the value
SqlUtil::Indexes::tryTake
*AbstractIndex tryTake(string k)
tries to remove the given key from the contained hash and returns the value if it exists
SqlUtil::Indexes::findEqual
*AbstractIndex findEqual(AbstractIndex ix)
find an index with columns equal to the index passed
SqlUtil::Indexes::add
add(string k, AbstractIndex val)
adds the given value to the hash with the given key name
SqlUtil::Indexes::memberGate
AbstractIndex memberGate(string k)
returns the AbstractIndex object corresponding to the key given or throws a KEY-ERROR exception
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::Tables::memberGate
AbstractTable memberGate(string k)
returns the AbstractTable object corresponding to the key given or throws a KEY-ERROR exception
SqlUtil::Tables::dropIterator
Qore::AbstractIterator dropIterator()
returns an iterator for a list of cached table names in the order that can be used to drop the tables...
SqlUtil::Tables::constructor
constructor(AbstractDatasource ds, hash tables, *hash< auto > opt)
creates and populates the object from a hash<auto> description
SqlUtil::Tables::populate
populate(AbstractDatasource ds, hash< auto > tables, *hash< auto > opt)
populates the object from a hash<auto> description
SqlUtil::Tables::tableRenamed
bool tableRenamed(string old_name, string new_name, string old_sql_name)
updates table names and internal references for renamed tables
SqlUtil::Tables::add
add(AbstractTable val)
adds the given value to the hash with the given key name
SqlUtil::Tables::getDropList
list< auto > getDropList()
returns a list of cached table names in the order that can be used to drop the tables,...
SqlUtil::Tables::add
add(string k, Table val)
adds the given value to the hash with the given key name
SqlUtil::Tables::take
AbstractTable take(string k)
removes the given key from the contained hash and returns the value
SqlUtil::Tables::getIfExists
*AbstractTable getIfExists(AbstractDatasource ds, string name)
gets a table from the database or from the cache if already cached; if the table does not exist,...
SqlUtil::Tables::populate
populate(AbstractDatasource ds)
populates the object from tables in the database
SqlUtil::Tables::constructor
constructor(AbstractDatasource ds)
creates and populates the object from tables in the database
SqlUtil::Tables::add
add(string k, AbstractTable val)
adds the given value to the hash with the given key name
SqlUtil::Tables::getDropConstraintIfExistsSql
*string getDropConstraintIfExistsSql(string tname, string cname, *hash< auto > opts)
returns an SQL string that can be used to drop an existing constraint on a table, if the table is not...
SqlUtil::Tables::getDropAllForeignConstraintsOnTableSql
*list< auto > getDropAllForeignConstraintsOnTableSql(string name, *hash< auto > opt)
returns a list of SQL strings that can be used to drop all the foreign constraints on a particular ta...
SqlUtil::Tables::add
add(Table val)
adds the given value to the hash with the given key name
SqlUtil::Tables::getRenameTableIfExistsSql
*string getRenameTableIfExistsSql(string old_name, string new_name, *hash< auto > opts)
returns an SQL string that can be used to rename the given table if it exists and the target does not...
SqlUtil::Tables::getElementName
string getElementName()
returns "table" since this object stores AbstractTable objects
SqlUtil::Tables::constructor
constructor()
creates an empty object
SqlUtil::Tables::get
AbstractTable get(AbstractDatasource ds, string name)
gets a table from the database or from the cache if already cached
SqlUtil::Triggers
trigger container class that throws an exception if an unknown trigger is accessed
Definition: SqlUtil.qm.dox.h:7142
SqlUtil::Triggers::memberGate
AbstractTrigger memberGate(string k)
returns the AbstractTrigger object corresponding to the key given or throws a KEY-ERROR exception
SqlUtil::Triggers::take
AbstractTrigger take(string k)
removes the given key from the contained hash and returns the value
SqlUtil::Triggers::add
add(string k, AbstractTrigger val)
adds the given value to the hash with the given key name
SqlUtil::Triggers::getElementName
string getElementName()
must return the name of the contained element
True
const True
False
const False
exp
number exp(number n)
exists
bool exists(...)
NULL
const NULL
sprintf
string sprintf(string fmt,...)
NT_STRING
const NT_STRING
hash
hash< auto > hash(object obj)
type
string type(auto arg)
number
number number(softnumber n)
SqlUtil
Qore AbstractDatabase class definition.
Definition: AbstractDatabase.qc.dox.h:26
SqlUtil::join_right_alias
hash< string, hash< JoinOperatorInfo > > join_right_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for right outer joins with the given arguments for use when joining with a table other...
SqlUtil::COP_MAX
const COP_MAX
to return the maximum value
Definition: SqlUtil.qm.dox.h:2508
SqlUtil::DT_YEAR
const DT_YEAR
Format unit: year.
Definition: SqlUtil.qm.dox.h:3572
SqlUtil::COP_OVER
const COP_OVER
the SQL "over" clause
Definition: SqlUtil.qm.dox.h:2528
SqlUtil::op_ge
hash< OperatorInfo > op_ge(auto arg)
returns an OperatorInfo hash for the ">=" operator with the given argument for use in where clauses w...
SqlUtil::COP_SEQ_CURRVAL
const COP_SEQ_CURRVAL
to return the last value of a sequence issued in the same session
Definition: SqlUtil.qm.dox.h:2578
SqlUtil::COP_LENGTH
const COP_LENGTH
to get the length of a text field
Definition: SqlUtil.qm.dox.h:2595
SqlUtil::COP_RANK
const COP_RANK
Analytic (window) function: RANK.
Definition: SqlUtil.qm.dox.h:2653
SqlUtil::COP_VALUE
const COP_VALUE
to append a constant value (SQL Literal) to use as an output column value
Definition: SqlUtil.qm.dox.h:2483
SqlUtil::OP_GE
const OP_GE
the SQL greater than or equals operator (>=) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4303
SqlUtil::COP_COALESCE
const COP_COALESCE
to return the first non-null argument in the list
Definition: SqlUtil.qm.dox.h:2583
SqlUtil::cop_year_hour
hash< ColumnOperatorInfo > cop_year_hour(auto column)
returns a ColumnOperatorInfo hash for the "year_hour" operator with the given argument
SqlUtil::OP_NE
const OP_NE
the SQL not equals operator (!= or <>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4308
SqlUtil::sqlutil_register_ds_deserializer
sqlutil_register_ds_deserializer(*code new_ds_get)
registers a closure or call reference taking a string type and string datasource configuration that w...
SqlUtil::CLOB
const CLOB
specifies a large variable-length character column (ie CLOB or TEXT, etc)
Definition: SqlUtil.qm.dox.h:2436
SqlUtil::cop_seq_currval
hash< ColumnOperatorInfo > cop_seq_currval(string seq, *string as)
returns a ColumnOperatorInfo hash for the "seq_currval" operator with the given argument giving the s...
SqlUtil::cop_coalesce
hash< ColumnOperatorInfo > cop_coalesce(auto col1, auto col2)
returns a ColumnOperatorInfo hash for the "coalesce" operator with the given column arguments; the fi...
SqlUtil::cop_percent_rank
hash< ColumnOperatorInfo > cop_percent_rank()
Analytic/window function: relative rank of the current row.
SqlUtil::uop_seq
hash< UpdateOperatorInfo > uop_seq(string seq)
returns an UpdateOperatorInfo hash for the "seq" operator with the given argument giving the sequence...
SqlUtil::join_left_alias
hash< string, hash< JoinOperatorInfo > > join_left_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for left outer joins with the given arguments for use when joining with a table other ...
SqlUtil::cop_dense_rank
hash< ColumnOperatorInfo > cop_dense_rank()
Analytic/window function: rank of the current row without gaps.
SqlUtil::OP_LE
const OP_LE
the SQL less than or equals (<=) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4293
SqlUtil::SZ_NONE
const SZ_NONE
the data type does not take a size parameter
Definition: SqlUtil.qm.dox.h:2444
SqlUtil::OP_EQ
const OP_EQ
the SQL equals operator (=) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4313
SqlUtil::COP_MIN
const COP_MIN
to return the minimum value
Definition: SqlUtil.qm.dox.h:2503
SqlUtil::DB_SYNONYMS
const DB_SYNONYMS
Feature: synonyms.
Definition: SqlUtil.qm.dox.h:2416
SqlUtil::DB_PACKAGES
const DB_PACKAGES
Feature: packages.
Definition: SqlUtil.qm.dox.h:2404
SqlUtil::DefaultUopMap
const DefaultUopMap
a hash of valid update operators
Definition: SqlUtil.qm.dox.h:3598
SqlUtil::COP_YEAR_HOUR
const COP_YEAR_HOUR
to return a date value with year to hextern information
Definition: SqlUtil.qm.dox.h:2568
SqlUtil::join_inner_alias
hash< string, hash< JoinOperatorInfo > > join_inner_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for standard inner joins with the given arguments for use when joining with a table ot...
SqlUtil::sqlutil_register_ds_serializer
sqlutil_register_ds_serializer(*code new_ds_do)
registers a closure or call reference taking a string type and string datasource configuration that w...
SqlUtil::op_substr
hash< OperatorInfo > op_substr(int start, *int count, string text)
returns an OperatorInfo hash for the "substr" operator with the given arguments; for use in where cla...
SqlUtil::COP_DIVIDE
const COP_DIVIDE
the SQL "divide" operator
Definition: SqlUtil.qm.dox.h:2543
SqlUtil::IOP_SEQ
const IOP_SEQ
for using the value of a sequence
Definition: SqlUtil.qm.dox.h:5621
SqlUtil::cop_prepend
hash< ColumnOperatorInfo > cop_prepend(auto column, string arg)
returns a ColumnOperatorInfo hash for the "prepend" operator with the given argument
SqlUtil::cop_ntile
hash< ColumnOperatorInfo > cop_ntile(int value)
Analytic/window function: integer ranging from 1 to the argument value, dividing the partition as equ...
SqlUtil::DT_MINUTE
const DT_MINUTE
Format unit: minute.
Definition: SqlUtil.qm.dox.h:3584
SqlUtil::VARCHAR
const VARCHAR
specifies a VARCHAR column (equivalent to Qore::Type::String)
Definition: SqlUtil.qm.dox.h:2424
SqlUtil::op_cle
hash< OperatorInfo > op_cle(string arg)
returns an OperatorInfo hash for the "<=" operator with the given argument for use in where clauses w...
SqlUtil::op_ne
hash< OperatorInfo > op_ne(auto arg)
returns an OperatorInfo hash for the "!=" or "<>" operator with the given argument for use in where c...
SqlUtil::OP_IN
const OP_IN
the SQL "in" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4353
SqlUtil::JopMap
const JopMap
a hash of valid join operators
Definition: SqlUtil.qm.dox.h:3809
SqlUtil::cop_avg
hash< ColumnOperatorInfo > cop_avg(auto column)
returns a ColumnOperatorInfo hash for the "avg" operator; returns average column values
SqlUtil::cop_over
hash< ColumnOperatorInfo > cop_over(auto column, *string partitionby, *string orderby)
returns a ColumnOperatorInfo hash for the "over" clause
SqlUtil::OP_NOT
const OP_NOT
the SQL "not" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4358
SqlUtil::op_eq
hash< OperatorInfo > op_eq(auto arg)
returns an OperatorInfo hash for the "=" operator with the given argument for use in where clauses wh...
SqlUtil::cop_sum
hash< ColumnOperatorInfo > cop_sum(auto column)
returns a ColumnOperatorInfo hash for the "sum" operator; returns the total sum of a numeric column.
SqlUtil::COP_YEAR
const COP_YEAR
to return a date value with year information only
Definition: SqlUtil.qm.dox.h:2553
SqlUtil::DefaultExpressionMap
const DefaultExpressionMap
Default expressions to be supported by all SqlUtil modules.
Definition: SqlUtil.qm.dox.h:4376
SqlUtil::join_inner
hash< string, hash< JoinOperatorInfo > > join_inner(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for standard inner joins with the given arguments
SqlUtil::DefaultOpMap
const DefaultOpMap
a hash of valid operators for use in Where Clauses
Definition: SqlUtil.qm.dox.h:5083
SqlUtil::uop_minus
hash< UpdateOperatorInfo > uop_minus(auto arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "-" operator with the given arguments
SqlUtil::uop_plus
hash< UpdateOperatorInfo > uop_plus(auto arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "+" operator with the given arguments
SqlUtil::SqlUtilDrivers
const SqlUtilDrivers
known drivers
Definition: SqlUtil.qm.dox.h:5676
SqlUtil::op_ceq
hash< OperatorInfo > op_ceq(string arg)
returns an OperatorInfo hash for the "=" operator with the given argument for use in where clauses wh...
SqlUtil::cop_value
hash< ColumnOperatorInfo > cop_value(auto arg)
returns a ColumnOperatorInfo hash for the "value" (literal) operator with the given argument
SqlUtil::iop_seq_currval
hash< InsertOperatorInfo > iop_seq_currval(string arg)
returns an InsertOperatorInfo hash for retrieving the current value of the given sequence in insert q...
SqlUtil::join_left
hash< string, hash< JoinOperatorInfo > > join_left(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for left outer joins with the given arguments
SqlUtil::DB_MVIEWS
const DB_MVIEWS
Feature: materialized views / snapshots.
Definition: SqlUtil.qm.dox.h:2402
SqlUtil::COP_COUNT
const COP_COUNT
to return the row count
Definition: SqlUtil.qm.dox.h:2523
SqlUtil::uop_seq_currval
hash< UpdateOperatorInfo > uop_seq_currval(string seq)
returns an UpdateOperatorInfo hash for the "seq" operator with the given argument giving the sequence...
SqlUtil::COP_MULTIPLY
const COP_MULTIPLY
the SQL "multiply" operator
Definition: SqlUtil.qm.dox.h:2548
SqlUtil::cop_rank
hash< ColumnOperatorInfo > cop_rank()
Analytic/window function: rank of the current row with gaps.
SqlUtil::OP_SUBSTR
const OP_SUBSTR
the SQL "substr" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4363
SqlUtil::COP_AVG
const COP_AVG
to return the average value
Definition: SqlUtil.qm.dox.h:2513
SqlUtil::cop_year_month
hash< ColumnOperatorInfo > cop_year_month(auto column)
returns a ColumnOperatorInfo hash for the "year_month" operator with the given argument
SqlUtil::cop_upper
hash< ColumnOperatorInfo > cop_upper(auto column)
returns a ColumnOperatorInfo hash for the "upper" operator with the given argument; returns a column ...
SqlUtil::DT_SECOND
const DT_SECOND
Format unit: hour.
Definition: SqlUtil.qm.dox.h:3587
SqlUtil::OP_CGE
const OP_CGE
the SQL greater than or equals operator (>=) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4333
SqlUtil::COP_PLUS
const COP_PLUS
the SQL "plus" operator
Definition: SqlUtil.qm.dox.h:2538
SqlUtil::COP_CUME_DIST
const COP_CUME_DIST
Analytic (window) function: CUME_DIST.
Definition: SqlUtil.qm.dox.h:2611
SqlUtil::op_in
hash< OperatorInfo > op_in()
returns an OperatorInfo hash for the "in" operator with all arguments passed to the function; for use...
SqlUtil::cop_trunc_date
hash< ColumnOperatorInfo > cop_trunc_date(auto column, string mask)
Truncates a date column or value regarding the given mask. The resulting value remains Qore::date (no...
SqlUtil::DefaultIopMap
const DefaultIopMap
a hash of default insert operator descriptions (currently empty, all operators are driver-dependent)
Definition: SqlUtil.qm.dox.h:5629
SqlUtil::op_like
hash< OperatorInfo > op_like(string str)
returns an OperatorInfo hash for the "like" operator with the given argument for use in where clauses
SqlUtil::cop_plus
hash< ColumnOperatorInfo > cop_plus(auto column1, auto column2)
returns a ColumnOperatorInfo hash for the "+" operator with the given arguments
SqlUtil::DT_MONTH
const DT_MONTH
Format unit: month.
Definition: SqlUtil.qm.dox.h:3575
SqlUtil::SZ_NUM
const SZ_NUM
the data type is numeric so takes an optional precision and scale
Definition: SqlUtil.qm.dox.h:2453
SqlUtil::COP_SUBSTR
const COP_SUBSTR
to extract a substring from a column
Definition: SqlUtil.qm.dox.h:2588
SqlUtil::COP_SEQ
const COP_SEQ
to return the next value of a sequence
Definition: SqlUtil.qm.dox.h:2573
SqlUtil::SZ_MAND
const SZ_MAND
the data type takes a mandatory size parameter
Definition: SqlUtil.qm.dox.h:2447
SqlUtil::cop_append
hash< ColumnOperatorInfo > cop_append(auto column, string arg)
returns a ColumnOperatorInfo hash for the "append" operator with the given argument
SqlUtil::uop_divide
hash< UpdateOperatorInfo > uop_divide(auto arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "/" operator with the given arguments
SqlUtil::COP_APPEND
const COP_APPEND
to append a string to a column on output
Definition: SqlUtil.qm.dox.h:2478
SqlUtil::BLOB
const BLOB
specifies a large variable-length binary column (ie BLOB or BYTEA, etc)
Definition: SqlUtil.qm.dox.h:2433
SqlUtil::op_in_select
hash< OperatorInfo > op_in_select(string table, hash< auto > select_hash)
returns an OperatorInfo hash for the "in" operator with a subquery as the argument; for use in where ...
SqlUtil::join_right
hash< string, hash< JoinOperatorInfo > > join_right(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for right outer joins with the given arguments
SqlUtil::cop_as
hash< ColumnOperatorInfo > cop_as(auto column, string arg)
returns a ColumnOperatorInfo hash for the "as" operator with the given argument
SqlUtil::DB_PROCEDURES
const DB_PROCEDURES
Feature: procedures.
Definition: SqlUtil.qm.dox.h:2406
SqlUtil::make_op
hash< OperatorInfo > make_op(string op, auto arg)
returns an OperatorInfo hash
SqlUtil::COP_PERCENT_RANK
const COP_PERCENT_RANK
Analytic (window) function: PERCENT_RANK.
Definition: SqlUtil.qm.dox.h:2646
SqlUtil::COP_NTILE
const COP_NTILE
Analytic (window) function: NTILE.
Definition: SqlUtil.qm.dox.h:2639
SqlUtil::cop_last_value
hash< ColumnOperatorInfo > cop_last_value(any column)
Analytic/window function: value evaluated at the row that is the last row of the window frame.
SqlUtil::OP_LT
const OP_LT
the SQL less than (<) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4288
SqlUtil::OP_CLE
const OP_CLE
the SQL less than or equals (<=) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4323
SqlUtil::COP_YEAR_MONTH
const COP_YEAR_MONTH
to return a date value with year to month information
Definition: SqlUtil.qm.dox.h:2558
SqlUtil::make_jop
hash< string, hash< JoinOperatorInfo > > make_jop(string jop, AbstractTable table, *string alias, *hash jcols, *hash cond, *string ta, *hash< auto > opt)
returns hash keyed with the table name assigned to a JoinOperatorInfo hash
SqlUtil::cop_lower
hash< ColumnOperatorInfo > cop_lower(auto column)
returns a ColumnOperatorInfo hash for the "lower" operator with the given argument; returns a column ...
SqlUtil::OP_BETWEEN
const OP_BETWEEN
the SQL "between" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4348
SqlUtil::cop_cume_dist
hash< ColumnOperatorInfo > cop_cume_dist()
Analytic/window function: relative rank of the current row.
SqlUtil::DB_TABLES
const DB_TABLES
Feature: tables.
Definition: SqlUtil.qm.dox.h:2410
SqlUtil::uop_upper
hash< UpdateOperatorInfo > uop_upper(*hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "upper" operator with the given argument; returns a column...
SqlUtil::cop_year
hash< ColumnOperatorInfo > cop_year(auto column)
returns a ColumnOperatorInfo hash for the "year" operator with the given argument
SqlUtil::uop_prepend
hash< UpdateOperatorInfo > uop_prepend(string arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "prepend" operator with the given argument
SqlUtil::COP_PREPEND
const COP_PREPEND
to prepend a string to a column on output
Definition: SqlUtil.qm.dox.h:2473
SqlUtil::make_iop
hash< InsertOperatorInfo > make_iop(string iop, auto arg)
returns an InsertOperatorInfo hash
SqlUtil::cop_divide
hash< ColumnOperatorInfo > cop_divide(auto column1, auto column2)
returns a ColumnOperatorInfo hash for the "/" operator with the given arguments
SqlUtil::op_cne
hash< OperatorInfo > op_cne(string arg)
returns an OperatorInfo hash for the "!=" or "<>" operator with the given argument for use in where c...
SqlUtil::COP_LOWER
const COP_LOWER
to return column value in lower case
Definition: SqlUtil.qm.dox.h:2493
SqlUtil::make_uop
hash< UpdateOperatorInfo > make_uop(string uop, auto arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash
SqlUtil::wop_or
hash< string, hash< OperatorInfo > > wop_or(hash h1, hash h2)
returns an OperatorInfo hash with a fake "_OR_" column name; the list of arguments to the function is...
SqlUtil::cop_distinct
hash< ColumnOperatorInfo > cop_distinct(auto column)
returns a ColumnOperatorInfo hash for the "distinct" operator with the given argument; returns distin...
SqlUtil::make_cop
hash< ColumnOperatorInfo > make_cop(string cop, auto column, auto arg)
returns a ColumnOperatorInfo hash
SqlUtil::cop_multiply
hash< ColumnOperatorInfo > cop_multiply(auto column1, auto column2)
returns a ColumnOperatorInfo hash for the "*" operator with the given arguments
SqlUtil::op_between
hash< OperatorInfo > op_between(auto l, auto r)
returns an OperatorInfo hash for the "between" operator with the given arguments, neither of which ca...
SqlUtil::DB_VIEWS
const DB_VIEWS
Feature: views.
Definition: SqlUtil.qm.dox.h:2414
SqlUtil::cop_length
hash< ColumnOperatorInfo > cop_length(auto column)
returns a ColumnOperatorInfo hash for the "len" operator with the given argument; returns the length ...
SqlUtil::op_cge
hash< OperatorInfo > op_cge(string arg)
returns an OperatorInfo hash for the ">=" operator with the given argument for use in where clauses w...
SqlUtil::COP_AS
const COP_AS
to rename a column on output
Definition: SqlUtil.qm.dox.h:2463
SqlUtil::uop_lower
hash< UpdateOperatorInfo > uop_lower(*hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "lower" operator with the given argument; returns a column...
SqlUtil::COP_CAST
const COP_CAST
to convert column value into another datatype
Definition: SqlUtil.qm.dox.h:2468
SqlUtil::JOP_INNER
const JOP_INNER
for standard inner joins
Definition: SqlUtil.qm.dox.h:3796
SqlUtil::OP_GT
const OP_GT
the SQL greater than operator (>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4298
SqlUtil::DT_HOUR
const DT_HOUR
Format unit: hour.
Definition: SqlUtil.qm.dox.h:3581
SqlUtil::COP_ROW_NUMBER
const COP_ROW_NUMBER
Analytic (window) function: ROW_NUMBER.
Definition: SqlUtil.qm.dox.h:2660
SqlUtil::cop_count
hash< ColumnOperatorInfo > cop_count(auto column='')
returns a ColumnOperatorInfo hash for the "count" operator; returns row counts
SqlUtil::op_clt
hash< OperatorInfo > op_clt(string arg)
returns an OperatorInfo hash for the "<" operator with the given argument for use in where clauses wh...
SqlUtil::cop_max
hash< ColumnOperatorInfo > cop_max(auto column)
returns a ColumnOperatorInfo hash for the "max" operator; returns maximum column values
SqlUtil::SZ_OPT
const SZ_OPT
the data type takes an optional size parameter
Definition: SqlUtil.qm.dox.h:2450
SqlUtil::CHAR
const CHAR
specifies a CHAR column
Definition: SqlUtil.qm.dox.h:2430
SqlUtil::COP_YEAR_DAY
const COP_YEAR_DAY
to return a date value with year to day information
Definition: SqlUtil.qm.dox.h:2563
SqlUtil::cop_substr
hash< ColumnOperatorInfo > cop_substr(auto column, int start, *int count)
returns a ColumnOperatorInfo hash for the "substr" operator with the given arguments; returns a subst...
SqlUtil::uop_multiply
hash< UpdateOperatorInfo > uop_multiply(auto arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "*" operator with the given arguments
SqlUtil::op_lt
hash< OperatorInfo > op_lt(auto arg)
returns an OperatorInfo hash for the "<" operator with the given argument for use in where clauses wh...
SqlUtil::OP_CNE
const OP_CNE
the SQL not equals operator (!= or <>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4338
SqlUtil::NUMERIC
const NUMERIC
specifies a numeric column (equivalent to Qore::Type::Number)
Definition: SqlUtil.qm.dox.h:2427
SqlUtil::OP_CLT
const OP_CLT
the SQL less than (<) operator for use in Where Clauses when comparing two columns
Definition: SqlUtil.qm.dox.h:4318
SqlUtil::OP_OR
const OP_OR
to combine SQL expressions with "or" for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4368
SqlUtil::COP_UPPER
const COP_UPPER
to return column value in upper case
Definition: SqlUtil.qm.dox.h:2488
SqlUtil::JOP_RIGHT
const JOP_RIGHT
for right outer joins
Definition: SqlUtil.qm.dox.h:3806
SqlUtil::op_cgt
hash< OperatorInfo > op_cgt(string arg)
returns an OperatorInfo hash for the ">" operator with the given argument for use in where clauses wh...
SqlUtil::COP_DENSE_RANK
const COP_DENSE_RANK
Analytic (window) function: DENSE_RANK.
Definition: SqlUtil.qm.dox.h:2618
SqlUtil::uop_substr
hash< UpdateOperatorInfo > uop_substr(int start, *int count, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "substr" operator with the given arguments; returns a subs...
SqlUtil::IOP_SEQ_CURRVAL
const IOP_SEQ_CURRVAL
for using the last value of a sequence issued in the current session
Definition: SqlUtil.qm.dox.h:5626
SqlUtil::COP_TRUNC_DATE
const COP_TRUNC_DATE
to return the date with truncated value
Definition: SqlUtil.qm.dox.h:2604
SqlUtil::COP_MINUS
const COP_MINUS
the SQL "minus" operator
Definition: SqlUtil.qm.dox.h:2533
SqlUtil::op_gt
hash< OperatorInfo > op_gt(auto arg)
returns an OperatorInfo hash for the ">" operator with the given argument for use in where clauses wh...
SqlUtil::COP_LAST_VALUE
const COP_LAST_VALUE
Analytic (window) function: LAST_VALUE.
Definition: SqlUtil.qm.dox.h:2632
SqlUtil::COP_FIRST_VALUE
const COP_FIRST_VALUE
Analytic (window) function: FIRST_VALUE.
Definition: SqlUtil.qm.dox.h:2625
SqlUtil::op_not
hash< OperatorInfo > op_not(hash arg)
returns an OperatorInfo hash for the "not" operator; for use in where clauses
SqlUtil::cop_year_day
hash< ColumnOperatorInfo > cop_year_day(auto column)
returns a ColumnOperatorInfo hash for the "year_day" operator with the given argument
SqlUtil::DefaultCopMap
const DefaultCopMap
a hash of default column operator descriptions
Definition: SqlUtil.qm.dox.h:2696
SqlUtil::DB_FUNCTIONS
const DB_FUNCTIONS
Features constants.
Definition: SqlUtil.qm.dox.h:2400
SqlUtil::op_le
hash< OperatorInfo > op_le(auto arg)
returns an OperatorInfo hash for the "<=" operator with the given argument for use in where clauses w...
SqlUtil::COP_DISTINCT
const COP_DISTINCT
to return distinct values
Definition: SqlUtil.qm.dox.h:2498
SqlUtil::OP_IN_SELECT
const OP_IN_SELECT
the SQL "in" operator with a select query for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4373
SqlUtil::uop_append
hash< UpdateOperatorInfo > uop_append(string arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "append" or concatenate operator with the given argument
SqlUtil::OP_CGT
const OP_CGT
the SQL greater than operator (>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4328
SqlUtil::cop_row_number
hash< ColumnOperatorInfo > cop_row_number()
Analytic/window function: number of the current row within its partition, counting from 1.
SqlUtil::DT_DAY
const DT_DAY
Format unit: day.
Definition: SqlUtil.qm.dox.h:3578
SqlUtil::cop_seq
hash< ColumnOperatorInfo > cop_seq(string seq, *string as)
returns a ColumnOperatorInfo hash for the "seq" operator with the given argument giving the sequence ...
SqlUtil::DB_SEQUENCES
const DB_SEQUENCES
Feature: sequences.
Definition: SqlUtil.qm.dox.h:2408
SqlUtil::DB_TYPES
const DB_TYPES
Feature: named types.
Definition: SqlUtil.qm.dox.h:2412
SqlUtil::OP_CEQ
const OP_CEQ
the SQL equals operator (=) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4343
SqlUtil::COP_SUM
const COP_SUM
to return the sum value
Definition: SqlUtil.qm.dox.h:2518
SqlUtil::OP_LIKE
const OP_LIKE
the SQL "like" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4283
SqlUtil::cop_min
hash< ColumnOperatorInfo > cop_min(auto column)
returns a ColumnOperatorInfo hash for the "min" operator; returns minimum column values
SqlUtil::cop_cast
hash< ColumnOperatorInfo > cop_cast(auto column, string arg, auto arg1, auto arg2)
returns a ColumnOperatorInfo hash for the "cast" operator with the given argument(s)
SqlUtil::cop_minus
hash< ColumnOperatorInfo > cop_minus(auto column1, auto column2)
returns a ColumnOperatorInfo hash for the "-" operator with the given arguments
SqlUtil::cop_first_value
hash< ColumnOperatorInfo > cop_first_value(any column)
Analytic/window function: value evaluated at the row that is the first row of the window frame.
SqlUtil::JOP_LEFT
const JOP_LEFT
for left outer joins
Definition: SqlUtil.qm.dox.h:3801
SqlUtil::iop_seq
hash< InsertOperatorInfo > iop_seq(string arg)
returns an InsertOperatorInfo hash for retrieving the value of the given sequence in insert queries
SqlUtil::ColumnOperatorInfo
column operator info hash as returned by all column operator functions
Definition: SqlUtil.qm.dox.h:2329
SqlUtil::ColumnOperatorInfo::cop
string cop
the column operator string code
Definition: SqlUtil.qm.dox.h:2330
SqlUtil::ColumnOperatorInfo::arg
auto arg
optional argument
Definition: SqlUtil.qm.dox.h:2332
SqlUtil::ColumnOperatorInfo::column
auto column
column sopecifier, may be a string or a complex hash
Definition: SqlUtil.qm.dox.h:2331
SqlUtil::GenericColumnInfo
generic column description hash in schema descriptions
Definition: SqlUtil.qm.dox.h:2299
SqlUtil::GenericColumnInfo::notnull
bool notnull
if the column should have a "not null" constraint on it; if missing the default value is False
Definition: SqlUtil.qm.dox.h:2315
SqlUtil::GenericColumnInfo::driver
hash< string, hash > driver
this key can optionally contain a hash keyed by driver name which contains a hash of values that will...
Definition: SqlUtil.qm.dox.h:2317
SqlUtil::GenericColumnInfo::default_value
auto default_value
the default value for the column
Definition: SqlUtil.qm.dox.h:2309
SqlUtil::GenericColumnInfo::scale
softint scale
for numeric data types, this value gives the scale
Definition: SqlUtil.qm.dox.h:2307
SqlUtil::GenericColumnInfo::size
softint size
for data types requiring a size component, the size; for numeric columns this represents the precisio...
Definition: SqlUtil.qm.dox.h:2305
SqlUtil::GenericColumnInfo::default_value_native
bool default_value_native
a boolean flag to say if a default_value should be validated against table column type (False) or use...
Definition: SqlUtil.qm.dox.h:2311
SqlUtil::GenericColumnInfo::comment
*string comment
an optional comment for the column
Definition: SqlUtil.qm.dox.h:2313
SqlUtil::GenericColumnInfo::qore_type
string qore_type
a qore type string that will be converted to a native DB type with some default conversion
Definition: SqlUtil.qm.dox.h:2301
SqlUtil::GenericColumnInfo::native_type
string native_type
the native database column type; if both native_type and qore_type are given then native_type is used
Definition: SqlUtil.qm.dox.h:2303
SqlUtil::GenericColumnInfo::auto_increment
*bool auto_increment
True for DBs that support an auto-increment column
Definition: SqlUtil.qm.dox.h:2319
SqlUtil::InsertOperatorInfo
insert operator info hash as returned by all insert operator functions
Definition: SqlUtil.qm.dox.h:2336
SqlUtil::InsertOperatorInfo::_iop
string _iop
the insert operator string code
Definition: SqlUtil.qm.dox.h:2337
SqlUtil::InsertOperatorInfo::arg
any arg
optional argument
Definition: SqlUtil.qm.dox.h:2338
SqlUtil::JoinOperatorInfo
join operator info hash as returned by all join operator functions
Definition: SqlUtil.qm.dox.h:2349
SqlUtil::JoinOperatorInfo::cond
*hash cond
additional conditions for the join clause for the table argument; see Where Clauses for more informat...
Definition: SqlUtil.qm.dox.h:2354
SqlUtil::JoinOperatorInfo::alias
*string alias
optional alias for table in the query
Definition: SqlUtil.qm.dox.h:2352
SqlUtil::JoinOperatorInfo::ta
*string ta
optional table name or alias of the other table to join with when not joining with the primary table
Definition: SqlUtil.qm.dox.h:2355
SqlUtil::JoinOperatorInfo::table
auto table
the table to join with (either an AbstractTable object or a string table name)
Definition: SqlUtil.qm.dox.h:2351
SqlUtil::JoinOperatorInfo::jcols
*hash jcols
the columns to use for the join, the keys will be columns in the source table and the values are colu...
Definition: SqlUtil.qm.dox.h:2353
SqlUtil::JoinOperatorInfo::opt
*hash< auto > opt
optional join options (for example, to specify a partition for the join if supported)
Definition: SqlUtil.qm.dox.h:2356
SqlUtil::JoinOperatorInfo::jop
string jop
the join operator string code
Definition: SqlUtil.qm.dox.h:2350
SqlUtil::OperatorInfo
SQL operator info hash as returned by all operator functions.
Definition: SqlUtil.qm.dox.h:2323
SqlUtil::OperatorInfo::arg
auto arg
optional argument
Definition: SqlUtil.qm.dox.h:2325
SqlUtil::OperatorInfo::op
string op
the operator string code
Definition: SqlUtil.qm.dox.h:2324
SqlUtil::QueryInfo
Query information.
Definition: SqlUtil.qm.dox.h:2663
SqlUtil::QueryInfo::expression_map
*hash< auto > expression_map
The expression map.
Definition: SqlUtil.qm.dox.h:2683
SqlUtil::QueryInfo::join_map
*hash< string, AbstractTable > join_map
Tables in this join; table alias -> table.
Definition: SqlUtil.qm.dox.h:2674
SqlUtil::QueryInfo::pseudo_column_map
*hash< auto > pseudo_column_map
Any valid pseudocolumns or aliases generated in th query.
Definition: SqlUtil.qm.dox.h:2680
SqlUtil::QueryInfo::where_operator_map
*hash< auto > where_operator_map
The old-style backwards-compatible "where operator" map.
Definition: SqlUtil.qm.dox.h:2686
SqlUtil::QueryInfo::table
object table
The primary table object.
Definition: SqlUtil.qm.dox.h:2665
SqlUtil::QueryInfo::query_hash
*hash< auto > query_hash
The original query hash.
Definition: SqlUtil.qm.dox.h:2668
SqlUtil::QueryInfo::column_operator_map
*hash< auto > column_operator_map
Any custom column operator map.
Definition: SqlUtil.qm.dox.h:2689
SqlUtil::QueryInfo::args
list< auto > args
arguments to bind in the query generated
Definition: SqlUtil.qm.dox.h:2692
SqlUtil::QueryInfo::query_options
*hash< auto > query_options
Any query options.
Definition: SqlUtil.qm.dox.h:2671
SqlUtil::QueryInfo::subquery_column_map
*hash< string, bool > subquery_column_map
When executing a superquery, we can only reference colums in the subquery.
Definition: SqlUtil.qm.dox.h:2677
SqlUtil::SqlCommandInfo
A hash describing SQL and arguments for an SQL DML command.
Definition: SqlUtil.qm.dox.h:2385
SqlUtil::SqlCommandInfo::sql
string sql
the SQL string for the update
Definition: SqlUtil.qm.dox.h:2387
SqlUtil::SqlCommandInfo::args
list< auto > args
the arguments for the string
Definition: SqlUtil.qm.dox.h:2390
SqlUtil::SqlUtilDataTypeOptionInfo
column data type options
Definition: SqlUtil.qm.dox.h:2360
SqlUtil::SqlUtilDataTypeOptionInfo::number_format
*string number_format
optional format string for converting strings to numeric / decimal / number columns
Definition: SqlUtil.qm.dox.h:2371
SqlUtil::SqlUtilDataTypeOptionInfo::data_timezone
*TimeZone data_timezone
the timezone when converting dates from external data to the DB's date
Definition: SqlUtil.qm.dox.h:2365
SqlUtil::SqlUtilDataTypeOptionInfo::maxlen
*softint maxlen
optional additional limit to the maximum length of the data
Definition: SqlUtil.qm.dox.h:2379
SqlUtil::SqlUtilDataTypeOptionInfo::db_timezone
*TimeZone db_timezone
the timezone to use when sending date/time values to the DB
Definition: SqlUtil.qm.dox.h:2368
SqlUtil::SqlUtilDataTypeOptionInfo::mandatory
*softbool mandatory
optional flag to overrude any nullable attribute and require data for the column
Definition: SqlUtil.qm.dox.h:2374
SqlUtil::SqlUtilDataTypeOptionInfo::date_format
*string date_format
optional format string for converting strings to dates for date / timestamp columns
Definition: SqlUtil.qm.dox.h:2362
SqlUtil::UpdateOperatorInfo
update operator info hash as returned by all update operator functions
Definition: SqlUtil.qm.dox.h:2342
SqlUtil::UpdateOperatorInfo::nest
*hash nest
option nested operation hash
Definition: SqlUtil.qm.dox.h:2345
SqlUtil::UpdateOperatorInfo::arg
auto arg
optional argument
Definition: SqlUtil.qm.dox.h:2344
SqlUtil::UpdateOperatorInfo::uop
string uop
the update operator string code
Definition: SqlUtil.qm.dox.h:2343