161parse_schema_name(
string nname, reference<string> schema, reference<string> name,
string default_schema =
'dbo');
173 constructor(AbstractDatasource ds, *
string savepoint =
'x' + get_random_string(31))
214 constructor(
string n_name,
bool n_unique, hash n_cols, *
string n_filegroup)
245 softlist getRenameSql(
string table_name,
string new_name);
265 list getRenameSql(
string table_name,
string new_name);
287 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs, *
int scale)
351 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs,
439 list getRenameSql(
string table_name,
string new_name);
500 constructor(
string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
614 const mssql_TempSavepoint =
"qore_mssql_tmp_savepoint";
646 list<string> featuresImpl();
651 MssqlSequence makeSequenceImpl(
string name, number start = 1, number increment = 1, *softnumber end, *hash
opts);
656 *AbstractSequence getSequenceImpl(
string name);
661 *AbstractView getViewImpl(
string name);
676 *AbstractFunction getFunctionImpl(
string name);
681 AbstractFunction getProcedureImpl(
string name);
686 list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
691 list getAlignSqlImpl(hash schema_hash, *hash opt);
720 list<string> listSequencesImpl();
725 list<string> listViewsImpl();
820 static auto tryExecArgs(AbstractDatasource
ds,
string sql, *softlist<auto> args);
861 const MssqlColumnDescOptions = AbstractTable::ColumnDescOptions;
863 const MssqlIndexOptions = AbstractTable::IndexOptions;
865 const MssqlConstraintOptions = AbstractTable::ConstraintOptions + MssqlIndexOptions;
867 const MssqlTableCreationOptions = AbstractTable::TableCreationOptions + MssqlConstraintOptions;
869 const MssqlAlignTableOptions = AbstractTable::AlignTableOptions + MssqlTableCreationOptions;
881 OP_SUBSTR: DefaultExpressionMap{OP_SUBSTR} + {
882 "code":
string sub (reference<hash<QueryInfo>> info,
int role, list<auto> args) {
883 string exp0 = info.table.getExpressionArg(\info, role, args[0],
884 AbstractDataProviderTypeMap.
"string");
885 string exp1 = info.table.getExpressionArg(\info, role, args[1],
886 AbstractDataProviderTypeMap.
"int");
887 if (!exists args[2]) {
888 return sprintf(
"substring(%s,%s,32767)", exp0, exp1);
890 return sprintf(
"substring(%s,%s,%s)", exp0, exp1,
891 info.table.getExpressionArg(\info, role, args[2], AbstractDataProviderTypeMap.
"int"));
894 COP_PREPEND: DefaultExpressionMap{COP_PREPEND} + {
895 "code":
string sub (reference<hash<QueryInfo>> info,
int role, list<auto> args) {
896 string exp0 = info.table.getExpressionArg(\info, role, args[0],
897 AbstractDataProviderTypeMap.
"string");
898 string exp1 = info.table.getExpressionArg(\info, role, args[1],
899 AbstractDataProviderTypeMap.
"string");
900 return sprintf(
"concat(%s, %s)", exp1, exp0);
903 COP_APPEND: DefaultExpressionMap{COP_APPEND} + {
904 "code":
string sub (reference<hash<QueryInfo>> info,
int role, list<auto> args) {
905 string exp0 = info.table.getExpressionArg(\info, role, args[0],
907 AbstractDataProviderTypeMap.
"string");
908 string exp1 = info.table.getExpressionArg(\info, role, args[1],
909 AbstractDataProviderTypeMap.
"string");
910 return sprintf(
"concat(%s, %s)", exp0, exp1);
918 "code":
string sub (reference<hash<QueryInfo>> info,
string cn, softlist arg) {
920 if (!exists arg[1]) {
921 info.args += arg[2]; # text
922 return sprintf(
"substring(%s,%v,32767) = %v", cn); # NOTE: length arg is required
924 info.args += arg[1]; # count
925 info.args += arg[2]; # text
926 return sprintf(
"substring(%s,%v,%v) = %v", cn);
1002 string getFromIntern(
string from, *hash qh);
1007 hash getTableCreationOptions();
1012 hash getTableDescriptionHashOptions();
1017 hash getColumnDescOptions();
1022 hash getIndexOptions();
1027 hash getConstraintOptions();
1032 hash getAlignTableOptions();
1061 bool checkExistenceImpl();
1066 Columns describeImpl();
1071 Columns describeSybaseImpl();
1076 Columns describeMssqlImpl();
1096 Indexes getIndexesImpl();
1101 Indexes getIndexesSybaseImpl();
1106 Indexes getIndexesMssqlImpl();
1111 ForeignConstraints getForeignConstraintsImpl(*hash
opts);
1116 ForeignConstraints getForeignConstraintsSybaseImpl();
1121 ForeignConstraints getForeignConstraintsMssqlImpl();
1126 Constraints getConstraintsImpl();
1131 Constraints getConstraintsSybaseImpl();
1136 Constraints getConstraintsMssqlImpl();
1141 Triggers getTriggersImpl();
1152 *list getCreateMiscSqlImpl(*hash opt,
bool cache);
1157 *list getAlignSqlImpl(AbstractTable table, *hash opt);
1168 string getRenameSqlImpl(
string new_name);
1173 AbstractColumn addColumnImpl(
string cname, hash opt,
bool nullable = True);
1178 AbstractPrimaryKey addPrimaryKeyImpl(
string cname, hash ch, *hash opt);
1183 AbstractIndex addIndexImpl(
string iname,
bool enabled, hash ch, *hash opt);
1187 private AbstractForeignConstraint addForeignConstraintImpl(
string cname, hash ch,
string table, hash tch,
1189 ForeignConstraintTarget fct(table,
new Columns(tch));
1194 AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *hash opt);
1199 AbstractUniqueConstraint addUniqueConstraintImpl(
string cname, hash ch, *hash opt);
1204 AbstractTrigger addTriggerImpl(
string tname,
string src, *hash opt);
1209 bool tryInsertImpl(
string sql, hash<auto> row);
1222 hash getQoreTypeMapImpl();
1227 hash getTypeMapImpl();
1259 setupTableImpl(hash desc, *hash opt);
1293 doSelectOrderBySqlUnlocked(info, \sql, coll);
1295 sql +=
" offset %v rows";
1296 info.args += info.query_hash.offset.toInt();
1298 if (info.query_hash.limit);
1321 *hash<auto> doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
1326 softbool tryUpdate(
string sql, hash<auto> row, Columns cols, list updc);
represents a Mssql-specific check constraint
Definition: MssqlSqlUtilBase.qm.dox.h:254
constructor(string n, string n_src)
creates the constraint from the supplied arguments
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
string getCreateSql(string name, string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
represents a Mssql-specific column
Definition: MssqlSqlUtilBase.qm.dox.h:274
string getDdlName(string name)
returns the column name with quoting in case the column name is a reserved word
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt)
returns a list of sql strings that can be used to modify the column to the new definition; if the col...
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
softlist getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table
int byte_size
byte size of the column
Definition: MssqlSqlUtilBase.qm.dox.h:278
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, *int scale)
creates the column from the supplied arguments
constructor()
empty constructor for subclasses
provides the Mssql-specific implementation of the AbstractDatabase interface
Definition: MssqlSqlUtilBase.qm.dox.h:602
bool supportsTypesImpl()
returns True if the database supports named types
softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
int getPhysicalSizeImpl()
SqlUtil::AbstractDatabase::getPhysicalSize()
list< string > listFunctionsImpl()
returns a list of string function names in the database
bool requiresScale()
Returns True if the driver requires a scale to support decimal values in numeric or decimal columns.
static string getCreateSql(list l)
returns a string that can be used to create the schema in the database
const MssqlSchemaDescriptionOptions
Mssql-specific schema description keys.
Definition: MssqlSqlUtilBase.qm.dox.h:612
string default_schema
default schema for user
Definition: MssqlSqlUtilBase.qm.dox.h:609
const MssqlReservedWords
hash of reserved words
Definition: MssqlSqlUtilBase.qm.dox.h:620
computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics()
int getMaximumPrecision()
Returns the maximum precision for numeric or decimal columns.
softlist< string > listTablesImpl()
returns a list of string table names in the database
static auto tryExecRaw(AbstractDatasource ds, string sql)
tries to execute a command so that if an error occurs the current transaction status is not lost
reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
bool supportsSequencesImpl()
returns True if the database supports sequences
bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
const MssqlReclaimSpaceOptions
Options for reclaimSpace()
Definition: MssqlSqlUtilBase.qm.dox.h:617
hash getReclaimSpaceOptions()
returns driver-specific options to the base abstract class
string getCreateSqlImpl(list l)
returns a string that can be used to create the schema in the database
bool is_sybase
sybase flag
Definition: MssqlSqlUtilBase.qm.dox.h:606
auto tryExecRawImpl(string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
list< string > listProceduresImpl()
since Mssql only supports functions, this method is identical to listFunctionsImpl()
const MaxPrecision
Maximum precision.
Definition: MssqlSqlUtilBase.qm.dox.h:624
hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
static bool isSybase(AbstractDatasource ds)
returns True if the DB is a Sybase database
auto tryExecArgsImpl(string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
bool supportsPackagesImpl()
returns True if the database supports packages
static auto tryExecArgs(AbstractDatasource ds, string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
represents a Mssql-specific foreign constraint
Definition: MssqlSqlUtilBase.qm.dox.h:234
constructor(string n, Columns c, ForeignConstraintTarget t)
creates the constraint from the supplied arguments
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
string getCreateSql(string name, string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
represents a Mssql-specific function
Definition: MssqlSqlUtilBase.qm.dox.h:565
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the function in the database
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
setName(string new_name)
sets the new name of the function
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
string getDropSql(*hash opt)
returns a string that can be used to drop the function from the database
represents a Mssql-specific index
Definition: MssqlSqlUtilBase.qm.dox.h:207
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
*string filegroup
the tablespace (filegroup) name of the index
Definition: MssqlSqlUtilBase.qm.dox.h:211
constructor(string n_name, bool n_unique, hash n_cols, *string n_filegroup)
creates the object from the arguments
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
the data type for Mssql DECIMAL columns
Definition: MssqlSqlUtilBase.qm.dox.h:197
constructor(string native_type, bool nullable, *hash< auto > options)
creates the object
represents a Mssql-specific numeric column
Definition: MssqlSqlUtilBase.qm.dox.h:347
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint scale)
creates the column from the supplied arguments
represents a Mssql-specific primary key constraint
Definition: MssqlSqlUtilBase.qm.dox.h:452
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
constructor(string n, *hash c, *string ts)
creates the object with the given attributes
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the constraint
MssqlColumn memberGate(string k)
returns the MssqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
constructor()
creates an empty primary key object
Mssql savepoint helper.
Definition: MssqlSqlUtilBase.qm.dox.h:165
deleteSavepointImpl()
Deletes the savepoint.
createSavepointImpl()
Creates the savepoint.
constructor(AbstractDatasource ds, *string savepoint='x'+get_random_string(31))
Creates the object.
rollbackImpl()
Rolls back to the savepoint.
class for Mssql sequences
Definition: MssqlSqlUtilBase.qm.dox.h:496
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_end)
creates the object from the arguments
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the sequence in the database
provides the Mssql-specific implementation of the SqlUtil::AbstractTable interface
Definition: MssqlSqlUtilBase.qm.dox.h:827
hash getSelectOptions()
returns the select options for this driver
const QoreTypeMap
maps qore type names to DB type names
Definition: MssqlSqlUtilBase.qm.dox.h:844
hash< auto > getWhereOperatorMap()
returns the "where" operator map for Mssql
bool supportsTablespacesImpl()
returns True if the database support tablespaces
copyImpl(AbstractTable old)
db-specific copy actions
const MssqlTruncDate
Map SqlUtil::cop_trunc_date() constants to Mssql internal masks.
Definition: MssqlSqlUtilBase.qm.dox.h:940
hash getColumnOperatorMapImpl()
returns the column operator map for this object
const MssqlTableDescriptionHashOptions
equal to SqlUtil::AbstractTable::TableDescriptionHashOptions
Definition: MssqlSqlUtilBase.qm.dox.h:859
list getColumnSqlNames(softlist cols)
returns a list of column names for use in SQL strings; subclasses can process the argument list in ca...
*string getTablespaceName()
returns the data filegroup name for the table or NOTHING if none is known
auto tryExecArgsImpl(string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: MssqlSqlUtilBase.qm.dox.h:959
bool hasArrayBind()
returns False because the Mssql driver does not support array binds / bulk DML operations
bool is_sybase
sybase flag
Definition: MssqlSqlUtilBase.qm.dox.h:831
const MssqlExpressionMap
Mssql Expression map.
Definition: MssqlSqlUtilBase.qm.dox.h:880
const MssqlCopMap
column operator specializations for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:932
code getUpsertClosure(hash< auto > row, int upsert_strategy=UpsertAuto, *hash opt)
returns a closure for performing upserts
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
doSelectLimitOnlyUnlockedImpl(reference< hash< QueryInfo > > info, reference< string > sql)
processes a string for use in SQL select statements with "limit" but no "orderby" or "offset"
*string filegroup
filegroup name for the table, if known
Definition: MssqlSqlUtilBase.qm.dox.h:953
*string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument
const SybaseQoreTypeMap
maps qore type names to Sybase/SAP type names
Definition: MssqlSqlUtilBase.qm.dox.h:854
bool isDuplicateRowErrorImpl(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
string getCreateTableSqlImpl(*hash opt)
returns a string that can be used to create the table in the database
bool ss_has_merge
"has merge" flag for SQL server
Definition: MssqlSqlUtilBase.qm.dox.h:834
const MssqlUopMap
a hash of default update operator definitions for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:948
const MssqlOpMap
where operator specializations for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:916
auto tryExecRawImpl(string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
private doSelectOrderByWithOffsetSqlUnlockedImpl(reference< hash< QueryInfo > > info, reference< string > sql, list< auto > coll)
processes a string for use in SQL select statements when there is an "order by" and "offset" argument
Definition: MssqlSqlUtilBase.qm.dox.h:1288
string schema
schema name for the table
Definition: MssqlSqlUtilBase.qm.dox.h:956
hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
const MsSqlServerTableHints
query hints
Definition: MssqlSqlUtilBase.qm.dox.h:876
clearImpl()
clears Mssql-specific table information
hash< auto > getExpressionMap()
Returns the expression map for Mssql.
const MssqlIopMap
a hash of default value operator descriptions for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:944
const MsQoreTypeMap
maps qore type names to MS SQL Server type names
Definition: MssqlSqlUtilBase.qm.dox.h:848
AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
const MssqlSelectOptions
select options supported by MssqlSqlUtilBase
Definition: MssqlSqlUtilBase.qm.dox.h:872
string getCreateSqlImpl(list l)
returns a string that can be used to create the table in the database
AbstractDataProviderType getNumericTypeImpl(string native_type, bool nullable, *hash< auto > options)
returns the type for number / numeric columns for the database so that data conversions can be handle...
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
string getSchemaName()
returns the schema name
string default_schema
the default schema for the user
Definition: MssqlSqlUtilBase.qm.dox.h:962
hash getInsertOperatorMap()
returns the insert operator map for this object
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema,...
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint with a unique index
bool ss_has_sequences
"has sequences" flag for SQL server
Definition: MssqlSqlUtilBase.qm.dox.h:837
const MssqlTypeMap
maps postgresql type names to type configurations
Definition: MssqlSqlUtilBase.qm.dox.h:840
represents a Mssql-specific trigger
Definition: MssqlSqlUtilBase.qm.dox.h:538
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from the database
common base class for unique constraints
Definition: MssqlSqlUtilBase.qm.dox.h:357
getIndexSql(reference< string > sql, string name, *hash opts)
adds index options onto the sql creation string
clearIndex()
clears any index base for the constraint
*string filegroup
any filegroup for the unique key index
Definition: MssqlSqlUtilBase.qm.dox.h:362
constructor(*string ts)
creates the constraint with an optional filegroup name
constructor()
empty constructor for subclasses
setTablespace(*string ts)
sets or clears the filegroup name
bool setIndexBase(string ix)
sets the supporting index name
*string getTablespace()
returns the filegroup name used for this constraint, if known
class modeling a unique constraint
Definition: MssqlSqlUtilBase.qm.dox.h:398
bool isEnabled()
returns True if the constraint is enabled, False if not
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
bool enabled
True if the constraint is enabled, False if not
Definition: MssqlSqlUtilBase.qm.dox.h:403
string getCreateSql(string name, string table_name, *hash opts)
returns a string that can be used to rename the constraint
constructor(string n, hash n_cols, bool e=True, *string ts)
creates the object with the given attributes
MssqlColumn memberGate(string k)
returns the MssqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
represents a Mssql view
Definition: MssqlSqlUtilBase.qm.dox.h:517
constructor(string n_name, string n_src, *string n_schemaname)
creates the object from the arguments
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the view in the database
const ReclaimSpaceOptions
transient AbstractDatasource ds
cache(*hash< auto > opts)
the MssqlSqlUtilBase namespace contains all the objects in the MssqlSqlUtilBase module
Definition: MssqlSqlUtilBase.qm.dox.h:152
MssqlDatabase get_database(AbstractDatasource nds, *hash< auto > opts)
returns a MssqlDatabase object corresponding to the arguments
MssqlTable get_table(AbstractDatasource nds, string nname, *hash< auto > opts)
returns a MssqlTable object corresponding to the arguments