Qore OracleSqlUtil Module Reference 1.6
Loading...
Searching...
No Matches
OracleSqlUtil.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* OracleSqlUtil.qm Copyright 2013 - 2023 Qore Technologies, s.r.o.
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// requires the Util module
30
31// for bindOracleCollection
32
33// don't use "$" signs for variables and class members, assume local variable scope
34
35// require type definitions everywhere
36
37// enable all warnings
38
39
40/* Version History: see docs below
41*/
42
160namespace OracleSqlUtil {
162 OracleTable get_table(AbstractDatasource nds, string nname, *hash opts);
163
164
166 OracleDatabase get_database(AbstractDatasource nds, *hash opts);
167
168
170class OracleSavepointHelper : public AbstractSavepointHelper {
171
172public:
174
178 constructor(AbstractDatasource ds, *string savepoint = 'x' + get_random_string(29)) ;
179
180
182protected:
184public:
185
186
188protected:
190public:
191
192
194protected:
196public:
197
198 };
199
202
203public:
205 constructor(string native_type, bool nullable, *hash<auto> options) ;
206
207 };
208
211
212public:
217
219protected:
221public:
222
223
224 constructor(string n, string nt, *string qt, softint sz, bool nul, *string dv, *string cm, bool is_char = False, bool cu = False, softint bs, *int scale)
225 ;
226
227
229
232
233
235
242 list<string> getAddColumnSql(AbstractTable t);
243
244
246
261 list<string> getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
262
263
265
275 string getRenameSql(AbstractTable t, string new_name);
276
277
279 bool equalImpl(AbstractColumn c);
280
281
283
285 string getDdlName(string name);
286
287 };
288
291
292public:
293 constructor(string n, string nt, *string qt, softint sz, bool nul, *string dv, *string cm, softint bs, softint scale = 0) ;
294
295 };
296
299
300public:
303
305 *string tablespace;
306
308 constructor(string n, bool u, hash c, string nt, *string t) ;
309
310
312 string getCreateSql(string table_name, *hash opt);
313
314
316 bool equalImpl(AbstractIndex ix);
317
318
320 string getRenameSql(string table_name, string new_name);
321
322 };
323
326
327public:
330
331 constructor(string n, Columns c, ForeignConstraintTarget t, bool e) ;
332
333
334 string getCreateSql(string table_name, *hash opt);
335
336
337 softlist getRenameSql(string table_name, string new_name);
338
339
341 string getDisableSql(string table_name);
342
343
345 string getEnableSql(string table_name, *hash opt);
346
347 };
348
351
352public:
355
356 constructor(string n, string n_src, bool e = True) ;
357
358
359 string getCreateSql(string table_name, *hash opt);
360
361
362 softlist getRenameSql(string table_name, string new_name);
363
364
366 string getDisableSql(string table_name);
367
368
370 string getEnableSql(string table_name, *hash opt);
371
372 };
373
376
377public:
378protected:
381
383 *string tablespace;
384
385public:
386
387 constructor(string n, hash n_cols, bool e = True, *string ts) ;
388
389
391
408
409
410 bool setIndexBase(string ix);
411
412
415
416
417 string getCreateSql(string table_name, *hash opts);
418
419
420 softlist getRenameSql(string table_name, string new_name);
421
422
424 string getDisableSql(string table_name);
425
426
428 string getEnableSql(string table_name, *hash opt);
429
430
432 bool isEnabled();
433
434
436 *string getTablespace();
437
438 };
439
442
443public:
444protected:
446 *string tablespace;
447
448public:
449
450 constructor();
451
452
453 constructor(string n, *hash c, *string ts) ;
454
455
457
474
475
476 bool setIndexBase(string ix);
477
478
481
482
483 string getCreateSql(string table_name, *hash opts);
484
485
486 softlist getRenameSql(string table_name, string new_name);
487
488
490
492 string getDropSql(string table_name);
493
494
496 string getDisableSql(string table_name);
497
498
500 string getEnableSql(string table_name, *hash opt);
501
502 };
503
506
507public:
509 constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
510
511
513 string getCreateSql(*hash opt);
514
515
517
521 softlist getRenameSql(string new_name, *hash opt);
522
523 };
524
527
528public:
530 *string type_text;
532 *string oid_text;
536 *string view_type;
541
543 constructor(string n_name, string n_src, *string n_schema, *string n_type_text, *string n_oid_text, *string n_view_type_owner, *string n_view_type, *string n_superview_name, bool n_updatable, bool n_container_data)
544 ;
545
546
548 string getCreateSql(*hash opt);
549
550
552
556 softlist getRenameSql(string new_name, *hash opt);
557
558 };
559
562
563public:
566
567 constructor(string n, string n_src, bool en = True) ;
568
569
570 softlist getCreateSql(string table_name, *hash opt);
571
572
574 bool equalImpl(AbstractFunctionBase t);
575
576
578 softlist getRenameSql(string table_name, string new_name);
579
580
582 softlist getDropSql(string table_name);
583
584 };
585
588
589public:
591
595 constructor(string n, string n_type, string n_src) ;
596
597
599
601 softlist getCreateSql(*hash opt);
602
603
605 bool equalImpl(AbstractFunctionBase t);
606
607
609
613 softlist getRenameSql(string new_name, *hash opt);
614
615 };
616
619
620public:
622
626 constructor(string n, string n_type, string n_src) ;
627
628
630
635 softlist getRenameSql(string new_name, *hash opt);
636
637 };
638
641
642public:
643 constructor(string n_name, string n_src) ;
644
645
647
649 string getDropSql(*hash opt);
650
651 };
652
655
656public:
658
661 constructor(string n, string n_src) ;
662
663 };
664
667
668public:
670
673 constructor(string n, string n_src) ;
674
675 };
676
679
680public:
682 *string body_src;
683
685
689 constructor(string n, string n_src, *string n_body_src) ;
690
691
693 list getCreateSql(*hash opt);
694
695
697 bool equalImpl(AbstractFunctionBase t);
698
699 };
700
703
704public:
710 *string tablespace;
711
713
719 constructor(string n, string n_src, bool n_logging = True, bool n_use_index = True, *string n_tablespace) ;
720
721
723 softlist getCreateSql(*hash opt);
724
725
726 bool equalImpl(AbstractFunctionBase t);
727
728 };
729
732
733public:
736
737
740
741
743
752
753
756
757
760
761
764
765
768
769
772
773
776
778 constructor(AbstractDatasource nds, *hash opts) ;
779
780
782
787
788
789protected:
790 list<string> featuresImpl();
791public:
792
793
794protected:
795 OracleSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
796public:
797
798
799protected:
800 getSchemaName(reference<string> name, reference<string> schema);
801public:
802
803
804protected:
805 *AbstractSequence getSequenceImpl(string name);
806public:
807
808
809protected:
810 *AbstractView getViewImpl(string name);
811public:
812
813
814protected:
815 OracleFunction makeFunctionImpl(string name, string src, *hash opts);
816public:
817
818
819protected:
820 OracleProcedure makeProcedureImpl(string name, string src, *hash opts);
821public:
822
823
824protected:
825 OraclePackage makePackage(string name, string src, string body, *hash opts);
826public:
827
828
829protected:
830 OraclePackage makePackageFromDescription(string name, hash ph, *hash opts);
831public:
832
833
834protected:
835 OracleType makeType(string name, string src, *hash opts);
836public:
837
838
839protected:
840 OracleMaterializedView makeMaterializedView(string name, string src, bool logging = True, bool use_index = True, *string tablespace, *hash opts);
841public:
842
843
844protected:
845 OracleMaterializedView makeMaterializedViewFromDescription(string name, hash mvh, *hash opts);
846public:
847
848
849protected:
850 list<auto> getDropSchemaSqlImpl(hash<auto> schema_hash, *hash<auto> opt);
851public:
852
853
854protected:
855 list getAlignSqlImpl(hash schema_hash, *hash opt);
856public:
857
858
859protected:
860 *OracleFunction getFunctionImpl(string name);
861public:
862
863
864protected:
865 *OracleProcedure getProcedureImpl(string name);
866public:
867
868
871
872
874 *OracleType getType(string name);
875
876
879
880
881protected:
882 *string getSource(string type, string name);
883public:
884
885
886protected:
887 checkSource(string type, string name, reference<string> src);
888public:
889
890
892 list<string> listSynonyms();
893
894
896 ListIterator synonymIterator();
897
898
900 list<string> listTypes();
901
902
904 ListIterator typeIterator();
905
906
908 list<string> listPackages();
909
910
912 ListIterator packageIterator();
913
914
916 list<string> listMaterializedViews();
917
918
921
922
923protected:
924 list<string> listTablesImpl();
925public:
926
927
928protected:
929 list<string> listFunctionsImpl();
930public:
931
932
933protected:
934 list<string> listProceduresImpl();
935public:
936
937
938protected:
939 list<string> listSequencesImpl();
940public:
941
942
943protected:
944 list<string> listViewsImpl();
945public:
946
947
948protected:
949 list<string> getListIntern(string type);
950public:
951
952
953protected:
954 list<string> getListIntern(list<auto> l);
955public:
956
957
958protected:
959 string getCreateSqlImpl(list l);
960public:
961
962
963 static string getCreateSql(list l);
964
966protected:
967 hash<auto> getCreationOptions();
968public:
969
970
972protected:
974public:
975
976
978protected:
980public:
981
982
984protected:
986public:
987
988
990protected:
992public:
993
994
996protected:
997 softint getNextSequenceValueImpl(string name);
998public:
999
1000
1002protected:
1003 softint getCurrentSequenceValueImpl(string name);
1004public:
1005
1006
1008protected:
1010public:
1011
1012
1014protected:
1016public:
1017
1018
1020protected:
1022public:
1023
1024
1026
1038 bool rebuildIndexAnalyze(AbstractIndex index, int maxh, int maxleaf);
1039
1040
1042
1054 bool rebuildIndexAnalyze(string name, int maxh, int maxleaf);
1055
1056
1058protected:
1059 bool rebuildIndexImpl(string name, *hash options);
1060public:
1061
1062
1064protected:
1066public:
1067
1068
1070protected:
1072public:
1073
1074
1076protected:
1078public:
1079
1080
1082protected:
1083 reclaimSpaceImpl(*hash options);
1084public:
1085
1086
1088protected:
1090public:
1091
1092
1093protected:
1094 oracleErrorCallback(int ac, string type, string name, *string table, *string new_name, *string info, string sql, hash<ExceptionInfo> ex);
1095public:
1096
1097 };
1098
1100
1103
1104public:
1106 const OraTypeMap = {
1107 "number": ("qore": Type::Number, "size": SZ_NUM, "size_range": (1, 38), "scale_range": (-84, 127)),
1108 "varchar2": {
1109 "qore": Type::String,
1110 "size": SZ_MAND,
1111 "size_range": (1, 4000),
1112 "is_char": True,
1113 "default_size": AbstractColumn::DefaultVarcharSize,
1114 },
1115 "char": {
1116 "qore": Type::String,
1117 "size": SZ_MAND,
1118 "size_range": (1, 4000),
1119 "is_char": True,
1120 "default_size": AbstractColumn::DefaultVarcharSize,
1121 },
1122 "date": ("qore": Type::Date,),
1123 "timestamp": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 9)),
1124 "timestamp with time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 9)),
1125 "timestamp with local time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 9)),
1126 "interval year to month": ("qore": Type::Date,),
1127 "interval day to second": ("qore": Type::Date,),
1128 "timestamp(0)": ("qore": Type::Date,),
1129 "timestamp(1)": ("qore": Type::Date,),
1130 "timestamp(2)": ("qore": Type::Date,),
1131 "timestamp(3)": ("qore": Type::Date,),
1132 "timestamp(4)": ("qore": Type::Date,),
1133 "timestamp(5)": ("qore": Type::Date,),
1134 "timestamp(6)": ("qore": Type::Date,),
1135 "timestamp(7)": ("qore": Type::Date,),
1136 "timestamp(8)": ("qore": Type::Date,),
1137 "timestamp(9)": ("qore": Type::Date,),
1138 "timestamp(0) with time zone": ("qore": Type::Date,),
1139 "timestamp(1) with time zone": ("qore": Type::Date,),
1140 "timestamp(2) with time zone": ("qore": Type::Date,),
1141 "timestamp(3) with time zone": ("qore": Type::Date,),
1142 "timestamp(4) with time zone": ("qore": Type::Date,),
1143 "timestamp(5) with time zone": ("qore": Type::Date,),
1144 "timestamp(6) with time zone": ("qore": Type::Date,),
1145 "timestamp(7) with time zone": ("qore": Type::Date,),
1146 "timestamp(8) with time zone": ("qore": Type::Date,),
1147 "timestamp(9) with time zone": ("qore": Type::Date,),
1148 "timestamp(0) with local time zone": ("qore": Type::Date,),
1149 "timestamp(1) with local time zone": ("qore": Type::Date,),
1150 "timestamp(2) with local time zone": ("qore": Type::Date,),
1151 "timestamp(3) with local time zone": ("qore": Type::Date,),
1152 "timestamp(4) with local time zone": ("qore": Type::Date,),
1153 "timestamp(5) with local time zone": ("qore": Type::Date,),
1154 "timestamp(6) with local time zone": ("qore": Type::Date,),
1155 "timestamp(7) with local time zone": ("qore": Type::Date,),
1156 "timestamp(8) with local time zone": ("qore": Type::Date,),
1157 "timestamp(9) with local time zone": ("qore": Type::Date,),
1158 "interval year(0) to month": ("qore": Type::Date,),
1159 "interval year(1) to month": ("qore": Type::Date,),
1160 "interval year(2) to month": ("qore": Type::Date,),
1161 "interval year(3) to month": ("qore": Type::Date,),
1162 "interval year(4) to month": ("qore": Type::Date,),
1163 "interval year(5) to month": ("qore": Type::Date,),
1164 "interval year(6) to month": ("qore": Type::Date,),
1165 "interval year(7) to month": ("qore": Type::Date,),
1166 "interval year(8) to month": ("qore": Type::Date,),
1167 "interval year(9) to month": ("qore": Type::Date,),
1168 "interval day(0) to second(0)": ("qore": Type::Date,),
1169 "interval day(0) to second(1)": ("qore": Type::Date,),
1170 "interval day(0) to second(2)": ("qore": Type::Date,),
1171 "interval day(0) to second(3)": ("qore": Type::Date,),
1172 "interval day(0) to second(4)": ("qore": Type::Date,),
1173 "interval day(0) to second(5)": ("qore": Type::Date,),
1174 "interval day(0) to second(6)": ("qore": Type::Date,),
1175 "interval day(0) to second(7)": ("qore": Type::Date,),
1176 "interval day(0) to second(8)": ("qore": Type::Date,),
1177 "interval day(0) to second(9)": ("qore": Type::Date,),
1178 "interval day(1) to second(0)": ("qore": Type::Date,),
1179 "interval day(1) to second(1)": ("qore": Type::Date,),
1180 "interval day(1) to second(2)": ("qore": Type::Date,),
1181 "interval day(1) to second(3)": ("qore": Type::Date,),
1182 "interval day(1) to second(4)": ("qore": Type::Date,),
1183 "interval day(1) to second(5)": ("qore": Type::Date,),
1184 "interval day(1) to second(6)": ("qore": Type::Date,),
1185 "interval day(1) to second(7)": ("qore": Type::Date,),
1186 "interval day(1) to second(8)": ("qore": Type::Date,),
1187 "interval day(1) to second(9)": ("qore": Type::Date,),
1188 "interval day(2) to second(0)": ("qore": Type::Date,),
1189 "interval day(2) to second(1)": ("qore": Type::Date,),
1190 "interval day(2) to second(2)": ("qore": Type::Date,),
1191 "interval day(2) to second(3)": ("qore": Type::Date,),
1192 "interval day(2) to second(4)": ("qore": Type::Date,),
1193 "interval day(2) to second(5)": ("qore": Type::Date,),
1194 "interval day(2) to second(6)": ("qore": Type::Date,),
1195 "interval day(2) to second(7)": ("qore": Type::Date,),
1196 "interval day(2) to second(8)": ("qore": Type::Date,),
1197 "interval day(2) to second(9)": ("qore": Type::Date,),
1198 "clob": ("qore": Type::String,),
1199 "blob": ("qore": Type::Binary,),
1200 "long": ("qore": Type::Binary,),
1201 "raw": ("qore": Type::Binary, "size": SZ_MAND, "size_range": (1, 2000)),
1202 "bfile": ("qore": Type::Binary,),
1203 "binary_float": ("qore": Type::Float,),
1204 "binary_double": ("qore": Type::Float,),
1205 "rowid": ("qore": Type::String,),
1206 "urowid": ("qore": Type::String, "size": SZ_OPT, "size_range": (1, 4000)),
1207 };
1208
1210 const QoreTypeMap = {
1211 "integer": "number",
1212 "float": "number",
1213 "number": "number",
1214 "string": "varchar2",
1215 "date": "timestamp(6)",
1216 "binary": "blob",
1217 SqlUtil::CHAR: "char",
1218 SqlUtil::CLOB: "clob",
1219 SqlUtil::BLOB: "blob",
1220 };
1221
1222 const OraColumnOpts = {
1223 "character_semantics": Type::Boolean,
1224 };
1225
1227
1230 const OraColumnOptions = AbstractTable::ColumnOptions + OraColumnOpts;
1231
1233
1236 const OraColumnDescOptions = AbstractTable::ColumnDescOptions + OraColumnOpts;
1237
1239
1242 const OracleIndexOptions = AbstractTable::IndexOptions + {
1243 "compute_statistics": Type::Boolean,
1244 };
1245
1247
1251 "index": Type::String,
1252 };
1253
1256
1257
1258 const OracleAlignTableOptions = AbstractTable::AlignTableOptions + OracleTableCreationOptions;
1259
1261
1265 const OracleSelectOptions = AbstractTable::SelectOptions + {
1266 "partition": Type::String,
1267 };
1268
1270 const OracleExpressionMap = DefaultExpressionMap + {
1271 OP_SUBSTR: DefaultExpressionMap{OP_SUBSTR} + {
1272 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1273 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1274 AbstractDataProviderTypeMap."string");
1275 string exp1 = info.table.getExpressionArg(\info, role, args[1],
1276 AbstractDataProviderTypeMap."int");
1277 if (!exists args[2]) {
1278 return sprintf("substr(%s,%s)", exp0, exp1);
1279 }
1280 return sprintf("substr(%s,%s,%s)", exp0, exp1,
1281 info.table.getExpressionArg(\info, role, args[2], AbstractDataProviderTypeMap."int"));
1282 },
1283 },
1284 COP_CAST: {
1285 "exp": <DataProviderExpressionInfo>{
1286 "type": DET_Operator,
1287 "label": COP_CAST,
1288 "name": "cast",
1289 "desc": "cast operator",
1290 "symbol": "cast",
1291 "args": (
1292 DataProviderSignatureAnyType,
1293 DataProviderSignatureStringValueType,
1294 DataProviderSignatureOptionalIntValueType,
1295 DataProviderSignatureOptionalIntValueType,
1296 ),
1297 "return_type": AbstractDataProviderTypeMap."any",
1298 },
1299 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1300 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1301 AbstractDataProviderTypeMap."any");
1302 string name = QoreTypeMap{args[1]} ?? args[1];
1303 *hash<auto> desc = OraTypeMap{name};
1304 string sql = sprintf ("cast (%s as %s", exp0, name);
1305 if (desc.size == SZ_MAND) {
1306 if (!exists args[1] && !exists desc.size_range)
1307 throw "OPERATOR-ERROR", sprintf ("cast operator missing size for type %s",
1308 name);
1309 sql += sprintf("(%d)", args[1] ?? desc.size_range[1]);
1310 } else if (desc.size == SZ_NUM && exists args[1]) {
1311 sql += sprintf("(%d", args[1]);
1312 sql += exists args[2] ? sprintf(",%d)", args[2]) : ")";
1313 } else if (desc.size == SZ_OPT && exists args[1]) {
1314 sql += sprintf("(%d)", args[1]);
1315 }
1316 sql += ")";
1317 return sql;
1318 },
1319 },
1320 COP_YEAR: {
1321 "exp": <DataProviderExpressionInfo>{
1322 "type": DET_Operator,
1323 "label": COP_YEAR,
1324 "name": COP_YEAR,
1325 "desc": "returns the year component of a date as a string (ex: `2022`)",
1326 "symbol": COP_YEAR,
1327 "args": (
1328 DataProviderSignatureDateType,
1329 ),
1330 "return_type": AbstractDataProviderTypeMap."string",
1331 },
1332 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1333 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1334 AbstractDataProviderTypeMap."date");
1335 return sprintf("to_char(%s, 'YYYY')", exp0);
1336 }
1337 },
1338 COP_YEAR_MONTH: {
1339 "exp": <DataProviderExpressionInfo>{
1340 "type": DET_Operator,
1341 "label": COP_YEAR_MONTH,
1342 "name": COP_YEAR_MONTH,
1343 "desc": "returns the year and month components of a date as a string (ex: `2022-06`)",
1344 "symbol": COP_YEAR_MONTH,
1345 "args": (
1346 DataProviderSignatureDateType,
1347 ),
1348 "return_type": AbstractDataProviderTypeMap."string",
1349 },
1350 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1351 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1352 AbstractDataProviderTypeMap."date");
1353 return sprintf("to_char(%s, 'YYYY-MM')", exp0);
1354 }
1355 },
1356 COP_YEAR_DAY: {
1357 "exp": <DataProviderExpressionInfo>{
1358 "type": DET_Operator,
1359 "label": COP_YEAR_DAY,
1360 "name": COP_YEAR_DAY,
1361 "desc": "returns the year, month, and day components of a date as a string (ex: `2022-06-29`)",
1362 "symbol": COP_YEAR_DAY,
1363 "args": (
1364 DataProviderSignatureDateType,
1365 ),
1366 "return_type": AbstractDataProviderTypeMap."string",
1367 },
1368 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1369 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1370 AbstractDataProviderTypeMap."date");
1371 return sprintf("to_char(%s, 'YYYY-MM-DD')", exp0);
1372 }
1373 },
1374 COP_YEAR_HOUR: {
1375 "exp": <DataProviderExpressionInfo>{
1376 "type": DET_Operator,
1377 "label": COP_YEAR_HOUR,
1378 "name": COP_YEAR_HOUR,
1379 "desc": "returns the year, month, day, and hour components of a date as a string "
1380 "(ex: `2022-06-29 15`)",
1381 "symbol": COP_YEAR_HOUR,
1382 "args": (
1383 DataProviderSignatureDateType,
1384 ),
1385 "return_type": AbstractDataProviderTypeMap."string",
1386 },
1387 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1388 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1389 AbstractDataProviderTypeMap."date");
1390 return sprintf("to_char(%s, 'YYYY-MM-DD HH24')", exp0);
1391 }
1392 },
1393 COP_TRUNC_DATE: {
1394 "exp": <DataProviderExpressionInfo>{
1395 "type": DET_Operator,
1396 "label": COP_TRUNC_DATE,
1397 "name": COP_TRUNC_DATE,
1398 "desc": "truncates the given date to the given resolution; args: date, string code: Y: year, "
1399 "M: month, D: day, H: hour, m: minute, S: second",
1400 "symbol": COP_TRUNC_DATE,
1401 "args": (
1402 DataProviderSignatureDateType,
1403 DataProviderSignatureStringValueType,
1404 ),
1405 "return_type": AbstractDataProviderTypeMap."date",
1406 },
1407 "code": string sub(reference<hash<QueryInfo>> info, int role, list<auto> args) {
1408 *string str = OracleTruncDate{args[1]};
1409 if (!str && !OracleTruncDate.hasKey(args[1])) {
1410 throw "TRUNC-DATE-ERROR", sprintf("unknown date truncation format argument %y; "
1411 "supported date format arguments: %y", args[1], keys OracleTruncDate);
1412 }
1413 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1414 AbstractDataProviderTypeMap."date");
1415 if (str) {
1416 return sprintf("trunc(%s, %s)", exp0, str);
1417 }
1418 // for timestamps
1419 return sprintf("cast (%s as date)", exp0);
1420 },
1421 },
1422 OP_IN: {
1423 "exp": <DataProviderExpressionInfo>{
1424 "type": DET_Operator,
1425 "label": OP_IN,
1426 "name": OP_IN,
1427 "desc": "returns True if the first value is in the list of following values",
1428 "symbol": OP_IN,
1429 "args": (
1430 DataProviderSignatureAnyType,
1431 DataProviderSignatureAnyType,
1432 ),
1433 "varargs": True,
1434 "return_type": AbstractDataProviderTypeMap."bool",
1435 },
1436 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1437%ifndef NO_ORACLE
1438 auto val = shift args;
1439 # Qorus bug #989 SqlUtil: oracle op_in can fail in large amount of input elements
1440 # There is no support for CLOBs in WHERE clause in Oracle at all.
1441 # Binding large strings (over 4000 chars is performed by a CLOB in Qore driver.
1442 # Result of op_in operator can be "ORA-00932: inconsistent datatypes" if is
1443 # the list longer or if it contains large items with:
1444 # return cn + " in (select regexp_substr(%v,'[^,]+', 1, level) from dual connect by
1445 # regexp_substr(%v, '[^,]+', 1, level) is not null)";
1446
1447 # determine list members type. Let's assume the 1st non NULL/NOTHING
1448 # element gives the type code for all elements.
1449 ListIterator it(args);
1450 # get list type code
1451 int ltype;
1452 while (it.next()) {
1453 switch (it.getValue().typeCode()) {
1454 case NT_NULL:
1455 case NT_NOTHING:
1456 continue;
1457 case NT_DATE:
1458 case NT_INT:
1459 case NT_FLOAT:
1460 case NT_NUMBER:
1461 case NT_STRING:
1462 ltype = it.getValue().typeCode();
1463 break;
1464 default:
1465 throw "ORACLE-IN-OPERATOR-ERROR", sprintf("the \"in\" operator unexpected list "
1466 "element type: %s; only simple types are supported", it.getValue().type());
1467 }
1468 if (ltype) {
1469 break;
1470 }
1471 }
1472
1473 # Split long array to chunks of no more than 32767 elements due to Oracle limitation
1474 # "ORA-22165: OCI-22165: given index [32767] must be in the range of [0] to [32766]"
1475 int count;
1476 while (args) {
1477 ++count;
1478 list<auto> chunk = extract args, 0, 32767;
1479
1480 # Bind to Oracle by expected type
1481 switch (ltype) {
1482 case NT_DATE:
1483 info.args += bindOracleCollection("SYS.ODCIDATELIST", chunk);
1484 break;
1485 case NT_INT:
1486 case NT_FLOAT:
1487 case NT_NUMBER:
1488 info.args += bindOracleCollection("SYS.ODCINUMBERLIST", chunk);
1489 break;
1490 default:
1491 info.args += bindOracleCollection("SYS.ODCIVARCHAR2LIST", chunk);
1492 }
1493 }
1494
1495 if (count) {
1496 string exp0 = info.table.getExpressionArg(\info, role, val,
1497 AbstractDataProviderTypeMap."date");
1498 return exp0 + " in (" + (map "select column_value from table(%v)",
1499 xrange(count)).join(" union all ") + ")";
1500 } else {
1501 return "1 != 1";
1502 }
1503%else
1504 throw "MISSING-ORACLE-DRIVER", "requires the oracle driver";
1505%endif
1506 },
1507 },
1508 COP_SEQ: {
1509 "exp": <DataProviderExpressionInfo>{
1510 "type": DET_Operator,
1511 "label": COP_SEQ,
1512 "name": COP_SEQ,
1513 "desc": "returns the next value in the given sequence; args: sequence name",
1514 "symbol": COP_SEQ,
1515 "args": (
1516 DataProviderSignatureStringValueType,
1517 ),
1518 "return_type": AbstractDataProviderTypeMap."int",
1519 },
1520 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1521 return sprintf("%s.nextval", args[0]);
1522 }
1523 },
1524 COP_SEQ_CURRVAL: {
1525 "exp": <DataProviderExpressionInfo>{
1526 "type": DET_Operator,
1527 "label": COP_SEQ_CURRVAL,
1528 "name": COP_SEQ_CURRVAL,
1529 "desc": "returns the current value in the given sequence; args: sequence name",
1530 "symbol": COP_SEQ_CURRVAL,
1531 "args": (
1532 DataProviderSignatureStringValueType,
1533 ),
1534 "return_type": AbstractDataProviderTypeMap."int",
1535 },
1536 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1537 return sprintf("%s.currval", args[0]);
1538 }
1539 },
1540 };
1541
1543 const OracleOpMap = ...;
1544
1545
1547 const OracleCopMap = ...;
1548
1549
1551 const OracleTruncDate = ...;
1552
1553
1555 const OracleIopMap = ...;
1556
1557
1559 const OracleUopMap = ...;
1560
1561
1564 "rowid": True,
1565 "rownum": True,
1566 "object_id": True,
1567 "object_value": True,
1568 "ora_rowscn": True,
1569 };
1570
1571protected:
1572 // schema name
1573 string schema;
1574
1575 // tablespace name
1576 *string tablespace;
1577
1578 // is the table read only?
1579 bool readonly;
1580
1581 // table comment
1582 *string comment;
1583
1584 // dblink
1585 *string dblink;
1586
1587 // Oracle server major version
1588 int ora_major;
1589
1590 // helper flag to indicate if is the OracleTable real table or a view
1591 bool m_isView = False;
1592
1593 // oraclesqlutil: allow to use DBA_* views instead of ALL_* if possible #2418
1594 // An internal cache to find the highest priority available
1595 // system dictionary object. Priority: DBA > ALL
1596 hash<string, string> m_sys_views = {
1597 "dba_col_comments" : "all_col_comments",
1598 "dba_cons_columns" : "all_cons_columns",
1599 "dba_constraints" : "all_constraints",
1600 "dba_db_links" : "all_db_links",
1601 "dba_ind_columns" : "all_ind_columns",
1602 "dba_ind_expressions" : "all_ind_expressions",
1603 "dba_indexes" : "all_indexes",
1604 "dba_objects" : "all_objects",
1605 "dba_sequences" : "all_sequences",
1606 "dba_synonyms" : "all_synonyms",
1607 "dba_tab_columns" : "all_tab_columns",
1608 "dba_tab_comments" : "all_tab_comments",
1609 "dba_tables" : "all_tables",
1610 "dba_triggers" : "all_triggers",
1611 "dba_views" : "all_views",
1612 };
1613
1614public:
1615
1616 constructor(AbstractDatasource nds, string nname, *hash opts) ;
1617
1618
1619 // oraclesqlutil: allow to use DBA_* views instead of ALL_* if possible #2418
1620 // get the most appropriate system catalogue/dictinary view available
1621protected:
1622 string systemView(string name);
1623public:
1624
1625
1626protected:
1627 bool checkExistenceImpl();
1628public:
1629
1630
1631protected:
1632 setTableInfoIntern();
1633public:
1634
1635
1637 string getSqlName();
1638
1639
1641 bool isView();
1642
1643
1644protected:
1645 hash<auto> setSchemaTable();
1646public:
1647
1648
1649protected:
1650 setDblinkSchema();
1651public:
1652
1653
1654 // Oracle has supprt for unlimitted synonym loops. There
1655 // can be mo relevels of synonyms before the real object
1656 // is listed.
1657protected:
1658 *hash resolveSynonym(string s_owner, string s_name);
1659public:
1660
1661
1662protected:
1663 hash<auto> setTable();
1664public:
1665
1666
1667protected:
1668 string getUserSchema();
1669public:
1670
1671
1672protected:
1673 string getDBString();
1674public:
1675
1676
1679
1680
1683
1684
1686 *string getComment();
1687
1688
1689 bool readOnly();
1690
1691
1692protected:
1693 hash<auto> getColumnOptions();
1694public:
1695
1696
1697protected:
1698 hash<auto> getColumnDescOptions();
1699public:
1700
1701
1703protected:
1704 hash<auto> getSelectOptions();
1705public:
1706
1707
1709
1711protected:
1712 bool optimizedLimit(*hash<auto> qh);
1713public:
1714
1715
1716protected:
1717 insertLimitOptimizerHint(hash<auto> qh, reference<string> sql);
1718public:
1719
1720
1721protected:
1722 doSelectOrderByWithOffsetSqlUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql, list<auto> coll);
1723public:
1724
1725
1727protected:
1728 doSelectLimitOnlyUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql);
1729public:
1730
1731
1732protected:
1733 Columns describeImpl();
1734public:
1735
1736
1737protected:
1738 OraclePrimaryKey getPrimaryKeyImpl();
1739public:
1740
1741
1742protected:
1743 Indexes getIndexesImpl();
1744public:
1745
1746
1747protected:
1748 ForeignConstraints getForeignConstraintsImpl(*hash opts);
1749public:
1750
1751
1752protected:
1753 Constraints getConstraintsImpl();
1754public:
1755
1756
1757protected:
1758 string getSelectSqlName(*hash qh);
1759public:
1760
1761
1762protected:
1763 Triggers getTriggersImpl();
1764public:
1765
1766
1767 string getCreateTableSqlImpl(*hash opt);
1768
1769
1771 hash<auto> getExpressionMap();
1772
1773
1776
1777
1778protected:
1779 *list getCreateMiscSqlImpl(*hash opt, bool cache);
1780public:
1781
1782
1783protected:
1784 string getCreateSqlImpl(list l);
1785public:
1786
1787
1788protected:
1789 string getRenameSqlImpl(string new_name);
1790public:
1791
1792
1793protected:
1794 AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
1795public:
1796
1797
1798protected:
1799 AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
1800public:
1801
1802
1803protected:
1804 AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
1805public:
1806
1807
1808protected:
1809 AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch, *hash opt);
1810public:
1811
1812
1813protected:
1814 AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
1815public:
1816
1817
1818protected:
1819 AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
1820public:
1821
1822
1823protected:
1824 AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
1825public:
1826
1827
1828protected:
1829 bool tryInsertImpl(string sql, hash<auto> row);
1830public:
1831
1832
1834
1836protected:
1837 bool isDuplicateRowErrorImpl(hash<ExceptionInfo> ex);
1838public:
1839
1840
1841protected:
1842 *list getAlignSqlImpl(AbstractTable t, *hash opt);
1843public:
1844
1845
1846protected:
1847 hash<auto> getQoreTypeMapImpl();
1848public:
1849
1850
1851protected:
1852 hash<auto> getTypeMapImpl();
1853public:
1854
1855
1856protected:
1857 hash<auto> getIndexOptions();
1858public:
1859
1860
1861protected:
1862 hash<auto> getConstraintOptions();
1863public:
1864
1865
1866protected:
1867 hash<auto> getTableCreationOptions();
1868public:
1869
1870
1871protected:
1872 hash<auto> getAlignTableOptions();
1873public:
1874
1875
1877protected:
1879public:
1880
1881
1883protected:
1885public:
1886
1887
1889protected:
1891public:
1892
1893
1895protected:
1896 *hash<auto> getPseudoColumnHash();
1897public:
1898
1899
1901protected:
1902 *string getSqlValueImpl(auto v);
1903public:
1904
1905
1907 string getColumnSqlName(string col);
1908
1909
1911 list getColumnSqlNames(softlist cols);
1912
1913
1915
1918 string getBaseType();
1919
1920
1922 code getBulkUpsertClosure(hash example_row, int upsert_strategy = AbstractTable::UpsertAuto, *hash opt);
1923
1924
1926 code getUpsertClosure(hash<auto> row, int upsert_strategy = UpsertAuto, *hash opt);
1927
1928
1930protected:
1931 code getUpsertInsertOnly(Columns cols, hash<auto> row, *hash opt);
1932public:
1933
1934
1936protected:
1937 code getUpsertUpdateOnly(Columns cols, hash<auto> row, *hash opt);
1938public:
1939
1940
1943
1944
1946
1949
1950
1952protected:
1954public:
1955
1956
1957protected:
1958 *hash doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
1959public:
1960
1961
1962protected:
1963 bool emptyImpl();
1964public:
1965
1966
1967protected:
1968 setupTableImpl(hash<auto> desc, *hash<auto> opt);
1969public:
1970
1971
1973protected:
1975public:
1976
1977
1979protected:
1981public:
1982
1983
1985protected:
1987public:
1988
1989
1991protected:
1992 copyImpl(AbstractTable old);
1993public:
1994
1995
1997protected:
1998 AbstractDataProviderType getNumericTypeImpl(string native_type, bool nullable, *hash<auto> options);
1999public:
2000
2001
2003
2007protected:
2008 AbstractSavepointHelper getSavepointHelperImpl(*string savepoint);
2009public:
2010
2011 };
2012};
represents an Oracle check constraint
Definition: OracleSqlUtil.qm.dox.h:350
bool enabled
True if the constraint is enabled, False if not
Definition: OracleSqlUtil.qm.dox.h:354
string getEnableSql(string table_name, *hash opt)
returns a string that can be used to enable the constraint in the database
string getDisableSql(string table_name)
returns a string that can be used to temporarily disable the constraint from the database
the base class for Oracle code objects
Definition: OracleSqlUtil.qm.dox.h:587
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the object in the database
constructor(string n, string n_type, string n_src)
creates the object from the arguments passed
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
softlist getCreateSql(*hash opt)
returns a string that can be used to create the object in the database
the base class for Oracle code objects that cannot be renamed in place
Definition: OracleSqlUtil.qm.dox.h:618
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the object in the database
constructor(string n, string n_type, string n_src)
creates the object from the arguments passed
represents an Oracle column
Definition: OracleSqlUtil.qm.dox.h:210
bool char_used
the column uses character semantics
Definition: OracleSqlUtil.qm.dox.h:214
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
constructor()
empty constructor for subclasses
list< string > getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table
int byte_size
byte size of the column
Definition: OracleSqlUtil.qm.dox.h:216
string getDdlName(string name)
returns the column name with quoting in case the column name is a reserved word
list< string > 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
string getNativeTypeString()
returns the string describing the native type that can be used in SQL
the Oracle specialization for SqlUtil::AbstractDatabase
Definition: OracleSqlUtil.qm.dox.h:731
bool supportsSequencesImpl()
returns True if the database supports sequences
int getPhysicalSizeImpl()
SqlUtil::AbstractDatabase::getPhysicalSize()
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
const OracleMaxPrecision
MAximum precision for Oracle NUMBER columns.
Definition: OracleSqlUtil.qm.dox.h:775
const OracleSchemaDescriptionOptions
oracle-specific schema description keys
Definition: OracleSqlUtil.qm.dox.h:751
const OracleAlignSchemaOptions
oracle-specific schema description / alignment options
Definition: OracleSqlUtil.qm.dox.h:739
reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
constructor(AbstractDatasource nds, *hash opts)
creates the object from the arguments given
hash< auto > getRebuildIndexOptions()
returns driver-specific options to the base abstract class
computeStatisticsTablesImpl(*hash options)
compute statistics for table(s) - a helper method
list< string > listTypes()
returns a list of string type names in the database
hash< auto > getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
ListIterator materializedViewIterator()
returns an iterator listing the string materialized view names in the database
const OracleComputeStatisticsOptions
Options for computeStatistics()
Definition: OracleSqlUtil.qm.dox.h:771
ListIterator synonymIterator()
returns an iterator listing the string synonym names in the database
const OracleMaterializedViewDescriptionOptions
oracle-specific materialized view description options
Definition: OracleSqlUtil.qm.dox.h:759
bool supportsPackagesImpl()
returns True if the database supports packages
const OraclePackageDescriptionOptions
oracle-specific package description options
Definition: OracleSqlUtil.qm.dox.h:755
*OracleType getType(string name)
returns an OracleType object for the package name given or NOTHING if the object does not exist or is...
bool rebuildIndexAnalyze(string name, int maxh, int maxleaf)
analyze index with ALTER INDEX ANAYZE. Then it checks INDEX_STATS for advices to rebuild.
int getMaximumPrecision()
Returns the maximum precision for numeric or decimal columns.
computeStatisticsSchemaImpl(*hash options)
compute statistics for schema - a helper method
bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
bool supportsTypesImpl()
returns True if the database supports named types
bool rebuildIndexAnalyze(AbstractIndex index, int maxh, int maxleaf)
analyze index with ALTER INDEX ANAYZE. Then it checks INDEX_STATS for advices to rebuild.
computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics()
list< string > listMaterializedViews()
returns a list of string materialized view names in the database
softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
const OracleRebuildIndexOptions
Options for rebuildIndex()
Definition: OracleSqlUtil.qm.dox.h:767
list< string > listSynonyms()
returns a list of string synonym names in the database
ListIterator typeIterator()
returns an iterator listing the string type names in the database
list< string > listPackages()
returns a list of string package names in the database
const OracleReservedWords
hash of reserved words
Definition: OracleSqlUtil.qm.dox.h:763
hash< auto > getCreationOptions()
returns driver-specific options to the base abstract class
*OraclePackage getPackage(string name)
returns an OraclePackage object for the package name given or NOTHING if the object does not exist or...
hash< auto > getComputeStatisticsOptions()
returns driver-specific options to the base abstract class
const OracleCreationOptions
oracle-specific generic creation options
Definition: OracleSqlUtil.qm.dox.h:735
ListIterator packageIterator()
returns an iterator listing the string package names in the database
*OracleMaterializedView getMaterializedView(string name)
returns an OracleMaterializedView object for the package name given or NOTHING if the object does not...
hash< auto > getAlignSchemaOptions()
returns driver-specific options to the base abstract class
represents an Oracle foreign constraint
Definition: OracleSqlUtil.qm.dox.h:325
string getEnableSql(string table_name, *hash opt)
returns a string that can be used to enable the constraint in the database
string getDisableSql(string table_name)
returns a string that can be used to temporarily disable the constraint from the database
bool enabled
True if the constraint is enabled, False if not
Definition: OracleSqlUtil.qm.dox.h:329
represents an Oracle function
Definition: OracleSqlUtil.qm.dox.h:654
constructor(string n, string n_src)
creates the object from the arguments passed
represents an Oracle index
Definition: OracleSqlUtil.qm.dox.h:298
string native_type
the native type of the index (if supported)
Definition: OracleSqlUtil.qm.dox.h:302
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
constructor(string n, bool u, hash c, string nt, *string t)
creates the object from the arguments
*string tablespace
the tablespace name of the index (if supported)
Definition: OracleSqlUtil.qm.dox.h:305
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
represents an Oracle materialized view
Definition: OracleSqlUtil.qm.dox.h:702
constructor(string n, string n_src, bool n_logging=True, bool n_use_index=True, *string n_tablespace)
creates the object from the arguments passed
bool use_index
Flag if is index used.
Definition: OracleSqlUtil.qm.dox.h:708
*string tablespace
Name of the potential tablespace.
Definition: OracleSqlUtil.qm.dox.h:710
bool logging
Flag if is loggign mode used.
Definition: OracleSqlUtil.qm.dox.h:706
softlist getCreateSql(*hash opt)
returns a string that can be used to create the object in the database
represents an Oracle number column
Definition: OracleSqlUtil.qm.dox.h:290
the data type for Oracle NUMBER columns
Definition: OracleSqlUtil.qm.dox.h:201
constructor(string native_type, bool nullable, *hash< auto > options)
creates the object
represents an Oracle package
Definition: OracleSqlUtil.qm.dox.h:678
list getCreateSql(*hash opt)
returns a string that can be used to create the package in the database
*string body_src
package body source
Definition: OracleSqlUtil.qm.dox.h:682
constructor(string n, string n_src, *string n_body_src)
creates the object from the arguments passed
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
represents an Oracle primary key
Definition: OracleSqlUtil.qm.dox.h:441
*string tablespace
any tablespace for the primary key index
Definition: OracleSqlUtil.qm.dox.h:446
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
OracleColumn memberGate(string k)
returns the OracleColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
string getEnableSql(string table_name, *hash opt)
returns a string that can be used to enable the constraint in the database
clearIndex()
clears any index base for the constraint
string getDisableSql(string table_name)
returns a string that can be used to temporarily disable the constraint from the database
represents an Oracle procedure
Definition: OracleSqlUtil.qm.dox.h:666
constructor(string n, string n_src)
creates the object from the arguments passed
Oracle savepoint helper.
Definition: OracleSqlUtil.qm.dox.h:170
createSavepointImpl()
Creates the savepoint.
deleteSavepointImpl()
Deletes the savepoint.
rollbackImpl()
Rolls back to the savepoint.
constructor(AbstractDatasource ds, *string savepoint='x'+get_random_string(29))
Creates the object.
represents an Oracle sequence
Definition: OracleSqlUtil.qm.dox.h:505
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_end)
creates the object from the arguments
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the sequence in the database
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
represents an Oracle table
Definition: OracleSqlUtil.qm.dox.h:1102
const OracleUopMap
a hash of default update operator definitions for Oracle
Definition: OracleSqlUtil.qm.dox.h:1559
hash< auto > getSelectOptions()
override in subclasses to return driver-specific options
bool hasArrayBind()
returns True because the oracle driver supports array binds / bulk DML operations
const OracleExpressionMap
Oracle Expression map.
Definition: OracleSqlUtil.qm.dox.h:1270
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
code getUpsertInsertOnly(Columns cols, hash< auto > row, *hash opt)
high-performance "insert only" upsert supporting bulk DML
const OraColumnOptions
Oracle-specific column options.
Definition: OracleSqlUtil.qm.dox.h:1230
*hash< auto > getPseudoColumnHash()
returns a hash of valid pseudocolumns
copyImpl(AbstractTable old)
db-specific copy actions
const OraTypeMap
maps oracle type names to type descriptions
Definition: OracleSqlUtil.qm.dox.h:1106
code getUpsertClosure(hash< auto > row, int upsert_strategy=UpsertAuto, *hash opt)
returns a closure for performing upserts; if the upsert_strategy argument is UpsertInsertFirst or Ups...
*string getComment()
returns any table comment or NOTHING if none is known
const OracleTableCreationOptions
Oracle table creation options.
Definition: OracleSqlUtil.qm.dox.h:1255
const OracleOpMap
where operator specializations for Oracle
Definition: OracleSqlUtil.qm.dox.h:1543
code getBulkUpsertClosure(hash example_row, int upsert_strategy=AbstractTable::UpsertAuto, *hash opt)
Oracle always supports bulk merging.
string getSchemaName()
returns the schema name
*string getTablespaceName()
returns the data tablespace name for the table if any or NOTHING if none is known
const OraColumnDescOptions
Oracle-specific column options.
Definition: OracleSqlUtil.qm.dox.h:1236
bool asteriskRequiresPrefix()
returns True if the database requires a wildcard "*" to be prefixed with the table name when it appea...
bool optimizedLimit(*hash< auto > qh)
Returns True if the current connection supports optimized limit option handling.
const QoreTypeMap
maps qore type names to an oracle type
Definition: OracleSqlUtil.qm.dox.h:1210
hash< auto > getExpressionMap()
Returns the expression map for Oracle.
const OracleIndexOptions
Oracle-specific index options.
Definition: OracleSqlUtil.qm.dox.h:1242
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
const OracleConstraintOptions
Oracle-specific constraint options.
Definition: OracleSqlUtil.qm.dox.h:1250
hash< auto > getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
hash< auto > getInsertOperatorMap()
returns the insert operator map for this object
bool isDuplicateRowErrorImpl(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
AbstractDataProviderType getNumericTypeImpl(string native_type, bool nullable, *hash< auto > options)
returns the type for number / numeric columns for the database so that data conversions can be handle...
bool supportsTablespacesImpl()
returns True if the database support tablespaces
string getSqlName()
returns the schema and table name in dot notation
const OracleSelectOptions
Oracle select options.
Definition: OracleSqlUtil.qm.dox.h:1265
const OracleCopMap
column operator specializations for Oracle
Definition: OracleSqlUtil.qm.dox.h:1547
const OraclePseudoColumnHash
a hash of valid pseudocolumns
Definition: OracleSqlUtil.qm.dox.h:1563
doSelectLimitOnlyUnlockedImpl(reference< hash< QueryInfo > > info, reference< string > sql)
processes a string for use in SQL select statements when there is a "limit" argument,...
list getColumnSqlNames(softlist cols)
returns a list of column names for use in SQL strings; subclasses can process the argument list in ca...
hash< auto > getWhereOperatorMap()
returns the "where" operator map for Oracle
*string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
string getBaseType()
returns the base type of the underlying object (either "table" or "view")
bool isView()
This method can change itself or disappear in the near future. Do not use it.
const OracleTruncDate
Map SqlUtil::cop_trunc_date() constants to Oracle internal masks.
Definition: OracleSqlUtil.qm.dox.h:1551
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
bool bindEmptyStringsAsNull()
returns True because Oracle treats empty strings like NULL on insert
code getUpsertUpdateOnly(Columns cols, hash< auto > row, *hash opt)
high-performance "update only" upsert supporting bulk DML
const OracleIopMap
a hash of default value operator descriptions for Oracle
Definition: OracleSqlUtil.qm.dox.h:1555
hash< auto > getColumnOperatorMapImpl()
returns the column operator map for this object
represents an Oracle trigger
Definition: OracleSqlUtil.qm.dox.h:561
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
bool enabled
True if the trigger is enabled, False if not
Definition: OracleSqlUtil.qm.dox.h:565
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from the database
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
represents an Oracle type
Definition: OracleSqlUtil.qm.dox.h:640
string getDropSql(*hash opt)
returns a string that can be used to drop the type from the database
represents an Oracle unique constraint
Definition: OracleSqlUtil.qm.dox.h:375
string getDisableSql(string table_name)
returns a string that can be used to temporarily disable the constraint from the database
bool enabled
True if the constraint is enabled, False if not
Definition: OracleSqlUtil.qm.dox.h:380
*string tablespace
any tablespace for the unique key index
Definition: OracleSqlUtil.qm.dox.h:383
clearIndex()
clears any index base for the constraint
*string getTablespace()
returns the tablespace name used for this constraint, if known
string getEnableSql(string table_name, *hash opt)
returns a string that can be used to enable the constraint in the database
bool isEnabled()
returns True if the constraint is enabled, False if not
OracleColumn memberGate(string k)
returns the OracleColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
represents an Oracle view
Definition: OracleSqlUtil.qm.dox.h:526
*string view_type_owner
Owner of the type of the view if the view is a typed view.
Definition: OracleSqlUtil.qm.dox.h:534
*string view_type
Type of the view if the view is a typed view.
Definition: OracleSqlUtil.qm.dox.h:536
constructor(string n_name, string n_src, *string n_schema, *string n_type_text, *string n_oid_text, *string n_view_type_owner, *string n_view_type, *string n_superview_name, bool n_updatable, bool n_container_data)
creates the object from the arguments
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the view in the database
*string oid_text
WITH OID clause of the typed view.
Definition: OracleSqlUtil.qm.dox.h:532
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
bool container_data
Indicates whether the view contains container-specific data.
Definition: OracleSqlUtil.qm.dox.h:540
*string superview_name
Name of the superview.
Definition: OracleSqlUtil.qm.dox.h:538
*string type_text
Type clause of the typed view.
Definition: OracleSqlUtil.qm.dox.h:530
cache(*hash< auto > opts)
const CLOB
const BLOB
const CHAR
the OracleSqlUtil namespace contains all the objects in the OracleSqlUtil module
Definition: OracleSqlUtil.qm.dox.h:160
OracleTable get_table(AbstractDatasource nds, string nname, *hash opts)
returns an OracleTable object corresponding to the arguments
OracleDatabase get_database(AbstractDatasource nds, *hash opts)
returns an OracleDatabase object corresponding to the arguments