FreetdsSqlUtil.qm.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
// @file FreetdsSqlUtil.qm Qore user module for working with PostgreSQL SQL data
/* FreetdsSqlUtil.qm Copyright (C) 2015 - 2016 Qore Technologies, sro
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 qore version
// requires the SqlUtil 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 FreetdsSqlUtil {
FreetdsTable get_table(AbstractDatasource nds, string nname, *hash opts);
FreetdsDatabase get_database(AbstractDatasource nds, *hash opts);
parse_schema_name(string nname, reference schema, reference name);
class FreetdsIndex : public SqlUtil::AbstractIndex {
public:
public :
*string filegroup;
public:
constructor(string n_name, bool n_unique, hash n_cols, *string n_filegroup) ;
string getCreateSql(string table_name, *hash opt);
private bool equalImpl(AbstractIndex ix);
string getRenameSql(string table_name, string new_name);
};
class FreetdsForeignConstraint : public SqlUtil::AbstractForeignConstraint {
public:
constructor(string n, Columns c, ForeignConstraintTarget t) ;
string getCreateSql(string table_name, *hash opt);
softlist getRenameSql(string table_name, string new_name);
string getCreateSql(string name, string table_name, *hash opt);
};
class FreetdsCheckConstraint : public SqlUtil::AbstractCheckConstraint {
public:
constructor(string n, string n_src) ;
string getCreateSql(string table_name, *hash opt);
list getRenameSql(string table_name, string new_name);
string getCreateSql(string name, string table_name, *hash opt);
};
class FreetdsColumn : public SqlUtil::AbstractColumn {
public:
public :
int byte_size;
public:
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs) ;
string getNativeTypeString();
softlist getAddColumnSql(AbstractTable t);
list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
string getRenameSql(AbstractTable t, string new_name);
private bool equalImpl(AbstractColumn c);
};
class FreetdsNumericColumn : public FreetdsColumn,public SqlUtil::NumericColumnInfo {
public:
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint n_scale) ;
string getNativeTypeString();
};
class FreetdsUniqueConstraintCommon : public SqlUtil::AbstractUniqueConstraint {
public:
private :
*string filegroup;
public:
constructor(*string ts);
*string getTablespace();
setTablespace(*string ts);
bool setIndexBase(string ix);
clearIndex();
getIndexSql(reference sql, string name, *hash opts);
abstract AbstractIterator keyIterator();
};
class FreetdsUniqueConstraint : public SqlUtil::AbstractUniqueConstraint,public FreetdsUniqueConstraintCommon {
public:
private :
bool enabled;
public:
constructor(string n, hash n_cols, bool e = True, *string ts) ;
FreetdsColumn memberGate(string k);
string getCreateSql(string table_name, *hash opts);
list getRenameSql(string table_name, string new_name);
string getCreateSql(string name, string table_name, *hash opts);
bool isEnabled();
};
class FreetdsPrimaryKey : public SqlUtil::AbstractPrimaryKey,public FreetdsUniqueConstraintCommon {
public:
constructor();
constructor(string n, *hash c, *string ts) ;
FreetdsColumn memberGate(string k);
string getCreateSql(string table_name, *hash opts);
softlist getRenameSql(string table_name, string new_name);
};
class FreetdsSequence : public SqlUtil::AbstractSequence {
public:
constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
string getCreateSql(*hash opt);
string getRenameSql(string new_name);
};
class FreetdsView : public SqlUtil::AbstractView {
public:
constructor(string n_name, string n_src, *string n_schemaname) ;
string getCreateSql(*hash opt);
softlist getRenameSql(string new_name);
};
class FreetdsTrigger : public SqlUtil::AbstractTrigger {
public:
constructor(string n, string n_src) ;
softlist getCreateSql(string table_name, *hash opt);
softlist getDropSql(string table_name);
private bool equalImpl(AbstractFunctionBase t);
softlist getRenameSql(string table_name, string new_name);
};
class FreetdsFunction : public SqlUtil::AbstractFunction {
public:
public :
*string args;
public:
constructor(string n, string n_src, *string a) ;
softlist getCreateSql(*hash opt);
string getDropSql();
private bool equalImpl(AbstractFunctionBase t);
softlist getRenameSql(string new_name);
setName(string new_name);
};
class FreetdsDatabase : public SqlUtil::AbstractDatabase {
public:
public :
bool is_sybase;
const FreetdsSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions;
const FreeTDS_TempSavepoint = "qore_freetds_tmp_savepoint";
const FreetdsReclaimSpaceOptions = ReclaimSpaceOptions;
public:
constructor(AbstractDatasource nds, *hash opts) ;
private list featuresImpl();
private FreetdsSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
private *AbstractSequence getSequenceImpl(string name);
private *AbstractView getViewImpl(string name);
private FreetdsFunction makeFunctionImpl(string name, string src, *hash opts);
private FreetdsFunction makeProcedureImpl(string name, string src, *hash opts);
private *AbstractFunction getFunctionImpl(string name);
private AbstractFunction getProcedureImpl(string name);
private list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
private list getAlignSqlImpl(hash schema_hash, *hash opt);
private softlist listTablesImpl();
private list listFunctionsImpl();
private list listProceduresImpl();
private list listSequencesImpl();
private list listViewsImpl();
private string getCreateSqlImpl(list l);
static bool isSybase(AbstractDatasource ds);
static string getCreateSql(list l);
private hash getSchemaDescriptionOptions();
private hash getReclaimSpaceOptions();
private softint getNextSequenceValueImpl(string name);
private softint getCurrentSequenceValueImpl(string name);
private bool supportsSequencesImpl();
private bool supportsTypesImpl();
private bool supportsPackagesImpl();
private bool rebuildIndexImpl(string name, *hash options);
private computeStatisticsImpl(*hash options);
private reclaimSpaceImpl(*hash options);
private any tryExecArgsImpl(string sql, *softlist args);
private any tryExecRawImpl(string sql, *softlist args);
static any tryExecArgs(AbstractDatasource ds, string sql, *softlist args);
static any tryExecRaw(AbstractDatasource ds, string sql);
};
class FreetdsTable : public SqlUtil::AbstractTable {
public:
public :
bool is_sybase;
bool ss_has_merge = False;
const FreetdsTypeMap = (
"numeric": ("qore": Type::Number, "size": SZ_NUM,),
"decimal": ("qore": Type::Number, "size": SZ_NUM,),
"tinyint": ("qore": Type::Int,),
"smallint": ("qore": Type::Int,),
"int": ("qore": Type::Int,),
"bigint": ("qore": Type::Int,),
"double": ("qore": Type::Float,),
"float": ("qore": Type::Float,), // NOTE: optional precision
"real": ("qore": Type::Float,),
"money": ("qore": Type::Number,),
"smallmoney": ("qore": Type::Number,),
"datetime": ("qore": Type::Date,),
"smalldatetime": ("qore": Type::Date,),
"date": ("qore": Type::Date,),
"time": ("qore": Type::Date,),
// NOTE: "size_range" is different between MS SQL Server and Sybase SQL Anywhere Server
// MS SQL: range is (1, 8000) or special keyword "max" for varchar types
// Sybase: range is (1, 32767) and size is mandatory for character-length semantics
"char": ("qore": Type::String, "size": SZ_OPT),
"char varying": ("qore": Type::String, "size": SZ_OPT),
"character varying": ("qore": Type::String, "size": SZ_OPT),
"varchar": ("qore": Type::String, "size": SZ_OPT),
// The following uni* types are used in Sybase Adaptive Server
"unichar": ("qore": Type::String, "size": SZ_MAND,),
"univarchar": ("qore": Type::String, "size": SZ_MAND,),
"unitext": ("qore": Type::String,),
// NOTE: "size_range" is different between MS SQL Server and Sybase SQL Anywhere Server
// MS SQL: range is (1, 8000) or special keyword "max" for varbinary types
// Sybase: range is (1, 32767)
"binary": ("qore": Type::Binary, "size": SZ_OPT),
"binary varying": ("qore": Type::Binary, "size": SZ_OPT),
"varbinary": ("qore": Type::Binary, "size": SZ_OPT),
// The following are used in Sybase, supported & deprecated in MS SQL
"text": ("qore": Type::String,), // domain, implemented as "long varchar"
"image": ("qore": Type::Binary,), // domain, implemented as "long binary"
// The following are Sybase specific
"long binary": ("qore": Type::Binary,),
"long varchar": ("qore": Type::String,),
);
const QoreTypeMap = (
"integer": "bigint",
"float": "float",
"number": "numeric",
"string": "varchar",
"date": "datetime",
"binary": "varbinary",
"bool": "tinyint",
SqlUtil::CHAR: "char",
SqlUtil::CLOB: "text",
SqlUtil::BLOB: "varbinary",
);
const FreetdsTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions;
const FreetdsColumnDescOptions = AbstractTable::ColumnDescOptions;
const FreetdsIndexOptions = AbstractTable::IndexOptions;
const FreetdsConstraintOptions = AbstractTable::ConstraintOptions + FreetdsIndexOptions;
const FreetdsTableCreationOptions = AbstractTable::TableCreationOptions + FreetdsConstraintOptions;
const FreetdsAlignTableOptions = AbstractTable::AlignTableOptions + FreetdsTableCreationOptions;
const FreetdsSelectOptions = AbstractTable::SelectOptions + (
"tablehint": "softstringlist",
);
const MsSqlServerTableHints = (
"fastfirstrow": True,
"holdlock": True,
"nolock": True,
"paglock": True,
"readcommitted": True,
"readpast": True,
"readuncommitted": True,
"repeatableread": True,
"rowlock": True,
"serializable": True,
"tablock": True,
"tablockx": True,
"updlock": True,
"xlock": True,
);
const FreetdsOpMap = DefaultOpMap + (
OP_SUBSTR: (
"code": string (object t, string cn, any arg, reference args, *hash jch, bool join = False, *hash ch, *hash psch) {
args += arg[0]; // start
if (!exists arg[1]);
args += arg[1]; // count
args += arg[2]; // text
return sprintf("substring(%s,%v,%v) = %v", cn);
},
),
);
const FreetdsCopMap = DefaultCopMap + (
COP_CAST: (
"code": string (string cve, list args) {
string name = QoreTypeMap{args[0]} ?? args[0];
hash desc = FreetdsTypeMap{name};
string sql = sprintf ("cast (%s as %s", cve, name);
switch (name);
sql += ")";
return sql;
},
),
COP_PREPEND: (
"arg": Type::String,
"sqlvalue": True,
"code": string (string cve, string arg) {
return sprintf("%s + %s", arg, cve);
},
),
COP_APPEND: (
"arg": Type::String,
"sqlvalue": True,
"code": string (string cve, string arg) {
return sprintf("%s + %s", cve, arg);
},
),
COP_SUBSTR: (
"code": string (string cve, list args) {
if (!exists args[1])
return sprintf("substring(%s,%d,32767)", cve, args[0]); // NOTE: length arg is required
return sprintf("substring(%s,%d,%d)", cve, args[0], args[1]);
},
),
COP_OVER: (
"argcolumn": True,
"argoptional": True,
"code": string (*string cve, *string arg) {
string sql = cve + " over (";
if (arg)
sql += sprintf("partition by %s", arg);
sql += ")";
return sql;
},
),
COP_YEAR: (
"code": string (string arg1, any arg) {
return sprintf("substring(convert(varchar, dt, 120), 1, 4)", arg1);
}
),
COP_YEAR_MONTH: (
"code": string (string arg1, any arg) {
return sprintf("substring(convert(varchar, dt, 120), 1, 7)", arg1);
}
),
COP_YEAR_DAY: (
"code": string (string arg1, any arg) {
return sprintf("substring(convert(varchar, dt, 120), 1, 10)", arg1);
}
),
COP_YEAR_HOUR: (
"code": string (string arg1, any arg) {
return sprintf("substring(convert(varchar, dt, 120), 1, 13)", arg1);
}
),
COP_SEQ: (
"nocolumn": True,
"withalias": True,
"code": string (*string cve, hash arg, reference psch) {
string sql = sprintf("next value for %s", arg.seq);
if (arg.as);
return sql;
}
),
COP_SEQ_CURRVAL: (
"nocolumn": True,
"code": string (*string cve, hash arg) {
throw "SEQUENCE-ERROR", sprintf("cannot select the current value of sequence %y because this database does not support this operation", arg.seq);
}
),
);
const FreetdsIopMap = DefaultIopMap + (
IOP_SEQ: (
"arg": Type::String,
"placeholder": "next value for %v",
),
);
const FreetdsUopMap = DefaultUopMap + (
COP_SEQ: (
"nocolumn": True,
"withalias": True,
"code": string (*string cve, string arg) {
return sprintf("next value for %s", arg);
}
),
COP_SEQ_CURRVAL: (
"nocolumn": True,
"code": string (*string cve, string arg) {
throw "SEQUENCE-ERROR", sprintf("cannot select the current value of sequence %y because this database does not support this operation", arg);
}
),
);
public:
private :
*string filegroup;
string schema;
Functions triggerFunctions;
public:
constructor(AbstractDatasource nds, string nname, *hash opts) ;
string getSchemaName();
*string getTablespaceName();
code getUpsertClosure(hash row, int upsert_strategy = UpsertAuto, *hash opt);
bool hasArrayBind();
string getSqlName();
private string getFromIntern(string from, *hash qh);
private hash getTableCreationOptions();
private hash getTableDescriptionHashOptions();
private hash getColumnDescOptions();
private hash getIndexOptions();
private hash getConstraintOptions();
private hash getAlignTableOptions();
private hash getWhereOperatorMap();
private hash getColumnOperatorMap();
private hash getInsertOperatorMap();
private hash getRawUpdateOperatorMap();
private hash getSelectOptions();
private bool checkExistenceImpl();
private Columns describeImpl();
private Columns describeSybaseImpl();
private Columns describeMssqlImpl();
private FreetdsPrimaryKey getPrimaryKeyImpl();
private FreetdsPrimaryKey getPrimaryKeySybaseImpl();
private FreetdsPrimaryKey getPrimaryKeyMssqlImpl();
private Indexes getIndexesImpl();
private Indexes getIndexesSybaseImpl();
private Indexes getIndexesMssqlImpl();
private ForeignConstraints getForeignConstraintsImpl(*hash opts);
private ForeignConstraints getForeignConstraintsSybaseImpl();
private ForeignConstraints getForeignConstraintsMssqlImpl();
private Constraints getConstraintsImpl();
private Constraints getConstraintsSybaseImpl();
private Constraints getConstraintsMssqlImpl();
private Triggers getTriggersImpl();
private string getCreateTableSqlImpl(*hash opt);
private *list getCreateMiscSqlImpl(*hash opt, bool cache);
private *list getAlignSqlImpl(AbstractTable table, *hash opt);
private string getCreateSqlImpl(list l);
private string getRenameSqlImpl(string new_name);
private AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
private AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
private AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
private AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch, *hash opt);
private AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
private AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
private AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
private bool tryInsertImpl(string sql, hash row);
private hash getQoreTypeMapImpl();
private hash getTypeMapImpl();
private *string getSqlValueImpl(any v);
private bool emptyImpl();
private clearImpl();
private setupTableImpl(hash desc, *hash opt);
private bool constraintsLinkedToIndexesImpl();
private bool uniqueIndexCreatesConstraintImpl();
private bool supportsTablespacesImpl();
private doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh);
private doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch, *hash psch, list coll);
private any tryExecArgsImpl(string sql, *softlist args);
private any tryExecRawImpl(string sql, *softlist args);
private copyImpl(AbstractTable old);
private *hash doReturningImpl(hash opt, reference sql, list args);
private softbool tryUpdate(string sql, hash row, Columns cols, list updc);
};
};
FreetdsSqlUtil::FreetdsFunction::getRenameSql
softlist getRenameSql(string new_name)
returns a string that can be used to rename the function in the database
SqlUtil::AbstractConstraint::name
string name
Date
const Date
SqlUtil::AbstractFunctionBase::getDropSql
string getDropSql()
FreetdsSqlUtil::FreetdsIndex::getRenameSql
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
FreetdsSqlUtil::FreetdsDatabase::supportsSequencesImpl
private bool supportsSequencesImpl()
returns True if the database supports sequences
COP_SEQ
const COP_SEQ
FreetdsSqlUtil::FreetdsForeignConstraint::constructor
constructor(string n, Columns c, ForeignConstraintTarget t)
creates the constraint from the supplied arguments
FreetdsSqlUtil::FreetdsDatabase::tryExecArgs
static any 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 ...
SqlUtil::AbstractTable::UpsertAuto
const UpsertAuto
String
const String
DefaultIopMap
const DefaultIopMap
FreetdsSqlUtil::FreetdsView::constructor
constructor(string n_name, string n_src, *string n_schemaname)
creates the object from the arguments
FreetdsSqlUtil::FreetdsTable::is_sybase
bool is_sybase
sybase flag
Definition: FreetdsSqlUtil.qm.dox.h:678
sprintf
string sprintf(string fmt,...)
FreetdsSqlUtil::FreetdsDatabase::supportsPackagesImpl
private bool supportsPackagesImpl()
returns True if the database supports packages
FreetdsSqlUtil::FreetdsTable::ss_has_merge
bool ss_has_merge
"has merge" flag for SQL server
Definition: FreetdsSqlUtil.qm.dox.h:681
FreetdsSqlUtil::FreetdsIndex::equalImpl
private bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
FreetdsSqlUtil::FreetdsPrimaryKey::constructor
constructor()
creates an empty primary key object
FreetdsSqlUtil::FreetdsTable::getSqlValueImpl
private *string getSqlValueImpl(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
SqlUtil::AbstractTable
DefaultCopMap
const DefaultCopMap
FreetdsSqlUtil::FreetdsTable::getColumnOperatorMap
private hash getColumnOperatorMap()
returns the column operator map for this object
FreetdsSqlUtil::FreetdsNumericColumn::constructor
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
FreetdsSqlUtil::FreetdsDatabase::getSchemaDescriptionOptions
private hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
FreetdsSqlUtil::FreetdsTable::FreetdsOpMap
const FreetdsOpMap
where operator specializations for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:781
FreetdsSqlUtil::FreetdsColumn::constructor
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs)
creates the column from the supplied arguments
FreetdsSqlUtil::FreetdsCheckConstraint::getCreateSql
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
FreetdsSqlUtil::FreetdsNumericColumn
represents a FreeTDS-specific numeric column
Definition: FreetdsSqlUtil.qm.dox.h:292
FreetdsSqlUtil::FreetdsTable::constraintsLinkedToIndexesImpl
private bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
FreetdsSqlUtil::FreetdsSequence
class for FreeTDS sequences
Definition: FreetdsSqlUtil.qm.dox.h:441
FreetdsSqlUtil::FreetdsUniqueConstraint::memberGate
FreetdsColumn memberGate(string k)
returns the FreetdsColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception...
SqlUtil::AbstractTable::cache
cache(*hash opts)
FreetdsSqlUtil::FreetdsDatabase::isSybase
static bool isSybase(AbstractDatasource ds)
returns True if the DB is a Sybase database
SqlUtil::AbstractIndex
FreetdsSqlUtil::FreetdsFunction::equalImpl
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
COP_OVER
const COP_OVER
FreetdsSqlUtil::FreetdsTable::schema
string schema
schema name for the table
Definition: FreetdsSqlUtil.qm.dox.h:909
FreetdsSqlUtil::FreetdsTrigger::getRenameSql
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
FreetdsSqlUtil::FreetdsTable::getSchemaName
string getSchemaName()
returns the schema name
FreetdsSqlUtil::FreetdsColumn
represents a FreeTDS-specific column
Definition: FreetdsSqlUtil.qm.dox.h:228
FreetdsSqlUtil::FreetdsUniqueConstraint::getCreateSql
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
FreetdsSqlUtil::FreetdsCheckConstraint::constructor
constructor(string n, string n_src)
creates the constraint from the supplied arguments
FreetdsSqlUtil::FreetdsPrimaryKey
represents a FreeTDS-specific primary key constraint
Definition: FreetdsSqlUtil.qm.dox.h:397
FreetdsSqlUtil::FreetdsTable::getSqlName
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
FreetdsSqlUtil::FreetdsTable::FreetdsTypeMap
const FreetdsTypeMap
maps postgresql type names to type configurations
Definition: FreetdsSqlUtil.qm.dox.h:684
FreetdsSqlUtil::FreetdsColumn::getModifySqlImpl
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...
FreetdsSqlUtil::FreetdsTable::FreetdsTableDescriptionHashOptions
const FreetdsTableDescriptionHashOptions
equal to SqlUtil::AbstractTable::TableDescriptionHashOptions
Definition: FreetdsSqlUtil.qm.dox.h:745
COP_SEQ_CURRVAL
const COP_SEQ_CURRVAL
SqlUtil::NumericColumnInfo
FreetdsSqlUtil::FreetdsTable::hasArrayBind
bool hasArrayBind()
returns False because the freetds driver does not support array binds / bulk DML operations ...
FreetdsSqlUtil::FreetdsTrigger::getCreateSql
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
True
const True
FreetdsSqlUtil::FreetdsView::getCreateSql
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
FreetdsSqlUtil::FreetdsTable::getWhereOperatorMap
private hash getWhereOperatorMap()
returns the "where" operator map for this object
SZ_MAND
const SZ_MAND
SqlUtil::CHAR
const CHAR
FreetdsSqlUtil::FreetdsTable::getInsertOperatorMap
private hash getInsertOperatorMap()
returns the insert operator map for this object
FreetdsSqlUtil::FreetdsDatabase::is_sybase
bool is_sybase
sybase flag
Definition: FreetdsSqlUtil.qm.dox.h:538
FreetdsSqlUtil::FreetdsUniqueConstraintCommon
common base class for unique constraints
Definition: FreetdsSqlUtil.qm.dox.h:305
SqlUtil::AbstractSequence
number
number number(softnumber n)
COP_YEAR_HOUR
const COP_YEAR_HOUR
FreetdsSqlUtil::FreetdsDatabase::tryExecRaw
static any tryExecRaw(AbstractDatasource ds, string sql)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
FreetdsSqlUtil::FreetdsColumn::byte_size
int byte_size
byte size of the column
Definition: FreetdsSqlUtil.qm.dox.h:233
FreetdsSqlUtil::FreetdsNumericColumn::getNativeTypeString
string getNativeTypeString()
returns a string giving the native type of the column
FreetdsSqlUtil::FreetdsUniqueConstraint
class modeling a unique constraint
Definition: FreetdsSqlUtil.qm.dox.h:343
FreetdsSqlUtil::FreetdsIndex::filegroup
*string filegroup
the tablespace (filegroup) name of the index
Definition: FreetdsSqlUtil.qm.dox.h:166
FreetdsSqlUtil::FreetdsUniqueConstraintCommon::constructor
constructor(*string ts)
creates the constraint with an optional filegroup name
FreetdsSqlUtil::FreetdsForeignConstraint
represents a FreeTDS-specific foreign constraint
Definition: FreetdsSqlUtil.qm.dox.h:188
SqlUtil::AbstractForeignConstraint
False
const False
SqlUtil::AbstractSqlUtilBase::l
Mutex l()
SqlUtil::AbstractCheckConstraint
FreetdsSqlUtil::FreetdsDatabase::getNextSequenceValueImpl
private softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
FreetdsSqlUtil::FreetdsTable::getCreateTableSqlImpl
private string getCreateTableSqlImpl(*hash opt)
returns a string that can be used to create the table in the database
list
list list(...)
Float
const Float
SqlUtil::AbstractTable::name
string name
FreetdsSqlUtil::FreetdsSequence::getCreateSql
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
FreetdsSqlUtil::FreetdsFunction::getCreateSql
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
FreetdsSqlUtil::FreetdsDatabase::tryExecRawImpl
private any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
FreetdsSqlUtil
the FreetdsSqlUtil namespace contains all the objects in the FreetdsSqlUtil module ...
Definition: FreetdsSqlUtil.qm.dox.h:148
FreetdsSqlUtil::FreetdsColumn::getRenameSql
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
FreetdsSqlUtil::FreetdsDatabase::getCurrentSequenceValueImpl
private softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
FreetdsSqlUtil::FreetdsDatabase::FreetdsReclaimSpaceOptions
const FreetdsReclaimSpaceOptions
Options for reclaimSpace()
Definition: FreetdsSqlUtil.qm.dox.h:546
FreetdsSqlUtil::FreetdsIndex::constructor
constructor(string n_name, bool n_unique, hash n_cols, *string n_filegroup)
creates the object from the arguments
FreetdsSqlUtil::FreetdsTable::getCreateSqlImpl
private string getCreateSqlImpl(list l)
returns a string that can be used to create the table in the database
SZ_NUM
const SZ_NUM
FreetdsSqlUtil::FreetdsTable::triggerFunctions
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: FreetdsSqlUtil.qm.dox.h:912
Binary
const Binary
FreetdsSqlUtil::FreetdsUniqueConstraintCommon::setTablespace
setTablespace(*string ts)
sets or clears the filegroup name
FreetdsSqlUtil::FreetdsDatabase::rebuildIndexImpl
private bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
FreetdsSqlUtil::FreetdsTrigger::constructor
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
FreetdsSqlUtil::FreetdsTable::FreetdsCopMap
const FreetdsCopMap
column operator specializations for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:795
FreetdsSqlUtil::FreetdsDatabase::tryExecArgsImpl
private any tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
FreetdsSqlUtil::FreetdsUniqueConstraintCommon::getTablespace
*string getTablespace()
returns the filegroup name used for this constraint, if known
FreetdsSqlUtil::FreetdsTable::tryExecArgsImpl
private any tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
exists
bool exists(...)
FreetdsSqlUtil::FreetdsDatabase
provides the FreeTDS-specific implementation of the AbstractDatabase interface
Definition: FreetdsSqlUtil.qm.dox.h:533
FreetdsSqlUtil::FreetdsTable::MsSqlServerTableHints
const MsSqlServerTableHints
query hints
Definition: FreetdsSqlUtil.qm.dox.h:763
COP_YEAR_MONTH
const COP_YEAR_MONTH
FreetdsSqlUtil::FreetdsUniqueConstraintCommon::clearIndex
clearIndex()
clears any index base for the constraint
FreetdsSqlUtil::FreetdsIndex
represents a FreeTDS-specific index
Definition: FreetdsSqlUtil.qm.dox.h:161
FreetdsSqlUtil::FreetdsDatabase::getReclaimSpaceOptions
private hash getReclaimSpaceOptions()
returns driver-specific options to the base abstract class
FreetdsSqlUtil::FreetdsPrimaryKey::memberGate
FreetdsColumn memberGate(string k)
returns the FreetdsColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception...
FreetdsSqlUtil::FreetdsDatabase::listTablesImpl
private softlist listTablesImpl()
returns a list of string table names in the database
FreetdsSqlUtil::FreetdsForeignConstraint::getCreateSql
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
SqlUtil::BLOB
const BLOB
FreetdsSqlUtil::FreetdsDatabase::supportsTypesImpl
private bool supportsTypesImpl()
returns True if the database supports named types
SqlUtil::CLOB
const CLOB
FreetdsSqlUtil::FreetdsTable::doSelectOrderByWithOffsetSqlUnlockedImpl
private doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference 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...
FreetdsSqlUtil::FreetdsView
represents a FreeTDS view
Definition: FreetdsSqlUtil.qm.dox.h:458
FreetdsSqlUtil::FreetdsTable::uniqueIndexCreatesConstraintImpl
private bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
FreetdsSqlUtil::FreetdsTable::doSelectLimitOnlyUnlockedImpl
private doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh)
processes a string for use in SQL select statements when there is a "limit" argument, but no "orderby" or "offset" arguments
FreetdsSqlUtil::FreetdsTable::FreetdsSelectOptions
const FreetdsSelectOptions
select options supported by FreetdsSqlUtil
Definition: FreetdsSqlUtil.qm.dox.h:758
FreetdsSqlUtil::FreetdsTable
provides the FreeTDS-specific implementation of the SqlUtil::AbstractTable interface ...
Definition: FreetdsSqlUtil.qm.dox.h:673
FreetdsSqlUtil::FreetdsCheckConstraint
represents a FreeTDS-specific check constraint
Definition: FreetdsSqlUtil.qm.dox.h:208
SqlUtil::AbstractSqlUtilBase::ds
AbstractDatasource ds
FreetdsSqlUtil::FreetdsDatabase::getCreateSql
static string getCreateSql(list l)
returns a string that can be used to create the schema in the database
FreetdsSqlUtil::FreetdsDatabase::computeStatisticsImpl
private computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics() ...
SqlUtil::AbstractFunction
FreetdsSqlUtil::FreetdsDatabase::listProceduresImpl
private list listProceduresImpl()
since FreeTDS only supports functions, this method is identical to listFunctionsImpl() ...
FreetdsSqlUtil::FreetdsTable::getUpsertClosure
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...
COP_PREPEND
const COP_PREPEND
FreetdsSqlUtil::FreetdsUniqueConstraint::enabled
bool enabled
True if the constraint is enabled, False if not
Definition: FreetdsSqlUtil.qm.dox.h:348
SqlUtil::AbstractView
SqlUtil::AbstractSqlUtilBase::opts
*hash opts
FreetdsSqlUtil::get_database
FreetdsDatabase get_database(AbstractDatasource nds, *hash opts)
returns a FreetdsDatabase object corresponding to the arguments
FreetdsSqlUtil::FreetdsUniqueConstraintCommon::getIndexSql
getIndexSql(reference sql, string name, *hash opts)
adds index options onto the sql creation string
FreetdsSqlUtil::FreetdsUniqueConstraint::constructor
constructor(string n, hash n_cols, bool e=True, *string ts)
creates the object with the given attributes
FreetdsSqlUtil::FreetdsUniqueConstraintCommon::filegroup
*string filegroup
any filegroup for the unique key index
Definition: FreetdsSqlUtil.qm.dox.h:310
FreetdsSqlUtil::FreetdsPrimaryKey::getRenameSql
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the constraint
Int
const Int
FreetdsSqlUtil::FreetdsTable::QoreTypeMap
const QoreTypeMap
maps qore type names to postgresql type names
Definition: FreetdsSqlUtil.qm.dox.h:731
COP_YEAR
const COP_YEAR
string
string string(softstring str, *string enc)
FreetdsSqlUtil::FreetdsFunction::getDropSql
string getDropSql()
returns a string that can be used to drop the function from the database
FreetdsSqlUtil::FreetdsUniqueConstraintCommon::setIndexBase
bool setIndexBase(string ix)
sets the supporting index name
FreetdsSqlUtil::FreetdsTable::supportsTablespacesImpl
private bool supportsTablespacesImpl()
returns True if the database support tablespaces
SqlUtil::AbstractTrigger
FreetdsSqlUtil::FreetdsTrigger
represents a FreeTDS-specific trigger
Definition: FreetdsSqlUtil.qm.dox.h:475
FreetdsSqlUtil::FreetdsColumn::getNativeTypeString
string getNativeTypeString()
returns a string giving the native type of the column
FreetdsSqlUtil::FreetdsSequence::getRenameSql
string getRenameSql(string new_name)
returns a string that can be used to rename the sequence in the database
SqlUtil::AbstractColumn
COP_CAST
const COP_CAST
FreetdsSqlUtil::FreetdsDatabase::getCreateSqlImpl
private string getCreateSqlImpl(list l)
returns a string that can be used to create the schema in the database
FreetdsSqlUtil::FreetdsTable::FreetdsUopMap
const FreetdsUopMap
a hash of default update operator definitions for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:886
DefaultUopMap
const DefaultUopMap
FreetdsSqlUtil::FreetdsFunction
represents a FreeTDS-specific function
Definition: FreetdsSqlUtil.qm.dox.h:500
COP_YEAR_DAY
const COP_YEAR_DAY
FreetdsSqlUtil::FreetdsTrigger::equalImpl
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
FreetdsSqlUtil::FreetdsIndex::getCreateSql
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
FreetdsSqlUtil::get_table
FreetdsTable get_table(AbstractDatasource nds, string nname, *hash opts)
returns a FreetdsTable object corresponding to the arguments
FreetdsSqlUtil::FreetdsTable::tryExecRawImpl
private any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
FreetdsSqlUtil::FreetdsTable::getSelectOptions
private hash getSelectOptions()
returns the select options for this driver
FreetdsSqlUtil::FreetdsTable::clearImpl
private clearImpl()
clears FreeTDS-specific table information
FreetdsSqlUtil::FreetdsPrimaryKey::getCreateSql
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
FreetdsSqlUtil::FreetdsColumn::equalImpl
private bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
hash
hash hash(object obj)
FreetdsSqlUtil::FreetdsDatabase::listFunctionsImpl
private list listFunctionsImpl()
returns a list of string function names in the database
COP_SUBSTR
const COP_SUBSTR
FreetdsSqlUtil::FreetdsFunction::setName
setName(string new_name)
sets the new name of the function
OP_SUBSTR
const OP_SUBSTR
SZ_OPT
const SZ_OPT
FreetdsSqlUtil::FreetdsDatabase::FreetdsSchemaDescriptionOptions
const FreetdsSchemaDescriptionOptions
FreeTDS-specific schema description keys.
Definition: FreetdsSqlUtil.qm.dox.h:541
IOP_SEQ
const IOP_SEQ
SqlUtil::AbstractDatabase
FreetdsSqlUtil::FreetdsUniqueConstraintCommon::keyIterator
abstract AbstractIterator keyIterator()
returns an iterator for keys iterating a list of string key names
FreetdsSqlUtil::FreetdsSequence::constructor
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_end)
creates the object from the arguments
FreetdsSqlUtil::FreetdsView::getRenameSql
softlist getRenameSql(string new_name)
returns a string that can be used to rename the view in the database
SqlUtil::AbstractPrimaryKey
FreetdsSqlUtil::FreetdsUniqueConstraint::isEnabled
bool isEnabled()
returns True if the constraint is enabled, False if not
join
string join(string str,...)
FreetdsSqlUtil::FreetdsTable::copyImpl
private copyImpl(AbstractTable old)
db-specific copy actions
Number
const Number
FreetdsSqlUtil::FreetdsTable::filegroup
*string filegroup
filegroup name for the table, if known
Definition: FreetdsSqlUtil.qm.dox.h:906
FreetdsSqlUtil::FreetdsColumn::getAddColumnSql
softlist getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table ...
FreetdsSqlUtil::FreetdsTable::getRawUpdateOperatorMap
private hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
DefaultOpMap
const DefaultOpMap
SqlUtil::AbstractUniqueConstraint
FreetdsSqlUtil::FreetdsTable::FreetdsIopMap
const FreetdsIopMap
a hash of default value operator descriptions for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:878
SqlUtil::AbstractDatabase::ReclaimSpaceOptions
const ReclaimSpaceOptions
FreetdsSqlUtil::FreetdsDatabase::reclaimSpaceImpl
private reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
COP_APPEND
const COP_APPEND
FreetdsSqlUtil::FreetdsTable::getTablespaceName
*string getTablespaceName()
returns the data filegroup name for the table or NOTHING if none is known