142 MysqlTable
get_table(AbstractDatasource nds,
string nname, *
hash opts);
149 parse_schema_name(
string nname, reference<*string> schema, reference<string> name);
162 constructor(
string n_name,
bool n_unique,
hash n_cols,
string n_type =
"BTREE") ;
177 string getRenameSql(
string table_name,
string new_name);
189 constructor(
string n, Columns c, ForeignConstraintTarget t) ;
196 softlist
getRenameSql(
string table_name,
string new_name);
202 string getAddSql(
string name,
string table_name, *
hash opt);
220 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs) ;
231 softlist getAddColumnSql(AbstractTable t);
252 softlist getModifySqlImpl(AbstractTable t, AbstractColumn col, *
hash opt);
289 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) ;
292 string getNativeTypeString();
309 bool setIndexBase(
string ix);
316 abstract AbstractIterator keyIterator();
319 getIndexSql(reference<string> sql,
string name, *
hash opts);
395 softlist
getRenameSql(
string table_name,
string new_name);
431 softlist
getRenameSql(
string table_name,
string new_name);
477 constructor(
string n_table_name,
string n_name,
number n_start = 1,
number n_increment = 1, *softnumber n_end) ;
515 constructor(
string n_name,
string n_src, *
string n_tablecatalog,
517 *
string n_checkoption, *
string n_definer,
518 *
string n_securitytype,
bool n_updatable)
540 const MysqlOptions = (
546 const MysqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + MysqlOptions;
549 const MysqlDatabaseOptions = AbstractDatabase::DatabaseOptions + MysqlOptions;
552 const MysqlSequenceTable = (
568 const MyusqlCreationOptions = AbstractDatabase::CreationOptions;
571 const MysqlSequenceFunction =
"%s(seq_name varchar(40)) returns decimal(14) 573 update %s set id = last_insert_id(id + 1) where name = seq_name; 574 return last_insert_id(); 578 const MysqlComputeStatisticsOptions = ComputeStatisticsOptions + (
583 const MysqlReclaimSpaceOptions = ReclaimSpaceOptions + (
588 const MysqlReservedWords = (
620 "current_date" :
True,
621 "current_time" :
True,
622 "current_timestamp" :
True,
623 "current_user" :
True,
628 "day_microsecond" :
True,
639 "deterministic" :
True,
641 "distinctrow" :
True,
668 "high_priority" :
True,
669 "hour_microsecond" :
True,
670 "hour_minute" :
True,
671 "hour_second" :
True,
679 "insensitive" :
True,
690 "io_after_gtids" :
True,
691 "io_before_gtids" :
True,
707 "localtimestamp" :
True,
713 "low_priority" :
True,
714 "master_bind" :
True,
715 "master_ssl_verify_server_cert" :
True,
722 "minute_microsecond" :
True,
723 "minute_second" :
True,
728 "no_write_to_binlog" :
True,
765 "second_microsecond" :
True,
776 "sqlexception" :
True,
779 "sql_big_result" :
True,
780 "sql_calc_found_rows" :
True,
781 "sql_small_result" :
True,
784 "straight_join" :
True,
806 "utc_timestamp" :
True,
810 "varcharacter" :
True,
830 string sequence_table =
"sqlutil_sequences";
831 string sequence_function =
"sqlutil_nextval";
844 string getSchemaName();
849 AbstractSequence makeSequenceImpl(
string name,
number start = 1,
number increment = 1, *softnumber end, *
hash opts);
855 *AbstractSequence getSequenceImpl(
string name);
861 *AbstractView getViewImpl(
string name);
879 *AbstractFunction getFunctionImpl(
string name);
885 static string makeParameter(
hash row);
891 AbstractFunction getProcedureImpl(
string name);
910 list listTablesImpl();
921 list listFunctionsImpl();
932 list listProceduresImpl();
938 list listSequencesImpl();
944 list listViewsImpl();
950 string getCreateSqlImpl(
list l);
959 hash getDatabaseOptions();
966 hash getSchemaDescriptionOptions();
973 hash getComputeStatisticsOptions();
980 hash getReclaimSpaceOptions();
987 softint getNextSequenceValueImpl(
string name);
994 softint getCurrentSequenceValueImpl(
string name);
1001 bool supportsSequencesImpl();
1008 bool supportsTypesImpl();
1015 bool supportsPackagesImpl();
1022 bool rebuildIndexImpl(
string name, *
hash options);
1029 computeStatisticsImpl(*
hash options);
1036 reclaimSpaceImpl(*
hash options);
1047 const MysqlTypeMap = (
1059 "timestamp": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
1060 "time": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
1083 const QoreTypeMap = (
1084 "integer":
"bigint",
1086 "number":
"decimal",
1087 "string":
"varchar",
1089 "binary":
"varbinary",
1097 const MysqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions + (
1107 const MysqlColumnDescOptions = AbstractTable::ColumnDescOptions + (
1113 const MysqlIndexOptions = AbstractTable::IndexOptions;
1115 const MysqlConstraintOptions = AbstractTable::ConstraintOptions + MysqlIndexOptions + (
1119 const MysqlTableCreationOptions = AbstractTable::TableCreationOptions + MysqlConstraintOptions;
1121 const MysqlAlignTableOptions = AbstractTable::AlignTableOptions + MysqlTableCreationOptions;
1127 string name = QoreTypeMap{args[0]} ?? args[0];
1128 if (name ==
"varchar") name =
"char";
1129 hash desc = MysqlTypeMap{name};
1130 string sql =
sprintf (
"cast(%s as %s", cve, name);
1140 "code":
string (
string cve,
string arg) {
1141 return sprintf(
"concat(%s,%s)", arg, cve);
1147 "code":
string (
string cve,
string arg) {
1148 return sprintf(
"concat(%s,%s)", cve, arg);
1152 "code":
string (
string arg1,
auto arg) {
1153 return sprintf(
"date_format(%s, '%%Y')", arg1);
1157 "code":
string (
string arg1,
auto arg) {
1158 return sprintf(
"date_format(%s, '%%Y-%%m')", arg1);
1162 "code":
string (
string arg1,
auto arg) {
1163 return sprintf(
"date_format(%s, '%%Y-%%m-%%e')", arg1);
1167 "code":
string (
string arg1,
auto arg) {
1168 return sprintf(
"date_format(%s, '%%Y-%%m-%%e %%k')", arg1);
1172 "code":
string sub(
string arg1,
auto arg) {
1173 if (!MysqlTruncDate.hasKey(arg));
1175 return sprintf(
"cast(date_format(%s, %s) as datetime)", arg1, MysqlTruncDate{arg});
1181 const MysqlTruncDate = (
1182 DT_YEAR :
"'%Y-01-01 00:00:00'",
1184 DT_DAY :
"'%Y-%m-%d 00:00:00'",
1185 DT_HOUR :
"'%Y-%m-%d %H:00:00'",
1194 string engine =
"innodb";
1202 string getSqlName();
1207 hash getTableCreationOptions();
1213 hash getTableDescriptionHashOptions();
1219 hash getColumnDescOptions();
1225 hash getIndexOptions();
1231 hash getConstraintOptions();
1237 hash getAlignTableOptions();
1244 hash getColumnOperatorMap();
1250 bool checkExistenceImpl();
1256 Columns describeImpl();
1262 *
string getCreatePrimaryKeySqlUnlocked(*
hash opt,
bool cache =
True);
1274 Indexes getIndexesImpl();
1280 ForeignConstraints getForeignConstraintsImpl(*
hash opts);
1286 Constraints getConstraintsImpl();
1292 Triggers getTriggersImpl();
1296 string getCreateTableSqlImpl(*
hash opt);
1300 bool hasArrayBind();
1305 *
list getCreateMiscSqlImpl(*
hash opt,
bool cache);
1311 *
list getAlignSqlImpl(AbstractTable table, *
hash opt);
1317 string getCreateSqlImpl(
list l);
1323 string getRenameSqlImpl(
string new_name);
1329 AbstractColumn addColumnImpl(
string cname,
hash opt,
bool nullable =
True);
1335 setPrimaryKeyUnlocked(AbstractPrimaryKey pk);
1341 addColumnToTableUnlocked(AbstractColumn c);
1347 AbstractPrimaryKey addPrimaryKeyImpl(
string cname,
hash ch, *
hash opt);
1353 AbstractIndex addIndexImpl(
string iname,
bool enabled,
hash ch, *
hash opt);
1359 AbstractForeignConstraint addForeignConstraintImpl(
string cname,
hash ch,
string table,
hash tch, *
hash opt);
1365 AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *
hash opt);
1371 AbstractUniqueConstraint addUniqueConstraintImpl(
string cname,
hash ch, *
hash opt);
1377 AbstractTrigger addTriggerImpl(
string tname,
string src, *
hash opt);
1383 bool tryInsertImpl(
string sql,
hash row);
1389 hash getQoreTypeMapImpl();
1395 hash getTypeMapImpl();
1402 *
string getSqlValueImpl(
auto v);
1409 static *
string getSqlValueIntern(
auto v);
1414 string getColumnSqlName(
string col);
1418 list getColumnSqlNames(softlist cols);
1433 static *
string getSqlValue(
auto v);
1443 preSetupTableImpl(reference<hash> desc, *
hash opt);
1449 setupTableImpl(
hash desc, *
hash opt);
1456 bool constraintsLinkedToIndexesImpl();
1463 bool uniqueIndexCreatesConstraintImpl();
1470 bool supportsTablespacesImpl();
1477 doSelectLimitOnlyUnlockedImpl(reference<string> sql, reference<list> args, *
hash qh);
1484 doSelectOrderByWithOffsetSqlUnlockedImpl(reference<string> sql, reference<list> args, *
hash qh, *
hash jch, *
hash ch, *
hash psch,
list coll);
1491 bool asteriskRequiresPrefix();
1497 *
hash doReturningImpl(
hash opt, reference<string> sql,
list args);
1508 bool hasReturningImpl();
1514 copyImpl(AbstractTable old);
int byte_size
byte size of the column
Definition: MysqlSqlUtil.qm.dox.h:216
represents a MySQL-specific foreign constraint
Definition: MysqlSqlUtil.qm.dox.h:186
string sprintf(string fmt,...)
the MysqlSqlUtil namespace contains all the objects in the MysqlSqlUtil module
Definition: MysqlSqlUtil.qm.dox.h:140
provides the MySQL-specific implementation of the AbstractDatabase interface
Definition: MysqlSqlUtil.qm.dox.h:535
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:499
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:510
number number(softnumber n)
*string checkoption
checkoption clause
Definition: MysqlSqlUtil.qm.dox.h:506
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:436
provides the MySQL-specific implementation of the AbstractTable interface
Definition: MysqlSqlUtil.qm.dox.h:1042
represents a MySQL-specific primary key constraint
Definition: MysqlSqlUtil.qm.dox.h:363
represents a MySQL-specific trigger
Definition: MysqlSqlUtil.qm.dox.h:408
*string definer
dafiner clause
Definition: MysqlSqlUtil.qm.dox.h:508
Datasource seqds
separate datasource dedicated for extern sequence implementation with autonomous transactions ...
Definition: MysqlSqlUtil.qm.dox.h:828
string string(softstring str, *string enc)
class for MySQL sequences based on a sequence table and autonomous transactions
Definition: MysqlSqlUtil.qm.dox.h:468
represents a MySQL-specific numeric column
Definition: MysqlSqlUtil.qm.dox.h:278
represents a MySQL-specific column
Definition: MysqlSqlUtil.qm.dox.h:211
*string tablecatalog
table catalog value
Definition: MysqlSqlUtil.qm.dox.h:504
represents a MySQL-specific index
Definition: MysqlSqlUtil.qm.dox.h:153
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