145 MysqlTable
get_table(AbstractDatasource nds,
string nname, *
hash opts);
152 parse_schema_name(
string nname, reference<*string> schema, reference<string> name);
165 constructor(
string n_name,
bool n_unique,
hash n_cols,
string n_type =
"BTREE") ;
180 string getRenameSql(
string table_name,
string new_name);
192 constructor(
string n, Columns c, ForeignConstraintTarget t) ;
199 softlist
getRenameSql(
string table_name,
string new_name);
205 string getAddSql(
string name,
string table_name, *
hash opt);
223 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs) ;
234 softlist getAddColumnSql(AbstractTable t);
255 softlist getModifySqlImpl(AbstractTable t, AbstractColumn col, *
hash opt);
292 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) ;
295 string getNativeTypeString();
312 bool setIndexBase(
string ix);
319 abstract AbstractIterator keyIterator();
322 getIndexSql(reference<string> sql,
string name, *
hash opts);
398 softlist
getRenameSql(
string table_name,
string new_name);
434 softlist
getRenameSql(
string table_name,
string new_name);
480 constructor(
string n_table_name,
string n_name,
number n_start = 1,
number n_increment = 1, *softnumber n_end) ;
518 constructor(
string n_name,
string n_src, *
string n_tablecatalog,
520 *
string n_checkoption, *
string n_definer,
521 *
string n_securitytype,
bool n_updatable)
543 const MysqlOptions = (
549 const MysqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + MysqlOptions;
552 const MysqlDatabaseOptions = AbstractDatabase::DatabaseOptions + MysqlOptions;
555 const MysqlSequenceTable = (
571 const MyusqlCreationOptions = AbstractDatabase::CreationOptions;
574 const MysqlSequenceFunction =
"%s(seq_name varchar(40)) returns decimal(14) 576 update %s set id = last_insert_id(id + 1) where name = seq_name; 577 return last_insert_id(); 581 const MysqlComputeStatisticsOptions = ComputeStatisticsOptions + (
586 const MysqlReclaimSpaceOptions = ReclaimSpaceOptions + (
591 const MysqlReservedWords = (
623 "current_date" :
True,
624 "current_time" :
True,
625 "current_timestamp" :
True,
626 "current_user" :
True,
631 "day_microsecond" :
True,
642 "deterministic" :
True,
644 "distinctrow" :
True,
671 "high_priority" :
True,
672 "hour_microsecond" :
True,
673 "hour_minute" :
True,
674 "hour_second" :
True,
682 "insensitive" :
True,
693 "io_after_gtids" :
True,
694 "io_before_gtids" :
True,
710 "localtimestamp" :
True,
716 "low_priority" :
True,
717 "master_bind" :
True,
718 "master_ssl_verify_server_cert" :
True,
725 "minute_microsecond" :
True,
726 "minute_second" :
True,
731 "no_write_to_binlog" :
True,
768 "second_microsecond" :
True,
779 "sqlexception" :
True,
782 "sql_big_result" :
True,
783 "sql_calc_found_rows" :
True,
784 "sql_small_result" :
True,
787 "straight_join" :
True,
809 "utc_timestamp" :
True,
813 "varcharacter" :
True,
833 string sequence_table =
"sqlutil_sequences";
834 string sequence_function =
"sqlutil_nextval";
847 string getSchemaName();
852 AbstractSequence makeSequenceImpl(
string name,
number start = 1,
number increment = 1, *softnumber end, *
hash opts);
858 *AbstractSequence getSequenceImpl(
string name);
864 *AbstractView getViewImpl(
string name);
882 *AbstractFunction getFunctionImpl(
string name);
888 static string makeParameter(
hash row);
894 AbstractFunction getProcedureImpl(
string name);
913 list listTablesImpl();
924 list listFunctionsImpl();
935 list listProceduresImpl();
941 list listSequencesImpl();
947 list listViewsImpl();
953 string getCreateSqlImpl(
list l);
962 hash getDatabaseOptions();
969 hash getSchemaDescriptionOptions();
976 hash getComputeStatisticsOptions();
983 hash getReclaimSpaceOptions();
990 softint getNextSequenceValueImpl(
string name);
997 softint getCurrentSequenceValueImpl(
string name);
1004 bool supportsSequencesImpl();
1011 bool supportsTypesImpl();
1018 bool supportsPackagesImpl();
1025 bool rebuildIndexImpl(
string name, *
hash options);
1032 computeStatisticsImpl(*
hash options);
1039 reclaimSpaceImpl(*
hash options);
1050 const MysqlTypeMap = (
1062 "timestamp": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
1063 "time": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
1086 const QoreTypeMap = (
1087 "integer":
"bigint",
1089 "number":
"decimal",
1090 "string":
"varchar",
1092 "binary":
"varbinary",
1100 const MysqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions + (
1110 const MysqlColumnDescOptions = AbstractTable::ColumnDescOptions + (
1116 const MysqlIndexOptions = AbstractTable::IndexOptions;
1118 const MysqlConstraintOptions = AbstractTable::ConstraintOptions + MysqlIndexOptions + (
1122 const MysqlTableCreationOptions = AbstractTable::TableCreationOptions + MysqlConstraintOptions;
1124 const MysqlAlignTableOptions = AbstractTable::AlignTableOptions + MysqlTableCreationOptions;
1127 const MysqlCopMap = (
1130 string name = QoreTypeMap{args[0]} ?? args[0];
1131 if (name ==
"varchar") name =
"char";
1132 hash desc = MysqlTypeMap{name};
1133 string sql =
sprintf (
"cast(%s as %s", cve, name);
1143 "code":
string (
string cve,
string arg) {
1144 return sprintf(
"concat(%s,%s)", arg, cve);
1150 "code":
string (
string cve,
string arg) {
1151 return sprintf(
"concat(%s,%s)", cve, arg);
1155 "code":
string (
string arg1,
auto arg) {
1156 return sprintf(
"date_format(%s, '%%Y')", arg1);
1160 "code":
string (
string arg1,
auto arg) {
1161 return sprintf(
"date_format(%s, '%%Y-%%m')", arg1);
1165 "code":
string (
string arg1,
auto arg) {
1166 return sprintf(
"date_format(%s, '%%Y-%%m-%%e')", arg1);
1170 "code":
string (
string arg1,
auto arg) {
1171 return sprintf(
"date_format(%s, '%%Y-%%m-%%e %%k')", arg1);
1175 "code":
string sub(
string arg1,
auto arg) {
1176 if (!MysqlTruncDate.hasKey(arg));
1178 return sprintf(
"cast(date_format(%s, %s) as datetime)", arg1, MysqlTruncDate{arg});
1184 const MysqlTruncDate = (
1185 DT_YEAR :
"'%Y-01-01 00:00:00'",
1187 DT_DAY :
"'%Y-%m-%d 00:00:00'",
1188 DT_HOUR :
"'%Y-%m-%d %H:00:00'",
1197 string engine =
"innodb";
1205 string getSqlName();
1210 hash getTableCreationOptions();
1216 hash getTableDescriptionHashOptions();
1222 hash getColumnDescOptions();
1228 hash getIndexOptions();
1234 hash getConstraintOptions();
1240 hash getAlignTableOptions();
1247 hash getColumnOperatorMapImpl();
1253 bool checkExistenceImpl();
1259 Columns describeImpl();
1265 *
string getCreatePrimaryKeySqlUnlocked(*
hash opt,
bool cache =
True);
1277 Indexes getIndexesImpl();
1283 ForeignConstraints getForeignConstraintsImpl(*
hash opts);
1289 Constraints getConstraintsImpl();
1295 Triggers getTriggersImpl();
1299 string getCreateTableSqlImpl(*
hash opt);
1303 bool hasArrayBind();
1308 *
list getCreateMiscSqlImpl(*
hash opt,
bool cache);
1314 *
list getAlignSqlImpl(AbstractTable table, *
hash opt);
1320 string getCreateSqlImpl(
list l);
1326 string getRenameSqlImpl(
string new_name);
1332 AbstractColumn addColumnImpl(
string cname,
hash opt,
bool nullable =
True);
1338 setPrimaryKeyUnlocked(AbstractPrimaryKey pk);
1344 addColumnToTableUnlocked(AbstractColumn c);
1350 AbstractPrimaryKey addPrimaryKeyImpl(
string cname,
hash ch, *
hash opt);
1356 AbstractIndex addIndexImpl(
string iname,
bool enabled,
hash ch, *
hash opt);
1362 AbstractForeignConstraint addForeignConstraintImpl(
string cname,
hash ch,
string table,
hash tch, *
hash opt);
1368 AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *
hash opt);
1374 AbstractUniqueConstraint addUniqueConstraintImpl(
string cname,
hash ch, *
hash opt);
1380 AbstractTrigger addTriggerImpl(
string tname,
string src, *
hash opt);
1386 bool tryInsertImpl(
string sql,
hash row);
1392 hash getQoreTypeMapImpl();
1398 hash getTypeMapImpl();
1405 *
string getSqlValueImpl(
auto v);
1412 static *
string getSqlValueIntern(
auto v);
1417 string getColumnSqlName(
string col);
1421 list getColumnSqlNames(softlist cols);
1436 static *
string getSqlValue(
auto v);
1446 preSetupTableImpl(reference<hash> desc, *
hash opt);
1452 setupTableImpl(
hash desc, *
hash opt);
1459 bool constraintsLinkedToIndexesImpl();
1466 bool uniqueIndexCreatesConstraintImpl();
1473 bool supportsTablespacesImpl();
1480 doSelectLimitOnlyUnlockedImpl(reference<string> sql, reference<list> args, *
hash qh);
1487 doSelectOrderByWithOffsetSqlUnlockedImpl(reference<string> sql, reference<list> args, *
hash qh, *
hash jch, *
hash ch, *
hash psch,
list coll);
1494 bool asteriskRequiresPrefix();
1500 *
hash doReturningImpl(
hash opt, reference<string> sql,
list args);
1511 bool hasReturningImpl();
1517 copyImpl(AbstractTable old);
int byte_size
byte size of the column
Definition: MysqlSqlUtil.qm.dox.h:219
represents a MySQL-specific foreign constraint
Definition: MysqlSqlUtil.qm.dox.h:189
string sprintf(string fmt,...)
the MysqlSqlUtil namespace contains all the objects in the MysqlSqlUtil module
Definition: MysqlSqlUtil.qm.dox.h:143
provides the MySQL-specific implementation of the AbstractDatabase interface
Definition: MysqlSqlUtil.qm.dox.h:538
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
represents a MySQL view
Definition: MysqlSqlUtil.qm.dox.h:502
MysqlDatabase get_database(AbstractDatasource nds, *hash opts)
returns a MysqlDatabase object corresponding to the arguments
*string securitytype
security type value
Definition: MysqlSqlUtil.qm.dox.h:513
number number(softnumber n)
*string checkoption
checkoption clause
Definition: MysqlSqlUtil.qm.dox.h:509
string getDropSql(string table_name)
returns a string that can be used to drop the index from the table
represents a MySQL-specific function
Definition: MysqlSqlUtil.qm.dox.h:439
provides the MySQL-specific implementation of the AbstractTable interface
Definition: MysqlSqlUtil.qm.dox.h:1045
represents a MySQL-specific primary key constraint
Definition: MysqlSqlUtil.qm.dox.h:366
represents a MySQL-specific trigger
Definition: MysqlSqlUtil.qm.dox.h:411
*string definer
dafiner clause
Definition: MysqlSqlUtil.qm.dox.h:511
Datasource seqds
separate datasource dedicated for extern sequence implementation with autonomous transactions ...
Definition: MysqlSqlUtil.qm.dox.h:831
string string(softstring str, *string enc)
class for MySQL sequences based on a sequence table and autonomous transactions
Definition: MysqlSqlUtil.qm.dox.h:471
represents a MySQL-specific numeric column
Definition: MysqlSqlUtil.qm.dox.h:281
represents a MySQL-specific column
Definition: MysqlSqlUtil.qm.dox.h:214
*string tablecatalog
table catalog value
Definition: MysqlSqlUtil.qm.dox.h:507
represents a MySQL-specific index
Definition: MysqlSqlUtil.qm.dox.h:156
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...
constructor(string n_name, bool n_unique, hash n_cols, string n_type="BTREE")
creates the object from the arguments