Qore MysqlSqlUtil Module Reference  1.1
MysqlSqlUtil.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
2 // @file MysqlSqlUtil.qm Qore user module for working with MySQL SQL data
3 
4 /* MysqlSqlUtil.qm Copyright 2013 - 2016 Qore Technologies, sro
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23 */
24 
25 // minimum required Qore version
26 
27 // requires the SqlUtil module
28 
29 // don't use "$" signs for variables and class members, assume local variable scope
30 
31 // require type definitions everywhere
32 
33 // enable all warnings
34 
35 
132 namespace MysqlSqlUtil {
135  MysqlTable get_table(AbstractDatasource nds, string nname, *hash opts);
136 
137 
139  MysqlDatabase get_database(AbstractDatasource nds, *hash opts);
140 
141 
142  parse_schema_name(string nname, reference schema, reference name);
143 
144 
147 
148 public:
149  public :
150  string type;
151 
152 public:
153 
155  constructor(string n_name, bool n_unique, hash n_cols, string n_type = "BTREE") ;
156 
157 
159  string getCreateSql(string table_name, *hash opt);
160 
161 
163  private bool equalImpl(AbstractIndex ix);
164 
165 
167  string getRenameSql(string table_name, string new_name);
168 
169 
171  string getDropSql(string table_name);
172 
173  };
174 
177 
178 public:
179  constructor(string n, Columns c, ForeignConstraintTarget t) ;
180 
181 
182  string getCreateSql(string table_name, *hash opt);
183 
184 
186  softlist getRenameSql(string table_name, string new_name);
187 
188 
189  string getCreateSql(string name, string table_name, *hash opt);
190 
191 
192  string getAddSql(string name, string table_name, *hash opt);
193 
194 
196  string getDropSql(string table_name);
197 
198  };
199 
202 
203 public:
204  public :
207 
208 public:
209 
210  constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs) ;
211 
212 
214 
221  softlist getAddColumnSql(AbstractTable t);
222 
223 
225  string getCreateSql(AbstractTable t);
226 
227 
229 
241  softlist getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
242 
243 
245 
255  string getRenameSql(AbstractTable t, string new_name);
256 
257 
259  private bool equalImpl(AbstractColumn c);
260 
261  };
262 
265 
266 public:
267  public :
268  bool unsigned;
269  bool auto_increment;
270  // auto-incrememnt columns must be either "unique" or "primary key" in mysql
271  bool pk = False;
272 
273 public:
274 
275  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) ;
276 
277 
278  string getNativeTypeString();
279 
280 
282  private bool equalImpl(AbstractColumn c);
283 
284  };
285 
286 class MysqlUniqueConstraintCommon : public SqlUtil::AbstractUniqueConstraint {
287 
288 public:
289  constructor();
290 
291 
292  bool setIndexBase(string ix);
293 
294 
296  clearIndex();
297 
298 
299  abstract AbstractIterator keyIterator();
300 
302  getIndexSql(reference sql, string name, *hash opts);
303 
304  };
305 
306 class MysqlUniqueConstraint : public SqlUtil::AbstractUniqueConstraint,public MysqlUniqueConstraintCommon {
307 
308 public:
309  constructor(string n, hash n_cols) ;
310 
311 
313 
328  MysqlColumn memberGate(string k);
329 
330 
331  string getCreateSql(string table_name, *hash opts);
332 
333 
334  list getRenameSql(string table_name, string new_name);
335 
336 
337  string getCreateSql(string name, string table_name, *hash opts);
338 
339 
341  string getDropSql(string table_name);
342 
343  };
344 
346 class MysqlPrimaryKey : public SqlUtil::AbstractPrimaryKey,public MysqlUniqueConstraintCommon {
347 
348 public:
349  constructor();
350 
351 
352  constructor(*hash c) ;
353 
354 
356 
371  MysqlColumn memberGate(string k);
372 
373 
374  string getCreateSql(string table_name, *hash opts);
375 
376 
378  softlist getRenameSql(string table_name, string new_name);
379 
380 
382  string getDropSql(string table_name);
383 
384 
386  bool supportsName();
387 
388  };
389 
392 
393 public:
395  constructor(string n, string n_src) ;
396 
397 
399  softlist getCreateSql(string table_name, *hash opt);
400 
401 
403  softlist getDropSql(string table_name);
404 
405 
407  private bool equalImpl(AbstractFunctionBase t);
408 
409 
411  softlist getRenameSql(string table_name, string new_name);
412 
413  };
414 
417 
418 public:
419  constructor(string n, string n_src) ;
420 
421 
423  softlist getCreateSql(*hash opt);
424 
425 
427  string getDropSql();
428 
429 
431  private bool equalImpl(AbstractFunctionBase t);
432 
433 
435  softlist getRenameSql(string new_name);
436 
437  };
438 
441 
442 public:
443  private :
444  string table_name;
445 
446 public:
447 
449  constructor(string n_table_name, string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
450 
451 
453  string getCreateSql(*hash opt);
454 
455 
457  string getRenameSql(string new_name);
458 
459 
461  string getDropSql();
462 
463  };
464 
467 
468 public:
469 
470  public :
472  *string tablecatalog;
474  *string checkoption;
476  *string definer;
478  *string securitytype;
479 
480 public:
481 
483  constructor(string n_name, string n_src, *string n_tablecatalog,
484  *string n_schema,
485  *string n_checkoption, *string n_definer,
486  *string n_securitytype, bool n_updatable)
487  ;
488 
489 
491  string getCreateSql(*hash opt);
492 
493 
495  softlist getRenameSql(string new_name);
496 
497  };
498 
501 
502 public:
503  public :
505  const MysqlOptions = (
506  "sequence_table": Type::String,
507  "sequence_function": Type::String,
508  );
509 
511  const MysqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + MysqlOptions;
512 
514  const MysqlDatabaseOptions = AbstractDatabase::DatabaseOptions + MysqlOptions;
515 
518  "columns": (
519  "name": (
520  "qore_type": SqlUtil::VARCHAR,
521  "size": 40,
522  "notnull": True,
523  ),
524  "id": (
525  "qore_type": Type::Number,
526  "size": 14,
527  "notnull": True,
528  ),
529  ),
530  );
531 
533  const MyusqlCreationOptions = AbstractDatabase::CreationOptions;
534 
536  const MysqlSequenceFunction = "%s(seq_name varchar(40)) returns decimal(14)
537 begin
538  update %s set id = last_insert_id(id + 1) where name = seq_name;
539  return last_insert_id();
540 end";
541 
544  "no-binlog" : Type::Boolean,
545  );
546 
549  "no-binlog" : Type::Boolean,
550  );
551 
552 public:
553 
554  private :
555  string schema;
556 
558  Datasource seqds;
559 
560  string sequence_table = "sqlutil_sequences";
561  string sequence_function = "sqlutil_nextval";
562 
563 public:
564 
565  constructor(AbstractDatasource nds, *hash opts) ;
566 
567 
568  private list featuresImpl();
569 
570 
571  string getSchemaName();
572 
573 
574  private AbstractSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
575 
576 
577  private *AbstractSequence getSequenceImpl(string name);
578 
579 
580  private *AbstractView getViewImpl(string name);
581 
582 
583  private MysqlFunction makeFunctionImpl(string name, string src, *hash opts);
584 
585 
586  private MysqlFunction makeProcedureImpl(string name, string src, *hash opts);
587 
588 
589  private *AbstractFunction getFunctionImpl(string name);
590 
591 
592 
593 private:
594  static string makeParameter(hash row);
595 public:
596 
597 
598  private AbstractFunction getProcedureImpl(string name);
599 
600 
601  private list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
602 
603 
604  private list getAlignSqlImpl(hash schema_hash, *hash opt);
605 
606 
608  private list listTablesImpl();
609 
610 
612 
616  private list listFunctionsImpl();
617 
618 
620 
624  private list listProceduresImpl();
625 
626 
627  private list listSequencesImpl();
628 
629 
630  private list listViewsImpl();
631 
632 
633  private string getCreateSqlImpl(list l);
634 
635 
636  static string getCreateSql(list l);
637 
639  private hash getDatabaseOptions();
640 
641 
644 
645 
648 
649 
651  private hash getReclaimSpaceOptions();
652 
653 
655  private softint getNextSequenceValueImpl(string name);
656 
657 
659  private softint getCurrentSequenceValueImpl(string name);
660 
661 
663  private bool supportsSequencesImpl();
664 
665 
667  private bool supportsTypesImpl();
668 
669 
671  private bool supportsPackagesImpl();
672 
673 
675  private bool rebuildIndexImpl(string name, *hash options);
676 
677 
679  private computeStatisticsImpl(*hash options);
680 
681 
683  private reclaimSpaceImpl(*hash options);
684 
685  };
686 
689 
690 public:
691  public :
693  const MysqlTypeMap = (
694  "decimal": ("qore": Type::Number, "size": SZ_NUM,),
695  "tinyint": ("qore": Type::Int, "ai": True,),
696  "smallint": ("qore": Type::Int, "ai": True,),
697  "mediumint": ("qore": Type::Int, "ai": True,),
698  "int": ("qore": Type::Int, "ai": True,),
699  "bigint": ("qore": Type::Int, "ai": True,),
700  "float": ("qore": Type::Float, "ai": True,),
701  "double": ("qore": Type::Float, "ai": True,),
702 
703  "date": ("qore": Type::Date,),
704  "datetime": ("qore": Type::Date,),
705  "timestamp": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
706  "time": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
707  "year": ("qore": Type::Int,),
708 
709  "char": ("qore": Type::String, "size": SZ_OPT, "size_range": (0, 255)),
710  "varchar": ("qore": Type::String, "size": SZ_MAND, "size_range": (0, 65535)),
711 
712  "binary": ("qore": Type::Binary, "size": SZ_OPT, "size_range": (0, 255)),
713  "varbinary": ("qore": Type::Binary, "size": SZ_MAND, "size_range": (0, 65535)),
714 
715  "tinytext": ("qore": Type::String,),
716  "text": ("qore": Type::String,),
717  "mediumtext": ("qore": Type::String,),
718  "longtext": ("qore": Type::String,),
719 
720  "tinyblob": ("qore": Type::Binary,),
721  "blob": ("qore": Type::Binary,),
722  "mediumblob": ("qore": Type::Binary,),
723  "longblob": ("qore": Type::Binary,),
724 
725  "bit": ("qore": Type::Int,),
726  );
727 
729  const QoreTypeMap = (
730  "integer": "bigint",
731  "float": "double",
732  "number": "decimal",
733  "string": "varchar",
734  "date": "datetime",
735  "binary": "varbinary",
736  "bool": "tinyint",
737  SqlUtil::CHAR: "char",
738  SqlUtil::CLOB: "mediumtext",
739  SqlUtil::BLOB: "mediumblob",
740  );
741 
743  const MysqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions + (
744  "engine": Type::String,
745  );
746 
748 
753  const MysqlColumnDescOptions = AbstractTable::ColumnDescOptions + (
754  "unsigned": Type::Boolean,
755  "auto_increment": Type::Boolean,
756  "pk": Type::Boolean,
757  );
758 
759  const MysqlIndexOptions = AbstractTable::IndexOptions;
760 
761  const MysqlConstraintOptions = AbstractTable::ConstraintOptions + MysqlIndexOptions + (
762  "index": Type::String,
763  );
764 
765  const MysqlTableCreationOptions = AbstractTable::TableCreationOptions + MysqlConstraintOptions;
766 
767  const MysqlAlignTableOptions = AbstractTable::AlignTableOptions + MysqlTableCreationOptions;
768 
771  COP_CAST: (
772  "code": string (string cve, list args) {
773  string name = QoreTypeMap{args[0]} ?? args[0];
774  if (name == "varchar") name = "char"; // NOTE: due to current MariaSQL issue ("ERROR 1064 (42000)")
775  hash desc = MysqlTypeMap{name};
776  string sql = sprintf ("cast(%s as %s", cve, name);
777  switch (name);
778 
779  sql += ")";
780  return sql;
781  },
782  ),
783  COP_PREPEND: (
784  "arg": Type::String,
785  "sqlvalue": True,
786  "code": string (string cve, string arg) {
787  return sprintf("concat(%s,%s)", arg, cve);
788  },
789  ),
790  COP_APPEND: (
791  "arg": Type::String,
792  "sqlvalue": True,
793  "code": string (string cve, string arg) {
794  return sprintf("concat(%s,%s)", cve, arg);
795  },
796  ),
797  COP_YEAR: (
798  "code": string (string arg1, any arg) {
799  return sprintf("date_format(%s, '%%Y')", arg1);
800  }
801  ),
802  COP_YEAR_MONTH: (
803  "code": string (string arg1, any arg) {
804  return sprintf("date_format(%s, '%%Y-%%m')", arg1);
805  }
806  ),
807  COP_YEAR_DAY: (
808  "code": string (string arg1, any arg) {
809  return sprintf("date_format(%s, '%%Y-%%m-%%e')", arg1);
810  }
811  ),
812  COP_YEAR_HOUR: (
813  "code": string (string arg1, any arg) {
814  return sprintf("date_format(%s, '%%Y-%%m-%%e %%k')", arg1);
815  }
816  ),
817  );
818 
819 public:
820 
821  private :
822  string schema;
823  string engine = "innodb";
824 
825 public:
826 
827  constructor(AbstractDatasource nds, string nname, *hash opts) ;
828 
829 
831  string getSqlName();
832 
833 
834  private hash getTableCreationOptions();
835 
836 
837  private hash getTableDescriptionHashOptions();
838 
839 
840  private hash getColumnDescOptions();
841 
842 
843  private hash getIndexOptions();
844 
845 
846  private hash getConstraintOptions();
847 
848 
849  private hash getAlignTableOptions();
850 
851 
853  private hash getColumnOperatorMap();
854 
855 
856  private bool checkExistenceImpl();
857 
858 
859  private Columns describeImpl();
860 
861 
862  private *string getCreatePrimaryKeySqlUnlocked(*hash opt, bool cache = True);
863 
864 
865  private MysqlPrimaryKey getPrimaryKeyImpl();
866 
867 
868  private Indexes getIndexesImpl();
869 
870 
871  private ForeignConstraints getForeignConstraintsImpl(*hash opts);
872 
873 
874  private Constraints getConstraintsImpl();
875 
876 
877  private Triggers getTriggersImpl();
878 
879 
880  string getCreateTableSqlImpl(*hash opt);
881 
882 
884  bool hasArrayBind();
885 
886 
887  private *list getCreateMiscSqlImpl(*hash opt, bool cache);
888 
889 
890  private *list getAlignSqlImpl(AbstractTable table, *hash opt);
891 
892 
893  private string getCreateSqlImpl(list l);
894 
895 
896  private string getRenameSqlImpl(string new_name);
897 
898 
899  private AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
900 
901 
902  private setPrimaryKeyUnlocked(AbstractPrimaryKey pk);
903 
904 
905  private addColumnToTableUnlocked(AbstractColumn c);
906 
907 
908  private AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
909 
910 
911  private AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
912 
913 
914  private AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch, *hash opt);
915 
916 
917  private AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
918 
919 
920  private AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
921 
922 
923  private AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
924 
925 
926  private bool tryInsertImpl(string sql, hash row);
927 
928 
929  private hash getQoreTypeMapImpl();
930 
931 
932  private hash getTypeMapImpl();
933 
934 
936  private *string getSqlValueImpl(any v);
937 
938 
940 
941 private:
942  static *string getSqlValueIntern(any v);
943 public:
944 
945 
947 
958  static *string getSqlValue(any v);
959 
960  private bool emptyImpl();
961 
962 
963  private preSetupTableImpl(reference desc, *hash opt);
964 
965 
966  private setupTableImpl(hash desc, *hash opt);
967 
968 
970  private bool constraintsLinkedToIndexesImpl();
971 
972 
974  private bool uniqueIndexCreatesConstraintImpl();
975 
976 
978  private bool supportsTablespacesImpl();
979 
980 
982  private doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh);
983 
984 
986  private doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch, *hash psch, list coll);
987 
988 
990  private bool asteriskRequiresPrefix();
991 
992 
993  private *hash doReturningImpl(hash opt, reference sql, list args);
994 
995 
996  private list getGroupOrderByListUnlocked(string key, hash qh, *hash jch, *hash ch, *hash psch, list coll);
997 
998 
1000  bool hasReturningImpl();
1001 
1002 
1004  private copyImpl(AbstractTable old);
1005 
1006  };
1007 };
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:753
const Date
int byte_size
byte size of the column
Definition: MysqlSqlUtil.qm.dox.h:206
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:693
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
const String
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:176
string getDropSql()
returns a string that can be used to drop the sequence from the database
string sprintf(string fmt,...)
const DefaultCopMap
const VARCHAR
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:133
provides the MySQL-specific implementation of the AbstractDatabase interface
Definition: MysqlSqlUtil.qm.dox.h:500
bool hasArrayBind()
returns False because the mysql driver does not support array binds / bulk DML operations ...
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:770
represents a MySQL view
Definition: MysqlSqlUtil.qm.dox.h:466
const MysqlSequenceTable
MySQL sequence emulation table.
Definition: MysqlSqlUtil.qm.dox.h:517
private bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
bool hasReturningImpl()
returns True if the current database driver supports the "returning" clause in insert statements...
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:478
private bool supportsPackagesImpl()
returns True if the database supports packages
const True
private bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
private bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
const SZ_MAND
const CHAR
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)
const COP_YEAR_HOUR
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...
private hash getReclaimSpaceOptions()
returns driver-specific options to the base abstract class
string getCreateSql(AbstractTable t)
returns an sql string that can be used to add the column to a table
private hash getComputeStatisticsOptions()
returns driver-specific options to the base abstract class
const MysqlReclaimSpaceOptions
Options for reclaimSpace()
Definition: MysqlSqlUtil.qm.dox.h:548
const False
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:474
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
const MysqlComputeStatisticsOptions
Options for computeStatistics()
Definition: MysqlSqlUtil.qm.dox.h:543
list list(...)
private bool asteriskRequiresPrefix()
returns True if the database requires a wildcard "*" to be prefixed with the table name when it appea...
const Float
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...
const Boolean
const SZ_NUM
private bool supportsTablespacesImpl()
returns True if the database support tablespaces
const MysqlSequenceFunction
MySQL sequence function.
Definition: MysqlSqlUtil.qm.dox.h:536
string getDropSql(string table_name)
returns a string that can be used to drop the index from the table
const Binary
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:743
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:416
private copyImpl(AbstractTable old)
db-specific copy actions
provides the MySQL-specific implementation of the AbstractTable interface
Definition: MysqlSqlUtil.qm.dox.h:688
represents a MySQL-specific primary key constraint
Definition: MysqlSqlUtil.qm.dox.h:346
const COP_YEAR_MONTH
const MyusqlCreationOptions
MySQL creation options.
Definition: MysqlSqlUtil.qm.dox.h:533
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:391
const BLOB
private softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
const CLOB
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
private hash getDatabaseOptions()
returns driver-specific options to the base abstract class
softlist getRenameSql(string table_name, string new_name)
primary keys have no name in MySQL so this method returns an empty list
private list listFunctionsImpl()
returns a list of string function names in the database
*string definer
dafiner clause
Definition: MysqlSqlUtil.qm.dox.h:476
private reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
private list listTablesImpl()
returns a list of string table names in the database
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...
const COP_PREPEND
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:558
const Int
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
const COP_YEAR
string string(softstring str, *string enc)
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:440
const COP_CAST
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
private computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics() ...
represents a MySQL-specific numeric column
Definition: MysqlSqlUtil.qm.dox.h:264
private bool supportsTypesImpl()
returns True if the database supports named types
represents a MySQL-specific column
Definition: MysqlSqlUtil.qm.dox.h:201
const COP_YEAR_DAY
const MysqlSchemaDescriptionOptions
MySQL-specific schema description keys.
Definition: MysqlSqlUtil.qm.dox.h:511
*string tablecatalog
table catalog value
Definition: MysqlSqlUtil.qm.dox.h:472
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:146
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
hash hash(object obj)
const MysqlOptions
MySQL-specific options.
Definition: MysqlSqlUtil.qm.dox.h:505
const SZ_OPT
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...
const MysqlDatabaseOptions
MySQL-specific database options.
Definition: MysqlSqlUtil.qm.dox.h:514
const Number
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:729
const COP_APPEND