128 MysqlTable
get_table(AbstractDatasource nds,
string nname, *
hash opts);
135 parse_schema_name(
string nname, reference schema, reference name);
148 constructor(
string n_name,
bool n_unique,
hash n_cols,
string n_type =
"BTREE");
156 private bool equalImpl(AbstractIndex ix);
160 string getRenameSql(
string table_name,
string new_name);
172 constructor(
string n, Columns c, ForeignConstraintTarget t);
175 string getCreateSql(
string table_name, *
hash opt);
179 softlist
getRenameSql(
string table_name,
string new_name);
182 string getCreateSql(
string name,
string table_name, *
hash opt);
185 string getAddSql(
string name,
string table_name, *
hash opt);
203 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs);
252 private bool equalImpl(AbstractColumn c);
268 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs, softint n_scale,
bool n_unsigned =
False,
bool n_auto_increment =
False,
bool n_pk =
False);
271 string getNativeTypeString();
275 private bool equalImpl(AbstractColumn c);
285 bool setIndexBase(
string ix);
292 abstract AbstractIterator keyIterator();
295 getIndexSql(reference sql,
string name, *
hash opts);
302 constructor(
string n,
hash n_cols);
321 MysqlColumn memberGate(
string k);
324 string getCreateSql(
string table_name, *
hash opts);
327 list getRenameSql(
string table_name,
string new_name);
330 string getCreateSql(
string name,
string table_name, *
hash opts);
334 string getDropSql(
string table_name);
345 constructor(*
hash c);
367 string getCreateSql(
string table_name, *
hash opts);
371 softlist
getRenameSql(
string table_name,
string new_name);
400 private bool equalImpl(AbstractFunctionBase t);
404 softlist
getRenameSql(
string table_name,
string new_name);
412 constructor(
string n,
string n_src);
424 private bool equalImpl(AbstractFunctionBase t);
442 constructor(
string n_table_name,
string n_name,
number n_start = 1,
number n_increment = 1, *softnumber n_end);
476 constructor(
string n_name,
string n_src, *
string n_tablecatalog,
478 *
string n_checkoption, *
string n_definer,
479 *
string n_securitytype,
bool n_updatable)
526 update %s set id = last_insert_id(id + 1) where name = seq_name;
527 return last_insert_id();
538 string sequence_table =
"sqlutil_sequences";
539 string sequence_function =
"sqlutil_nextval";
543 constructor(AbstractDatasource nds, *
hash opts);
546 private list featuresImpl();
549 string getSchemaName();
552 private AbstractSequence makeSequenceImpl(
string name,
number start = 1,
number increment = 1, *softnumber end, *
hash opts);
555 private *AbstractSequence getSequenceImpl(
string name);
558 private *AbstractView getViewImpl(
string name);
567 private *AbstractFunction getFunctionImpl(
string name);
572 static string makeParameter(
hash row);
576 private AbstractFunction getProcedureImpl(
string name);
579 private list getDropSchemaSqlImpl(
hash schema_hash, *
hash opt);
582 private list getAlignSqlImpl(
hash schema_hash, *
hash opt);
605 private list listSequencesImpl();
608 private list listViewsImpl();
611 private string getCreateSqlImpl(
list l);
614 static string getCreateSql(
list l);
655 "timestamp": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
656 "time": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
685 "binary":
"varbinary",
709 const MysqlIndexOptions = AbstractTable::IndexOptions;
711 const MysqlConstraintOptions = AbstractTable::ConstraintOptions + MysqlIndexOptions + (
715 const MysqlTableCreationOptions = AbstractTable::TableCreationOptions + MysqlConstraintOptions;
717 const MysqlAlignTableOptions = AbstractTable::AlignTableOptions + MysqlTableCreationOptions;
724 "code":
string (
string cve,
string arg) {
725 return sprintf(
"concat(%s,%s)", arg, cve);
731 "code":
string (
string cve,
string arg) {
732 return sprintf(
"concat(%s,%s)", cve, arg);
736 "code":
string (
string arg1, any arg) {
737 return sprintf(
"date_format(%s, '%%Y')", arg1);
741 "code":
string (
string arg1, any arg) {
742 return sprintf(
"date_format(%s, '%%Y-%%m')", arg1);
746 "code":
string (
string arg1, any arg) {
747 return sprintf(
"date_format(%s, '%%Y-%%m-%%e')", arg1);
751 "code":
string (
string arg1, any arg) {
752 return sprintf(
"date_format(%s, '%%Y-%%m-%%e %%k')", arg1);
761 string engine =
"innodb";
765 constructor(AbstractDatasource nds,
string nname, *
hash opts);
772 private hash getTableCreationOptions();
775 private hash getTableDescriptionHashOptions();
778 private hash getColumnDescOptions();
781 private hash getIndexOptions();
784 private hash getConstraintOptions();
787 private hash getAlignTableOptions();
794 private bool checkExistenceImpl();
797 private Columns describeImpl();
800 private *
string getCreatePrimaryKeySqlUnlocked(*
hash opt,
bool cache =
True);
803 private MysqlPrimaryKey getPrimaryKeyImpl();
806 private Indexes getIndexesImpl();
809 private ForeignConstraints getForeignConstraintsImpl(*
hash opts);
812 private Constraints getConstraintsImpl();
815 private Triggers getTriggersImpl();
818 string getCreateTableSqlImpl(*
hash opt);
824 private *
list getAlignSqlImpl(AbstractTable table, *
hash opt);
827 private string getCreateSqlImpl(
list l);
830 private string getRenameSqlImpl(
string new_name);
833 private AbstractColumn addColumnImpl(
string cname,
hash opt,
bool nullable =
True);
836 private setPrimaryKeyUnlocked(AbstractPrimaryKey pk);
839 private addColumnToTableUnlocked(AbstractColumn c);
842 private AbstractPrimaryKey addPrimaryKeyImpl(
string cname,
hash ch, *
hash opt);
845 private AbstractIndex addIndexImpl(
string iname,
bool enabled,
hash ch, *
hash opt);
848 private AbstractForeignConstraint addForeignConstraintImpl(
string cname,
hash ch,
string table,
hash tch, *
hash opt);
851 private AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *
hash opt);
854 private AbstractUniqueConstraint addUniqueConstraintImpl(
string cname,
hash ch, *
hash opt);
857 private AbstractTrigger addTriggerImpl(
string tname,
string src, *
hash opt);
860 private bool tryInsertImpl(
string sql,
hash row);
863 private hash getQoreTypeMapImpl();
866 private hash getTypeMapImpl();
894 private bool emptyImpl();
897 private preSetupTableImpl(reference desc, *
hash opt);
900 private setupTableImpl(
hash desc, *
hash opt);
924 private copyImpl(AbstractTable old);
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
softlist getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table ...
const MysqlColumnDescOptions
extends SqlUtil::AbstractTable::ColumnDescOptions with MySQL-specific values
Definition: MysqlSqlUtil.qm.dox.h:703
int byte_size
byte size of the column
Definition: MysqlSqlUtil.qm.dox.h:199
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
const MysqlTypeMap
maps mysql type names to type configurations
Definition: MysqlSqlUtil.qm.dox.h:643
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
string getDropSql()
returns a string that can be used to drop the function from the database
represents a MySQL-specific foreign constraint
Definition: MysqlSqlUtil.qm.dox.h:169
string getDropSql()
returns a string that can be used to drop the sequence from the database
string sprintf(string fmt,...)
private bool supportsSequencesImpl()
returns True since we have a workaround implementation for sequences in MySQL
the MysqlSqlUtil namespace contains all the objects in the MysqlSqlUtil module
Definition: MysqlSqlUtil.qm.dox.h:126
provides the MySQL-specific implementation of the AbstractDatabase interface
Definition: MysqlSqlUtil.qm.dox.h:493
private bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
MysqlTable get_table(AbstractDatasource nds, string nname, *hash opts)
returns a MysqlTable object corresponding to the arguments
const MysqlCopMap
column operator specializations for MySQL
Definition: MysqlSqlUtil.qm.dox.h:720
represents a MySQL view
Definition: MysqlSqlUtil.qm.dox.h:459
const MysqlSequenceTable
MySQL sequence emulation table.
Definition: MysqlSqlUtil.qm.dox.h:505
private bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
MysqlDatabase get_database(AbstractDatasource nds, *hash opts)
returns a MysqlDatabase object corresponding to the arguments
private doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch)
processes a string for use in SQL select statements when there is an "order by" and "offset" argument...
*string securitytype
security type value
Definition: MysqlSqlUtil.qm.dox.h:471
private bool supportsPackagesImpl()
returns True if the database supports packages
private bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
softlist 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 getRenameSql(string new_name)
returns a string that can be used to rename the function in the database
number number(softnumber n)
private bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
softlist getRenameSql(string table_name, string new_name)
returns a string that drops the constraint and re-adds it, since MySQL does not support renaming cons...
string getCreateSql(AbstractTable t)
returns an sql string that can be used to add the column to a table
softlist getRenameSql(string new_name)
returns a string that can be used to rename the view in the database
*string checkoption
checkoption clause
Definition: MysqlSqlUtil.qm.dox.h:467
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
string getDropSql(string table_name)
returns a string that can be used to drop the foreign constraint from the database ...
string getRenameSql(string new_name)
returns a string that can be used to rename the sequence in the database
private *string getSqlValueImpl(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
private bool supportsTablespacesImpl()
returns True if the database support tablespaces
const MysqlSequenceFunction
MySQL sequence function.
Definition: MysqlSqlUtil.qm.dox.h:524
string getDropSql(string table_name)
returns a string that can be used to drop the index from the table
MysqlColumn memberGate(string k)
returns the MysqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception ...
const MysqlTableDescriptionHashOptions
extends SqlUtil::AbstractTable::TableDescriptionHashOptions with "engine" for the DB engine behind th...
Definition: MysqlSqlUtil.qm.dox.h:693
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
represents a MySQL-specific function
Definition: MysqlSqlUtil.qm.dox.h:409
private copyImpl(AbstractTable old)
db-specific copy actions
provides the MySQL-specific implementation of the AbstractTable interface
Definition: MysqlSqlUtil.qm.dox.h:638
represents a MySQL-specific primary key constraint
Definition: MysqlSqlUtil.qm.dox.h:339
const MyusqlCreationOptions
MySQL creation options.
Definition: MysqlSqlUtil.qm.dox.h:521
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
represents a MySQL-specific trigger
Definition: MysqlSqlUtil.qm.dox.h:384
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
softlist getRenameSql(string table_name, string new_name)
primary keys have no name in MySQL so this method returns an empty list
string string(softstring str)
private list listFunctionsImpl()
returns a list of string function names in the database
*string definer
dafiner clause
Definition: MysqlSqlUtil.qm.dox.h:469
private list listTablesImpl()
returns a list of string table names in the database
static *string getSqlValueIntern(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
Datasource seqds
separate datasource dedicated for extern sequence implementation with autonomous transactions ...
Definition: MysqlSqlUtil.qm.dox.h:536
constructor(string n_table_name, string n_name, number n_start=1, number n_increment=1, *softnumber n_end)
creates the object from the arguments
constructor(string n_name, string n_src, *string n_tablecatalog, *string n_schema, *string n_checkoption, *string n_definer, *string n_securitytype, bool n_updatable)
creates the object from the arguments
private hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
class for MySQL sequences based on a sequence table and autonomous transactions
Definition: MysqlSqlUtil.qm.dox.h:433
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
represents a MySQL-specific numeric column
Definition: MysqlSqlUtil.qm.dox.h:257
private bool supportsTypesImpl()
returns True if the database supports named types
represents a MySQL-specific column
Definition: MysqlSqlUtil.qm.dox.h:194
const MysqlSchemaDescriptionOptions
MySQL-specific schema description keys.
Definition: MysqlSqlUtil.qm.dox.h:498
*string tablecatalog
table catalog value
Definition: MysqlSqlUtil.qm.dox.h:465
private bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
private list listProceduresImpl()
returns a list of string procedure names in the database
represents a MySQL-specific index
Definition: MysqlSqlUtil.qm.dox.h:139
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
bool supportsName()
returns False since primary key constraints in MySQL have no name
private hash getColumnOperatorMap()
returns the column operator map for this object
static *string getSqlValue(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument ...
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index 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; hwoever mysql does not support...
private softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
constructor(string n_name, bool n_unique, hash n_cols, string n_type="BTREE")
creates the object from the arguments
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
const QoreTypeMap
maps qore type names to postgresql type names
Definition: MysqlSqlUtil.qm.dox.h:679