Qore MysqlSqlUtil Module Reference 1.0

- Main Page
- Related Pages
- Namespaces
- Classes

All Classes Namespaces Functions Variables Groups Pages
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 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 // this module requires Qore 0.8.8 or better
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
36 /* Version History
37 * 2013-10-04 v1.0: David Nichols <david@qore.org>
38 + the initial version of the MysqlSqlUtil module
39 */
40
125 namespace MysqlSqlUtil {
128 MysqlTable get_table(AbstractDatasource nds, string nname, *hash opts);
129
130
132 MysqlDatabase get_database(AbstractDatasource nds, *hash opts);
133
134
136 class MysqlIndex : public SqlUtil::AbstractIndex {
137
138 public:
139 public :
140 string type;
141
142 public:
143
145 constructor(string n_name, bool n_unique, hash n_cols, string n_type = "BTREE");
146
147
149 string getCreateSql(string table_name, *hash opt);
150
151
153
154 private:
155 bool equalImpl(AbstractIndex ix);
156 public:
157
158
160 string getRenameSql(string table_name, string new_name);
161
162
164 string getDropSql(string table_name);
165
166 };
167
169 class MysqlForeignConstraint : public SqlUtil::AbstractForeignConstraint {
170
171 public:
172 constructor(string n, Columns c, ForeignConstraintTarget t);
173
174
175 string getCreateSql(string table_name, *hash opt);
176
177
179 softlist getRenameSql(string table_name, string new_name);
180
181
182 string getCreateSql(string name, string table_name, *hash opt);
183
184
185 string getAddSql(string name, string table_name, *hash opt);
186
187
189 string getDropSql(string table_name);
190
191 };
192
194 class MysqlColumn : public SqlUtil::AbstractColumn {
195
196 public:
197 public :
199 int byte_size;
200
201 public:
202
203 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs);
204
205
207
214 softlist getCreateSql(AbstractTable t);
215
216
218
230 softlist getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
231
232
234
244 string getRenameSql(AbstractTable t, string new_name);
245
246
248
249 private:
250 bool equalImpl(AbstractColumn c);
251 public:
252
253 };
254
256 class MysqlNumericColumn : public MysqlColumn,public SqlUtil::NumericColumnInfo {
257
258 public:
259 public :
260 bool unsigned;
261 bool auto_increment;
262 // auto-incrememnt columns must be either "unique" or "primary key" in mysql
263 bool pk = False;
264
265 public:
266
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);
268
269
270 string getNativeTypeString();
271
272
274
275 private:
276 bool equalImpl(AbstractColumn c);
277 public:
278
279 };
280
281 class MysqlUniqueConstraintCommon : public SqlUtil::AbstractUniqueConstraint {
282
283 public:
284 constructor();
285
286
287 bool setIndexBase(string ix);
288
289
291 clearIndex();
292
293
294 abstract AbstractIterator keyIterator();
295
297 getIndexSql(reference sql, string name, *hash opts);
298
299 };
300
301 class MysqlUniqueConstraint : public SqlUtil::AbstractUniqueConstraint,public MysqlUniqueConstraintCommon {
302
303 public:
304 constructor(string n, hash n_cols);
305
306
308
323 MysqlColumn memberGate(string k);
324
325
326 string getCreateSql(string table_name, *hash opts);
327
328
329 list getRenameSql(string table_name, string new_name);
330
331
332 string getCreateSql(string name, string table_name, *hash opts);
333
334
336 string getDropSql(string table_name);
337
338 };
339
341 class MysqlPrimaryKey : public SqlUtil::AbstractPrimaryKey,public MysqlUniqueConstraintCommon {
342
343 public:
344 constructor();
345
346
347 constructor(*hash c);
348
349
351
366 MysqlColumn memberGate(string k);
367
368
369 string getCreateSql(string table_name, *hash opts);
370
371
373 softlist getRenameSql(string table_name, string new_name);
374
375
377 string getDropSql(string table_name);
378
379
381 bool supportsName();
382
383 };
384
386 class MysqlTrigger : public SqlUtil::AbstractTrigger {
387
388 public:
390 constructor(string n, string n_src);
391
392
394 softlist getCreateSql(string table_name, *hash opt);
395
396
398 softlist getDropSql(string table_name);
399
400
402
403 private:
404 bool equalImpl(AbstractFunctionBase t);
405 public:
406
407
409 softlist getRenameSql(string table_name, string new_name);
410
411 };
412
414 class MysqlFunction : public SqlUtil::AbstractFunction {
415
416 public:
417 constructor(string n, string n_src);
418
419
421 softlist getCreateSql(*hash opt);
422
423
425 string getDropSql();
426
427
429
430 private:
431 bool equalImpl(AbstractFunctionBase t);
432 public:
433
434
436 softlist getRenameSql(string new_name);
437
438 };
439
441 class MysqlSequence : public SqlUtil::AbstractSequence {
442
443 public:
444 private :
445 string table_name;
446
447 public:
448
450 constructor(string n_table_name, string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end);
451
452
454 string getCreateSql(*hash opt);
455
456
458 string getRenameSql(string new_name);
459
460
462 string getDropSql();
463
464 };
465
467 class MysqlDatabase : public SqlUtil::AbstractDatabase {
468
469 public:
470 public :
472 const MysqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + (
473 "sequence_table": Type::String,
474 "sequence_function": Type::String,
475 );
476
477
479 const MysqlSequenceTable = (
480 "columns": (
481 "name": (
482 "qore_type": SqlUtil::VARCHAR,
483 "size": 40,
484 "notnull": True,
485 ),
486 "id": (
487 "qore_type": Type::Number,
488 "size": 14,
489 "notnull": True,
490 ),
491 ),
492 );
493
495 const MysqlSequenceFunction = "%s(seq_name varchar(40)) returns decimal(14)
496 begin
497 update %s set id = last_insert_id(id + 1) where name = seq_name;
498 return last_insert_id();
499 end";
500
501 public:
502
503 private :
504 string schema;
505
507 Datasource seqds;
508
509 string sequence_table = "sqlutil_sequences";
510 string sequence_function = "sqlutil_nextval";
511
512 public:
513
514 constructor(AbstractDatasource nds, *hash opts);
515
516
517
518 private:
519 list featuresImpl();
520 public:
521
522
523 string getSchemaName();
524
525
526
527 private:
528 AbstractSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
529 public:
530
531
532
533 private:
534 *AbstractSequence getSequenceImpl(string name);
535 public:
536
537
538
539 private:
540 MysqlFunction makeFunctionImpl(string name, string src, *hash opts);
541 public:
542
543
544
545 private:
546 MysqlFunction makeProcedureImpl(string name, string src, *hash opts);
547 public:
548
549
550
551 private:
552 *AbstractFunction getFunctionImpl(string name);
553 public:
554
555
556
557 private:
558 static string makeParameter(hash row);
559 public:
560
561
562
563 private:
564 AbstractFunction getProcedureImpl(string name);
565 public:
566
567
568
569 private:
570 list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
571 public:
572
573
574
575 private:
576 list getAlignSqlImpl(hash schema_hash, *hash opt);
577 public:
578
579
581
582 private:
583 list listTablesImpl();
584 public:
585
586
588
593 private:
594 list listFunctionsImpl();
595 public:
596
597
599
604 private:
605 list listProceduresImpl();
606 public:
607
608
609
610 private:
611 list listSequencesImpl();
612 public:
613
614
615
616 private:
617 list listViewsImpl();
618 public:
619
620
621
622 private:
623 string getCreateSqlImpl(list l);
624 public:
625
626
627 static string getCreateSql(list l);
628
630
631 private:
632 hash getSchemaDescriptionOptions();
633 public:
634
635
637
638 private:
639 softint getNextSequenceValueImpl(string name);
640 public:
641
642
644
645 private:
646 bool supportsSequencesImpl();
647 public:
648
649
651
652 private:
653 bool supportsTypesImpl();
654 public:
655
656
658
659 private:
660 bool supportsPackagesImpl();
661 public:
662
663 };
664
666 class MysqlTable : public SqlUtil::AbstractTable {
667
668 public:
669 public :
671 const MysqlTypeMap = (
672 "decimal": ("qore": Type::Number, "size": SZ_NUM,),
673 "tinyint": ("qore": Type::Int, "ai": True,),
674 "smallint": ("qore": Type::Int, "ai": True,),
675 "mediumint": ("qore": Type::Int, "ai": True,),
676 "int": ("qore": Type::Int, "ai": True,),
677 "bigint": ("qore": Type::Int, "ai": True,),
678 "float": ("qore": Type::Float, "ai": True,),
679 "double": ("qore": Type::Float, "ai": True,),
680
681 "date": ("qore": Type::Date,),
682 "datetime": ("qore": Type::Date,),
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,),
685 "year": ("qore": Type::Int,),
686
687 "char": ("qore": Type::String, "size": SZ_MAND,),
688 "varchar": ("qore": Type::String, "size": SZ_MAND,),
689
690 "binary": ("qore": Type::Binary,),
691 "varbinary": ("qore": Type::Binary,),
692
693 "tinytext": ("qore": Type::String,),
694 "text": ("qore": Type::String,),
695 "mediumtext": ("qore": Type::String,),
696 "longtext": ("qore": Type::String,),
697
698 "tinyblob": ("qore": Type::Binary,),
699 "blob": ("qore": Type::Binary,),
700 "mediumblob": ("qore": Type::Binary,),
701 "longblob": ("qore": Type::Binary,),
702
703 "bit": ("qore": Type::Int,),
704 );
705
707 const QoreTypeMap = (
708 "integer": "bigint",
709 "float": "double",
710 "number": "decimal",
711 "string": "varchar",
712 "date": "datetime",
713 "binary": "varbinary",
714 "bool": "tinyint",
715 SqlUtil::CHAR: "char",
716 SqlUtil::CLOB: "mediumtext",
717 SqlUtil::BLOB: "mediumblob",
718 );
719
721 const MysqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions + (
722 "engine": Type::String,
723 );
724
726
731 const MysqlColumnDescOptions = AbstractTable::ColumnDescOptions + (
732 "unsigned": Type::Boolean,
733 "auto_increment": Type::Boolean,
734 "pk": Type::Boolean,
735 );
736
737 const MysqlIndexOptions = AbstractTable::IndexOptions;
738
739 const MysqlConstraintOptions = AbstractTable::ConstraintOptions + MysqlIndexOptions + (
740 "index": Type::String,
741 );
742
743 const MysqlTableCreationOptions = AbstractTable::TableCreationOptions + MysqlConstraintOptions;
744
745 const MysqlAlignTableOptions = AbstractTable::AlignTableOptions + MysqlTableCreationOptions;
746
748 const MysqlCopMap = DefaultCopMap + (
749 COP_PREPEND: (
750 "arg": Type::String,
751 "sqlvalue": True,
752 "code": string (string cve, string arg) {
753 return sprintf("concat(%s,%s)", arg, cve);
754
755 public:
756 ),
757 COP_APPEND: (
758 "arg": Type::String,
759 "sqlvalue": True,
760 "code": string (string cve, string arg) {
761 return sprintf("concat(%s,%s)", cve, arg);
762 },
763 ),
764 COP_YEAR: (
765 "code": string (string arg1, any arg) {
766 return sprintf("date_format(%s, '%%Y')", arg1);
767 }
768 ),
769 COP_YEAR_MONTH: (
770 "code": string (string arg1, any arg) {
771 return sprintf("date_format(%s, '%%Y-%%m')", arg1);
772 }
773 ),
774 COP_YEAR_DAY: (
775 "code": string (string arg1, any arg) {
776 return sprintf("date_format(%s, '%%Y-%%m-%%e')", arg1);
777 }
778 ),
779 COP_YEAR_HOUR: (
780 "code": string (string arg1, any arg) {
781 return sprintf("date_format(%s, '%%Y-%%m-%%e %%k')", arg1);
782 }
783 ),
784 );
785 }
786
787 private :
788 string schema;
789 string engine = "innodb";
790
791 public:
792
793 constructor(AbstractDatasource nds, string nname, *hash opts);
794
795
797 string getSqlName();
798
799
800
801 private:
802 hash getTableCreationOptions();
803 public:
804
805
806
807 private:
808 hash getTableDescriptionHashOptions();
809 public:
810
811
812
813 private:
814 hash getColumnDescOptions();
815 public:
816
817
818
819 private:
820 hash getIndexOptions();
821 public:
822
823
824
825 private:
826 hash getConstraintOptions();
827 public:
828
829
830
831 private:
832 hash getAlignTableOptions();
833 public:
834
835
837
838 private:
839 hash getColumnOperatorMap();
840 public:
841
842
843
844 private:
845 bool checkExistenceImpl();
846 public:
847
848
849
850 private:
851 Columns describeImpl();
852 public:
853
854
855
856 private:
857 *string getCreatePrimaryKeySqlUnlocked(*hash opt, bool cache = True);
858 public:
859
860
861
862 private:
863 MysqlPrimaryKey getPrimaryKeyImpl();
864 public:
865
866
867
868 private:
869 Indexes getIndexesImpl();
870 public:
871
872
873
874 private:
875 ForeignConstraints getForeignConstraintsImpl(*hash opts);
876 public:
877
878
879
880 private:
881 Constraints getConstraintsImpl();
882 public:
883
884
885
886 private:
887 Triggers getTriggersImpl();
888 public:
889
890
891 string getCreateTableSqlImpl(*hash opt);
892
893
894 *list getCreateMiscSqlImpl(*hash opt, bool cache);
895
896
897
898 private:
899 *list getAlignSqlImpl(AbstractTable table, *hash opt);
900 public:
901
902
903
904 private:
905 string getCreateSqlImpl(list l);
906 public:
907
908
909
910 private:
911 string getRenameSqlImpl(string new_name);
912 public:
913
914
915
916 private:
917 AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
918 public:
919
920
921
922 private:
923 setPrimaryKeyUnlocked(AbstractPrimaryKey pk);
924 public:
925
926
927
928 private:
929 addColumnToTableUnlocked(AbstractColumn c);
930 public:
931
932
933
934 private:
935 AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
936 public:
937
938
939
940 private:
941 AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
942 public:
943
944
945
946 private:
947 AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch, *hash opt);
948 public:
949
950
951
952 private:
953 AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
954 public:
955
956
957
958 private:
959 AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
960 public:
961
962
963
964 private:
965 AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
966 public:
967
968
969
970 private:
971 bool tryInsertImpl(string sql, hash row);
972 public:
973
974
975
976 private:
977 hash getQoreTypeMapImpl();
978 public:
979
980
981
982 private:
983 hash getTypeMapImpl();
984 public:
985
986
988
989 private:
990 *string getSqlValueImpl(any v);
991 public:
992
993
995
996 private:
997 static *string getSqlValueIntern(any v);
998 public:
999
1000
1002
1013 static *string getSqlValue(any v);
1014
1015
1016 private:
1017 bool emptyImpl();
1018 public:
1019
1020
1021
1022 private:
1023 preSetupTableImpl(reference desc, *hash opt);
1024 public:
1025
1026
1027
1028 private:
1029 setupTableImpl(hash desc, *hash opt);
1030 public:
1031
1032
1034
1035 private:
1036 bool constraintsLinkedToIndexesImpl();
1037 public:
1038
1039
1041
1042 private:
1043 bool uniqueIndexCreatesConstraintImpl();
1044 public:
1045
1046
1048
1049 private:
1050 bool supportsTablespacesImpl();
1051 public:
1052
1053
1055
1056 private:
1057 doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh);
1058 public:
1059
1060
1062
1063 private:
1064 doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch);
1065 public:
1066
1067
1069
1070 private:
1071 copyImpl(AbstractTable old);
1072 public:
1073
1074 };
1075 };
SqlUtil::AbstractConstraint::name
string name
MysqlSqlUtil::MysqlFunction::getCreateSql
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
MysqlSqlUtil::MysqlDatabase::getSchemaDescriptionOptions
hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
MysqlSqlUtil::MysqlTable::MysqlColumnDescOptions
const MysqlColumnDescOptions
extends SqlUtil::AbstractTable::ColumnDescOptions with MySQL-specific values
Definition: MysqlSqlUtil.qm.dox.h:731
Date
const Date
MysqlSqlUtil::MysqlColumn::byte_size
int byte_size
byte size of the column
Definition: MysqlSqlUtil.qm.dox.h:199
MysqlSqlUtil::MysqlColumn::getRenameSql
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
MysqlSqlUtil::MysqlTable::MysqlTypeMap
const MysqlTypeMap
maps mysql type names to type configurations
Definition: MysqlSqlUtil.qm.dox.h:671
String
const String
MysqlSqlUtil::MysqlFunction::getDropSql
string getDropSql()
returns a string that can be used to drop the function from the database
MysqlSqlUtil::MysqlForeignConstraint
represents a MySQL-specific foreign constraint
Definition: MysqlSqlUtil.qm.dox.h:169
MysqlSqlUtil::MysqlTrigger::equalImpl
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
MysqlSqlUtil::MysqlSequence::getDropSql
string getDropSql()
returns a string that can be used to drop the sequence from the database
sprintf
string sprintf(string fmt,...)
SqlUtil::AbstractTable
DefaultCopMap
const DefaultCopMap
SqlUtil::VARCHAR
const VARCHAR
MysqlSqlUtil::MysqlDatabase
provides the MySQL-specific implementation of the AbstractDatabase interface
Definition: MysqlSqlUtil.qm.dox.h:467
SqlUtil::AbstractTable::cache
cache(*hash opts)
MysqlSqlUtil::MysqlIndex::equalImpl
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
SqlUtil::AbstractIndex
MysqlSqlUtil::get_table
MysqlTable get_table(AbstractDatasource nds, string nname, *hash opts)
returns a MysqlTable object corresponding to the arguments
MysqlSqlUtil::MysqlTable::MysqlCopMap
const MysqlCopMap
column operator specializations for MySQL
Definition: MysqlSqlUtil.qm.dox.h:748
MysqlSqlUtil::MysqlDatabase::supportsSequencesImpl
bool supportsSequencesImpl()
returns True since we have a workaround implementation for sequences in MySQL
MysqlSqlUtil::MysqlDatabase::MysqlSequenceTable
const MysqlSequenceTable
MySQL sequence emulation table.
Definition: MysqlSqlUtil.qm.dox.h:479
MysqlSqlUtil::get_database
MysqlDatabase get_database(AbstractDatasource nds, *hash opts)
returns a MysqlDatabase object corresponding to the arguments
SqlUtil::NumericColumnInfo
True
const True
SZ_MAND
const SZ_MAND
SqlUtil::CHAR
const CHAR
SqlUtil::AbstractSequence
MysqlSqlUtil::MysqlColumn::getModifySqlImpl
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...
MysqlSqlUtil::MysqlFunction::getRenameSql
softlist getRenameSql(string new_name)
returns a string that can be used to rename the function in the database
number
number number(softnumber n)
COP_YEAR_HOUR
const COP_YEAR_HOUR
MysqlSqlUtil::MysqlForeignConstraint::getRenameSql
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...
MysqlSqlUtil::MysqlFunction::equalImpl
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
SqlUtil::AbstractForeignConstraint
MysqlSqlUtil::MysqlTable::getColumnOperatorMap
hash getColumnOperatorMap()
returns the column operator map for this object
False
const False
SqlUtil::AbstractSqlUtilBase::l
Mutex l()
MysqlSqlUtil::MysqlTrigger::getCreateSql
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
list
list list(...)
Float
const Float
MysqlSqlUtil::MysqlDatabase::supportsPackagesImpl
bool supportsPackagesImpl()
returns True if the database supports packages
MysqlSqlUtil::MysqlTable::getSqlValueImpl
*string getSqlValueImpl(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
MysqlSqlUtil::MysqlDatabase::listFunctionsImpl
list listFunctionsImpl()
returns a list of string function names in the database
MysqlSqlUtil::MysqlTrigger::getDropSql
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from the database
MysqlSqlUtil::MysqlForeignConstraint::getDropSql
string getDropSql(string table_name)
returns a string that can be used to drop the foreign constraint from the database ...
MysqlSqlUtil::MysqlSequence::getRenameSql
string getRenameSql(string new_name)
returns a string that can be used to rename the sequence in the database
MysqlSqlUtil::MysqlDatabase::listProceduresImpl
list listProceduresImpl()
returns a list of string procedure names in the database
Boolean
const Boolean
SZ_NUM
const SZ_NUM
MysqlSqlUtil::MysqlDatabase::MysqlSequenceFunction
const MysqlSequenceFunction
MySQL sequence function.
Definition: MysqlSqlUtil.qm.dox.h:495
MysqlSqlUtil::MysqlIndex::getDropSql
string getDropSql(string table_name)
returns a string that can be used to drop the index from the table
SqlUtil::AbstractColumn::getCreateSql
string getCreateSql()
Binary
const Binary
MysqlSqlUtil::MysqlPrimaryKey::memberGate
MysqlColumn memberGate(string k)
returns the MysqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception ...
MysqlSqlUtil::MysqlTable::MysqlTableDescriptionHashOptions
const MysqlTableDescriptionHashOptions
extends SqlUtil::AbstractTable::TableDescriptionHashOptions with &quot;engine&quot; for the DB engine behind th...
Definition: MysqlSqlUtil.qm.dox.h:721
MysqlSqlUtil::MysqlSequence::getCreateSql
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
MysqlSqlUtil::MysqlFunction
represents a MySQL-specific function
Definition: MysqlSqlUtil.qm.dox.h:414
MysqlSqlUtil::MysqlDatabase::listTablesImpl
list listTablesImpl()
returns a list of string table names in the database
MysqlSqlUtil::MysqlColumn::equalImpl
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
MysqlSqlUtil::MysqlTable::uniqueIndexCreatesConstraintImpl
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
MysqlSqlUtil::MysqlTable
provides the MySQL-specific implementation of the AbstractTable interface
Definition: MysqlSqlUtil.qm.dox.h:666
MysqlSqlUtil::MysqlPrimaryKey
represents a MySQL-specific primary key constraint
Definition: MysqlSqlUtil.qm.dox.h:341
COP_YEAR_MONTH
const COP_YEAR_MONTH
MysqlSqlUtil::MysqlTrigger
represents a MySQL-specific trigger
Definition: MysqlSqlUtil.qm.dox.h:386
SqlUtil::BLOB
const BLOB
SqlUtil::CLOB
const CLOB
MysqlSqlUtil::MysqlTable::getSqlName
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
MysqlSqlUtil::MysqlTable::supportsTablespacesImpl
bool supportsTablespacesImpl()
returns True if the database support tablespaces
MysqlSqlUtil::MysqlPrimaryKey::getRenameSql
softlist getRenameSql(string table_name, string new_name)
primary keys have no name in MySQL so this method returns an empty list
string
string string(softstring str)
SqlUtil::AbstractFunction
COP_PREPEND
const COP_PREPEND
SqlUtil::AbstractSqlUtilBase::opts
*hash opts
MysqlSqlUtil::MysqlNumericColumn::equalImpl
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
MysqlSqlUtil::MysqlTable::getSqlValueIntern
static *string getSqlValueIntern(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
MysqlSqlUtil::MysqlDatabase::seqds
Datasource seqds
separate datasource dedicated for extern sequence implementation with autonomous transactions ...
Definition: MysqlSqlUtil.qm.dox.h:507
Int
const Int
MysqlSqlUtil::MysqlSequence::constructor
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
COP_YEAR
const COP_YEAR
MysqlSqlUtil::MysqlDatabase::supportsTypesImpl
bool supportsTypesImpl()
returns True if the database supports named types
SqlUtil::AbstractTrigger
MysqlSqlUtil::MysqlTable::copyImpl
copyImpl(AbstractTable old)
db-specific copy actions
SqlUtil::AbstractColumn
MysqlSqlUtil::MysqlTrigger::constructor
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
MysqlSqlUtil::MysqlSequence
class for MySQL sequences based on a sequence table and autonomous transactions
Definition: MysqlSqlUtil.qm.dox.h:441
MysqlSqlUtil::MysqlDatabase::getNextSequenceValueImpl
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
MysqlSqlUtil::MysqlNumericColumn
represents a MySQL-specific numeric column
Definition: MysqlSqlUtil.qm.dox.h:256
MysqlSqlUtil::MysqlColumn
represents a MySQL-specific column
Definition: MysqlSqlUtil.qm.dox.h:194
COP_YEAR_DAY
const COP_YEAR_DAY
MysqlSqlUtil::MysqlDatabase::MysqlSchemaDescriptionOptions
const MysqlSchemaDescriptionOptions
MySQL-specific schema description keys.
Definition: MysqlSqlUtil.qm.dox.h:472
MysqlSqlUtil::MysqlTable::doSelectLimitOnlyUnlockedImpl
doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh)
processes a string for use in SQL select statements when there is a &quot;limit&quot; argument, but no &quot;orderby&quot; or &quot;offset&quot; arguments
MysqlSqlUtil::MysqlPrimaryKey::getDropSql
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
MysqlSqlUtil::MysqlIndex
represents a MySQL-specific index
Definition: MysqlSqlUtil.qm.dox.h:136
MysqlSqlUtil::MysqlTrigger::getRenameSql
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
MysqlSqlUtil::MysqlPrimaryKey::supportsName
bool supportsName()
returns False since primary key constraints in MySQL have no name
hash
hash hash(object obj)
SZ_OPT
const SZ_OPT
MysqlSqlUtil::MysqlTable::getSqlValue
static *string getSqlValue(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument ...
MysqlSqlUtil::MysqlIndex::getCreateSql
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
MysqlSqlUtil::MysqlIndex::getRenameSql
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...
SqlUtil::AbstractDatabase
MysqlSqlUtil::MysqlTable::constraintsLinkedToIndexesImpl
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
SqlUtil::AbstractPrimaryKey
Number
const Number
MysqlSqlUtil::MysqlIndex::constructor
constructor(string n_name, bool n_unique, hash n_cols, string n_type="BTREE")
creates the object from the arguments
MysqlSqlUtil::MysqlTable::doSelectOrderByWithOffsetSqlUnlockedImpl
doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch)
processes a string for use in SQL select statements when there is an &quot;order by&quot; and &quot;offset&quot; argument...
SqlUtil::AbstractUniqueConstraint
MysqlSqlUtil::MysqlTable::QoreTypeMap
const QoreTypeMap
maps qore type names to postgresql type names
Definition: MysqlSqlUtil.qm.dox.h:707
COP_APPEND
const COP_APPEND