Qore OracleSqlUtil Module Reference  1.2.4
OracleSqlUtil.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
2 // @file OracleSqlUtil.qm Qore user module for working with Oracle SQL data
3 
4 /* OracleSqlUtil.qm Copyright 2013 - 2017 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 // this module requires Qore 0.8.13 or better
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  a.*, rownum rnum from (select * from schema.table where type = %v order by type) a where rownum <= %v) where rnum > %v", ("user", 300, 200));
72  @endcode
73  note that the following simpler SQL is generated for Oracle 12c+ servers:
74  @code{.py}
75 $ds.vselectRows("select * from schema.table where type = %v order by type offset %v rows fetch next %v rows only", ("user", 200, 100));
76  @endcode
77 
78  @subsection ora_in_operator IN Operator on Oracle
79 
80  In order to avoid dynamic SQL and better manage the server's shared pool (in particular, the number of parsed statements), the %OracleSqlUtil
81  module uses bind by value with the SQL \c IN operator.
82 
83  For example, the following query:
84  @code{.py}
85 my *hash $q = $table.select(("where": ("col1": op_in(1, 2, 3, 4))));
86  @endcode
87 
88  Results in the equivalent of the following SQL:
89  @code{.py}
90 my *hash $q = $ds.select("select * from schema.table where col1 in (select column_value from table(%v))", bindOracleCollection("SYS.ODCIVARCHAR2LIST", (1,2,3,4)));
91  @endcode
92 
93  @htmlonly <style><!-- td.qore { background-color: #5b9409; color: white; } --></style> @endhtmlonly
94  <table>
95  <tr>
96  <td class="qore"><b>Qore Type</b></td>
97  <td class="qore"><b>Oracle Collection</b></td>
98  </tr>
99  <tr>
100  <td>Date</td>
101  <td>\c SYS.ODCIDATELIST</td>
102  </tr>
103  <tr>
104  <td>Float</td>
105  <td>\c SYS.ODCINUMBERLIST</td>
106  </tr>
107  <tr>
108  <td>Integer</td>
109  <td>\c SYS.ODCINUMBERLIST</td>
110  </tr>
111  <tr>
112  <td>Number</td>
113  <td>\c SYS.ODCINUMBERLIST</td>
114  </tr>
115  <tr>
116  <td>String</td>
117  <td>\c SYS.ODCIVARCHAR2LIST</td>
118  </tr>
119  </table>
120 
121  There universal collections are limited to 32767 elements. And \c SYS.ODCIVARCHAR2LIST element size is \c VARCHAR2(4000).
122 
123  @subsection ora_partitioning_select Partition Support in Selects
124 
125  It's possible to select from a particular partition of a table with %OracleSqlUtil;
126  @ref OracleSqlUtil::OracleTable::OracleSelectOptions "OracleSelectOptions" defines the \c "partition" key which can be added to a
127  @ref select_option_hash "select option hash" to specify the partition to select from as in the following example:
128  @code{.py}
129 my *list $rows = $table.selectRows(("created": op_gt(2012-05-01), "partition": "p1"));
130  @endcode
131  Which generates an SQL command like the following:
132  @code{.py}
133 my *list $rows = $ds.vselectRows("select * from schema.table partition(p1) where created > %v", (2012-05-01));
134  @endcode
135 
136  @subsection ora_partitioning_join Partition Support in Joins
137 
138  It's possible to perform a join on a particular partition of a table with %OracleSqlUtil; the join option \c "partition" is
139  supported to specify the partition to join on as in the following example:
140  @code{.py}
141 my *list $rows = $table.selectRows(("join": join_inner($table2, "t2", ("id": "altid"), NOTHING, ("partition": "p2"))));
142  @endcode
143  Which generates an SQL command like the following:
144  @code{.py}
145 my *list $rows = $ds.vselectRows("select * from schema.table inner join schema.table2 partition(p2) t2 on (schema.table.id = t2.altid)");
146  @endcode
147 
148  @section ora_schema_management Schema Management on Oracle
149 
150  Note that when getting an object description from an Oracle database, if the object cannot be found in the connection schema, then
151  if a synonym of the same type exists and the target object is accessible, then the target object is read automatically and the owning
152  schema name is also set to the actual owner of the object.
153 
154  @subsection ora_type_mapping Type Mapping
155 
156  Column types are mapped from %Qore types as follows:
157 
158  <b>Oracle Column Type Mappings</b>
159  <table>
160  <tr>
161  <td class="qore"><b>Generic Type Name</b></td>
162  <td class="qore"><b>Oracle Type Used</b></td>
163  </tr>
164  <tr>
165  <td>\c float</td>
166  <td>\c number</td>
167  </tr>
168  <tr>
169  <td>\c integer</td>
170  <td>\c number</td>
171  </tr>
172  <tr>
173  <td>\c number</td>
174  <td>\c number</td>
175  </tr>
176  <tr>
177  <td>\c string</td>
178  <td>\c varchar2</td>
179  </tr>
180  <tr>
181  <td>\c date</td>
182  <td>\c timestamp(6)</td>
183  </tr>
184  <tr>
185  <td>\c binary</td>
186  <td>\c blob</td>
187  </tr>
188  <tr>
189  <td>@ref SqlUtil::BLOB</td>
190  <td>\c blob</td>
191  </tr>
192  <tr>
193  <td>@ref SqlUtil::CHAR</td>
194  <td>\c char</td>
195  </tr>
196  <tr>
197  <td>@ref SqlUtil::CLOB</td>
198  <td>\c clob</td>
199  </tr>
200  <tr>
201  <td>@ref SqlUtil::NUMERIC</td>
202  <td>\c number</td>
203  </tr>
204  <tr>
205  <td>@ref SqlUtil::VARCHAR</td>
206  <td>\c varchar2</td>
207  </tr>
208  </table>
209 
210  To use other types, use the \c "native_type" @ref SqlUtil::AbstractTable::ColumnDescOptions "column description option" with the
211  native Oracle type name instead (under the \c "driver" and \c "oracle" keys for schemas supporting multiple databases).
212 
213  @subsection ora_other_objects Additional Object Types Supported
214 
215  The following additional schema objects can be managed with %OracleSqlUtil:
216  - @ref ora_materialized_views "materialized views"
217  - @ref ora_packages "packages"
218  - @ref ora_types "types"
219 
220  @subsection ora_materialized_views Materialized Views
221 
222  The @ref schema_desc_hash takes an optional key, \c "materialized_views" that allows materialized views in Oracle schemas to be managed along with other objects.
223 
224  The \c "materialized_views" should be assigned to a hash, each key name is the name of the materialized view, and the values are hashes with the
225  following keys:
226  - \c "logging": (@ref bool_type "bool") if the materialized view should be logged
227  - \c "use_index": (@ref bool_type "bool") if the materialized view should be indexed
228  - \c "src": (@ref bool_type "bool") the source of the materialized view
229 
230  The \c "materialized_views" key can go in the top level of the @ref schema_desc_hash for Oracle-only schemas, or, for schemas targeting multiple database types, under the \c "driver" and \c "oracle" keys as in the following example:
231 
232  @code{.py}
233 my hash $schema = (
234  "driver": (
235  "oracle": (
236  "materialized_views": (
237  "example_mv": (
238  "logging": False,
239  "use_index": False,
240  "src": "select type, count(1) total_count from table group by type",
241  ),
242  ),
243  ),
244  ),
245 );
246  @endcode
247 
248  @subsection ora_packages Packages
249 
250  The @ref schema_desc_hash takes an optional key, \c "packages" that allows packages in Oracle schemas to be managed along with other objects.
251 
252  The \c "packages" should be assigned to a hash, each key name is the name of the package, and the values are hashes with the
253  following key:
254  - \c "src": (@ref bool_type "bool") the source of the package
255 
256  The \c "packages" key can go in the top level of the @ref schema_desc_hash for Oracle-only schemas, or, for schemas targeting multiple database types, under the \c "driver" and \c "oracle" keys as in the following example:
257 
258  @code{.py}
259 my hash $schema = (
260  "driver": (
261  "oracle": (
262  "packages": (
263  "example_pkg": (
264  "src": "types as
265 type cursorType is ref cursor;
266 MYSTATCOMPLETE constant order_status.orderstatus%type := 'C';
267 MYSTATERROR constant order_status.orderstatus%type := 'E';
268 ",
269  ),
270  ),
271  ),
272  ),
273 );
274  @endcode
275 
276  @subsection ora_types Types
277 
278  The @ref schema_desc_hash takes an optional key, \c "types" that allows types in Oracle schemas to be managed along with other objects.
279 
280  The \c "types" should be assigned to a hash, each key name is the name of the type, and the values are strings giving the type definition.
281 
282  The \c "types" key can go in the top level of the @ref schema_desc_hash for Oracle-only schemas, or, for schemas targeting multiple database types, under the \c "driver" and \c "oracle" keys as in the following example:
283 
284  @code{.py}
285 my hash $schema = (
286  "driver": (
287  "oracle": (
288  "types": (
289  "num_array": "table of number",
290  "str_array": "table of varchar2(240)",
291  ),
292  ),
293  ),
294 );
295  @endcode
296 
297  @see OracleSqlUtil::OracleDatabase::OracleSchemaDescriptionOptions for a list of Oracle-specific schema description hash keys.
298 
299  @section ora_relnotes Release Notes
300 
301  @subsection v124 OracleSqlUtil v1.2.4
302  - implemented support for custom column operators (<a href="https://github.com/qorelanguage/qore/issues/2314">issue 2314</a>)
303  - implemented support for chained synonyms (<a href="https://github.com/qorelanguage/qore/issues/2408">issue 2408</a>)
304  - allow to use DBA_* views instead of ALL_* if possible (<a href="https://github.com/qorelanguage/qore/issues/2418">issue 2418</a>)
305 
306  @subsection v123 OracleSqlUtil v1.2.3
307  - fixed a bug in \c character_semantics for standalone column (<a href="https://github.com/qorelanguage/qore/issues/1688">issue 1688</a>)
308  - implemented @ref cop_trunc_date() operator (<a href="https://github.com/qorelanguage/qore/issues/2032">issue 2032</a>)
309 
310  @subsection v122 OracleSqlUtil v1.2.2
311  - fixed a bug in the \a force option (i.e. cascade) for dropping types (<a href="https://github.com/qorelanguage/qore/issues/1683">issue 1683</a>)
312 
313  @subsection v121 OracleSqlUtil v1.2.1
314  - implemented the \a force option (i.e. cascade) for dropping code objects (<a href="https://github.com/qorelanguage/qore/issues/1314">issue 1314</a>)
315  - worked around ORA-22165 from op_in() caused by Oracle's limit on number of collection elements (<a href="https://github.com/qorelanguage/qore/issues/1660">issue 1660</a>)
316 
317  @subsection v12 OracleSqlUtil v1.2
318  - implemented support for the \c "returning" clause as an insert option
319  - implemented support for views for DML in the @ref OracleSqlUtil::OracleTable class
320  - implemented @ref OracleSqlUtil::OracleTable::getBaseType()
321  - implemented support for Oracle pseudocolumns in queries
322  - implemented support for @ref SqlUtil::cop_cast() operator
323  - fixed bugs in @ref SqlUtil::cop_seq() and @ref SqlUtil::cop_seq_currval() (<a href="https://github.com/qorelanguage/qore/issues/624">issue 624</a>)
324  - return lists from Oracle's data dictionary ordered
325  - implemented @ref OracleSqlUtil::OracleTable::bindEmptyStringsAsNull()
326  - implemented high-performance "upsert" (merge) support also supporting bulk DML
327  - implemented @ref SqlUtil::cop_substr() and @ref SqlUtil::uop_substr() operators (<a href="https://github.com/qorelanguage/qore/issues/801">issue 801</a>)
328  - implemented @ref SqlUtil::op_substr() where operator (<a href="https://github.com/qorelanguage/qore/issues/883">issue 883</a>)
329 
330  @subsection v11 OracleSqlUtil v1.1
331  - fixed selects with "limit" but no "offset"
332  - convert date/time values to timestamps with microseconds resolution instead of dates with second resolution when dynamically inserting values as strings in SQL (binding by value not affected)
333  - fixed schema information classes when the "string-numbers" driver option is enabled
334 
335  @subsection v10 OracleSqlUtil v1.0
336  - initial release
337 */
338 
340 namespace OracleSqlUtil {
342  OracleTable get_table(AbstractDatasource nds, string nname, *hash opts);
343 
344 
346  OracleDatabase get_database(AbstractDatasource nds, *hash opts);
347 
348 
351 
352 public:
353  public :
355  bool char_used;
358 
359 public:
360 
361  constructor(string n, string nt, *string qt, softint sz, bool nul, *string dv, *string cm, bool is_char = False, bool cu = False, softint bs) ;
362 
363 
365  string getNativeTypeString();
366 
367 
369 
376  list getAddColumnSql(AbstractTable t);
377 
378 
380 
390  list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
391 
392 
394 
404  string getRenameSql(AbstractTable t, string new_name);
405 
406 
408  bool equalImpl(AbstractColumn c);
409 
410  };
411 
414 
415 public:
416  constructor(string n, string nt, *string qt, softint sz, bool nul, *string dv, *string cm, softint bs, softint n_scale = 0) ;
417 
418 
419  string getNativeTypeString();
420 
421  };
422 
425 
426 public:
427  public :
429  string native_type;
430 
432  *string tablespace;
433 
434 public:
435 
437  constructor(string n, bool u, hash c, string nt, *string t) ;
438 
439 
441  string getCreateSql(string table_name, *hash opt);
442 
443 
445  bool equalImpl(AbstractIndex ix);
446 
447 
449  string getRenameSql(string table_name, string new_name);
450 
451  };
452 
455 
456 public:
457  public :
459  bool enabled;
460 
461 public:
462 
463  constructor(string n, Columns c, ForeignConstraintTarget t, bool e) ;
464 
465 
466  string getCreateSql(string table_name, *hash opt);
467 
468 
469  softlist getRenameSql(string table_name, string new_name);
470 
471 
473  string getDisableSql(string table_name);
474 
475 
477  string getEnableSql(string table_name, *hash opt);
478 
479  };
480 
483 
484 public:
485  public :
487  bool enabled;
488 
489 public:
490 
491  constructor(string n, string n_src, bool e = True) ;
492 
493 
494  string getCreateSql(string table_name, *hash opt);
495 
496 
497  softlist getRenameSql(string table_name, string new_name);
498 
499 
501  string getDisableSql(string table_name);
502 
503 
505  string getEnableSql(string table_name, *hash opt);
506 
507  };
508 
511 
512 public:
513  private :
515  bool enabled;
516 
518  *string tablespace;
519 
520 public:
521 
522  constructor(string n, hash n_cols, bool e = True, *string ts) ;
523 
524 
526 
541  OracleColumn memberGate(string k);
542 
543 
544  bool setIndexBase(string ix);
545 
546 
548  clearIndex();
549 
550 
551  string getCreateSql(string table_name, *hash opts);
552 
553 
554  softlist getRenameSql(string table_name, string new_name);
555 
556 
558  string getDisableSql(string table_name);
559 
560 
562  string getEnableSql(string table_name, *hash opt);
563 
564 
566  bool isEnabled();
567 
568 
570  *string getTablespace();
571 
572  };
573 
576 
577 public:
578  private :
580  *string tablespace;
581 
582 public:
583 
584  constructor();
585 
586 
587  constructor(string n, *hash c, *string ts) ;
588 
589 
591 
606  OracleColumn memberGate(string k);
607 
608 
609  bool setIndexBase(string ix);
610 
611 
613  clearIndex();
614 
615 
616  string getCreateSql(string table_name, *hash opts);
617 
618 
619  softlist getRenameSql(string table_name, string new_name);
620 
621 
623 
625  string getDropSql(string table_name);
626 
627 
629  string getDisableSql(string table_name);
630 
631 
633  string getEnableSql(string table_name, *hash opt);
634 
635  };
636 
639 
640 public:
642  constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
643 
644 
646  string getCreateSql(*hash opt);
647 
648 
650 
654  softlist getRenameSql(string new_name, *hash opt);
655 
656  };
657 
660 
661 public:
662  public :
664  *string type_text;
666  *string oid_text;
670  *string view_type;
672  *string superview_name;
675 
676 public:
677 
679  constructor(string n_name, string n_src, *string n_schema, *string n_type_text,
680  *string n_oid_text, *string n_view_type_owner,
681  *string n_view_type, *string n_superview_name,
682  bool n_updatable, bool n_container_data)
683  ;
684 
685 
687  string getCreateSql(*hash opt);
688 
689 
691 
695  softlist getRenameSql(string new_name, *hash opt);
696 
697  };
698 
701 
702 public:
703  public :
705  bool enabled;
706 
707 public:
708 
709  constructor(string n, string n_src, bool en = True) ;
710 
711 
712  softlist getCreateSql(string table_name, *hash opt);
713 
714 
716  bool equalImpl(AbstractFunctionBase t);
717 
718 
720  softlist getRenameSql(string table_name, string new_name);
721 
722 
724  softlist getDropSql(string table_name);
725 
726  };
727 
730 
731 public:
733 
737  constructor(string n, string n_type, string n_src) ;
738 
739 
741 
743  softlist getCreateSql(*hash opt);
744 
745 
747  bool equalImpl(AbstractFunctionBase t);
748 
749 
751 
755  softlist getRenameSql(string new_name, *hash opt);
756 
757  };
758 
761 
762 public:
764 
768  constructor(string n, string n_type, string n_src) ;
769 
770 
772 
777  softlist getRenameSql(string new_name, *hash opt);
778 
779  };
780 
783 
784 public:
785  constructor(string n_name, string n_src) ;
786 
787 
789 
791  string getDropSql(*hash opt);
792 
793  };
794 
797 
798 public:
800 
803  constructor(string n, string n_src) ;
804 
805  };
806 
809 
810 public:
812 
815  constructor(string n, string n_src) ;
816 
817  };
818 
821 
822 public:
823  public :
825  *string body_src;
826 
827 public:
828 
830 
834  constructor(string n, string n_src, *string n_body_src) ;
835 
836 
838  list getCreateSql(*hash opt);
839 
840 
842  bool equalImpl(AbstractFunctionBase t);
843 
844  };
845 
848 
849 public:
850  public :
852  bool logging;
854  bool use_index;
856  *string tablespace;
857 
858 public:
859 
861 
867  constructor(string n, string n_src, bool n_logging = True, bool n_use_index = True, *string n_tablespace) ;
868 
869 
871  softlist getCreateSql(*hash opt);
872 
873 
874  bool equalImpl(AbstractFunctionBase t);
875 
876  };
877 
880 
881 public:
882  public :
884  const OracleCreationOptions = AbstractDatabase::CreationOptions + (
885  "compute_statistics": Type::Boolean,
886  );
887 
889  const OracleAlignSchemaOptions = AbstractDatabase::AlignSchemaOptions
890  + OracleCreationOptions
891  + OracleTable::OracleAlignTableOptions
892  ;
893 
895 
903  const OracleSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + (
904  "types": Type::Hash,
905  "type_map": Type::Hash,
906 
907  "packages": Type::Hash,
908  "package_map": Type::Hash,
909 
910  "materialized_views": Type::Hash,
911  "materialized_view_map": Type::Hash,
912 
913  //"synonyms": Type::Hash,
914  //"synonym_map": Type::Hash,
915  );
916 
918  const OraclePackageDescriptionOptions = (
919  "src": Type::String,
920  "body": Type::String,
921  );
922 
924  const OracleMaterializedViewDescriptionOptions = (
925  "logging": Type::Boolean,
926  "use_index": Type::Boolean,
927  "tablespace": Type::String,
928  "src": Type::String,
929  );
930 
932  const OracleReservedWords = (
933  "access": True,
934  "else": True,
935  "modify": True,
936  "start": True,
937  "add": True,
938  "exclusive": True,
939  "noaudit": True,
940  "select": True,
941  "all": True,
942  "exists": True,
943  "nocompress": True,
944  "session": True,
945  "alter": True,
946  "file": True,
947  "not": True,
948  "set": True,
949  "and": True,
950  "float": True,
951  "notfound": True,
952  "share": True,
953  "any": True,
954  "for": True,
955  "nowait": True,
956  "size": True,
957  "arraylen": True,
958  "from": True,
959  "null": True,
960  "smallint": True,
961  "as": True,
962  "grant": True,
963  "number": True,
964  "sqlbuf": True,
965  "asc": True,
966  "group": True,
967  "of": True,
968  "successful": True,
969  "audit": True,
970  "having": True,
971  "offline": True,
972  "synonym": True,
973  "between": True,
974  "identified": True,
975  "on": True,
976  "sysdate": True,
977  "by": True,
978  "immediate": True,
979  "online": True,
980  "table": True,
981  "char": True,
982  "in": True,
983  "option": True,
984  "then": True,
985  "check": True,
986  "increment": True,
987  "or": True,
988  "to": True,
989  "cluster": True,
990  "index": True,
991  "order": True,
992  "trigger": True,
993  "column": True,
994  "initial": True,
995  "pctfree": True,
996  "uid": True,
997  "comment": True,
998  "insert": True,
999  "prior": True,
1000  "union": True,
1001  "compress": True,
1002  "integer": True,
1003  "privileges": True,
1004  "unique": True,
1005  "connect": True,
1006  "intersect": True,
1007  "public": True,
1008  "update": True,
1009  "create": True,
1010  "into": True,
1011  "raw": True,
1012  "user": True,
1013  "current": True,
1014  "is": True,
1015  "rename": True,
1016  "validate": True,
1017  "date": True,
1018  "level": True,
1019  "resource": True,
1020  "values": True,
1021  "decimal": True,
1022  "like": True,
1023  "revoke": True,
1024  "varchar": True,
1025  "default": True,
1026  "lock": True,
1027  "row": True,
1028  "varchar2": True,
1029  "delete": True,
1030  "long": True,
1031  "view": True,
1032  "desc": True,
1033  "maxextents": True,
1034  "rowlabel": True,
1035  "whenever": True,
1036  "distinct": True,
1037  "minus": True,
1038  "rownum": True,
1039  "where": True,
1040  "drop": True,
1041  "mode": True,
1042  "rows": True,
1043  "with": True,
1044  );
1045 
1047  const OracleRebuildIndexOptions = (
1048  "parallel" : Type::Boolean,
1049  "logging" : Type::Boolean,
1050  "statictics" : Type::Boolean,
1051  "tablespace" : Type::String,
1052  "cond_rebuild" : Type::Boolean,
1053  "cond_maxheight" : Type::Int,
1054  "cond_maxleafpct" : Type::Int,
1055  );
1056 
1058  const OracleComputeStatisticsOptions = ComputeStatisticsOptions + (
1059  "estimate_percent" : Type::Int,
1060  "block_sample" : Type::Boolean,
1061  "method_opt" : Type::String,
1062  "degree" : Type::Int,
1063  "granularity" : Type::String,
1064  "cascade" : Type::Boolean,
1065  "stattab" : Type::String,
1066  "statid" : Type::String,
1067  "options" : Type::String,
1068  "statown" : Type::String,
1069  );
1070 
1071 public:
1072 
1074  constructor(AbstractDatasource nds, *hash opts) ;
1075 
1076 
1077 
1078 private:
1079  list featuresImpl();
1080 public:
1081 
1082 
1083 
1084 private:
1085  OracleSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
1086 public:
1087 
1088 
1089 
1090 private:
1091  getSchemaName(reference<string> name, reference<string> schema);
1092 public:
1093 
1094 
1095 
1096 private:
1097  *AbstractSequence getSequenceImpl(string name);
1098 public:
1099 
1100 
1101 
1102 private:
1103  *AbstractView getViewImpl(string name);
1104 public:
1105 
1106 
1107 
1108 private:
1109  OracleFunction makeFunctionImpl(string name, string src, *hash opts);
1110 public:
1111 
1112 
1113 
1114 private:
1115  OracleProcedure makeProcedureImpl(string name, string src, *hash opts);
1116 public:
1117 
1118 
1119 
1120 private:
1121  OraclePackage makePackage(string name, string src, string body, *hash opts);
1122 public:
1123 
1124 
1125 
1126 private:
1127  OraclePackage makePackageFromDescription(string name, hash ph, *hash opts);
1128 public:
1129 
1130 
1131 
1132 private:
1133  OracleType makeType(string name, string src, *hash opts);
1134 public:
1135 
1136 
1137 
1138 private:
1139  OracleMaterializedView makeMaterializedView(string name, string src, bool logging = True, bool use_index = True, *string tablespace, *hash opts);
1140 public:
1141 
1142 
1143 
1144 private:
1145  OracleMaterializedView makeMaterializedViewFromDescription(string name, hash mvh, *hash opts);
1146 public:
1147 
1148 
1149 
1150 private:
1151  list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
1152 public:
1153 
1154 
1155 
1156 private:
1157  list getAlignSqlImpl(hash schema_hash, *hash opt);
1158 public:
1159 
1160 
1161 
1162 private:
1163  *OracleFunction getFunctionImpl(string name);
1164 public:
1165 
1166 
1167 
1168 private:
1169  *OracleProcedure getProcedureImpl(string name);
1170 public:
1171 
1172 
1174  *OraclePackage getPackage(string name);
1175 
1176 
1178  *OracleType getType(string name);
1179 
1180 
1182  *OracleMaterializedView getMaterializedView(string name);
1183 
1184 
1185 
1186 private:
1187  *string getSource(string type, string name);
1188 public:
1189 
1190 
1191 
1192 private:
1193  checkSource(string type, string name, reference<string> src);
1194 public:
1195 
1196 
1198  list listSynonyms();
1199 
1200 
1202  ListIterator synonymIterator();
1203 
1204 
1206  list listTypes();
1207 
1208 
1210  ListIterator typeIterator();
1211 
1212 
1214  list listPackages();
1215 
1216 
1218  ListIterator packageIterator();
1219 
1220 
1222  list listMaterializedViews();
1223 
1224 
1226  ListIterator materializedViewIterator();
1227 
1228 
1229 
1230 private:
1231  list listTablesImpl();
1232 public:
1233 
1234 
1235 
1236 private:
1237  list listFunctionsImpl();
1238 public:
1239 
1240 
1241 
1242 private:
1243  list listProceduresImpl();
1244 public:
1245 
1246 
1247 
1248 private:
1249  list listSequencesImpl();
1250 public:
1251 
1252 
1253 
1254 private:
1255  list listViewsImpl();
1256 public:
1257 
1258 
1259 
1260 private:
1261  list getListIntern(string type);
1262 public:
1263 
1264 
1265 
1266 private:
1267  list getListIntern(list l);
1268 public:
1269 
1270 
1271 
1272 private:
1273  string getCreateSqlImpl(list l);
1274 public:
1275 
1276 
1277  static string getCreateSql(list l);
1278 
1280 
1281 private:
1282  hash getCreationOptions();
1283 public:
1284 
1285 
1287 
1288 private:
1289  hash getAlignSchemaOptions();
1290 public:
1291 
1292 
1294 
1295 private:
1296  hash getSchemaDescriptionOptions();
1297 public:
1298 
1299 
1301 
1302 private:
1303  hash getRebuildIndexOptions();
1304 public:
1305 
1306 
1308 
1309 private:
1310  hash getComputeStatisticsOptions();
1311 public:
1312 
1313 
1315 
1316 private:
1317  softint getNextSequenceValueImpl(string name);
1318 public:
1319 
1320 
1322 
1323 private:
1324  softint getCurrentSequenceValueImpl(string name);
1325 public:
1326 
1327 
1329 
1330 private:
1331  bool supportsSequencesImpl();
1332 public:
1333 
1334 
1336 
1337 private:
1338  bool supportsTypesImpl();
1339 public:
1340 
1341 
1343 
1344 private:
1345  bool supportsPackagesImpl();
1346 public:
1347 
1348 
1350 
1362  bool rebuildIndexAnalyze(AbstractIndex index, int maxh, int maxleaf);
1363 
1364 
1366 
1378  bool rebuildIndexAnalyze(string name, int maxh, int maxleaf);
1379 
1380 
1382 
1383 private:
1384  bool rebuildIndexImpl(string name, *hash options);
1385 public:
1386 
1387 
1389 
1390 private:
1391  computeStatisticsImpl(*hash options);
1392 public:
1393 
1394 
1396 
1397 private:
1398  computeStatisticsSchemaImpl(*hash options);
1399 public:
1400 
1401 
1403 
1404 private:
1405  computeStatisticsTablesImpl(*hash options);
1406 public:
1407 
1408 
1410 
1411 private:
1412  reclaimSpaceImpl(*hash options);
1413 public:
1414 
1415 
1416  };
1417 
1419 
1422 
1423 public:
1424  public :
1426  const OraTypeMap = (
1427  "number": ("qore": Type::Number, "size": SZ_NUM, "size_range": (1, 38), "scale_range": (-84, 127)),
1428  "varchar2": ("qore": Type::String, "size": SZ_MAND, "size_range": (1, 4000), "is_char": True),
1429  "char": ("qore": Type::String, "size": SZ_MAND, "size_range": (1, 4000), "is_char": True),
1430  "date": ("qore": Type::Date,),
1431  "timestamp": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 9)),
1432  "timestamp with time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 9)),
1433  "timestamp with local time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 9)),
1434  "interval year to month": ("qore": Type::Date,),
1435  "interval day to second": ("qore": Type::Date,),
1436  "timestamp(0)": ("qore": Type::Date,),
1437  "timestamp(1)": ("qore": Type::Date,),
1438  "timestamp(2)": ("qore": Type::Date,),
1439  "timestamp(3)": ("qore": Type::Date,),
1440  "timestamp(4)": ("qore": Type::Date,),
1441  "timestamp(5)": ("qore": Type::Date,),
1442  "timestamp(6)": ("qore": Type::Date,),
1443  "timestamp(7)": ("qore": Type::Date,),
1444  "timestamp(8)": ("qore": Type::Date,),
1445  "timestamp(9)": ("qore": Type::Date,),
1446  "timestamp(0) with time zone": ("qore": Type::Date,),
1447  "timestamp(1) with time zone": ("qore": Type::Date,),
1448  "timestamp(2) with time zone": ("qore": Type::Date,),
1449  "timestamp(3) with time zone": ("qore": Type::Date,),
1450  "timestamp(4) with time zone": ("qore": Type::Date,),
1451  "timestamp(5) with time zone": ("qore": Type::Date,),
1452  "timestamp(6) with time zone": ("qore": Type::Date,),
1453  "timestamp(7) with time zone": ("qore": Type::Date,),
1454  "timestamp(8) with time zone": ("qore": Type::Date,),
1455  "timestamp(9) with time zone": ("qore": Type::Date,),
1456  "timestamp(0) with local time zone": ("qore": Type::Date,),
1457  "timestamp(1) with local time zone": ("qore": Type::Date,),
1458  "timestamp(2) with local time zone": ("qore": Type::Date,),
1459  "timestamp(3) with local time zone": ("qore": Type::Date,),
1460  "timestamp(4) with local time zone": ("qore": Type::Date,),
1461  "timestamp(5) with local time zone": ("qore": Type::Date,),
1462  "timestamp(6) with local time zone": ("qore": Type::Date,),
1463  "timestamp(7) with local time zone": ("qore": Type::Date,),
1464  "timestamp(8) with local time zone": ("qore": Type::Date,),
1465  "timestamp(9) with local time zone": ("qore": Type::Date,),
1466  "interval year(0) to month": ("qore": Type::Date,),
1467  "interval year(1) to month": ("qore": Type::Date,),
1468  "interval year(2) to month": ("qore": Type::Date,),
1469  "interval year(3) to month": ("qore": Type::Date,),
1470  "interval year(4) to month": ("qore": Type::Date,),
1471  "interval year(5) to month": ("qore": Type::Date,),
1472  "interval year(6) to month": ("qore": Type::Date,),
1473  "interval year(7) to month": ("qore": Type::Date,),
1474  "interval year(8) to month": ("qore": Type::Date,),
1475  "interval year(9) to month": ("qore": Type::Date,),
1476  "interval day(0) to second(0)": ("qore": Type::Date,),
1477  "interval day(0) to second(1)": ("qore": Type::Date,),
1478  "interval day(0) to second(2)": ("qore": Type::Date,),
1479  "interval day(0) to second(3)": ("qore": Type::Date,),
1480  "interval day(0) to second(4)": ("qore": Type::Date,),
1481  "interval day(0) to second(5)": ("qore": Type::Date,),
1482  "interval day(0) to second(6)": ("qore": Type::Date,),
1483  "interval day(0) to second(7)": ("qore": Type::Date,),
1484  "interval day(0) to second(8)": ("qore": Type::Date,),
1485  "interval day(0) to second(9)": ("qore": Type::Date,),
1486  "interval day(1) to second(0)": ("qore": Type::Date,),
1487  "interval day(1) to second(1)": ("qore": Type::Date,),
1488  "interval day(1) to second(2)": ("qore": Type::Date,),
1489  "interval day(1) to second(3)": ("qore": Type::Date,),
1490  "interval day(1) to second(4)": ("qore": Type::Date,),
1491  "interval day(1) to second(5)": ("qore": Type::Date,),
1492  "interval day(1) to second(6)": ("qore": Type::Date,),
1493  "interval day(1) to second(7)": ("qore": Type::Date,),
1494  "interval day(1) to second(8)": ("qore": Type::Date,),
1495  "interval day(1) to second(9)": ("qore": Type::Date,),
1496  "interval day(2) to second(0)": ("qore": Type::Date,),
1497  "interval day(2) to second(1)": ("qore": Type::Date,),
1498  "interval day(2) to second(2)": ("qore": Type::Date,),
1499  "interval day(2) to second(3)": ("qore": Type::Date,),
1500  "interval day(2) to second(4)": ("qore": Type::Date,),
1501  "interval day(2) to second(5)": ("qore": Type::Date,),
1502  "interval day(2) to second(6)": ("qore": Type::Date,),
1503  "interval day(2) to second(7)": ("qore": Type::Date,),
1504  "interval day(2) to second(8)": ("qore": Type::Date,),
1505  "interval day(2) to second(9)": ("qore": Type::Date,),
1506  "clob": ("qore": Type::String,),
1507  "blob": ("qore": Type::Binary,),
1508  "long": ("qore": Type::Binary,),
1509  "raw": ("qore": Type::Binary, "size": SZ_MAND, "size_range": (1, 2000)),
1510  "bfile": ("qore": Type::Binary,),
1511  "binary_float": ("qore": Type::Float,),
1512  "binary_double": ("qore": Type::Float,),
1513  "rowid": ("qore": Type::String,),
1514  "urowid": ("qore": Type::String, "size": SZ_OPT, "size_range": (1, 4000)),
1515  );
1516 
1518  const QoreTypeMap = (
1519  "integer": "number",
1520  "float": "number",
1521  "number": "number",
1522  "string": "varchar2",
1523  "date": "timestamp(6)",
1524  "binary": "blob",
1525  SqlUtil::CHAR: "char",
1526  SqlUtil::CLOB: "clob",
1527  SqlUtil::BLOB: "blob",
1528  );
1529 
1530  const OraColumnOpts = (
1531  "character_semantics": Type::Boolean,
1532  );
1533 
1535 
1538  const OraColumnOptions = AbstractTable::ColumnOptions + OraColumnOpts;
1539 
1541 
1544  const OraColumnDescOptions = AbstractTable::ColumnDescOptions + OraColumnOpts;
1545 
1547 
1550  const OracleIndexOptions = AbstractTable::IndexOptions + (
1551  "compute_statistics": Type::Boolean,
1552  );
1553 
1555 
1558  const OracleConstraintOptions = OracleIndexOptions + (
1559  "index": Type::String,
1560  );
1561 
1563  const OracleTableCreationOptions = AbstractTable::TableCreationOptions
1564  + OracleConstraintOptions
1565  + OraColumnOptions
1566  ;
1567 
1568  const OracleAlignTableOptions = AbstractTable::AlignTableOptions + OracleTableCreationOptions;
1569 
1571 
1575  const OracleSelectOptions = AbstractTable::SelectOptions + (
1576  "partition": Type::String,
1577  );
1578 
1580  const OracleOpMap = DefaultOpMap + (
1581  OP_IN: (
1582  "code": string (object t, string cn, softlist arg, reference<list> args, *hash jch, bool join = False, *hash ch, *hash psch) {
1583  // Qorus bug #989 SqlUtil: oracle op_in can fail in large amount of input elements
1584  // There is no support for CLOBs in WHERE clause in Oracle at all.
1585  // Binding large strings (over 4000 chars is performed by a CLOB in Qore driver.
1586  // Result of op_in operator can be "ORA-00932: inconsistent datatypes" if is
1587  // the list longer or if it contains large items with:
1588  // return cn + " in (select regexp_substr(%v,'[^,]+', 1, level) from dual connect by regexp_substr(%v, '[^,]+', 1, level) is not null)";
1589 
1590  // determine list members type. Let's assume the 1st non NULL/NOTHING
1591  // element gives the type code for all elements.
1592  ListIterator it(arg);
1593  int ltype;
1594  while (it.next());
1595 
1596 
1597  // Split long array to chunks of no more than 32767 elements due to Oracle limitation
1598  // "ORA-22165: OCI-22165: given index [32767] must be in the range of [0] to [32766]"
1599  int count;
1600  while (arg.size());
1601 
1602 
1603  if (count)
1604  return cn + " in (" + (map "select column_value from table(%v)", xrange(1,count)).join(" union all ") + ")";
1605  else
1606  return "1 != 1";
1607  throw "MISSING-ORACLE-DRIVER", "op_in requires oracle driver";
1608  },
1609  ),
1610  OP_SUBSTR: (
1611  "code": string (object t, string cn, auto arg, reference<list> args, *hash jch, bool join = False, *hash ch, *hash psch) {
1612  args += arg[0]; // start
1613  if (!exists arg[1]);
1614 
1615  args += arg[1]; // count
1616  args += arg[2]; // text
1617  return sprintf("substr(%s,%v,%v) = %v", cn);
1618  },
1619  ),
1620  );
1621 
1623  const OracleCopMap = (
1624  COP_CAST: (
1625  "code": string (string cve, list args) {
1626  string name = QoreTypeMap{args[0]} ?? args[0];
1627  hash desc = OraTypeMap{name};
1628  string sql = sprintf ("cast (%s as %s", cve, name);
1629  switch (name);
1630 
1631  sql += ")";
1632  return sql;
1633  },
1634  ),
1635  COP_SUBSTR: (
1636  "code": string (string cve, list args) {
1637  if (!exists args[1])
1638  return sprintf("substr(%s,%d)", cve, args[0]);
1639  return sprintf("substr(%s,%d,%d)", cve, args[0], args[1]);
1640  },
1641  ),
1642  COP_YEAR: (
1643  "code": string (string arg1, auto arg) {
1644  return sprintf("to_char(%s, 'YYYY')", arg1);
1645  }
1646  ),
1647  COP_YEAR_MONTH: (
1648  "code": string (string arg1, auto arg) {
1649  return sprintf("to_char(%s, 'YYYY-MM')", arg1);
1650  }
1651  ),
1652  COP_YEAR_DAY: (
1653  "code": string (string arg1, auto arg) {
1654  return sprintf("to_char(%s, 'YYYY-MM-DD')", arg1);
1655  }
1656  ),
1657  COP_YEAR_HOUR: (
1658  "code": string (string arg1, auto arg) {
1659  return sprintf("to_char(%s, 'YYYY-MM-DD HH24')", arg1);
1660  }
1661  ),
1662  COP_SEQ: (
1663  "nocolumn": True,
1664  "withalias": True,
1665  "code": string (*string cve, hash arg, reference<hash> psch) {
1666  string sql = sprintf("%s.nextval", arg.seq);
1667  if (arg.as);
1668 
1669  return sql;
1670  }
1671  ),
1672  COP_SEQ_CURRVAL: (
1673  "nocolumn": True,
1674  "withalias": True,
1675  "code": string (*string cve, hash arg, reference<hash> psch) {
1676  string sql = sprintf("%s.currval", arg.seq);
1677  if (arg.as);
1678 
1679  return sql;
1680  }
1681  ),
1682  COP_TRUNC_DATE: (
1683  "code": string sub(string arg1, auto arg) {
1684  if (!OracleTruncDate.hasKey(arg));
1685 
1686  // seconds are not part of TRUNC() in oracle
1687  if (exists OracleTruncDate{arg});
1688 
1689  // for timestamps
1690  return sprintf("cast (%s as date)", arg1);
1691  }
1692  )
1693  );
1694 
1696  const OracleTruncDate = (
1697  DT_YEAR : "'YYYY'",
1698  DT_MONTH : "'MM'",
1699  DT_DAY : "'DD'",
1700  DT_HOUR : "'HH24'",
1701  DT_MINUTE : "'MI'",
1702  DT_SECOND : NOTHING,
1703  );
1704 
1706  const OracleIopMap = DefaultIopMap + (
1707  IOP_SEQ: (
1708  "arg": Type::String,
1709  "immediate": True,
1710  "code": string (string cve, string arg) {
1711  return sprintf("%s.nextval", arg);
1712  },
1713  ),
1714  IOP_SEQ_CURRVAL: (
1715  "arg": Type::String,
1716  "immediate": True,
1717  "code": string (string cve, string arg) {
1718  return sprintf("%s.currval", arg);
1719  },
1720  ),
1721  );
1722 
1724  const OracleUopMap = DefaultUopMap + (
1725  COP_SEQ: (
1726  "nocolumn": True,
1727  "code": string (*string cve, string arg) {
1728  return sprintf("%s.nextval", arg);
1729  }
1730  ),
1731  COP_SEQ_CURRVAL: (
1732  "nocolumn": True,
1733  "code": string (*string cve, string arg) {
1734  return sprintf("%s.currval", arg);
1735  }
1736  ),
1737  );
1738 
1740  const OraclePseudoColumnHash = (
1741  "rowid": True,
1742  "rownum": True,
1743  "object_id": True,
1744  "object_value": True,
1745  "ora_rowscn": True,
1746  );
1747 
1748 public:
1749 
1750  private :
1751  // schema name
1752  string schema;
1753 
1754  // tablespace name
1755  *string tablespace;
1756 
1757  // is the table read only?
1758  bool readonly;
1759 
1760  // table comment
1761  *string comment;
1762 
1763  // dblink
1764  *string dblink;
1765 
1766  // Oracle server major version
1767  int ora_major;
1768 
1769  // helper flag to indicate if is the OracleTable real table or a view
1770  bool m_isView = False;
1771 
1772  // oraclesqlutil: allow to use DBA_* views instead of ALL_* if possible #2418
1773  // An internal cache to find the highest priority available
1774  // system dictionary object. Priority: DBA > ALL
1775  hash m_sys_views = (
1776  "dba_col_comments" : "all_col_comments",
1777  "dba_cons_columns" : "all_cons_columns",
1778  "dba_constraints" : "all_constraints",
1779  "dba_db_links" : "all_db_links",
1780  "dba_ind_columns" : "all_ind_columns",
1781  "dba_ind_expressions" : "all_ind_expressions",
1782  "dba_indexes" : "all_indexes",
1783  "dba_objects" : "all_objects",
1784  "dba_sequences" : "all_sequences",
1785  "dba_synonyms" : "all_synonyms",
1786  "dba_tab_columns" : "all_tab_columns",
1787  "dba_tab_comments" : "all_tab_comments",
1788  "dba_tables" : "all_tables",
1789  "dba_triggers" : "all_triggers",
1790  "dba_views" : "all_views",
1791  );
1792 
1793 public:
1794 
1795  constructor(AbstractDatasource nds, string nname, *hash opts) ;
1796 
1797 
1798  // oraclesqlutil: allow to use DBA_* views instead of ALL_* if possible #2418
1799  // get the most appropriate system catalogue/dictinary view available
1800 
1801 private:
1802  string systemView(string name);
1803 public:
1804 
1805 
1806 
1807 private:
1808  bool checkExistenceImpl();
1809 public:
1810 
1811 
1812 
1813 private:
1814  setTableInfoIntern();
1815 public:
1816 
1817 
1819  string getSqlName();
1820 
1821 
1823  bool isView();
1824 
1825 
1826 
1827 private:
1828  hash setSchemaTable();
1829 public:
1830 
1831 
1832 
1833 private:
1834  setDblinkSchema();
1835 public:
1836 
1837 
1838  // Oracle has supprt for unlimitted synonym loops. There
1839  // can be mo relevels of synonyms before the real object
1840  // is listed.
1841 
1842 private:
1843  *hash resolveSynonym(string s_owner, string s_name);
1844 public:
1845 
1846 
1847 
1848 private:
1849  hash setTable();
1850 public:
1851 
1852 
1853 
1854 private:
1855  string getUserSchema();
1856 public:
1857 
1858 
1859 
1860 private:
1861  string getDBString();
1862 public:
1863 
1864 
1866  string getSchemaName();
1867 
1868 
1870  *string getTablespaceName();
1871 
1872 
1874  *string getComment();
1875 
1876 
1877  bool readOnly();
1878 
1879 
1880 
1881 private:
1882  hash getColumnOptions();
1883 public:
1884 
1885 
1886 
1887 private:
1888  hash getColumnDescOptions();
1889 public:
1890 
1891 
1893 
1894 private:
1895  hash getSelectOptions();
1896 public:
1897 
1898 
1899 
1900 private:
1901  getSelectWhereSqlUnlocked(reference<string> sql, reference<list> args, *hash qh, *hash jch, bool join = False, *hash ch, *hash psch);
1902 public:
1903 
1904 
1905 
1906 private:
1907  doSelectOrderByWithOffsetSqlUnlockedImpl(reference<string> sql, reference<list> args, *hash qh, *hash jch, *hash ch, *hash psch, list coll);
1908 public:
1909 
1910 
1912 
1913 private:
1914  doSelectLimitOnlyUnlockedImpl(reference<string> sql, reference<list> args, *hash qh);
1915 public:
1916 
1917 
1918 
1919 private:
1920  Columns describeImpl();
1921 public:
1922 
1923 
1924 
1925 private:
1926  OraclePrimaryKey getPrimaryKeyImpl();
1927 public:
1928 
1929 
1930 
1931 private:
1932  Indexes getIndexesImpl();
1933 public:
1934 
1935 
1936 
1937 private:
1938  ForeignConstraints getForeignConstraintsImpl(*hash opts);
1939 public:
1940 
1941 
1942 
1943 private:
1944  Constraints getConstraintsImpl();
1945 public:
1946 
1947 
1948 
1949 private:
1950  string getSelectSqlName(*hash qh);
1951 public:
1952 
1953 
1954 
1955 private:
1956  Triggers getTriggersImpl();
1957 public:
1958 
1959 
1960  string getCreateTableSqlImpl(*hash opt);
1961 
1962 
1963 
1964 private:
1965  *list getCreateMiscSqlImpl(*hash opt, bool cache);
1966 public:
1967 
1968 
1969 
1970 private:
1971  string getCreateSqlImpl(list l);
1972 public:
1973 
1974 
1975 
1976 private:
1977  string getRenameSqlImpl(string new_name);
1978 public:
1979 
1980 
1981 
1982 private:
1983  AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
1984 public:
1985 
1986 
1987 
1988 private:
1989  AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
1990 public:
1991 
1992 
1993 
1994 private:
1995  AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
1996 public:
1997 
1998 
1999 
2000 private:
2001  AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch, *hash opt);
2002 public:
2003 
2004 
2005 
2006 private:
2007  AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
2008 public:
2009 
2010 
2011 
2012 private:
2013  AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
2014 public:
2015 
2016 
2017 
2018 private:
2019  AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
2020 public:
2021 
2022 
2023 
2024 private:
2025  bool tryInsertImpl(string sql, hash row);
2026 public:
2027 
2028 
2029 
2030 private:
2031  *list getAlignSqlImpl(AbstractTable t, *hash opt);
2032 public:
2033 
2034 
2035 
2036 private:
2037  hash getQoreTypeMapImpl();
2038 public:
2039 
2040 
2041 
2042 private:
2043  hash getTypeMapImpl();
2044 public:
2045 
2046 
2047 
2048 private:
2049  hash getIndexOptions();
2050 public:
2051 
2052 
2053 
2054 private:
2055  hash getConstraintOptions();
2056 public:
2057 
2058 
2059 
2060 private:
2061  hash getTableCreationOptions();
2062 public:
2063 
2064 
2065 
2066 private:
2067  hash getAlignTableOptions();
2068 public:
2069 
2070 
2072 
2073 private:
2074  hash getWhereOperatorMap();
2075 public:
2076 
2077 
2079 
2080 private:
2081  hash getColumnOperatorMapImpl();
2082 public:
2083 
2084 
2086 
2087 private:
2088  hash getInsertOperatorMap();
2089 public:
2090 
2091 
2093 
2094 private:
2095  hash getRawUpdateOperatorMap();
2096 public:
2097 
2098 
2100 
2101 private:
2102  *hash getPseudoColumnHash();
2103 public:
2104 
2105 
2107 
2108 private:
2109  *string getSqlValueImpl(auto v);
2110 public:
2111 
2112 
2114  string getColumnSqlName(string col);
2115 
2116 
2118  list getColumnSqlNames(softlist cols);
2119 
2120 
2122 
2125  string getBaseType();
2126 
2127 
2129  code getBulkUpsertClosure(hash example_row, int upsert_strategy = AbstractTable::UpsertAuto, *hash opt);
2130 
2131 
2133  code getUpsertClosure(hash row, int upsert_strategy = UpsertAuto, *hash opt);
2134 
2135 
2137 
2138 private:
2139  code getUpsertInsertOnly(Columns cols, hash row, *hash opt);
2140 public:
2141 
2142 
2144 
2145 private:
2146  code getUpsertUpdateOnly(Columns cols, hash row, *hash opt);
2147 public:
2148 
2149 
2151  bool hasArrayBind();
2152 
2153 
2155 
2157  bool bindEmptyStringsAsNull();
2158 
2159 
2161 
2162 private:
2163  bool asteriskRequiresPrefix();
2164 public:
2165 
2166 
2167 
2168 private:
2169  *hash doReturningImpl(hash opt, reference<string> sql, list args);
2170 public:
2171 
2172 
2173 
2174 private:
2175  bool emptyImpl();
2176 public:
2177 
2178 
2179 
2180 private:
2181  setupTableImpl(hash desc, *hash opt);
2182 public:
2183 
2184 
2186 
2187 private:
2188  bool constraintsLinkedToIndexesImpl();
2189 public:
2190 
2191 
2193 
2194 private:
2195  bool uniqueIndexCreatesConstraintImpl();
2196 public:
2197 
2198 
2200 
2201 private:
2202  bool supportsTablespacesImpl();
2203 public:
2204 
2205 
2207 
2208 private:
2209  copyImpl(AbstractTable old);
2210 public:
2211 
2212  };
2213 };
represents an Oracle unique constraint
Definition: OracleSqlUtil.qm.dox.h:510
const Date
represents an Oracle materialized view
Definition: OracleSqlUtil.qm.dox.h:847
date date(date dt)
const COP_SEQ
const Hash
the OracleSqlUtil namespace contains all the objects in the OracleSqlUtil module
Definition: OracleSqlUtil.qm.dox.h:340
const UpsertAuto
const String
const DefaultIopMap
string sprintf(string fmt,...)
const OP_IN
hash< ColumnOperatorInfo > cop_cast(auto column, string arg, auto arg1, auto arg2)
*string tablespace
the tablespace name of the index (if supported)
Definition: OracleSqlUtil.qm.dox.h:432
bool logging
Flag if is loggign mode used.
Definition: OracleSqlUtil.qm.dox.h:852
*string view_type_owner
Owner of the type of the view if the view is a typed view.
Definition: OracleSqlUtil.qm.dox.h:668
represents an Oracle table
Definition: OracleSqlUtil.qm.dox.h:1421
*string tablespace
Name of the potential tablespace.
Definition: OracleSqlUtil.qm.dox.h:856
*string superview_name
Name of the superview.
Definition: OracleSqlUtil.qm.dox.h:672
bool enabled
True if the trigger is enabled, False if not
Definition: OracleSqlUtil.qm.dox.h:705
const COP_SEQ_CURRVAL
const True
const SZ_MAND
const CHAR
bool enabled
True if the constraint is enabled, False if not
Definition: OracleSqlUtil.qm.dox.h:459
bool enabled
True if the constraint is enabled, False if not
Definition: OracleSqlUtil.qm.dox.h:487
represents an Oracle procedure
Definition: OracleSqlUtil.qm.dox.h:808
number number(softnumber n)
const COP_YEAR_HOUR
hash< UpdateOperatorInfo > uop_substr(int start, *int count, *hash< UpdateOperatorInfo > nest)
const IOP_SEQ_CURRVAL
const False
*string tablespace
any tablespace for the unique key index
Definition: OracleSqlUtil.qm.dox.h:518
bool enabled
True if the constraint is enabled, False if not
Definition: OracleSqlUtil.qm.dox.h:515
represents an Oracle view
Definition: OracleSqlUtil.qm.dox.h:659
RangeIterator xrange(int start, int stop, int step=1, auto val)
list list(...)
const Float
int index(softstring str, softstring substr, softint pos=0)
const DT_DAY
const Boolean
const SZ_NUM
date microseconds(softint us)
const Binary
*string oid_text
WITH OID clause of the typed view.
Definition: OracleSqlUtil.qm.dox.h:666
bool exists(...)
hash< ColumnOperatorInfo > cop_trunc_date(auto column, string mask)
bool use_index
Flag if is index used.
Definition: OracleSqlUtil.qm.dox.h:854
const COP_YEAR_MONTH
const BLOB
the Oracle specialization for SqlUtil::AbstractDatabase
Definition: OracleSqlUtil.qm.dox.h:879
int byte_size
byte size of the column
Definition: OracleSqlUtil.qm.dox.h:357
const CLOB
const NOTHING
string type(auto arg)
const COP_TRUNC_DATE
the base class for Oracle code objects that cannot be renamed in place
Definition: OracleSqlUtil.qm.dox.h:760
represents an Oracle check constraint
Definition: OracleSqlUtil.qm.dox.h:482
represents an Oracle number column
Definition: OracleSqlUtil.qm.dox.h:413
represents an Oracle package
Definition: OracleSqlUtil.qm.dox.h:820
hash< ColumnOperatorInfo > cop_seq(string seq, *string as)
const Int
const COP_YEAR
string string(softstring str, *string enc)
represents an Oracle column
Definition: OracleSqlUtil.qm.dox.h:350
*string type_text
Type clause of the typed view.
Definition: OracleSqlUtil.qm.dox.h:664
OracleDatabase get_database(AbstractDatasource nds, *hash opts)
returns an OracleDatabase object corresponding to the arguments
const COP_CAST
hash< OperatorInfo > op_in()
const DT_MINUTE
hash< ColumnOperatorInfo > cop_seq_currval(string seq, *string as)
const DT_HOUR
*string body_src
package body source
Definition: OracleSqlUtil.qm.dox.h:825
const DefaultUopMap
const COP_YEAR_DAY
*string tablespace
any tablespace for the primary key index
Definition: OracleSqlUtil.qm.dox.h:580
*string view_type
Type of the view if the view is a typed view.
Definition: OracleSqlUtil.qm.dox.h:670
const DT_MONTH
represents an Oracle sequence
Definition: OracleSqlUtil.qm.dox.h:638
represents an Oracle trigger
Definition: OracleSqlUtil.qm.dox.h:700
hash< OperatorInfo > op_substr(int start, *int count, string text)
OracleTable get_table(AbstractDatasource nds, string nname, *hash opts)
returns an OracleTable object corresponding to the arguments
hash hash(object obj)
bool container_data
Indicates whether the view contains container-specific data.
Definition: OracleSqlUtil.qm.dox.h:674
const COP_SUBSTR
const OracleSchemaDescriptionOptions
oracle-specific schema description keys
Definition: OracleSqlUtil.qm.dox.h:903
const OP_SUBSTR
hash< ColumnOperatorInfo > cop_substr(auto column, int start, *int count)
const SZ_OPT
const IOP_SEQ
represents an Oracle foreign constraint
Definition: OracleSqlUtil.qm.dox.h:454
represents an Oracle type
Definition: OracleSqlUtil.qm.dox.h:782
const DT_YEAR
represents an Oracle primary key
Definition: OracleSqlUtil.qm.dox.h:575
string native_type
the native type of the index (if supported)
Definition: OracleSqlUtil.qm.dox.h:429
string join(string str,...)
const Number
represents an Oracle index
Definition: OracleSqlUtil.qm.dox.h:424
const DefaultOpMap
bool char_used
the column uses character semantics
Definition: OracleSqlUtil.qm.dox.h:355
const DT_SECOND
represents an Oracle function
Definition: OracleSqlUtil.qm.dox.h:796
the base class for Oracle code objects
Definition: OracleSqlUtil.qm.dox.h:729