160 namespace FreetdsSqlUtil {
163 FreetdsTable
get_table(AbstractDatasource nds,
string nname, *
hash opts);
170 parse_schema_name(
string nname, reference<string> schema, reference<string> name);
184 constructor(
string n_name,
bool n_unique,
hash n_cols, *
string n_filegroup) ;
199 string getRenameSql(
string table_name,
string new_name);
208 constructor(
string n, Columns c, ForeignConstraintTarget t) ;
215 softlist getRenameSql(
string table_name,
string new_name);
235 list getRenameSql(
string table_name,
string new_name);
254 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs) ;
316 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs, softint n_scale) ;
404 list getRenameSql(
string table_name,
string new_name);
456 softlist
getRenameSql(
string table_name,
string new_name);
486 constructor(
string n_name,
string n_src, *
string n_schemaname) ;
526 softlist
getRenameSql(
string table_name,
string new_name);
539 constructor(
string n,
string n_src, *
string a) ;
582 const FreeTDS_TempSavepoint =
"qore_freetds_tmp_savepoint";
596 "authorization":
True,
617 "containstable":
True,
623 "current_date":
True,
624 "current_time":
True,
625 "current_timestamp":
True,
626 "current_user":
True,
658 "freetexttable":
True,
668 "identity_insert":
True,
688 "nonclustered":
True,
697 "opendatasource":
True,
733 "securityaudit":
True,
735 "semantickeyphrasetable":
True,
736 "semanticsimilaritydetailstable":
True,
737 "semanticsimilaritytable":
True,
738 "session_user":
True,
772 "within group":
True,
778 constructor(AbstractDatasource nds, *
hash opts) ;
795 *AbstractSequence getSequenceImpl(
string name);
801 *AbstractView getViewImpl(
string name);
819 *AbstractFunction getFunctionImpl(
string name);
825 AbstractFunction getProcedureImpl(
string name);
870 list listSequencesImpl();
876 list listViewsImpl();
978 static auto tryExecArgs(AbstractDatasource
ds,
string sql, *softlist args);
981 static auto tryExecRaw(AbstractDatasource
ds,
string sql);
1045 "integer":
"bigint",
1047 "number":
"numeric",
1048 "string":
"varchar",
1050 "binary":
"varbinary",
1067 const FreetdsColumnDescOptions = AbstractTable::ColumnDescOptions;
1069 const FreetdsIndexOptions = AbstractTable::IndexOptions;
1071 const FreetdsConstraintOptions = AbstractTable::ConstraintOptions + FreetdsIndexOptions;
1073 const FreetdsTableCreationOptions = AbstractTable::TableCreationOptions + FreetdsConstraintOptions;
1075 const FreetdsAlignTableOptions = AbstractTable::AlignTableOptions + FreetdsTableCreationOptions;
1079 "tablehint":
"softstringlist",
1084 "fastfirstrow":
True,
1088 "readcommitted":
True,
1090 "readuncommitted":
True,
1091 "repeatableread":
True,
1093 "serializable":
True,
1109 return sprintf(
"substring(%s,%v,%v) = %v", cn);
1120 string sql =
sprintf (
"cast (%s as %s", cve, name);
1130 "code":
string (
string cve,
string arg) {
1131 return sprintf(
"%s + %s", arg, cve);
1137 "code":
string (
string cve,
string arg) {
1138 return sprintf(
"%s + %s", cve, arg);
1142 "code":
string (
string cve,
list args) {
1144 return sprintf(
"substring(%s,%d,32767)", cve, args[0]);
1145 return sprintf(
"substring(%s,%d,%d)", cve, args[0], args[1]);
1149 "code":
string (
string arg1,
auto arg) {
1150 return sprintf(
"substring(convert(varchar, dt, 120), 1, 4)", arg1);
1154 "code":
string (
string arg1,
auto arg) {
1155 return sprintf(
"substring(convert(varchar, dt, 120), 1, 7)", arg1);
1159 "code":
string (
string arg1,
auto arg) {
1160 return sprintf(
"substring(convert(varchar, dt, 120), 1, 10)", arg1);
1164 "code":
string (
string arg1,
auto arg) {
1165 return sprintf(
"substring(convert(varchar, dt, 120), 1, 13)", arg1);
1171 "code":
string (*
string cve,
hash arg, reference<hash> psch) {
1172 string sql =
sprintf(
"next value for %s", arg.seq);
1180 "code":
string (*
string cve,
hash arg) {
1181 throw "SEQUENCE-ERROR",
sprintf(
"cannot select the current value of sequence %y because this database does not support this operation", arg.seq);
1185 "code":
string (
string cve,
auto arg) {
1186 return sprintf(
"len(%s)", cve);
1190 "code":
string sub(
string arg1,
auto arg) {
1194 return replace(cmd,
"%s", arg1);
1205 DT_YEAR :
"datetimefromparts(datepart(year, %s), 1, 1, 0, 0, 0, 0)",
1206 DT_MONTH :
"datetimefromparts(datepart(year, %s), datepart(month, %s), 1, 0, 0, 0, 0)",
1207 DT_DAY :
"datetimefromparts(datepart(year, %s), datepart(month, %s), datepart(day, %s), 0, 0, 0, 0)",
1208 DT_HOUR :
"datetimefromparts(datepart(year, %s), datepart(month, %s), datepart(day, %s), datepart(hour, %s), 0, 0, 0)",
1209 DT_MINUTE :
"datetimefromparts(datepart(year, %s), datepart(month, %s), datepart(day, %s), datepart(hour, %s), datepart(minute, %s), 0, 0)",
1210 DT_SECOND :
"datetimefromparts(datepart(year, %s), datepart(month, %s), datepart(day, %s), datepart(hour, %s), datepart(minute, %s), datepart(second, %s), 0)",
1217 "placeholder":
"next value for %v",
1226 "code":
string (*
string cve,
string arg) {
1227 return sprintf(
"next value for %s", arg);
1232 "code":
string (*
string cve,
string arg) {
1233 throw "SEQUENCE-ERROR",
sprintf(
"cannot select the current value of sequence %y because this database does not support this operation", arg);
1252 constructor(AbstractDatasource nds,
string nname, *
hash opts) ;
1277 string getFromIntern(
string from, *
hash qh);
1283 hash getTableCreationOptions();
1289 hash getTableDescriptionHashOptions();
1295 hash getColumnDescOptions();
1301 hash getIndexOptions();
1307 hash getConstraintOptions();
1313 hash getAlignTableOptions();
1354 bool checkExistenceImpl();
1360 Columns describeImpl();
1366 Columns describeSybaseImpl();
1372 Columns describeMssqlImpl();
1396 Indexes getIndexesImpl();
1402 Indexes getIndexesSybaseImpl();
1408 Indexes getIndexesMssqlImpl();
1414 ForeignConstraints getForeignConstraintsImpl(*
hash opts);
1420 ForeignConstraints getForeignConstraintsSybaseImpl();
1426 ForeignConstraints getForeignConstraintsMssqlImpl();
1432 Constraints getConstraintsImpl();
1438 Constraints getConstraintsSybaseImpl();
1444 Constraints getConstraintsMssqlImpl();
1450 Triggers getTriggersImpl();
1469 *
list getAlignSqlImpl(AbstractTable table, *
hash opt);
1482 string getRenameSqlImpl(
string new_name);
1488 AbstractColumn addColumnImpl(
string cname,
hash opt,
bool nullable =
True);
1494 AbstractPrimaryKey addPrimaryKeyImpl(
string cname,
hash ch, *
hash opt);
1500 AbstractIndex addIndexImpl(
string iname,
bool enabled,
hash ch, *
hash opt);
1506 AbstractForeignConstraint addForeignConstraintImpl(
string cname,
hash ch,
string table,
hash tch, *
hash opt);
1512 AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *
hash opt);
1518 AbstractUniqueConstraint addUniqueConstraintImpl(
string cname,
hash ch, *
hash opt);
1524 AbstractTrigger addTriggerImpl(
string tname,
string src, *
hash opt);
1530 bool tryInsertImpl(
string sql,
hash row);
1536 hash getQoreTypeMapImpl();
1542 hash getTypeMapImpl();
1576 setupTableImpl(
hash desc, *
hash opt);
1638 *
hash doReturningImpl(
hash opt, reference<string> sql,
list args);
1644 softbool tryUpdate(
string sql,
hash row, Columns cols,
list updc);
list listProceduresImpl()
since FreeTDS only supports functions, this method is identical to listFunctionsImpl() ...
string getCreateSqlImpl(list l)
returns a string that can be used to create the table in the database
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
constructor(string n, Columns c, ForeignConstraintTarget t)
creates the constraint from the supplied arguments
getIndexSql(reference< string > sql, string name, *hash opts)
adds index options onto the sql creation string
constructor(string n_name, string n_src, *string n_schemaname)
creates the object from the arguments
bool is_sybase
sybase flag
Definition: FreetdsSqlUtil.qm.dox.h:990
string sprintf(string fmt,...)
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
bool ss_has_merge
"has merge" flag for SQL server
Definition: FreetdsSqlUtil.qm.dox.h:993
constructor()
creates an empty primary key object
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint n_scale)
creates the column from the supplied arguments
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
const FreetdsOpMap
where operator specializations for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:1101
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs)
creates the column 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
represents a FreeTDS-specific numeric column
Definition: FreetdsSqlUtil.qm.dox.h:312
const SybaseQoreTypeMap
maps qore type names to Sybase/SAP type names
Definition: FreetdsSqlUtil.qm.dox.h:1062
class for FreeTDS sequences
Definition: FreetdsSqlUtil.qm.dox.h:461
FreetdsColumn memberGate(string k)
returns the FreetdsColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception...
static bool isSybase(AbstractDatasource ds)
returns True if the DB is a Sybase database
string schema
schema name for the table
Definition: FreetdsSqlUtil.qm.dox.h:1245
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
string getSchemaName()
returns the schema name
represents a FreeTDS-specific column
Definition: FreetdsSqlUtil.qm.dox.h:244
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
constructor(string n, string n_src)
creates the constraint from the supplied arguments
represents a FreeTDS-specific primary key constraint
Definition: FreetdsSqlUtil.qm.dox.h:417
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
auto tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
const FreetdsTypeMap
maps postgresql type names to type configurations
Definition: FreetdsSqlUtil.qm.dox.h:996
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...
const FreetdsTableDescriptionHashOptions
equal to SqlUtil::AbstractTable::TableDescriptionHashOptions
Definition: FreetdsSqlUtil.qm.dox.h:1065
auto tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
bool hasArrayBind()
returns False because the freetds driver does not support array binds / bulk DML operations ...
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
bool is_sybase
sybase flag
Definition: FreetdsSqlUtil.qm.dox.h:577
common base class for unique constraints
Definition: FreetdsSqlUtil.qm.dox.h:325
number number(softnumber n)
hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
int byte_size
byte size of the column
Definition: FreetdsSqlUtil.qm.dox.h:249
hash getInsertOperatorMap()
returns the insert operator map for this object
list getColumnSqlNames(softlist cols)
returns a list of column names for use in SQL strings; subclasses can process the argument list in ca...
string getNativeTypeString()
returns a string giving the native type of the column
hash getSelectOptions()
returns the select options for this driver
clearImpl()
clears FreeTDS-specific table information
class modeling a unique constraint
Definition: FreetdsSqlUtil.qm.dox.h:363
*string filegroup
the tablespace (filegroup) name of the index
Definition: FreetdsSqlUtil.qm.dox.h:179
constructor(*string ts)
creates the constraint with an optional filegroup name
represents a FreeTDS-specific foreign constraint
Definition: FreetdsSqlUtil.qm.dox.h:204
hash getColumnOperatorMapImpl()
returns the column operator map for this object
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
string replace(string str, string source, string target, int start=0, int end=-1)
const FreetdsReservedWords
hash of reserved words
Definition: FreetdsSqlUtil.qm.dox.h:588
*string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the function in the database
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the view in the database
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
const FreetdsReclaimSpaceOptions
Options for reclaimSpace()
Definition: FreetdsSqlUtil.qm.dox.h:585
constructor(string n_name, bool n_unique, hash n_cols, *string n_filegroup)
creates the object from the arguments
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: FreetdsSqlUtil.qm.dox.h:1248
setTablespace(*string ts)
sets or clears the filegroup name
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
string getCreateSqlImpl(list l)
returns a string that can be used to create the schema in the database
const FreetdsCopMap
column operator specializations for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:1115
hash getReclaimSpaceOptions()
returns driver-specific options to the base abstract class
doSelectLimitOnlyUnlockedImpl(reference< string > sql, reference< list > args, *hash qh)
processes a string for use in SQL select statements when there is a "limit" argument, but no "orderby" or "offset" arguments
*string getTablespace()
returns the filegroup name used for this constraint, if known
provides the FreeTDS-specific implementation of the AbstractDatabase interface
Definition: FreetdsSqlUtil.qm.dox.h:572
auto tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
const MsSqlServerTableHints
query hints
Definition: FreetdsSqlUtil.qm.dox.h:1083
bool supportsTablespacesImpl()
returns True if the database support tablespaces
copyImpl(AbstractTable old)
db-specific copy actions
clearIndex()
clears any index base for the constraint
represents a FreeTDS-specific index
Definition: FreetdsSqlUtil.qm.dox.h:174
FreetdsColumn memberGate(string k)
returns the FreetdsColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception...
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics() ...
represents a FreeTDS view
Definition: FreetdsSqlUtil.qm.dox.h:482
bool supportsSequencesImpl()
returns True if the database supports sequences
const FreetdsSelectOptions
select options supported by FreetdsSqlUtil
Definition: FreetdsSqlUtil.qm.dox.h:1078
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
provides the FreeTDS-specific implementation of the SqlUtil::AbstractTable interface ...
Definition: FreetdsSqlUtil.qm.dox.h:985
represents a FreeTDS-specific check constraint
Definition: FreetdsSqlUtil.qm.dox.h:224
static string getCreateSql(list l)
returns a string that can be used to create the schema in the database
bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
auto tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
code getUpsertClosure(hash row, int upsert_strategy=UpsertAuto, *hash opt)
returns a closure for performing upserts; if the underlying dataserver supports an optimized MERGE st...
bool enabled
True if the constraint is enabled, False if not
Definition: FreetdsSqlUtil.qm.dox.h:368
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
FreetdsDatabase get_database(AbstractDatasource nds, *hash opts)
returns a FreetdsDatabase object corresponding to the arguments
constructor(string n, hash n_cols, bool e=True, *string ts)
creates the object with the given attributes
*string filegroup
any filegroup for the unique key index
Definition: FreetdsSqlUtil.qm.dox.h:330
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the constraint
const FreetdsTruncDate
Map SqlUtil::cop_trunc_date() constants to Oracle internal masks.
Definition: FreetdsSqlUtil.qm.dox.h:1204
const QoreTypeMap
maps qore type names to DB type names
Definition: FreetdsSqlUtil.qm.dox.h:1044
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
string string(softstring str, *string enc)
list listFunctionsImpl()
returns a list of string function names in the database
bool setIndexBase(string ix)
sets the supporting index name
static auto tryExecArgs(AbstractDatasource ds, string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
hash getWhereOperatorMap()
returns the "where" operator map for this object
bool supportsPackagesImpl()
returns True if the database supports packages
softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
represents a FreeTDS-specific trigger
Definition: FreetdsSqlUtil.qm.dox.h:503
string getNativeTypeString()
returns a string giving the native type of the column
const MsQoreTypeMap
maps qore type names to MS SQL Server type names
Definition: FreetdsSqlUtil.qm.dox.h:1057
const FreetdsUopMap
a hash of default update operator definitions for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:1222
represents a FreeTDS-specific function
Definition: FreetdsSqlUtil.qm.dox.h:531
string getCreateTableSqlImpl(*hash opt)
returns a string that can be used to create the table in the database
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
FreetdsTable get_table(AbstractDatasource nds, string nname, *hash opts)
returns a FreetdsTable object corresponding to the arguments
doSelectOrderByWithOffsetSqlUnlockedImpl(reference< string > sql, reference< list > args, *hash qh, *hash jch, *hash ch, *hash psch, list coll)
processes a string for use in SQL select statements when there is an "order by" and "offset" argument...
reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from the database
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
bool supportsTypesImpl()
returns True if the database supports named types
softlist listTablesImpl()
returns a list of string table names in the database
hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
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 ...
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
const FreetdsSchemaDescriptionOptions
FreeTDS-specific schema description keys.
Definition: FreetdsSqlUtil.qm.dox.h:580
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the sequence in the database
abstract AbstractIterator keyIterator()
returns an iterator for keys iterating a list of string key names
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_end)
creates the object from the arguments
bool isEnabled()
returns True if the constraint is enabled, False if not
string join(string str,...)
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
*string filegroup
filegroup name for the table, if known
Definition: FreetdsSqlUtil.qm.dox.h:1242
softlist getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table ...
const FreetdsIopMap
a hash of default value operator descriptions for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:1214
const ReclaimSpaceOptions
*string getTablespaceName()
returns the data filegroup name for the table or NOTHING if none is known