210 parse_schema_name(
string nname, reference<string> schema, reference<string> name,
string default_schema =
'dbo');
222 constructor(AbstractDatasource ds, *
string savepoint =
'x' + get_random_string(31))
263 constructor(
string n_name,
bool n_unique, hash n_cols, *
string n_filegroup)
294 softlist getRenameSql(
string table_name,
string new_name);
314 list getRenameSql(
string table_name,
string new_name);
336 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs, *
int scale)
400 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs,
488 list getRenameSql(
string table_name,
string new_name);
549 constructor(
string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
663 const FreeTDS_TempSavepoint =
"qore_freetds_tmp_savepoint";
695 list<string> featuresImpl();
700 FreetdsSequence makeSequenceImpl(
string name, number start = 1, number increment = 1, *softnumber end, *hash
opts);
705 *AbstractSequence getSequenceImpl(
string name);
710 *AbstractView getViewImpl(
string name);
725 *AbstractFunction getFunctionImpl(
string name);
730 AbstractFunction getProcedureImpl(
string name);
735 list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
740 list getAlignSqlImpl(hash schema_hash, *hash opt);
769 list<string> listSequencesImpl();
774 list<string> listViewsImpl();
869 static auto tryExecArgs(AbstractDatasource
ds,
string sql, *softlist<auto> args);
910 const FreetdsColumnDescOptions = AbstractTable::ColumnDescOptions;
912 const FreetdsIndexOptions = AbstractTable::IndexOptions;
914 const FreetdsConstraintOptions = AbstractTable::ConstraintOptions + FreetdsIndexOptions;
916 const FreetdsTableCreationOptions = AbstractTable::TableCreationOptions + FreetdsConstraintOptions;
918 const FreetdsAlignTableOptions = AbstractTable::AlignTableOptions + FreetdsTableCreationOptions;
930 OP_SUBSTR: DefaultExpressionMap{OP_SUBSTR} + {
931 "code":
string sub (reference<hash<QueryInfo>> info,
int role, list<auto> args) {
932 string exp0 = info.table.getExpressionArg(\info, role, args[0],
933 AbstractDataProviderTypeMap.
"string");
934 string exp1 = info.table.getExpressionArg(\info, role, args[1],
935 AbstractDataProviderTypeMap.
"int");
936 if (!exists args[2]) {
937 return sprintf(
"substring(%s,%s,32767)", exp0, exp1);
939 return sprintf(
"substring(%s,%s,%s)", exp0, exp1,
940 info.table.getExpressionArg(\info, role, args[2], AbstractDataProviderTypeMap.
"int"));
943 COP_PREPEND: DefaultExpressionMap{COP_PREPEND} + {
944 "code":
string sub (reference<hash<QueryInfo>> info,
int role, list<auto> args) {
945 string exp0 = info.table.getExpressionArg(\info, role, args[0],
946 AbstractDataProviderTypeMap.
"string");
947 string exp1 = info.table.getExpressionArg(\info, role, args[1],
948 AbstractDataProviderTypeMap.
"string");
949 return sprintf(
"concat(%s, %s)", exp1, exp0);
952 COP_APPEND: DefaultExpressionMap{COP_APPEND} + {
953 "code":
string sub (reference<hash<QueryInfo>> info,
int role, list<auto> args) {
954 string exp0 = info.table.getExpressionArg(\info, role, args[0],
956 AbstractDataProviderTypeMap.
"string");
957 string exp1 = info.table.getExpressionArg(\info, role, args[1],
958 AbstractDataProviderTypeMap.
"string");
959 return sprintf(
"concat(%s, %s)", exp0, exp1);
967 "code":
string sub (reference<hash<QueryInfo>> info,
string cn, softlist arg) {
969 if (!exists arg[1]) {
970 info.args += arg[2]; # text
971 return sprintf(
"substring(%s,%v,32767) = %v", cn); # NOTE: length arg is required
973 info.args += arg[1]; # count
974 info.args += arg[2]; # text
975 return sprintf(
"substring(%s,%v,%v) = %v", cn);
1051 string getFromIntern(
string from, *hash qh);
1056 hash getTableCreationOptions();
1061 hash getTableDescriptionHashOptions();
1066 hash getColumnDescOptions();
1071 hash getIndexOptions();
1076 hash getConstraintOptions();
1081 hash getAlignTableOptions();
1110 bool checkExistenceImpl();
1115 Columns describeImpl();
1120 Columns describeSybaseImpl();
1125 Columns describeMssqlImpl();
1145 Indexes getIndexesImpl();
1150 Indexes getIndexesSybaseImpl();
1155 Indexes getIndexesMssqlImpl();
1160 ForeignConstraints getForeignConstraintsImpl(*hash
opts);
1165 ForeignConstraints getForeignConstraintsSybaseImpl();
1170 ForeignConstraints getForeignConstraintsMssqlImpl();
1175 Constraints getConstraintsImpl();
1180 Constraints getConstraintsSybaseImpl();
1185 Constraints getConstraintsMssqlImpl();
1190 Triggers getTriggersImpl();
1201 *list getCreateMiscSqlImpl(*hash opt,
bool cache);
1206 *list getAlignSqlImpl(AbstractTable table, *hash opt);
1217 string getRenameSqlImpl(
string new_name);
1222 AbstractColumn addColumnImpl(
string cname, hash opt,
bool nullable = True);
1227 AbstractPrimaryKey addPrimaryKeyImpl(
string cname, hash ch, *hash opt);
1232 AbstractIndex addIndexImpl(
string iname,
bool enabled, hash ch, *hash opt);
1236 private AbstractForeignConstraint addForeignConstraintImpl(
string cname, hash ch,
string table, hash tch,
1238 ForeignConstraintTarget fct(table,
new Columns(tch));
1243 AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *hash opt);
1248 AbstractUniqueConstraint addUniqueConstraintImpl(
string cname, hash ch, *hash opt);
1253 AbstractTrigger addTriggerImpl(
string tname,
string src, *hash opt);
1258 bool tryInsertImpl(
string sql, hash<auto> row);
1271 hash getQoreTypeMapImpl();
1276 hash getTypeMapImpl();
1308 setupTableImpl(hash desc, *hash opt);
1342 doSelectOrderBySqlUnlocked(info, \sql, coll);
1344 sql +=
" offset %v rows";
1345 info.args += info.query_hash.offset.toInt();
1347 if (info.query_hash.limit);
1370 *hash<auto> doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
1375 softbool tryUpdate(
string sql, hash<auto> row, Columns cols, list updc);
represents a FreeTDS-specific check constraint
Definition: FreetdsSqlUtil.qm.dox.h:303
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
constructor(string n, string n_src)
creates the constraint from the supplied arguments
represents a FreeTDS-specific column
Definition: FreetdsSqlUtil.qm.dox.h:323
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
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...
softlist getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table
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
string getDdlName(string name)
returns the column name with quoting in case the column name is a reserved word
constructor()
empty constructor for subclasses
int byte_size
byte size of the column
Definition: FreetdsSqlUtil.qm.dox.h:327
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
provides the FreeTDS-specific implementation of the AbstractDatabase interface
Definition: FreetdsSqlUtil.qm.dox.h:651
string default_schema
default schema for user
Definition: FreetdsSqlUtil.qm.dox.h:658
hash getReclaimSpaceOptions()
returns driver-specific options to the base abstract class
bool is_sybase
sybase flag
Definition: FreetdsSqlUtil.qm.dox.h:655
bool supportsPackagesImpl()
returns True if the database supports packages
int getPhysicalSizeImpl()
SqlUtil::AbstractDatabase::getPhysicalSize()
bool requiresScale()
Returns True if the driver requires a scale to support decimal values in numeric or decimal columns.
static bool isSybase(AbstractDatasource ds)
returns True if the DB is a Sybase database
list< string > listProceduresImpl()
since FreeTDS only supports functions, this method is identical to listFunctionsImpl()
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
static string getCreateSql(list l)
returns a string that can be used to create the schema in the database
list< string > listFunctionsImpl()
returns a list of string function names in the database
bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
const FreetdsReservedWords
hash of reserved words
Definition: FreetdsSqlUtil.qm.dox.h:669
int getMaximumPrecision()
Returns the maximum precision for numeric or decimal columns.
reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
bool supportsSequencesImpl()
returns True if the database supports sequences
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 getCreateSqlImpl(list l)
returns a string that can be used to create the schema 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
const FreetdsReclaimSpaceOptions
Options for reclaimSpace()
Definition: FreetdsSqlUtil.qm.dox.h:666
bool supportsTypesImpl()
returns True if the database supports named types
const MaxPrecision
Maximum precision.
Definition: FreetdsSqlUtil.qm.dox.h:673
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics()
hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
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
const FreetdsSchemaDescriptionOptions
FreeTDS-specific schema description keys.
Definition: FreetdsSqlUtil.qm.dox.h:661
softlist< string > listTablesImpl()
returns a list of string table names in the database
represents a FreeTDS-specific foreign constraint
Definition: FreetdsSqlUtil.qm.dox.h:283
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
constructor(string n, Columns c, ForeignConstraintTarget t)
creates the constraint from the supplied arguments
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 FreeTDS-specific function
Definition: FreetdsSqlUtil.qm.dox.h:614
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
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
string getDropSql(*hash opt)
returns a string that can be used to drop the function from the database
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the function in the database
represents a FreeTDS-specific index
Definition: FreetdsSqlUtil.qm.dox.h:256
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
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: FreetdsSqlUtil.qm.dox.h:260
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
constructor(string n_name, bool n_unique, hash n_cols, *string n_filegroup)
creates the object from the arguments
the data type for FreeTDS DECIMAL columns
Definition: FreetdsSqlUtil.qm.dox.h:246
constructor(string native_type, bool nullable, *hash< auto > options)
creates the object
represents a FreeTDS-specific numeric column
Definition: FreetdsSqlUtil.qm.dox.h:396
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 FreeTDS-specific primary key constraint
Definition: FreetdsSqlUtil.qm.dox.h:501
FreetdsColumn memberGate(string k)
returns the FreetdsColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the constraint
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
constructor()
creates an empty primary key object
constructor(string n, *hash c, *string ts)
creates the object with the given attributes
FreeTDS savepoint helper.
Definition: FreetdsSqlUtil.qm.dox.h:214
rollbackImpl()
Rolls back to the savepoint.
deleteSavepointImpl()
Deletes the savepoint.
constructor(AbstractDatasource ds, *string savepoint='x'+get_random_string(31))
Creates the object.
createSavepointImpl()
Creates the savepoint.
class for FreeTDS sequences
Definition: FreetdsSqlUtil.qm.dox.h:545
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 FreeTDS-specific implementation of the SqlUtil::AbstractTable interface
Definition: FreetdsSqlUtil.qm.dox.h:876
const FreetdsTableDescriptionHashOptions
equal to SqlUtil::AbstractTable::TableDescriptionHashOptions
Definition: FreetdsSqlUtil.qm.dox.h:908
list getColumnSqlNames(softlist cols)
returns a list of column names for use in SQL strings; subclasses can process the argument list in ca...
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema,...
const FreetdsIopMap
a hash of default value operator descriptions for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:993
bool is_sybase
sybase flag
Definition: FreetdsSqlUtil.qm.dox.h:880
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: FreetdsSqlUtil.qm.dox.h:1337
*string getTablespaceName()
returns the data filegroup name for the table or NOTHING if none is known
hash< auto > getWhereOperatorMap()
returns the "where" operator map for FreeTDS
doSelectLimitOnlyUnlockedImpl(reference< hash< QueryInfo > > info, reference< string > sql)
processes a string for use in SQL select statements with "limit" but no "orderby" or "offset"
const MsSqlServerTableHints
query hints
Definition: FreetdsSqlUtil.qm.dox.h:925
hash< auto > getExpressionMap()
Returns the expression map for FreeTDS.
hash getInsertOperatorMap()
returns the insert operator map for this object
hash getColumnOperatorMapImpl()
returns the column operator map for this object
const SybaseQoreTypeMap
maps qore type names to Sybase/SAP type names
Definition: FreetdsSqlUtil.qm.dox.h:903
bool ss_has_sequences
"has sequences" flag for SQL server
Definition: FreetdsSqlUtil.qm.dox.h:886
const FreetdsCopMap
column operator specializations for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:981
string schema
schema name for the table
Definition: FreetdsSqlUtil.qm.dox.h:1005
const FreetdsUopMap
a hash of default update operator definitions for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:997
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 filegroup
filegroup name for the table, if known
Definition: FreetdsSqlUtil.qm.dox.h:1002
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
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...
const FreetdsSelectOptions
select options supported by FreetdsSqlUtil
Definition: FreetdsSqlUtil.qm.dox.h:921
const FreetdsExpressionMap
FreeTDS Expression map.
Definition: FreetdsSqlUtil.qm.dox.h:929
const QoreTypeMap
maps qore type names to DB type names
Definition: FreetdsSqlUtil.qm.dox.h:893
clearImpl()
clears FreeTDS-specific table information
const MsQoreTypeMap
maps qore type names to MS SQL Server type names
Definition: FreetdsSqlUtil.qm.dox.h:897
bool ss_has_merge
"has merge" flag for SQL server
Definition: FreetdsSqlUtil.qm.dox.h:883
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
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
copyImpl(AbstractTable old)
db-specific copy actions
string getCreateTableSqlImpl(*hash opt)
returns a string that can be used to create the table in the database
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint with a unique index
bool isDuplicateRowErrorImpl(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
const FreetdsTypeMap
maps postgresql type names to type configurations
Definition: FreetdsSqlUtil.qm.dox.h:889
const FreetdsOpMap
where operator specializations for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:965
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: FreetdsSqlUtil.qm.dox.h:1008
const FreetdsTruncDate
Map SqlUtil::cop_trunc_date() constants to FreeTDS internal masks.
Definition: FreetdsSqlUtil.qm.dox.h:989
string getSchemaName()
returns the schema name
string getCreateSqlImpl(list l)
returns a string that can be used to create the table in the database
*string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument
code getUpsertClosure(hash< auto > row, int upsert_strategy=UpsertAuto, *hash opt)
returns a closure for performing upserts
AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
bool supportsTablespacesImpl()
returns True if the database support tablespaces
string default_schema
the default schema for the user
Definition: FreetdsSqlUtil.qm.dox.h:1011
hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
bool hasArrayBind()
returns False because the freetds driver does not support array binds / bulk DML operations
hash getSelectOptions()
returns the select options for this driver
represents a FreeTDS-specific trigger
Definition: FreetdsSqlUtil.qm.dox.h:587
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from 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 getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
common base class for unique constraints
Definition: FreetdsSqlUtil.qm.dox.h:406
bool setIndexBase(string ix)
sets the supporting index name
*string filegroup
any filegroup for the unique key index
Definition: FreetdsSqlUtil.qm.dox.h:411
getIndexSql(reference< string > sql, string name, *hash opts)
adds index options onto the sql creation string
constructor(*string ts)
creates the constraint with an optional filegroup name
constructor()
empty constructor for subclasses
clearIndex()
clears any index base for the constraint
*string getTablespace()
returns the filegroup name used for this constraint, if known
setTablespace(*string ts)
sets or clears the filegroup name
class modeling a unique constraint
Definition: FreetdsSqlUtil.qm.dox.h:447
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
bool isEnabled()
returns True if the constraint is enabled, False if not
FreetdsColumn memberGate(string k)
returns the FreetdsColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
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
bool enabled
True if the constraint is enabled, False if not
Definition: FreetdsSqlUtil.qm.dox.h:452
represents a FreeTDS view
Definition: FreetdsSqlUtil.qm.dox.h:566
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 FreetdsSqlUtil namespace contains all the objects in the FreetdsSqlUtil module
Definition: FreetdsSqlUtil.qm.dox.h:201
FreetdsDatabase get_database(AbstractDatasource nds, *hash< auto > opts)
returns a FreetdsDatabase object corresponding to the arguments
FreetdsTable get_table(AbstractDatasource nds, string nname, *hash< auto > opts)
returns a FreetdsTable object corresponding to the arguments