125 namespace MysqlSqlUtil {
128 MysqlTable
get_table(AbstractDatasource nds,
string nname, *
hash opts);
145 constructor(
string n_name,
bool n_unique,
hash n_cols,
string n_type =
"BTREE");
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);
267 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);
270 string getNativeTypeString();
287 bool setIndexBase(
string ix);
294 abstract AbstractIterator keyIterator();
297 getIndexSql(reference sql,
string name, *
hash opts);
304 constructor(
string n,
hash n_cols);
323 MysqlColumn memberGate(
string k);
326 string getCreateSql(
string table_name, *
hash opts);
329 list getRenameSql(
string table_name,
string new_name);
332 string getCreateSql(
string name,
string table_name, *
hash opts);
336 string getDropSql(
string table_name);
347 constructor(*
hash c);
369 string getCreateSql(
string table_name, *
hash opts);
373 softlist
getRenameSql(
string table_name,
string new_name);
409 softlist
getRenameSql(
string table_name,
string new_name);
417 constructor(
string n,
string n_src);
450 constructor(
string n_table_name,
string n_name,
number n_start = 1,
number n_increment = 1, *softnumber n_end);
497 update %s set id = last_insert_id(id + 1) where name = seq_name;
498 return last_insert_id();
509 string sequence_table =
"sqlutil_sequences";
510 string sequence_function =
"sqlutil_nextval";
514 constructor(AbstractDatasource nds, *
hash opts);
523 string getSchemaName();
528 AbstractSequence makeSequenceImpl(
string name,
number start = 1,
number increment = 1, *softnumber end, *
hash opts);
534 *AbstractSequence getSequenceImpl(
string name);
552 *AbstractFunction getFunctionImpl(
string name);
558 static string makeParameter(
hash row);
564 AbstractFunction getProcedureImpl(
string name);
611 list listSequencesImpl();
617 list listViewsImpl();
623 string getCreateSqlImpl(
list l);
627 static string getCreateSql(
list l);
683 "timestamp": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
684 "time": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
713 "binary":
"varbinary",
737 const MysqlIndexOptions = AbstractTable::IndexOptions;
739 const MysqlConstraintOptions = AbstractTable::ConstraintOptions + MysqlIndexOptions + (
743 const MysqlTableCreationOptions = AbstractTable::TableCreationOptions + MysqlConstraintOptions;
745 const MysqlAlignTableOptions = AbstractTable::AlignTableOptions + MysqlTableCreationOptions;
752 "code":
string (
string cve,
string arg) {
753 return sprintf(
"concat(%s,%s)", arg, cve);
760 "code":
string (
string cve,
string arg) {
761 return sprintf(
"concat(%s,%s)", cve, arg);
765 "code":
string (
string arg1, any arg) {
766 return sprintf(
"date_format(%s, '%%Y')", arg1);
770 "code":
string (
string arg1, any arg) {
771 return sprintf(
"date_format(%s, '%%Y-%%m')", arg1);
775 "code":
string (
string arg1, any arg) {
776 return sprintf(
"date_format(%s, '%%Y-%%m-%%e')", arg1);
780 "code":
string (
string arg1, any arg) {
781 return sprintf(
"date_format(%s, '%%Y-%%m-%%e %%k')", arg1);
789 string engine =
"innodb";
793 constructor(AbstractDatasource nds,
string nname, *
hash opts);
802 hash getTableCreationOptions();
808 hash getTableDescriptionHashOptions();
814 hash getColumnDescOptions();
820 hash getIndexOptions();
826 hash getConstraintOptions();
832 hash getAlignTableOptions();
845 bool checkExistenceImpl();
851 Columns describeImpl();
857 *
string getCreatePrimaryKeySqlUnlocked(*
hash opt,
bool cache =
True);
869 Indexes getIndexesImpl();
875 ForeignConstraints getForeignConstraintsImpl(*
hash opts);
881 Constraints getConstraintsImpl();
887 Triggers getTriggersImpl();
891 string getCreateTableSqlImpl(*
hash opt);
899 *
list getAlignSqlImpl(AbstractTable table, *
hash opt);
905 string getCreateSqlImpl(
list l);
911 string getRenameSqlImpl(
string new_name);
917 AbstractColumn addColumnImpl(
string cname,
hash opt,
bool nullable =
True);
923 setPrimaryKeyUnlocked(AbstractPrimaryKey pk);
929 addColumnToTableUnlocked(AbstractColumn c);
935 AbstractPrimaryKey addPrimaryKeyImpl(
string cname,
hash ch, *
hash opt);
941 AbstractIndex addIndexImpl(
string iname,
bool enabled,
hash ch, *
hash opt);
947 AbstractForeignConstraint addForeignConstraintImpl(
string cname,
hash ch,
string table,
hash tch, *
hash opt);
953 AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *
hash opt);
959 AbstractUniqueConstraint addUniqueConstraintImpl(
string cname,
hash ch, *
hash opt);
965 AbstractTrigger addTriggerImpl(
string tname,
string src, *
hash opt);
971 bool tryInsertImpl(
string sql,
hash row);
977 hash getQoreTypeMapImpl();
983 hash getTypeMapImpl();
1023 preSetupTableImpl(reference desc, *
hash opt);
1029 setupTableImpl(
hash desc, *
hash opt);
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
const MysqlColumnDescOptions
extends SqlUtil::AbstractTable::ColumnDescOptions with MySQL-specific values
Definition: MysqlSqlUtil.qm.dox.h:731
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:671
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
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
string getDropSql()
returns a string that can be used to drop the sequence from the database
string sprintf(string fmt,...)
provides the MySQL-specific implementation of the AbstractDatabase interface
Definition: MysqlSqlUtil.qm.dox.h:467
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
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:748
bool supportsSequencesImpl()
returns True since we have a workaround implementation for sequences in MySQL
const MysqlSequenceTable
MySQL sequence emulation table.
Definition: MysqlSqlUtil.qm.dox.h:479
MysqlDatabase get_database(AbstractDatasource nds, *hash opts)
returns a MysqlDatabase object corresponding to the arguments
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)
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...
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
hash getColumnOperatorMap()
returns the column operator map for this object
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
bool supportsPackagesImpl()
returns True if the database supports packages
*string getSqlValueImpl(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
list listFunctionsImpl()
returns a list of string function names in the database
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from 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
list listProceduresImpl()
returns a list of string procedure names in the database
const MysqlSequenceFunction
MySQL sequence function.
Definition: MysqlSqlUtil.qm.dox.h:495
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:721
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:414
list listTablesImpl()
returns a list of string table names in the database
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
provides the MySQL-specific implementation of the AbstractTable interface
Definition: MysqlSqlUtil.qm.dox.h:666
represents a MySQL-specific primary key constraint
Definition: MysqlSqlUtil.qm.dox.h:341
represents a MySQL-specific trigger
Definition: MysqlSqlUtil.qm.dox.h:386
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
bool supportsTablespacesImpl()
returns True if the database support tablespaces
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)
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
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:507
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
bool supportsTypesImpl()
returns True if the database supports named types
copyImpl(AbstractTable old)
db-specific copy actions
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:441
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
represents a MySQL-specific numeric column
Definition: MysqlSqlUtil.qm.dox.h:256
represents a MySQL-specific column
Definition: MysqlSqlUtil.qm.dox.h:194
const MysqlSchemaDescriptionOptions
MySQL-specific schema description keys.
Definition: MysqlSqlUtil.qm.dox.h:472
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
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
represents a MySQL-specific index
Definition: MysqlSqlUtil.qm.dox.h:136
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
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...
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
constructor(string n_name, bool n_unique, hash n_cols, string n_type="BTREE")
creates the object from the arguments
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...
const QoreTypeMap
maps qore type names to postgresql type names
Definition: MysqlSqlUtil.qm.dox.h:707