Qore OracleSqlUtilBase Module Reference 1.6
Loading...
Searching...
No Matches
OracleSqlUtilBase.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* OracleSqlUtilBase.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
420 OracleTable get_table(AbstractDatasource nds, string nname, *hash opts);
421
422
424 OracleDatabase get_database(AbstractDatasource nds, *hash opts);
425
426
428class OracleSavepointHelper : public AbstractSavepointHelper {
429
430public:
432
436 constructor(AbstractDatasource ds, *string savepoint = 'x' + get_random_string(29)) ;
437
438
440protected:
442public:
443
444
446protected:
448public:
449
450
452protected:
454public:
455
456 };
457
460
461public:
463 constructor(string native_type, bool nullable, *hash<auto> options) ;
464
465 };
466
469
470public:
475
477protected:
479public:
480
481
482 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)
483 ;
484
485
487
490
491
493
500 list<string> getAddColumnSql(AbstractTable t);
501
502
504
519 list<string> getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
520
521
523
533 string getRenameSql(AbstractTable t, string new_name);
534
535
537 bool equalImpl(AbstractColumn c);
538
539
541
543 string getDdlName(string name);
544
545 };
546
549
550public:
551 constructor(string n, string nt, *string qt, softint sz, bool nul, *string dv, *string cm, softint bs, softint scale = 0) ;
552
553 };
554
557
558public:
561
563 *string tablespace;
564
566 constructor(string n, bool u, hash c, string nt, *string t) ;
567
568
570 string getCreateSql(string table_name, *hash opt);
571
572
574 bool equalImpl(AbstractIndex ix);
575
576
578 string getRenameSql(string table_name, string new_name);
579
580 };
581
584
585public:
588
589 constructor(string n, Columns c, ForeignConstraintTarget t, bool e) ;
590
591
592 string getCreateSql(string table_name, *hash opt);
593
594
595 softlist getRenameSql(string table_name, string new_name);
596
597
599 string getDisableSql(string table_name);
600
601
603 string getEnableSql(string table_name, *hash opt);
604
605 };
606
609
610public:
613
614 constructor(string n, string n_src, bool e = True) ;
615
616
617 string getCreateSql(string table_name, *hash opt);
618
619
620 softlist getRenameSql(string table_name, string new_name);
621
622
624 string getDisableSql(string table_name);
625
626
628 string getEnableSql(string table_name, *hash opt);
629
630 };
631
634
635public:
636protected:
639
641 *string tablespace;
642
643public:
644
645 constructor(string n, hash n_cols, bool e = True, *string ts) ;
646
647
649
666
667
668 bool setIndexBase(string ix);
669
670
673
674
675 string getCreateSql(string table_name, *hash opts);
676
677
678 softlist getRenameSql(string table_name, string new_name);
679
680
682 string getDisableSql(string table_name);
683
684
686 string getEnableSql(string table_name, *hash opt);
687
688
690 bool isEnabled();
691
692
694 *string getTablespace();
695
696 };
697
700
701public:
702protected:
704 *string tablespace;
705
706public:
707
708 constructor();
709
710
711 constructor(string n, *hash c, *string ts) ;
712
713
715
732
733
734 bool setIndexBase(string ix);
735
736
739
740
741 string getCreateSql(string table_name, *hash opts);
742
743
744 softlist getRenameSql(string table_name, string new_name);
745
746
748
750 string getDropSql(string table_name);
751
752
754 string getDisableSql(string table_name);
755
756
758 string getEnableSql(string table_name, *hash opt);
759
760 };
761
764
765public:
767 constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
768
769
771 string getCreateSql(*hash opt);
772
773
775
779 softlist getRenameSql(string new_name, *hash opt);
780
781 };
782
785
786public:
788 *string type_text;
790 *string oid_text;
794 *string view_type;
799
801 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)
802 ;
803
804
806 string getCreateSql(*hash opt);
807
808
810
814 softlist getRenameSql(string new_name, *hash opt);
815
816 };
817
820
821public:
824
825 constructor(string n, string n_src, bool en = True) ;
826
827
828 softlist getCreateSql(string table_name, *hash opt);
829
830
832 bool equalImpl(AbstractFunctionBase t);
833
834
836 softlist getRenameSql(string table_name, string new_name);
837
838
840 softlist getDropSql(string table_name);
841
842 };
843
846
847public:
849
853 constructor(string n, string n_type, string n_src) ;
854
855
857
859 softlist getCreateSql(*hash opt);
860
861
863 bool equalImpl(AbstractFunctionBase t);
864
865
867
871 softlist getRenameSql(string new_name, *hash opt);
872
873 };
874
877
878public:
880
884 constructor(string n, string n_type, string n_src) ;
885
886
888
893 softlist getRenameSql(string new_name, *hash opt);
894
895 };
896
899
900public:
901 constructor(string n_name, string n_src) ;
902
903
905
907 string getDropSql(*hash opt);
908
909 };
910
913
914public:
916
919 constructor(string n, string n_src) ;
920
921 };
922
925
926public:
928
931 constructor(string n, string n_src) ;
932
933 };
934
937
938public:
940 *string body_src;
941
943
947 constructor(string n, string n_src, *string n_body_src) ;
948
949
951 list getCreateSql(*hash opt);
952
953
955 bool equalImpl(AbstractFunctionBase t);
956
957 };
958
961
962public:
968 *string tablespace;
969
971
977 constructor(string n, string n_src, bool n_logging = True, bool n_use_index = True, *string n_tablespace) ;
978
979
981 softlist getCreateSql(*hash opt);
982
983
984 bool equalImpl(AbstractFunctionBase t);
985
986 };
987
990
991public:
994
995
998
999
1001
1010
1011
1014
1015
1018
1019
1022
1023
1026
1027
1030
1031
1034
1036 constructor(AbstractDatasource nds, *hash opts) ;
1037
1038
1040
1045
1046
1047protected:
1048 list<string> featuresImpl();
1049public:
1050
1051
1052protected:
1053 OracleSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
1054public:
1055
1056
1057protected:
1058 getSchemaName(reference<string> name, reference<string> schema);
1059public:
1060
1061
1062protected:
1063 *AbstractSequence getSequenceImpl(string name);
1064public:
1065
1066
1067protected:
1068 *AbstractView getViewImpl(string name);
1069public:
1070
1071
1072protected:
1073 OracleFunction makeFunctionImpl(string name, string src, *hash opts);
1074public:
1075
1076
1077protected:
1078 OracleProcedure makeProcedureImpl(string name, string src, *hash opts);
1079public:
1080
1081
1082protected:
1083 OraclePackage makePackage(string name, string src, string body, *hash opts);
1084public:
1085
1086
1087protected:
1088 OraclePackage makePackageFromDescription(string name, hash ph, *hash opts);
1089public:
1090
1091
1092protected:
1093 OracleType makeType(string name, string src, *hash opts);
1094public:
1095
1096
1097protected:
1098 OracleMaterializedView makeMaterializedView(string name, string src, bool logging = True, bool use_index = True, *string tablespace, *hash opts);
1099public:
1100
1101
1102protected:
1103 OracleMaterializedView makeMaterializedViewFromDescription(string name, hash mvh, *hash opts);
1104public:
1105
1106
1107protected:
1108 list<auto> getDropSchemaSqlImpl(hash<auto> schema_hash, *hash<auto> opt);
1109public:
1110
1111
1112protected:
1113 list getAlignSqlImpl(hash schema_hash, *hash opt);
1114public:
1115
1116
1117protected:
1118 *OracleFunction getFunctionImpl(string name);
1119public:
1120
1121
1122protected:
1123 *OracleProcedure getProcedureImpl(string name);
1124public:
1125
1126
1129
1130
1132 *OracleType getType(string name);
1133
1134
1137
1138
1139protected:
1140 *string getSource(string type, string name);
1141public:
1142
1143
1144protected:
1145 checkSource(string type, string name, reference<string> src);
1146public:
1147
1148
1150 list<string> listSynonyms();
1151
1152
1154 ListIterator synonymIterator();
1155
1156
1158 list<string> listTypes();
1159
1160
1162 ListIterator typeIterator();
1163
1164
1166 list<string> listPackages();
1167
1168
1170 ListIterator packageIterator();
1171
1172
1175
1176
1179
1180
1181protected:
1182 list<string> listTablesImpl();
1183public:
1184
1185
1186protected:
1187 list<string> listFunctionsImpl();
1188public:
1189
1190
1191protected:
1192 list<string> listProceduresImpl();
1193public:
1194
1195
1196protected:
1197 list<string> listSequencesImpl();
1198public:
1199
1200
1201protected:
1202 list<string> listViewsImpl();
1203public:
1204
1205
1206protected:
1207 list<string> getListIntern(string type);
1208public:
1209
1210
1211protected:
1212 list<string> getListIntern(list<auto> l);
1213public:
1214
1215
1216protected:
1217 string getCreateSqlImpl(list l);
1218public:
1219
1220
1221 static string getCreateSql(list l);
1222
1224protected:
1226public:
1227
1228
1230protected:
1232public:
1233
1234
1236protected:
1238public:
1239
1240
1242protected:
1244public:
1245
1246
1248protected:
1250public:
1251
1252
1254protected:
1255 softint getNextSequenceValueImpl(string name);
1256public:
1257
1258
1260protected:
1261 softint getCurrentSequenceValueImpl(string name);
1262public:
1263
1264
1266protected:
1268public:
1269
1270
1272protected:
1274public:
1275
1276
1278protected:
1280public:
1281
1282
1284
1296 bool rebuildIndexAnalyze(AbstractIndex index, int maxh, int maxleaf);
1297
1298
1300
1312 bool rebuildIndexAnalyze(string name, int maxh, int maxleaf);
1313
1314
1316protected:
1317 bool rebuildIndexImpl(string name, *hash options);
1318public:
1319
1320
1322protected:
1324public:
1325
1326
1328protected:
1330public:
1331
1332
1334protected:
1336public:
1337
1338
1340protected:
1341 reclaimSpaceImpl(*hash options);
1342public:
1343
1344
1346protected:
1348public:
1349
1350
1351protected:
1352 oracleErrorCallback(int ac, string type, string name, *string table, *string new_name, *string info, string sql, hash<ExceptionInfo> ex);
1353public:
1354
1355 };
1356
1358
1361
1362public:
1364 const OraTypeMap = {
1365 "number": ("qore": Type::Number, "size": SZ_NUM, "size_range": (1, 38), "scale_range": (-84, 127)),
1366 "varchar2": {
1367 "qore": Type::String,
1368 "size": SZ_MAND,
1369 "size_range": (1, 4000),
1370 "is_char": True,
1371 "default_size": AbstractColumn::DefaultVarcharSize,
1372 },
1373 "char": {
1374 "qore": Type::String,
1375 "size": SZ_MAND,
1376 "size_range": (1, 4000),
1377 "is_char": True,
1378 "default_size": AbstractColumn::DefaultVarcharSize,
1379 },
1380 "date": ("qore": Type::Date,),
1381 "timestamp": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 9)),
1382 "timestamp with time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 9)),
1383 "timestamp with local time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 9)),
1384 "interval year to month": ("qore": Type::Date,),
1385 "interval day to second": ("qore": Type::Date,),
1386 "timestamp(0)": ("qore": Type::Date,),
1387 "timestamp(1)": ("qore": Type::Date,),
1388 "timestamp(2)": ("qore": Type::Date,),
1389 "timestamp(3)": ("qore": Type::Date,),
1390 "timestamp(4)": ("qore": Type::Date,),
1391 "timestamp(5)": ("qore": Type::Date,),
1392 "timestamp(6)": ("qore": Type::Date,),
1393 "timestamp(7)": ("qore": Type::Date,),
1394 "timestamp(8)": ("qore": Type::Date,),
1395 "timestamp(9)": ("qore": Type::Date,),
1396 "timestamp(0) with time zone": ("qore": Type::Date,),
1397 "timestamp(1) with time zone": ("qore": Type::Date,),
1398 "timestamp(2) with time zone": ("qore": Type::Date,),
1399 "timestamp(3) with time zone": ("qore": Type::Date,),
1400 "timestamp(4) with time zone": ("qore": Type::Date,),
1401 "timestamp(5) with time zone": ("qore": Type::Date,),
1402 "timestamp(6) with time zone": ("qore": Type::Date,),
1403 "timestamp(7) with time zone": ("qore": Type::Date,),
1404 "timestamp(8) with time zone": ("qore": Type::Date,),
1405 "timestamp(9) with time zone": ("qore": Type::Date,),
1406 "timestamp(0) with local time zone": ("qore": Type::Date,),
1407 "timestamp(1) with local time zone": ("qore": Type::Date,),
1408 "timestamp(2) with local time zone": ("qore": Type::Date,),
1409 "timestamp(3) with local time zone": ("qore": Type::Date,),
1410 "timestamp(4) with local time zone": ("qore": Type::Date,),
1411 "timestamp(5) with local time zone": ("qore": Type::Date,),
1412 "timestamp(6) with local time zone": ("qore": Type::Date,),
1413 "timestamp(7) with local time zone": ("qore": Type::Date,),
1414 "timestamp(8) with local time zone": ("qore": Type::Date,),
1415 "timestamp(9) with local time zone": ("qore": Type::Date,),
1416 "interval year(0) to month": ("qore": Type::Date,),
1417 "interval year(1) to month": ("qore": Type::Date,),
1418 "interval year(2) to month": ("qore": Type::Date,),
1419 "interval year(3) to month": ("qore": Type::Date,),
1420 "interval year(4) to month": ("qore": Type::Date,),
1421 "interval year(5) to month": ("qore": Type::Date,),
1422 "interval year(6) to month": ("qore": Type::Date,),
1423 "interval year(7) to month": ("qore": Type::Date,),
1424 "interval year(8) to month": ("qore": Type::Date,),
1425 "interval year(9) to month": ("qore": Type::Date,),
1426 "interval day(0) to second(0)": ("qore": Type::Date,),
1427 "interval day(0) to second(1)": ("qore": Type::Date,),
1428 "interval day(0) to second(2)": ("qore": Type::Date,),
1429 "interval day(0) to second(3)": ("qore": Type::Date,),
1430 "interval day(0) to second(4)": ("qore": Type::Date,),
1431 "interval day(0) to second(5)": ("qore": Type::Date,),
1432 "interval day(0) to second(6)": ("qore": Type::Date,),
1433 "interval day(0) to second(7)": ("qore": Type::Date,),
1434 "interval day(0) to second(8)": ("qore": Type::Date,),
1435 "interval day(0) to second(9)": ("qore": Type::Date,),
1436 "interval day(1) to second(0)": ("qore": Type::Date,),
1437 "interval day(1) to second(1)": ("qore": Type::Date,),
1438 "interval day(1) to second(2)": ("qore": Type::Date,),
1439 "interval day(1) to second(3)": ("qore": Type::Date,),
1440 "interval day(1) to second(4)": ("qore": Type::Date,),
1441 "interval day(1) to second(5)": ("qore": Type::Date,),
1442 "interval day(1) to second(6)": ("qore": Type::Date,),
1443 "interval day(1) to second(7)": ("qore": Type::Date,),
1444 "interval day(1) to second(8)": ("qore": Type::Date,),
1445 "interval day(1) to second(9)": ("qore": Type::Date,),
1446 "interval day(2) to second(0)": ("qore": Type::Date,),
1447 "interval day(2) to second(1)": ("qore": Type::Date,),
1448 "interval day(2) to second(2)": ("qore": Type::Date,),
1449 "interval day(2) to second(3)": ("qore": Type::Date,),
1450 "interval day(2) to second(4)": ("qore": Type::Date,),
1451 "interval day(2) to second(5)": ("qore": Type::Date,),
1452 "interval day(2) to second(6)": ("qore": Type::Date,),
1453 "interval day(2) to second(7)": ("qore": Type::Date,),
1454 "interval day(2) to second(8)": ("qore": Type::Date,),
1455 "interval day(2) to second(9)": ("qore": Type::Date,),
1456 "clob": ("qore": Type::String,),
1457 "blob": ("qore": Type::Binary,),
1458 "long": ("qore": Type::Binary,),
1459 "raw": ("qore": Type::Binary, "size": SZ_MAND, "size_range": (1, 2000)),
1460 "bfile": ("qore": Type::Binary,),
1461 "binary_float": ("qore": Type::Float,),
1462 "binary_double": ("qore": Type::Float,),
1463 "rowid": ("qore": Type::String,),
1464 "urowid": ("qore": Type::String, "size": SZ_OPT, "size_range": (1, 4000)),
1465 };
1466
1468 const QoreTypeMap = {
1469 "integer": "number",
1470 "float": "number",
1471 "number": "number",
1472 "string": "varchar2",
1473 "date": "timestamp(6)",
1474 "binary": "blob",
1475 SqlUtil::CHAR: "char",
1476 SqlUtil::CLOB: "clob",
1477 SqlUtil::BLOB: "blob",
1478 };
1479
1480 const OraColumnOpts = {
1481 "character_semantics": Type::Boolean,
1482 };
1483
1485
1488 const OraColumnOptions = AbstractTable::ColumnOptions + OraColumnOpts;
1489
1491
1494 const OraColumnDescOptions = AbstractTable::ColumnDescOptions + OraColumnOpts;
1495
1497
1500 const OracleIndexOptions = AbstractTable::IndexOptions + {
1501 "compute_statistics": Type::Boolean,
1502 };
1503
1505
1509 "index": Type::String,
1510 };
1511
1514
1515
1516 const OracleAlignTableOptions = AbstractTable::AlignTableOptions + OracleTableCreationOptions;
1517
1519
1523 const OracleSelectOptions = AbstractTable::SelectOptions + {
1524 "partition": Type::String,
1525 };
1526
1528 const OracleExpressionMap = DefaultExpressionMap + {
1529 OP_SUBSTR: DefaultExpressionMap{OP_SUBSTR} + {
1530 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1531 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1532 AbstractDataProviderTypeMap."string");
1533 string exp1 = info.table.getExpressionArg(\info, role, args[1],
1534 AbstractDataProviderTypeMap."int");
1535 if (!exists args[2]) {
1536 return sprintf("substr(%s,%s)", exp0, exp1);
1537 }
1538 return sprintf("substr(%s,%s,%s)", exp0, exp1,
1539 info.table.getExpressionArg(\info, role, args[2], AbstractDataProviderTypeMap."int"));
1540 },
1541 },
1542 COP_CAST: {
1543 "exp": <DataProviderExpressionInfo>{
1544 "type": DET_Operator,
1545 "label": COP_CAST,
1546 "name": "cast",
1547 "desc": "cast operator",
1548 "symbol": "cast",
1549 "args": (
1550 DataProviderSignatureAnyType,
1551 DataProviderSignatureStringValueType,
1552 DataProviderSignatureOptionalIntValueType,
1553 DataProviderSignatureOptionalIntValueType,
1554 ),
1555 "return_type": AbstractDataProviderTypeMap."any",
1556 },
1557 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1558 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1559 AbstractDataProviderTypeMap."any");
1560 string name = QoreTypeMap{args[1]} ?? args[1];
1561 *hash<auto> desc = OraTypeMap{name};
1562 string sql = sprintf ("cast (%s as %s", exp0, name);
1563 if (desc.size == SZ_MAND) {
1564 if (!exists args[1] && !exists desc.size_range)
1565 throw "OPERATOR-ERROR", sprintf ("cast operator missing size for type %s",
1566 name);
1567 sql += sprintf("(%d)", args[1] ?? desc.size_range[1]);
1568 } else if (desc.size == SZ_NUM && exists args[1]) {
1569 sql += sprintf("(%d", args[1]);
1570 sql += exists args[2] ? sprintf(",%d)", args[2]) : ")";
1571 } else if (desc.size == SZ_OPT && exists args[1]) {
1572 sql += sprintf("(%d)", args[1]);
1573 }
1574 sql += ")";
1575 return sql;
1576 },
1577 },
1578 COP_YEAR: {
1579 "exp": <DataProviderExpressionInfo>{
1580 "type": DET_Operator,
1581 "label": COP_YEAR,
1582 "name": COP_YEAR,
1583 "desc": "returns the year component of a date as a string (ex: `2022`)",
1584 "symbol": COP_YEAR,
1585 "args": (
1586 DataProviderSignatureDateType,
1587 ),
1588 "return_type": AbstractDataProviderTypeMap."string",
1589 },
1590 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1591 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1592 AbstractDataProviderTypeMap."date");
1593 return sprintf("to_char(%s, 'YYYY')", exp0);
1594 }
1595 },
1596 COP_YEAR_MONTH: {
1597 "exp": <DataProviderExpressionInfo>{
1598 "type": DET_Operator,
1599 "label": COP_YEAR_MONTH,
1600 "name": COP_YEAR_MONTH,
1601 "desc": "returns the year and month components of a date as a string (ex: `2022-06`)",
1602 "symbol": COP_YEAR_MONTH,
1603 "args": (
1604 DataProviderSignatureDateType,
1605 ),
1606 "return_type": AbstractDataProviderTypeMap."string",
1607 },
1608 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1609 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1610 AbstractDataProviderTypeMap."date");
1611 return sprintf("to_char(%s, 'YYYY-MM')", exp0);
1612 }
1613 },
1614 COP_YEAR_DAY: {
1615 "exp": <DataProviderExpressionInfo>{
1616 "type": DET_Operator,
1617 "label": COP_YEAR_DAY,
1618 "name": COP_YEAR_DAY,
1619 "desc": "returns the year, month, and day components of a date as a string (ex: `2022-06-29`)",
1620 "symbol": COP_YEAR_DAY,
1621 "args": (
1622 DataProviderSignatureDateType,
1623 ),
1624 "return_type": AbstractDataProviderTypeMap."string",
1625 },
1626 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1627 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1628 AbstractDataProviderTypeMap."date");
1629 return sprintf("to_char(%s, 'YYYY-MM-DD')", exp0);
1630 }
1631 },
1632 COP_YEAR_HOUR: {
1633 "exp": <DataProviderExpressionInfo>{
1634 "type": DET_Operator,
1635 "label": COP_YEAR_HOUR,
1636 "name": COP_YEAR_HOUR,
1637 "desc": "returns the year, month, day, and hour components of a date as a string "
1638 "(ex: `2022-06-29 15`)",
1639 "symbol": COP_YEAR_HOUR,
1640 "args": (
1641 DataProviderSignatureDateType,
1642 ),
1643 "return_type": AbstractDataProviderTypeMap."string",
1644 },
1645 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1646 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1647 AbstractDataProviderTypeMap."date");
1648 return sprintf("to_char(%s, 'YYYY-MM-DD HH24')", exp0);
1649 }
1650 },
1651 COP_TRUNC_DATE: {
1652 "exp": <DataProviderExpressionInfo>{
1653 "type": DET_Operator,
1654 "label": COP_TRUNC_DATE,
1655 "name": COP_TRUNC_DATE,
1656 "desc": "truncates the given date to the given resolution; args: date, string code: Y: year, "
1657 "M: month, D: day, H: hour, m: minute, S: second",
1658 "symbol": COP_TRUNC_DATE,
1659 "args": (
1660 DataProviderSignatureDateType,
1661 DataProviderSignatureStringValueType,
1662 ),
1663 "return_type": AbstractDataProviderTypeMap."date",
1664 },
1665 "code": string sub(reference<hash<QueryInfo>> info, int role, list<auto> args) {
1666 *string str = OracleTruncDate{args[1]};
1667 if (!str && !OracleTruncDate.hasKey(args[1])) {
1668 throw "TRUNC-DATE-ERROR", sprintf("unknown date truncation format argument %y; "
1669 "supported date format arguments: %y", args[1], keys OracleTruncDate);
1670 }
1671 string exp0 = info.table.getExpressionArg(\info, role, args[0],
1672 AbstractDataProviderTypeMap."date");
1673 if (str) {
1674 return sprintf("trunc(%s, %s)", exp0, str);
1675 }
1676 // for timestamps
1677 return sprintf("cast (%s as date)", exp0);
1678 },
1679 },
1680 OP_IN: {
1681 "exp": <DataProviderExpressionInfo>{
1682 "type": DET_Operator,
1683 "label": OP_IN,
1684 "name": OP_IN,
1685 "desc": "returns True if the first value is in the list of following values",
1686 "symbol": OP_IN,
1687 "args": (
1688 DataProviderSignatureAnyType,
1689 DataProviderSignatureAnyType,
1690 ),
1691 "varargs": True,
1692 "return_type": AbstractDataProviderTypeMap."bool",
1693 },
1694 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1695%ifndef NO_ORACLE
1696 auto val = shift args;
1697 # Qorus bug #989 SqlUtil: oracle op_in can fail in large amount of input elements
1698 # There is no support for CLOBs in WHERE clause in Oracle at all.
1699 # Binding large strings (over 4000 chars is performed by a CLOB in Qore driver.
1700 # Result of op_in operator can be "ORA-00932: inconsistent datatypes" if is
1701 # the list longer or if it contains large items with:
1702 # return cn + " in (select regexp_substr(%v,'[^,]+', 1, level) from dual connect by
1703 # regexp_substr(%v, '[^,]+', 1, level) is not null)";
1704
1705 # determine list members type. Let's assume the 1st non NULL/NOTHING
1706 # element gives the type code for all elements.
1707 ListIterator it(args);
1708 # get list type code
1709 int ltype;
1710 while (it.next()) {
1711 switch (it.getValue().typeCode()) {
1712 case NT_NULL:
1713 case NT_NOTHING:
1714 continue;
1715 case NT_DATE:
1716 case NT_INT:
1717 case NT_FLOAT:
1718 case NT_NUMBER:
1719 case NT_STRING:
1720 ltype = it.getValue().typeCode();
1721 break;
1722 default:
1723 throw "ORACLE-IN-OPERATOR-ERROR", sprintf("the \"in\" operator unexpected list "
1724 "element type: %s; only simple types are supported", it.getValue().type());
1725 }
1726 if (ltype) {
1727 break;
1728 }
1729 }
1730
1731 # Split long array to chunks of no more than 32767 elements due to Oracle limitation
1732 # "ORA-22165: OCI-22165: given index [32767] must be in the range of [0] to [32766]"
1733 int count;
1734 while (args) {
1735 ++count;
1736 list<auto> chunk = extract args, 0, 32767;
1737
1738 # Bind to Oracle by expected type
1739 switch (ltype) {
1740 case NT_DATE:
1741 info.args += bindOracleCollection("SYS.ODCIDATELIST", chunk);
1742 break;
1743 case NT_INT:
1744 case NT_FLOAT:
1745 case NT_NUMBER:
1746 info.args += bindOracleCollection("SYS.ODCINUMBERLIST", chunk);
1747 break;
1748 default:
1749 info.args += bindOracleCollection("SYS.ODCIVARCHAR2LIST", chunk);
1750 }
1751 }
1752
1753 if (count) {
1754 string exp0 = info.table.getExpressionArg(\info, role, val,
1755 AbstractDataProviderTypeMap."date");
1756 return exp0 + " in (" + (map "select column_value from table(%v)",
1757 xrange(count)).join(" union all ") + ")";
1758 } else {
1759 return "1 != 1";
1760 }
1761%else
1762 throw "MISSING-ORACLE-DRIVER", "requires the oracle driver";
1763%endif
1764 },
1765 },
1766 COP_SEQ: {
1767 "exp": <DataProviderExpressionInfo>{
1768 "type": DET_Operator,
1769 "label": COP_SEQ,
1770 "name": COP_SEQ,
1771 "desc": "returns the next value in the given sequence; args: sequence name",
1772 "symbol": COP_SEQ,
1773 "args": (
1774 DataProviderSignatureStringValueType,
1775 ),
1776 "return_type": AbstractDataProviderTypeMap."int",
1777 },
1778 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1779 return sprintf("%s.nextval", args[0]);
1780 }
1781 },
1782 COP_SEQ_CURRVAL: {
1783 "exp": <DataProviderExpressionInfo>{
1784 "type": DET_Operator,
1785 "label": COP_SEQ_CURRVAL,
1786 "name": COP_SEQ_CURRVAL,
1787 "desc": "returns the current value in the given sequence; args: sequence name",
1788 "symbol": COP_SEQ_CURRVAL,
1789 "args": (
1790 DataProviderSignatureStringValueType,
1791 ),
1792 "return_type": AbstractDataProviderTypeMap."int",
1793 },
1794 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
1795 return sprintf("%s.currval", args[0]);
1796 }
1797 },
1798 };
1799
1801 const OracleOpMap = ...;
1802
1803
1805 const OracleCopMap = ...;
1806
1807
1809 const OracleTruncDate = ...;
1810
1811
1813 const OracleIopMap = ...;
1814
1815
1817 const OracleUopMap = ...;
1818
1819
1822 "rowid": True,
1823 "rownum": True,
1824 "object_id": True,
1825 "object_value": True,
1826 "ora_rowscn": True,
1827 };
1828
1829protected:
1830 // schema name
1831 string schema;
1832
1833 // tablespace name
1834 *string tablespace;
1835
1836 // is the table read only?
1837 bool readonly;
1838
1839 // table comment
1840 *string comment;
1841
1842 // dblink
1843 *string dblink;
1844
1845 // Oracle server major version
1846 int ora_major;
1847
1848 // helper flag to indicate if is the OracleTable real table or a view
1849 bool m_isView = False;
1850
1851 // oraclesqlutilbase: allow to use DBA_* views instead of ALL_* if possible #2418
1852 // An internal cache to find the highest priority available
1853 // system dictionary object. Priority: DBA > ALL
1854 hash<string, string> m_sys_views = {
1855 "dba_col_comments" : "all_col_comments",
1856 "dba_cons_columns" : "all_cons_columns",
1857 "dba_constraints" : "all_constraints",
1858 "dba_db_links" : "all_db_links",
1859 "dba_ind_columns" : "all_ind_columns",
1860 "dba_ind_expressions" : "all_ind_expressions",
1861 "dba_indexes" : "all_indexes",
1862 "dba_objects" : "all_objects",
1863 "dba_sequences" : "all_sequences",
1864 "dba_synonyms" : "all_synonyms",
1865 "dba_tab_columns" : "all_tab_columns",
1866 "dba_tab_comments" : "all_tab_comments",
1867 "dba_tables" : "all_tables",
1868 "dba_triggers" : "all_triggers",
1869 "dba_views" : "all_views",
1870 };
1871
1872public:
1873
1874 constructor(AbstractDatasource nds, string nname, *hash opts) ;
1875
1876
1877protected:
1878 introspectSystemViews();
1879public:
1880
1881
1882 // oraclesqlutil: allow to use DBA_* views instead of ALL_* if possible #2418
1883 // get the most appropriate system catalogue/dictinary view available
1884protected:
1885 string systemView(string name);
1886public:
1887
1888
1889protected:
1890 bool checkExistenceImpl();
1891public:
1892
1893
1894protected:
1895 setTableInfoIntern();
1896public:
1897
1898
1900 string getSqlName();
1901
1902
1904 bool isView();
1905
1906
1907protected:
1908 hash<auto> setSchemaTable();
1909public:
1910
1911
1912protected:
1913 setDblinkSchema();
1914public:
1915
1916
1917 // Oracle has supprt for unlimitted synonym loops. There
1918 // can be mo relevels of synonyms before the real object
1919 // is listed.
1920protected:
1921 *hash resolveSynonym(string s_owner, string s_name);
1922public:
1923
1924
1925protected:
1926 hash<auto> setTable();
1927public:
1928
1929
1930protected:
1931 string getUserSchema();
1932public:
1933
1934
1935protected:
1936 string getDBString();
1937public:
1938
1939
1942
1943
1946
1947
1949 *string getComment();
1950
1951
1952 bool readOnly();
1953
1954
1955protected:
1956 hash<auto> getColumnOptions();
1957public:
1958
1959
1960protected:
1961 hash<auto> getColumnDescOptions();
1962public:
1963
1964
1966protected:
1967 hash<auto> getSelectOptions();
1968public:
1969
1970
1972
1974protected:
1975 bool optimizedLimit(*hash<auto> qh);
1976public:
1977
1978
1979protected:
1980 insertLimitOptimizerHint(hash<auto> qh, reference<string> sql);
1981public:
1982
1983
1984protected:
1985 doSelectOrderByWithOffsetSqlUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql, list<auto> coll);
1986public:
1987
1988
1990protected:
1991 doSelectLimitOnlyUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql);
1992public:
1993
1994
1995protected:
1996 Columns describeImpl();
1997public:
1998
1999
2000protected:
2001 OraclePrimaryKey getPrimaryKeyImpl();
2002public:
2003
2004
2005protected:
2006 Indexes getIndexesImpl();
2007public:
2008
2009
2010protected:
2011 ForeignConstraints getForeignConstraintsImpl(*hash opts);
2012public:
2013
2014
2015protected:
2016 Constraints getConstraintsImpl();
2017public:
2018
2019
2020protected:
2021 string getSelectSqlName(*hash qh);
2022public:
2023
2024
2025protected:
2026 Triggers getTriggersImpl();
2027public:
2028
2029
2030 string getCreateTableSqlImpl(*hash opt);
2031
2032
2034 hash<auto> getExpressionMap();
2035
2036
2039
2040
2041protected:
2042 *list getCreateMiscSqlImpl(*hash opt, bool cache);
2043public:
2044
2045
2046protected:
2047 string getCreateSqlImpl(list l);
2048public:
2049
2050
2051protected:
2052 string getRenameSqlImpl(string new_name);
2053public:
2054
2055
2056protected:
2057 AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
2058public:
2059
2060
2061protected:
2062 AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
2063public:
2064
2065
2066protected:
2067 AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
2068public:
2069
2070
2071protected:
2072 AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch, *hash opt);
2073public:
2074
2075
2076protected:
2077 AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
2078public:
2079
2080
2081protected:
2082 AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
2083public:
2084
2085
2086protected:
2087 AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
2088public:
2089
2090
2091protected:
2092 bool tryInsertImpl(string sql, hash<auto> row);
2093public:
2094
2095
2097
2099protected:
2100 bool isDuplicateRowErrorImpl(hash<ExceptionInfo> ex);
2101public:
2102
2103
2104protected:
2105 *list getAlignSqlImpl(AbstractTable t, *hash opt);
2106public:
2107
2108
2109protected:
2110 hash<auto> getQoreTypeMapImpl();
2111public:
2112
2113
2114protected:
2115 hash<auto> getTypeMapImpl();
2116public:
2117
2118
2119protected:
2120 hash<auto> getIndexOptions();
2121public:
2122
2123
2124protected:
2125 hash<auto> getConstraintOptions();
2126public:
2127
2128
2129protected:
2130 hash<auto> getTableCreationOptions();
2131public:
2132
2133
2134protected:
2135 hash<auto> getAlignTableOptions();
2136public:
2137
2138
2140protected:
2142public:
2143
2144
2146protected:
2148public:
2149
2150
2152protected:
2154public:
2155
2156
2158protected:
2159 *hash<auto> getPseudoColumnHash();
2160public:
2161
2162
2164protected:
2165 *string getSqlValueImpl(auto v);
2166public:
2167
2168
2170 string getColumnSqlName(string col);
2171
2172
2174 list getColumnSqlNames(softlist cols);
2175
2176
2178
2181 string getBaseType();
2182
2183
2185 code getBulkUpsertClosure(hash example_row, int upsert_strategy = AbstractTable::UpsertAuto, *hash opt);
2186
2187
2189 code getUpsertClosure(hash<auto> row, int upsert_strategy = UpsertAuto, *hash opt);
2190
2191
2193protected:
2194 code getUpsertInsertOnly(Columns cols, hash<auto> row, *hash opt);
2195public:
2196
2197
2199protected:
2200 code getUpsertUpdateOnly(Columns cols, hash<auto> row, *hash opt);
2201public:
2202
2203
2206
2207
2209
2212
2213
2215protected:
2217public:
2218
2219
2220protected:
2221 *hash doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
2222public:
2223
2224
2225protected:
2226 bool emptyImpl();
2227public:
2228
2229
2230protected:
2231 setupTableImpl(hash<auto> desc, *hash<auto> opt);
2232public:
2233
2234
2236protected:
2238public:
2239
2240
2242protected:
2244public:
2245
2246
2248protected:
2250public:
2251
2252
2254protected:
2255 copyImpl(AbstractTable old);
2256public:
2257
2258
2260protected:
2261 AbstractDataProviderType getNumericTypeImpl(string native_type, bool nullable, *hash<auto> options);
2262public:
2263
2264
2266
2270protected:
2271 AbstractSavepointHelper getSavepointHelperImpl(*string savepoint);
2272public:
2273
2274 };
2275};
represents an Oracle check constraint
Definition: OracleSqlUtilBase.qm.dox.h:608
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: OracleSqlUtilBase.qm.dox.h:612
string getEnableSql(string table_name, *hash opt)
returns a string that can be used to enable the constraint in the database
the base class for Oracle code objects
Definition: OracleSqlUtilBase.qm.dox.h:845
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the object in the database
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
constructor(string n, string n_type, string n_src)
creates the object from the arguments passed
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: OracleSqlUtilBase.qm.dox.h:876
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: OracleSqlUtilBase.qm.dox.h:468
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
list< string > getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
string getNativeTypeString()
returns the string describing the native type that can be used in SQL
string getDdlName(string name)
returns the column name with quoting in case the column name is a reserved word
int byte_size
byte size of the column
Definition: OracleSqlUtilBase.qm.dox.h:474
constructor()
empty constructor for subclasses
bool char_used
the column uses character semantics
Definition: OracleSqlUtilBase.qm.dox.h:472
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
the Oracle specialization for SqlUtil::AbstractDatabase
Definition: OracleSqlUtilBase.qm.dox.h:989
int getPhysicalSizeImpl()
SqlUtil::AbstractDatabase::getPhysicalSize()
ListIterator packageIterator()
returns an iterator listing the string package names in the database
const OracleMaterializedViewDescriptionOptions
oracle-specific materialized view description options
Definition: OracleSqlUtilBase.qm.dox.h:1017
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
const OracleReservedWords
hash of reserved words
Definition: OracleSqlUtilBase.qm.dox.h:1021
bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
list< string > listSynonyms()
returns a list of string synonym names in the database
int getMaximumPrecision()
Returns the maximum precision for numeric or decimal columns.
bool supportsPackagesImpl()
returns True if the database supports packages
*OraclePackage getPackage(string name)
returns an OraclePackage object for the package name given or NOTHING if the object does not exist or...
ListIterator synonymIterator()
returns an iterator listing the string synonym names in the database
*OracleType getType(string name)
returns an OracleType object for the package name given or NOTHING if the object does not exist or is...
list< string > listMaterializedViews()
returns a list of string materialized view names in the database
bool supportsSequencesImpl()
returns True if the database supports sequences
const OracleAlignSchemaOptions
oracle-specific schema description / alignment options
Definition: OracleSqlUtilBase.qm.dox.h:997
bool rebuildIndexAnalyze(string name, int maxh, int maxleaf)
analyze index with ALTER INDEX ANAYZE. Then it checks INDEX_STATS for advices to rebuild.
reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
list< string > listTypes()
returns a list of string type names in the database
const OracleSchemaDescriptionOptions
oracle-specific schema description keys
Definition: OracleSqlUtilBase.qm.dox.h:1009
hash< auto > getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
const OracleComputeStatisticsOptions
Options for computeStatistics()
Definition: OracleSqlUtilBase.qm.dox.h:1029
hash< auto > getRebuildIndexOptions()
returns driver-specific options to the base abstract class
computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics()
constructor(AbstractDatasource nds, *hash opts)
creates the object from the arguments given
const OracleMaxPrecision
MAximum precision for Oracle NUMBER columns.
Definition: OracleSqlUtilBase.qm.dox.h:1033
hash< auto > getCreationOptions()
returns driver-specific options to the base abstract class
bool supportsTypesImpl()
returns True if the database supports named types
ListIterator materializedViewIterator()
returns an iterator listing the string materialized view names in the database
const OraclePackageDescriptionOptions
oracle-specific package description options
Definition: OracleSqlUtilBase.qm.dox.h:1013
*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
bool rebuildIndexAnalyze(AbstractIndex index, int maxh, int maxleaf)
analyze index with ALTER INDEX ANAYZE. Then it checks INDEX_STATS for advices to rebuild.
const OracleCreationOptions
oracle-specific generic creation options
Definition: OracleSqlUtilBase.qm.dox.h:993
ListIterator typeIterator()
returns an iterator listing the string type names in the database
softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
hash< auto > getComputeStatisticsOptions()
returns driver-specific options to the base abstract class
const OracleRebuildIndexOptions
Options for rebuildIndex()
Definition: OracleSqlUtilBase.qm.dox.h:1025
computeStatisticsTablesImpl(*hash options)
compute statistics for table(s) - a helper method
computeStatisticsSchemaImpl(*hash options)
compute statistics for schema - a helper method
list< string > listPackages()
returns a list of string package names in the database
represents an Oracle foreign constraint
Definition: OracleSqlUtilBase.qm.dox.h:583
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: OracleSqlUtilBase.qm.dox.h:587
represents an Oracle function
Definition: OracleSqlUtilBase.qm.dox.h:912
constructor(string n, string n_src)
creates the object from the arguments passed
represents an Oracle index
Definition: OracleSqlUtilBase.qm.dox.h:556
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
string native_type
the native type of the index (if supported)
Definition: OracleSqlUtilBase.qm.dox.h:560
constructor(string n, bool u, hash c, string nt, *string t)
creates the object from the arguments
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
*string tablespace
the tablespace name of the index (if supported)
Definition: OracleSqlUtilBase.qm.dox.h:563
represents an Oracle materialized view
Definition: OracleSqlUtilBase.qm.dox.h:960
*string tablespace
Name of the potential tablespace.
Definition: OracleSqlUtilBase.qm.dox.h:968
bool use_index
Flag if is index used.
Definition: OracleSqlUtilBase.qm.dox.h:966
bool logging
Flag if is loggign mode used.
Definition: OracleSqlUtilBase.qm.dox.h:964
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
softlist getCreateSql(*hash opt)
returns a string that can be used to create the object in the database
represents an Oracle number column
Definition: OracleSqlUtilBase.qm.dox.h:548
the data type for Oracle NUMBER columns
Definition: OracleSqlUtilBase.qm.dox.h:459
constructor(string native_type, bool nullable, *hash< auto > options)
creates the object
represents an Oracle package
Definition: OracleSqlUtilBase.qm.dox.h:936
*string body_src
package body source
Definition: OracleSqlUtilBase.qm.dox.h:940
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
constructor(string n, string n_src, *string n_body_src)
creates the object from the arguments passed
list getCreateSql(*hash opt)
returns a string that can be used to create the package in the database
represents an Oracle primary key
Definition: OracleSqlUtilBase.qm.dox.h:699
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
*string tablespace
any tablespace for the primary key index
Definition: OracleSqlUtilBase.qm.dox.h:704
OracleColumn memberGate(string k)
returns the OracleColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
string getDisableSql(string table_name)
returns a string that can be used to temporarily disable the constraint from the database
clearIndex()
clears any index base for the constraint
string getEnableSql(string table_name, *hash opt)
returns a string that can be used to enable the constraint in the database
represents an Oracle procedure
Definition: OracleSqlUtilBase.qm.dox.h:924
constructor(string n, string n_src)
creates the object from the arguments passed
Oracle savepoint helper.
Definition: OracleSqlUtilBase.qm.dox.h:428
deleteSavepointImpl()
Deletes the savepoint.
createSavepointImpl()
Creates 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: OracleSqlUtilBase.qm.dox.h:763
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
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
represents an Oracle table
Definition: OracleSqlUtilBase.qm.dox.h:1360
hash< auto > getSelectOptions()
override in subclasses to return driver-specific options
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...
hash< auto > getColumnOperatorMapImpl()
returns the column operator map for this object
*string getComment()
returns any table comment or NOTHING if none is known
copyImpl(AbstractTable old)
db-specific copy actions
const OracleTruncDate
Map SqlUtil::cop_trunc_date() constants to Oracle internal masks.
Definition: OracleSqlUtilBase.qm.dox.h:1809
const OracleCopMap
column operator specializations for Oracle
Definition: OracleSqlUtilBase.qm.dox.h:1805
string getSchemaName()
returns the schema name
code getUpsertUpdateOnly(Columns cols, hash< auto > row, *hash opt)
high-performance "update only" upsert supporting bulk DML
*string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
const OracleSelectOptions
Oracle select options.
Definition: OracleSqlUtilBase.qm.dox.h:1523
*hash< auto > getPseudoColumnHash()
returns a hash of valid pseudocolumns
bool asteriskRequiresPrefix()
returns True if the database requires a wildcard "*" to be prefixed with the table name when it appea...
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
const OracleIopMap
a hash of default value operator descriptions for Oracle
Definition: OracleSqlUtilBase.qm.dox.h:1813
const OracleConstraintOptions
Oracle-specific constraint options.
Definition: OracleSqlUtilBase.qm.dox.h:1508
AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
const OraTypeMap
maps oracle type names to type descriptions
Definition: OracleSqlUtilBase.qm.dox.h:1364
const OraColumnDescOptions
Oracle-specific column options.
Definition: OracleSqlUtilBase.qm.dox.h:1494
const OraclePseudoColumnHash
a hash of valid pseudocolumns
Definition: OracleSqlUtilBase.qm.dox.h:1821
const OracleOpMap
where operator specializations for Oracle
Definition: OracleSqlUtilBase.qm.dox.h:1801
string getSqlName()
returns the schema and table name in dot notation
*string getTablespaceName()
returns the data tablespace name for the table if any or NOTHING if none is known
bool isDuplicateRowErrorImpl(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
bool bindEmptyStringsAsNull()
returns True because Oracle treats empty strings like NULL on insert
hash< auto > getExpressionMap()
Returns the expression map for Oracle.
const OracleExpressionMap
Oracle Expression map.
Definition: OracleSqlUtilBase.qm.dox.h:1528
hash< auto > getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
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...
bool optimizedLimit(*hash< auto > qh)
Returns True if the current connection supports optimized limit option handling.
const OraColumnOptions
Oracle-specific column options.
Definition: OracleSqlUtilBase.qm.dox.h:1488
hash< auto > getInsertOperatorMap()
returns the insert operator map for this object
bool isView()
This method can change itself or disappear in the near future. Do not use it.
list getColumnSqlNames(softlist cols)
returns a list of column names for use in SQL strings; subclasses can process the argument list in ca...
const OracleUopMap
a hash of default update operator definitions for Oracle
Definition: OracleSqlUtilBase.qm.dox.h:1817
doSelectLimitOnlyUnlockedImpl(reference< hash< QueryInfo > > info, reference< string > sql)
processes a string for use in SQL select statements when there is a "limit" argument,...
code getUpsertInsertOnly(Columns cols, hash< auto > row, *hash opt)
high-performance "insert only" upsert supporting bulk DML
bool supportsTablespacesImpl()
returns True if the database support tablespaces
const OracleIndexOptions
Oracle-specific index options.
Definition: OracleSqlUtilBase.qm.dox.h:1500
bool hasArrayBind()
returns True because the oracle driver supports array binds / bulk DML operations
const OracleTableCreationOptions
Oracle table creation options.
Definition: OracleSqlUtilBase.qm.dox.h:1513
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
const QoreTypeMap
maps qore type names to an oracle type
Definition: OracleSqlUtilBase.qm.dox.h:1468
hash< auto > getWhereOperatorMap()
returns the "where" operator map for Oracle
string getBaseType()
returns the base type of the underlying object (either "table" or "view")
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
code getBulkUpsertClosure(hash example_row, int upsert_strategy=AbstractTable::UpsertAuto, *hash opt)
Oracle always supports bulk merging.
represents an Oracle trigger
Definition: OracleSqlUtilBase.qm.dox.h:819
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from the database
bool enabled
True if the trigger is enabled, False if not
Definition: OracleSqlUtilBase.qm.dox.h:823
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
represents an Oracle type
Definition: OracleSqlUtilBase.qm.dox.h:898
string getDropSql(*hash opt)
returns a string that can be used to drop the type from the database
represents an Oracle unique constraint
Definition: OracleSqlUtilBase.qm.dox.h:633
bool isEnabled()
returns True if the constraint is enabled, False if not
string getDisableSql(string table_name)
returns a string that can be used to temporarily disable the constraint from the database
clearIndex()
clears any index base for the constraint
string getEnableSql(string table_name, *hash opt)
returns a string that can be used to enable the constraint in the database
bool enabled
True if the constraint is enabled, False if not
Definition: OracleSqlUtilBase.qm.dox.h:638
*string getTablespace()
returns the tablespace name used for this constraint, if known
*string tablespace
any tablespace for the unique key index
Definition: OracleSqlUtilBase.qm.dox.h:641
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: OracleSqlUtilBase.qm.dox.h:784
*string view_type_owner
Owner of the type of the view if the view is a typed view.
Definition: OracleSqlUtilBase.qm.dox.h:792
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
*string type_text
Type clause of the typed view.
Definition: OracleSqlUtilBase.qm.dox.h:788
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
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: OracleSqlUtilBase.qm.dox.h:790
*string superview_name
Name of the superview.
Definition: OracleSqlUtilBase.qm.dox.h:796
*string view_type
Type of the view if the view is a typed view.
Definition: OracleSqlUtilBase.qm.dox.h:794
bool container_data
Indicates whether the view contains container-specific data.
Definition: OracleSqlUtilBase.qm.dox.h:798
cache(*hash< auto > opts)
const CLOB
const BLOB
const CHAR
the OracleSqlUtilBase namespace contains all the objects in the OracleSqlUtilBase module
Definition: OracleSqlUtilBase.qm.dox.h:418
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