Qore SqlUtil Module Reference 1.9.1
Loading...
Searching...
No Matches
AbstractDatabase.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
26namespace SqlUtil {
29
30public:
32
35 const DatabaseOptions = ...;
36
37
39
42 const CacheOptions = ...;
43
44
46
51 const CallbackOptions = ...;
52
53
63 const AC_Unchanged = 0;
64
66 const AC_Create = 1;
67
69 const AC_Drop = 2;
70
72 const AC_Rename = 3;
73
75 const AC_Modify = 4;
76
78 const AC_Truncate = 5;
79
81 const AC_Add = 6;
82
84 const AC_Recreate = 7;
85
87 const AC_Insert = 8;
88
90 const AC_Update = 9;
91
93 const AC_Delete = 10;
94
96 const AC_NotFound = 11;
98
100 const ActionMap = ...;
101
102
104 const ActionDescMap = ...;
105
106
108 const ActionLetterMap = ...;
109
110
112
118 const CreationOptions = ...;
119
120
122
126
127
129
132 const DropSchemaOptions = ...;
133
134
136
149
150
152
158
159
162
163
166
167
168protected:
170 bool native_case = False;
171
172 // AbstractDatabase::getPhysicalSize() return in a case of no data
173 const GET_PHYSICAL_DB_SIZE_NOVAL = -1;
174
175public:
176
178
183protected:
184 constructor(AbstractDatasource nds, *hash nopts) ;
185public:
186
187
189 list features();
190
191
192 static doOkCallback(*hash<auto> opt, int ac, string type, string name, *string table, *string info);
193
194protected:
195 static runInfoCallback(code info_callback, int ac, string type, string name, *string table, *string new_name, *string info);
196public:
197
198
199 static *string doCallback(*hash<auto> opt, *string sql, int ac, string type, string name, *string table, *string new_name, *string info);
200
201 static list doCallback(*hash<auto> opt, list sql, int ac, string type, string name, *string table, *string new_name, *string info);
202
204
215 auto tryExec(string sql);
216
217
219
229 auto tryExecArgs(string sql, *softlist<auto> args);
230
231
233
244 auto tryExecRaw(string sql);
245
246
248
262 list<auto> getAlignSql(hash schema_hash, *hash<auto> opt, *Tables table_cache);
263
264
266
279 list<auto> getDropSchemaSql(hash schema_hash, *hash<auto> opt);
280
281
282protected:
283 list dropSqlUnlocked(string type, hash schema_hash, code get, code make, *hash<auto> opt, string make_arg_type);
284public:
285
286
287protected:
288 list alignCodeUnlocked(string type, hash schema_hash, code get, code make, *hash<auto> opt, string make_arg_type);
289public:
290
291
293
309 AbstractSequence makeSequence(string name, number start = 1, number increment = 1, *softnumber end, *hash<auto> opts);
310
311
312 AbstractSequence makeSequenceFromDescription(string name, *hash<auto> sh, *hash<auto> opts);
313
314
316
331 AbstractTable makeTable(string name, hash<auto> desc, *hash<auto> opts);
332
333
335
350 AbstractFunction makeFunction(string name, string src, *hash<auto> opts);
351
352
354
369 AbstractFunction makeProcedure(string name, string src, *hash<auto> opt);
370
371
373
385 bool dropFunctionIfExists(string name, *hash<auto> opt);
386
387
389
401 bool dropProcedureIfExists(string name, *hash<auto> opt);
402
403
405
417 bool dropSequenceIfExists(string name, *hash<auto> opt);
418
419
421
433 bool dropViewIfExists(string name, *hash<auto> opt);
434
435
437
449 bool dropTableIfExists(string name, *hash<auto> opt);
450
451
453
465 *string getDropFunctionSqlIfExists(string name, *hash<auto> opt);
466
467
469
481 *string getDropProcedureSqlIfExists(string name, *hash<auto> opt);
482
483
485
497 *string getDropSequenceSqlIfExists(string name, *hash<auto> opt);
498
499
501
513 *list<auto> getDropTableSqlIfExists(string name, *hash<auto> opt);
514
515
516 doDropSql(*softlist l, string type, string name, *hash<auto> opt);
517
518
519 bool doDrop(*softlist l, string type, string name, *hash<auto> opt);
520
521
523
535 list<auto> getAlignFunctionSql(AbstractFunction f, *hash<auto> opt);
536
537
539
551 list<auto> getAlignProcedureSql(AbstractFunction f, *hash<auto> opt);
552
553
555
564 *AbstractTable getTable(string name);
565
566
568
578
579
581
593
594
596
608
609
611
620 *AbstractView getView(string name);
621
622
624
633 int getNextSequenceValue(string name);
634
635
637
646 int getCurrentSequenceValue(string name);
647
648
650
659 string getSqlFromList(list l);
660
661
664
665
668
669
672
673
675 list<string> listTables();
676
677
680
681
683 list<string> listFunctions();
684
685
688
689
691 list<string> listProcedures();
692
693
696
697
699 list<string> listSequences();
700
701
704
705
707 list<string> listViews();
708
709
712
713
715
725 bool rebuildIndex(string name, *hash<auto> options);
726
727
729
737 bool rebuildIndex(AbstractIndex index, *hash<auto> options);
738
739
741
748 computeStatistics(*hash<auto> options);
749
750
752
759 reclaimSpace(*hash<auto> options);
760
761
763
773
774
776
781
782
784
789
790
791protected:
792 validateOptionsIntern(string err, hash<auto> ropt, reference<hash> opt);
793public:
794
795
796protected:
797 validateOptionsIntern(string err, hash<auto> ropt, reference<hash> opt, string tag);
798public:
799
800
801 static AbstractDatabase getDatabase(AbstractDatasource nds, *hash<auto> opts);
802
803 static string loadModule(AbstractDatasource nds, *reference<string> drv);
804
805 static AbstractDatabase getDatabase(string dsstr, *hash<auto> opts);
806
807 static AbstractDatabase getDatabase(hash<auto> dsh, *hash<auto> opts);
808
809 static checkDriverOptions(reference<hash<auto>> h, string drv);
810
812protected:
813 hash<auto> getDatabaseOptions();
814public:
815
816
818protected:
819 hash<auto> getCallbackOptions();
820public:
821
822
824protected:
825 hash<auto> getCreationOptions();
826public:
827
828
830protected:
831 hash<auto> getCacheOptions();
832public:
833
834
836protected:
838public:
839
840
842protected:
844public:
845
846
848protected:
850public:
851
852
854protected:
856public:
857
858
860protected:
862public:
863
864
866protected:
868public:
869
870
872protected:
874public:
875
876
878protected:
879 auto tryExecArgsImpl(string sql, *softlist<auto> args);
880public:
881
882
884protected:
885 auto tryExecRawImpl(string sql);
886public:
887
888
889protected:
890 abstract string getCreateSqlImpl(list l);
891public:
892protected:
893 abstract list<auto> getAlignSqlImpl(hash schema_hash, *hash<auto> opt);
894public:
895protected:
896 abstract list<auto> getDropSchemaSqlImpl(hash schema_hash, *hash<auto> opt);
897public:
898
899protected:
900 abstract *AbstractSequence getSequenceImpl(string name);
901public:
902protected:
903 abstract *AbstractFunction getFunctionImpl(string name);
904public:
905protected:
906 abstract *AbstractFunction getProcedureImpl(string name);
907public:
908protected:
909 abstract *AbstractView getViewImpl(string name);
910public:
911
912protected:
913 abstract AbstractSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash<auto> opts);
914public:
915protected:
916 abstract AbstractFunction makeFunctionImpl(string name, string src, *hash<auto> opts);
917public:
918protected:
919 abstract AbstractFunction makeProcedureImpl(string name, string src, *hash<auto> opts);
920public:
921
922protected:
923 abstract list<string> featuresImpl();
924public:
925protected:
926 abstract list<string> listTablesImpl();
927public:
928protected:
929 abstract list<string> listFunctionsImpl();
930public:
931protected:
932 abstract list<string> listProceduresImpl();
933public:
934protected:
935 abstract list<string> listSequencesImpl();
936public:
937protected:
938 abstract list<string> listViewsImpl();
939public:
940
942protected:
943 abstract int getNextSequenceValueImpl(string name);
944public:
946protected:
947 abstract int getCurrentSequenceValueImpl(string name);
948public:
949
951protected:
952 abstract bool supportsSequencesImpl();
953public:
954protected:
955 abstract bool supportsPackagesImpl();
956public:
957protected:
958 abstract bool supportsTypesImpl();
959public:
960
961protected:
962 abstract bool rebuildIndexImpl(string name, *hash<auto> options);
963public:
964protected:
965 abstract computeStatisticsImpl(*hash<auto> options);
966public:
967protected:
968 abstract reclaimSpaceImpl(*hash<auto> options);
969public:
970protected:
971 abstract int getPhysicalSizeImpl();
972public:
973};
974};
the base abstract class for the database implementation
Definition: AbstractDatabase.qc.dox.h:28
Qore::ListIterator viewIterator()
returns an iterator listing the string view names in the database
const CreationOptions
default generic creation options
Definition: AbstractDatabase.qc.dox.h:118
int getNextSequenceValue(string name)
returns the next value in the given sequence
const CallbackOptions
generic callback options
Definition: AbstractDatabase.qc.dox.h:51
hash< auto > getReclaimSpaceOptions()
override in subclasses to return driver-specific options
bool dropProcedureIfExists(string name, *hash< auto > opt)
drops the given procedure if it exists; returns True if the procedure was dropped,...
hash< auto > getRebuildIndexOptions()
override in subclasses to return driver-specific options
const DropSchemaOptions
default generic drop schema options
Definition: AbstractDatabase.qc.dox.h:132
*string getDropSequenceSqlIfExists(string name, *hash< auto > opt)
returns the SQL require to drop the given sequence if it exists or NOTHING if the named sequence does...
const CacheOptions
generic cache options
Definition: AbstractDatabase.qc.dox.h:42
bool supportsTypes()
returns True if the database supports named types
abstract int getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
const SchemaDescriptionOptions
default generic schema description keys
Definition: AbstractDatabase.qc.dox.h:148
list< auto > getAlignSql(hash schema_hash, *hash< auto > opt, *Tables table_cache)
accepts a hash argument describing a database schema and returns a list of SQL strings that can be us...
list< string > listProcedures()
returns a list of string procedure names in the database
hash< auto > getCallbackOptions()
override in subclasses to return driver-specific options
bool rebuildIndex(AbstractIndex index, *hash< auto > options)
Rebuild an index in the DB.
list features()
See DB Features Constants.
hash< auto > getCreationOptions()
override in subclasses to return driver-specific options
*string getDropFunctionSqlIfExists(string name, *hash< auto > opt)
returns the SQL require to drop the given function if it exists or NOTHING if the named function does...
AbstractFunction makeFunction(string name, string src, *hash< auto > opts)
creates a database-specific AbstractFunction object corresponding to the arguments
bool requiresScale()
Returns True if the driver requires a scale to support decimal values in numeric or decimal columns.
const ActionMap
maps from action codes to action descriptions
Definition: AbstractDatabase.qc.dox.h:100
*AbstractFunction getProcedure(string name)
returns an AbstractFunction argument for the given stored procedure name or NOTHING if the stored pro...
list< auto > getAlignProcedureSql(AbstractFunction f, *hash< auto > opt)
returns a list of SQL strings that can be used to update a stored procedure in the database to the st...
int getPhysicalSize()
Get the current database physical size in bytes.
*list< auto > getDropTableSqlIfExists(string name, *hash< auto > opt)
returns the SQL require to drop the given table if it exists or NOTHING if the named table does not e...
AbstractSequence makeSequence(string name, number start=1, number increment=1, *softnumber end, *hash< auto > opts)
creates a database-specific AbstractSequence object corresponding to the arguments
bool supportsPackages()
returns True if the database supports packages
const ActionDescMap
maps from action descriptions to action codes
Definition: AbstractDatabase.qc.dox.h:104
const ComputeStatisticsOptions
Options for computeStatistics()
Definition: AbstractDatabase.qc.dox.h:161
hash< auto > getDatabaseOptions()
override in subclasses to return driver-specific options
reclaimSpace(*hash< auto > options)
Reclaim taken but unused space in the DB.
hash< auto > getCacheOptions()
override in subclasses to return driver-specific options
bool rebuildIndex(string name, *hash< auto > options)
Rebuild an index in the DB.
hash< auto > getSequenceDescriptionOptions()
override in subclasses to return driver-specific options
auto tryExecArgs(string sql, *softlist< auto > args)
executes some SQL with optional arguments so that if an error occurs the current transaction state is...
const AlignSchemaOptions
default generic schema description / alignment options
Definition: AbstractDatabase.qc.dox.h:125
bool native_case
native case option
Definition: AbstractDatabase.qc.dox.h:170
const DatabaseOptions
database options
Definition: AbstractDatabase.qc.dox.h:35
*AbstractView getView(string name)
returns an AbstractView argument for the given view name or NOTHING if the view cannot be found
bool supportsSequences()
returns True if the database supports sequences
int getCurrentSequenceValue(string name)
returns the last value issued for the given sequence in the current session
computeStatistics(*hash< auto > options)
Compute database statistics.
bool dropTableIfExists(string name, *hash< auto > opt)
drops the given table if it exists; returns True if the table was dropped, False if not
auto tryExecRaw(string sql)
executes some SQL so that if an error occurs the current transaction state is not lost
auto tryExec(string sql)
executes some SQL with optional arguments so that if an error occurs the current transaction state is...
hash< auto > getSchemaDescriptionOptions()
override in subclasses to return driver-specific options
Qore::ListIterator tableIterator()
returns an iterator listing the string table names in the database
abstract bool supportsSequencesImpl()
returns True if the database supports sequences
auto tryExecArgsImpl(string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
list< string > listViews()
returns a list of string view names in the database
Qore::ListIterator functionIterator()
returns an iterator listing the string function names in the database
const ReclaimSpaceOptions
Options for reclaimSpace()
Definition: AbstractDatabase.qc.dox.h:165
bool dropViewIfExists(string name, *hash< auto > opt)
drops the given view if it exists; returns True if the view was dropped, False if not
hash< auto > getComputeStatisticsOptions()
override in subclasses to return driver-specific options
int getMaximumPrecision()
Returns the maximum precision for numeric or decimal columns.
bool dropSequenceIfExists(string name, *hash< auto > opt)
drops the given sequence if it exists; returns True if the sequence was dropped, False if not
AbstractTable makeTable(string name, hash< auto > desc, *hash< auto > opts)
creates a database-specific AbstractTable object corresponding to the arguments
hash< auto > getAlignSchemaOptions()
override in subclasses to return driver-specific options
const ActionLetterMap
maps from action codes to action letter codes
Definition: AbstractDatabase.qc.dox.h:108
abstract int getNextSequenceValueImpl(string name)
returns the next value in the given sequence
AbstractFunction makeProcedure(string name, string src, *hash< auto > opt)
creates a database-specific AbstractFunction object for a stored procedure corresponding to the argum...
Qore::ListIterator procedureIterator()
returns an iterator listing the string procedure names in the database
Qore::ListIterator sequenceIterator()
returns an iterator listing the string sequence names in the database
list< string > listSequences()
returns a list of string sequence names in the database
auto tryExecRawImpl(string sql)
tries to execute a command so that if an error occurs the current transaction status is not lost
list< auto > getAlignFunctionSql(AbstractFunction f, *hash< auto > opt)
returns a list of SQL strings that can be used to update a function in the database to the function d...
*string getDropProcedureSqlIfExists(string name, *hash< auto > opt)
returns the SQL require to drop the given procedure if it exists or NOTHING if the named procedure do...
string getSqlFromList(list l)
returns an SQL string corresponding to the list of commands in the argument
*AbstractTable getTable(string name)
returns an AbstractTable argument for the given table name or NOTHING if the table cannot be found
*AbstractFunction getFunction(string name)
returns an AbstractFunction argument for the given function name or NOTHING if the function cannot be...
list< string > listFunctions()
returns a list of string function names in the database
constructor(AbstractDatasource nds, *hash nopts)
creates the object; private constructor
list< string > listTables()
returns a list of string table names in the database
list< auto > getDropSchemaSql(hash schema_hash, *hash< auto > opt)
accepts a hash argument describing a database schema and returns a list of SQL strings that can be us...
*AbstractSequence getSequence(string name)
returns an AbstractSequence argument for the given sequence name or NOTHING if the sequence cannot be...
bool dropFunctionIfExists(string name, *hash< auto > opt)
drops the given function if it exists; returns True if the function was dropped, False if not
hash< auto > getDropSchemaOptions()
override in subclasses to return driver-specific options
const SequenceDescriptionOptions
default generic sequence description keys
Definition: AbstractDatabase.qc.dox.h:157
base class for functions
Definition: SqlUtil.qm.dox.h:7085
the abstract base class for index information
Definition: SqlUtil.qm.dox.h:6546
base class for sequences
Definition: SqlUtil.qm.dox.h:6968
base class for abstract SqlUtil classes
Definition: AbstractSqlUtilBase.qc.dox.h:28
transient Mutex l()
mutex for atomic actions
*hash< auto > opts
option hash
Definition: AbstractSqlUtilBase.qc.dox.h:35
the base abstract class for the table implementation
Definition: AbstractTable.qc.dox.h:30
base class for views
Definition: SqlUtil.qm.dox.h:7004
the table container class stores a collection of tables in a schema
Definition: SqlUtil.qm.dox.h:6098
const AC_NotFound
used when dropping object but the object is not present
Definition: AbstractDatabase.qc.dox.h:96
const AC_Modify
used when an object is modified in place
Definition: AbstractDatabase.qc.dox.h:75
const AC_Add
used when an element is added to an existing object
Definition: AbstractDatabase.qc.dox.h:81
const AC_Recreate
used when an object is recreated (usually dropped and recreated in place)
Definition: AbstractDatabase.qc.dox.h:84
const AC_Update
used when data is updated in a table
Definition: AbstractDatabase.qc.dox.h:90
const AC_Drop
used when an object is dropped
Definition: AbstractDatabase.qc.dox.h:69
const AC_Create
used when a new object is created
Definition: AbstractDatabase.qc.dox.h:66
const AC_Delete
used when data is deleted in a table
Definition: AbstractDatabase.qc.dox.h:93
const AC_Truncate
used when a table is truncated
Definition: AbstractDatabase.qc.dox.h:78
const AC_Unchanged
Definition: AbstractDatabase.qc.dox.h:63
const AC_Insert
used when data is inserted in a table
Definition: AbstractDatabase.qc.dox.h:87
const AC_Rename
used when an object is renamed
Definition: AbstractDatabase.qc.dox.h:72
Qore AbstractDatabase class definition.
Definition: AbstractDatabase.qc.dox.h:26