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)) ;
212 constructor(
string n_name,
bool n_unique, hash n_cols, *
string n_filegroup) ;
242 softlist getRenameSql(
string table_name,
string new_name);
262 list getRenameSql(
string table_name,
string new_name);
284 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs, *
int scale) ;
347 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs, softint
scale) ;
434 list getRenameSql(
string table_name,
string new_name);
495 constructor(
string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
609 const mssql_TempSavepoint =
"qore_mssql_tmp_savepoint";
641 list<string> featuresImpl();
646 MssqlSequence makeSequenceImpl(
string name, number start = 1, number increment = 1, *softnumber end, *hash
opts);
651 *AbstractSequence getSequenceImpl(
string name);
656 *AbstractView getViewImpl(
string name);
671 *AbstractFunction getFunctionImpl(
string name);
676 AbstractFunction getProcedureImpl(
string name);
681 list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
686 list getAlignSqlImpl(hash schema_hash, *hash opt);
715 list<string> listSequencesImpl();
720 list<string> listViewsImpl();
815 static auto tryExecArgs(AbstractDatasource
ds,
string sql, *softlist<auto> args);
856 const MssqlColumnDescOptions = AbstractTable::ColumnDescOptions;
858 const MssqlIndexOptions = AbstractTable::IndexOptions;
860 const MssqlConstraintOptions = AbstractTable::ConstraintOptions + MssqlIndexOptions;
862 const MssqlTableCreationOptions = AbstractTable::TableCreationOptions + MssqlConstraintOptions;
864 const MssqlAlignTableOptions = AbstractTable::AlignTableOptions + MssqlTableCreationOptions;
876 OP_SUBSTR: DefaultExpressionMap{OP_SUBSTR} + {
877 "code":
string sub (reference<hash<QueryInfo>> info,
int role, list<auto> args) {
878 string exp0 = info.table.getExpressionArg(\info, role, args[0],
879 AbstractDataProviderTypeMap.
"string");
880 string exp1 = info.table.getExpressionArg(\info, role, args[1],
881 AbstractDataProviderTypeMap.
"int");
882 if (!exists args[2]) {
883 return sprintf(
"substring(%s,%s,32767)", exp0, exp1);
885 return sprintf(
"substring(%s,%s,%s)", exp0, exp1,
886 info.table.getExpressionArg(\info, role, args[2], AbstractDataProviderTypeMap.
"int"));
889 COP_PREPEND: DefaultExpressionMap{COP_PREPEND} + {
890 "code":
string sub (reference<hash<QueryInfo>> info,
int role, list<auto> args) {
891 string exp0 = info.table.getExpressionArg(\info, role, args[0],
892 AbstractDataProviderTypeMap.
"string");
893 string exp1 = info.table.getExpressionArg(\info, role, args[1],
894 AbstractDataProviderTypeMap.
"string");
895 return sprintf(
"concat(%s, %s)", exp1, exp0);
898 COP_APPEND: DefaultExpressionMap{COP_APPEND} + {
899 "code":
string sub (reference<hash<QueryInfo>> info,
int role, list<auto> args) {
900 string exp0 = info.table.getExpressionArg(\info, role, args[0],
902 AbstractDataProviderTypeMap.
"string");
903 string exp1 = info.table.getExpressionArg(\info, role, args[1],
904 AbstractDataProviderTypeMap.
"string");
905 return sprintf(
"concat(%s, %s)", exp0, exp1);
913 "code":
string sub (reference<hash<QueryInfo>> info,
string cn, softlist arg) {
915 if (!exists arg[1]) {
916 info.args += arg[2]; # text
917 return sprintf(
"substring(%s,%v,32767) = %v", cn); # NOTE: length arg is required
919 info.args += arg[1]; # count
920 info.args += arg[2]; # text
921 return sprintf(
"substring(%s,%v,%v) = %v", cn);
997 string getFromIntern(
string from, *hash qh);
1002 hash getTableCreationOptions();
1007 hash getTableDescriptionHashOptions();
1012 hash getColumnDescOptions();
1017 hash getIndexOptions();
1022 hash getConstraintOptions();
1027 hash getAlignTableOptions();
1056 bool checkExistenceImpl();
1061 Columns describeImpl();
1066 Columns describeSybaseImpl();
1071 Columns describeMssqlImpl();
1091 Indexes getIndexesImpl();
1096 Indexes getIndexesSybaseImpl();
1101 Indexes getIndexesMssqlImpl();
1106 ForeignConstraints getForeignConstraintsImpl(*hash
opts);
1111 ForeignConstraints getForeignConstraintsSybaseImpl();
1116 ForeignConstraints getForeignConstraintsMssqlImpl();
1121 Constraints getConstraintsImpl();
1126 Constraints getConstraintsSybaseImpl();
1131 Constraints getConstraintsMssqlImpl();
1136 Triggers getTriggersImpl();
1147 *list getCreateMiscSqlImpl(*hash opt,
bool cache);
1152 *list getAlignSqlImpl(AbstractTable table, *hash opt);
1163 string getRenameSqlImpl(
string new_name);
1168 AbstractColumn addColumnImpl(
string cname, hash opt,
bool nullable = True);
1173 AbstractPrimaryKey addPrimaryKeyImpl(
string cname, hash ch, *hash opt);
1178 AbstractIndex addIndexImpl(
string iname,
bool enabled, hash ch, *hash opt);
1183 AbstractForeignConstraint addForeignConstraintImpl(
string cname, hash ch,
string table, hash tch, *hash opt);
1188 AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *hash opt);
1193 AbstractUniqueConstraint addUniqueConstraintImpl(
string cname, hash ch, *hash opt);
1198 AbstractTrigger addTriggerImpl(
string tname,
string src, *hash opt);
1203 bool tryInsertImpl(
string sql, hash<auto> row);
1216 hash getQoreTypeMapImpl();
1221 hash getTypeMapImpl();
1253 setupTableImpl(hash desc, *hash opt);
1306 *hash<auto> doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
1311 softbool tryUpdate(
string sql, hash<auto> row, Columns cols, list updc);
represents a Mssql-specific check constraint
Definition: MssqlSqlUtilBase.qm.dox.h:251
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:271
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:275
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:597
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:607
string default_schema
default schema for user
Definition: MssqlSqlUtilBase.qm.dox.h:604
const MssqlReservedWords
hash of reserved words
Definition: MssqlSqlUtilBase.qm.dox.h:615
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:612
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:601
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:619
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:231
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:560
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:205
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:209
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:196
constructor(string native_type, bool nullable, *hash< auto > options)
creates the object
represents a Mssql-specific numeric column
Definition: MssqlSqlUtilBase.qm.dox.h:343
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:447
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:491
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:822
hash getSelectOptions()
returns the select options for this driver
const QoreTypeMap
maps qore type names to DB type names
Definition: MssqlSqlUtilBase.qm.dox.h:839
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:935
hash getColumnOperatorMapImpl()
returns the column operator map for this object
const MssqlTableDescriptionHashOptions
equal to SqlUtil::AbstractTable::TableDescriptionHashOptions
Definition: MssqlSqlUtilBase.qm.dox.h:854
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:954
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:826
const MssqlExpressionMap
Mssql Expression map.
Definition: MssqlSqlUtilBase.qm.dox.h:875
const MssqlCopMap
column operator specializations for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:927
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:948
*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:849
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:829
const MssqlUopMap
a hash of default update operator definitions for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:943
const MssqlOpMap
where operator specializations for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:911
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
string schema
schema name for the table
Definition: MssqlSqlUtilBase.qm.dox.h:951
hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
const MsSqlServerTableHints
query hints
Definition: MssqlSqlUtilBase.qm.dox.h:871
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:939
const MsQoreTypeMap
maps qore type names to MS SQL Server type names
Definition: MssqlSqlUtilBase.qm.dox.h:843
AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
const MssqlSelectOptions
select options supported by MssqlSqlUtilBase
Definition: MssqlSqlUtilBase.qm.dox.h:867
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:957
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,...
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
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:832
const MssqlTypeMap
maps postgresql type names to type configurations
Definition: MssqlSqlUtilBase.qm.dox.h:835
represents a Mssql-specific trigger
Definition: MssqlSqlUtilBase.qm.dox.h:533
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:352
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:357
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:393
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:398
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:512
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