Qore SqlUtil Module Reference  1.7.3
SqlUtil.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* SqlUtil.qm Copyright (C) 2013 - 2021 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 Util module
28 
29 // requires the DataProvider module
30 
31 // don't use "$" signs for variables and class members, assume local variable scope
32 
33 // require type definitions everywhere
34 
35 // enable all warnings
36 
37 
38 // version history is included below in the docs
39 
2138 namespace SqlUtil {
2141  public struct GenericColumnInfo {
2143  string qore_type;
2145  string native_type;
2147  softint size;
2149  softint scale;
2155  *string comment;
2157  bool notnull = False;
2159  hash<string, hash> driver;
2162  };
2163 
2165  public struct OperatorInfo {
2166  string op;
2167  auto arg;
2168  };
2169 
2171  public struct ColumnOperatorInfo {
2172  string cop;
2173  auto column;
2174  auto arg;
2175  };
2176 
2178  public struct InsertOperatorInfo {
2179  string _iop;
2180  any arg;
2181  };
2182 
2184  public struct UpdateOperatorInfo {
2185  string uop;
2186  auto arg;
2188  };
2189 
2191  public struct JoinOperatorInfo {
2192  string jop;
2193  auto table;
2194  *string alias;
2197  *string ta;
2198  *hash<auto> opt;
2199  };
2200 
2204  *string date_format;
2205 
2207  *TimeZone data_timezone;
2208 
2210  *TimeZone db_timezone;
2211 
2213  *string number_format;
2214 
2216  *softbool mandatory;
2217 
2219 
2221  *softint maxlen;
2222  };
2223 
2225 
2227  public struct SqlCommandInfo {
2229  string sql;
2230 
2232  list<auto> args;
2233  };
2234 
2239 
2242  const DB_FUNCTIONS = "functions";
2244  const DB_MVIEWS = "materialized views";
2246  const DB_PACKAGES = "packages";
2248  const DB_PROCEDURES = "procedures";
2250  const DB_SEQUENCES = "sequences";
2252  const DB_TABLES = "tables";
2254  const DB_TYPES = "named types";
2256  const DB_VIEWS = "views";
2258  const DB_SYNONYMS = "synonyms";
2260 
2261  /* @defgroup SqlTypeConstants SQL Type Constants
2262  These constants can be used for the \c "qore_type" values when creating columns to specify additional SQL column types
2263  */
2265  const VARCHAR = "string";
2267 
2269  const NUMERIC = "number";
2270 
2272  const CHAR = "char";
2273 
2275  const BLOB = "blob";
2276 
2278  const CLOB = "clob";
2280 
2285  const SZ_NONE = 0;
2287 
2289  const SZ_MAND = 1;
2290 
2292  const SZ_OPT = 2;
2293 
2295  const SZ_NUM = 3;
2297 
2302 
2305  const COP_AS = "as";
2306 
2308 
2310  const COP_CAST = "cast";
2311 
2313 
2315  const COP_PREPEND = "prepend";
2316 
2318 
2320  const COP_APPEND = "append";
2321 
2323 
2325  const COP_VALUE = "value";
2326 
2328 
2330  const COP_UPPER = "upper";
2331 
2333 
2335  const COP_LOWER = "lower";
2336 
2338 
2340  const COP_DISTINCT = "distinct";
2341 
2343 
2345  const COP_MIN = "min";
2346 
2348 
2350  const COP_MAX = "max";
2351 
2353 
2355  const COP_AVG = "avg";
2356 
2358 
2360  const COP_SUM = "sum";
2361 
2363 
2365  const COP_COUNT = "count";
2366 
2368 
2370  const COP_OVER = "over";
2371 
2373 
2375  const COP_MINUS = "minus";
2376 
2378 
2380  const COP_PLUS = "plus";
2381 
2383 
2385  const COP_DIVIDE = "divide";
2386 
2388 
2390  const COP_MULTIPLY = "multiply";
2391 
2393 
2395  const COP_YEAR = "year";
2396 
2398 
2400  const COP_YEAR_MONTH = "year_month";
2401 
2403 
2405  const COP_YEAR_DAY = "year_day";
2406 
2408 
2410  const COP_YEAR_HOUR = "year_hour";
2411 
2413 
2415  const COP_SEQ = "seq";
2416 
2418 
2420  const COP_SEQ_CURRVAL = "seq_currval";
2421 
2423 
2425  const COP_COALESCE = "coalesce";
2426 
2428 
2430  const COP_SUBSTR = "substr";
2431 
2433 
2437  const COP_LENGTH = "length";
2438 
2440 
2446  const COP_TRUNC_DATE = "truncate_date";
2447 
2449 
2453  const COP_CUME_DIST = "cume_dist";
2454 
2456 
2460  const COP_DENSE_RANK = "dense_rank";
2461 
2463 
2467  const COP_FIRST_VALUE = "first_value";
2468 
2470 
2474  const COP_LAST_VALUE = "last_value";
2475 
2477 
2481  const COP_NTILE = "ntile";
2482 
2484 
2488  const COP_PERCENT_RANK = "percent_rank";
2489 
2491 
2495  const COP_RANK = "rank";
2496 
2498 
2502  const COP_ROW_NUMBER = "row_number";
2503 
2505  const DefaultCopMap = ...;
2506 
2508 
2550 
2559  hash<ColumnOperatorInfo> make_cop(string cop, auto column, auto arg);
2560 
2561 
2563 
2575  hash<ColumnOperatorInfo> cop_as(auto column, string arg);
2576 
2577 
2579 
2593  hash<ColumnOperatorInfo> cop_cast(auto column, string arg, auto arg1, auto arg2);
2594 
2595 
2597 
2607  hash<ColumnOperatorInfo> cop_prepend(auto column, string arg);
2608 
2609 
2611 
2621  hash<ColumnOperatorInfo> cop_append(auto column, string arg);
2622 
2623 
2625 
2753  hash<ColumnOperatorInfo> cop_value(auto arg);
2754 
2755 
2757 
2766  hash<ColumnOperatorInfo> cop_upper(auto column);
2767 
2768 
2770 
2779  hash<ColumnOperatorInfo> cop_lower(auto column);
2780 
2781 
2783 
2792  hash<ColumnOperatorInfo> cop_distinct(auto column);
2793 
2794 
2796 
2805  hash<ColumnOperatorInfo> cop_min(auto column);
2806 
2807 
2809 
2818  hash<ColumnOperatorInfo> cop_max(auto column);
2819 
2820 
2822 
2831  hash<ColumnOperatorInfo> cop_avg(auto column);
2832 
2833 
2835 
2844  hash<ColumnOperatorInfo> cop_sum(auto column);
2845 
2846 
2848 
2855  hash<ColumnOperatorInfo> cop_count(auto column = '');
2856 
2857 
2859 
2866  hash<ColumnOperatorInfo> cop_over(auto column, *string partitionby, *string orderby);
2867 
2868 
2870 
2880  hash<ColumnOperatorInfo> cop_minus(auto column1, auto column2);
2881 
2882 
2884 
2894  hash<ColumnOperatorInfo> cop_plus(auto column1, auto column2);
2895 
2896 
2898 
2908  hash<ColumnOperatorInfo> cop_divide(auto column1, auto column2);
2909 
2910 
2912 
2922  hash<ColumnOperatorInfo> cop_multiply(auto column1, auto column2);
2923 
2924 
2926 
2935  hash<ColumnOperatorInfo> cop_year(auto column);
2936 
2937 
2939 
2948  hash<ColumnOperatorInfo> cop_year_month(auto column);
2949 
2950 
2952 
2961  hash<ColumnOperatorInfo> cop_year_day(auto column);
2962 
2963 
2965 
2974  hash<ColumnOperatorInfo> cop_year_hour(auto column);
2975 
2976 
2978 
2988  hash<ColumnOperatorInfo> cop_seq(string seq, *string as);
2989 
2990 
2992 
3002  hash<ColumnOperatorInfo> cop_seq_currval(string seq, *string as);
3003 
3004 
3006 
3018  hash<ColumnOperatorInfo> cop_coalesce(auto col1, auto col2);
3019 
3020 
3022 
3033  hash<ColumnOperatorInfo> cop_substr(auto column, int start, *int count);
3034 
3035 
3037 
3048  hash<ColumnOperatorInfo> cop_length(auto column);
3049 
3050 
3052 
3066  hash<ColumnOperatorInfo> cop_trunc_date(auto column, string mask);
3067 
3068 
3069 
3071 
3099  hash<ColumnOperatorInfo> cop_cume_dist();
3100 
3101 
3103 
3131  hash<ColumnOperatorInfo> cop_dense_rank();
3132 
3133 
3135 
3163  hash<ColumnOperatorInfo> cop_first_value(any column);
3164 
3165 
3167 
3195  hash<ColumnOperatorInfo> cop_last_value(any column);
3196 
3197 
3199 
3229  hash<ColumnOperatorInfo> cop_ntile(int value);
3230 
3231 
3233 
3261  hash<ColumnOperatorInfo> cop_percent_rank();
3262 
3263 
3265 
3293  hash<ColumnOperatorInfo> cop_rank();
3294 
3295 
3297 
3325  hash<ColumnOperatorInfo> cop_row_number();
3326 
3327 
3329 
3380  const DT_YEAR = "Y";
3382 
3384  const DT_MONTH = "M";
3385 
3387  const DT_DAY = "D";
3388 
3390  const DT_HOUR = "H";
3391 
3393  const DT_MINUTE = "m";
3394 
3396  const DT_SECOND = "S";
3397 
3398  // let's simulate and enum here'
3399  const DT_ALL_VALUES = ( DT_YEAR, DT_MONTH, DT_DAY, DT_HOUR, DT_MINUTE, DT_SECOND );
3401 
3406  const DefaultUopMap = ...;
3408 
3410 
3432 
3441  hash<UpdateOperatorInfo> make_uop(string uop, auto arg, *hash<UpdateOperatorInfo> nest);
3442 
3443 
3445 
3455  hash<UpdateOperatorInfo> uop_prepend(string arg, *hash<UpdateOperatorInfo> nest);
3456 
3457 
3459 
3469  hash<UpdateOperatorInfo> uop_append(string arg, *hash<UpdateOperatorInfo> nest);
3470 
3471 
3473 
3482  hash<UpdateOperatorInfo> uop_upper(*hash<UpdateOperatorInfo> nest);
3483 
3484 
3486 
3495  hash<UpdateOperatorInfo> uop_lower(*hash<UpdateOperatorInfo> nest);
3496 
3497 
3499 
3510  hash<UpdateOperatorInfo> uop_substr(int start, *int count, *hash<UpdateOperatorInfo> nest);
3511 
3512 
3514 
3524  hash<UpdateOperatorInfo> uop_plus(auto arg, *hash<UpdateOperatorInfo> nest);
3525 
3526 
3528 
3538  hash<UpdateOperatorInfo> uop_minus(auto arg, *hash<UpdateOperatorInfo> nest);
3539 
3540 
3542 
3552  hash<UpdateOperatorInfo> uop_multiply(auto arg, *hash<UpdateOperatorInfo> nest);
3553 
3554 
3556 
3566  hash<UpdateOperatorInfo> uop_divide(auto arg, *hash<UpdateOperatorInfo> nest);
3567 
3568 
3570 
3579  hash<UpdateOperatorInfo> uop_seq(string seq);
3580 
3581 
3583 
3592  hash<UpdateOperatorInfo> uop_seq_currval(string seq);
3593 
3595 
3602 
3605  const JOP_INNER = "inner";
3606 
3608 
3610  const JOP_LEFT = "left";
3611 
3613 
3615  const JOP_RIGHT = "right";
3616 
3618  const JopMap = ...;
3619 
3621 
3631 
3635  hash<string, hash<JoinOperatorInfo>> make_jop(string jop, AbstractTable table, *string alias, *hash jcols, *hash cond, *string ta, *hash<auto> opt);
3636 
3637 
3639 
3643  hash<string, hash<JoinOperatorInfo>> make_jop(string jop, string table_name, *string alias, *hash jcols, *hash cond, *string ta, *hash<auto> opt);
3644 
3645 
3647 
3666  hash<string, hash<JoinOperatorInfo>> join_inner(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3667 
3668 
3670 
3689  hash<string, hash<JoinOperatorInfo>> join_inner(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3690 
3691 
3693 
3712  hash<string, hash<JoinOperatorInfo>> join_inner(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3713 
3714 
3716 
3738  hash<string, hash<JoinOperatorInfo>> join_inner(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3739 
3740 
3742 
3762  hash<string, hash<JoinOperatorInfo>> join_inner(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3763 
3764 
3766 
3788  hash<string, hash<JoinOperatorInfo>> join_inner_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3789 
3790 
3792 
3811  hash<string, hash<JoinOperatorInfo>> join_left(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3812 
3813 
3815 
3834  hash<string, hash<JoinOperatorInfo>> join_left(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3835 
3836 
3838 
3859  hash<string, hash<JoinOperatorInfo>> join_left(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3860 
3861 
3863 
3883  hash<string, hash<JoinOperatorInfo>> join_left(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3884 
3885 
3887 
3907  hash<string, hash<JoinOperatorInfo>> join_left(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3908 
3909 
3911 
3933  hash<string, hash<JoinOperatorInfo>> join_left_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3934 
3935 
3937 
3956  hash<string, hash<JoinOperatorInfo>> join_right(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3957 
3958 
3960 
3979  hash<string, hash<JoinOperatorInfo>> join_right(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3980 
3981 
3983 
4004  hash<string, hash<JoinOperatorInfo>> join_right(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4005 
4006 
4008 
4028  hash<string, hash<JoinOperatorInfo>> join_right(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4029 
4030 
4032 
4052  hash<string, hash<JoinOperatorInfo>> join_right(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4053 
4054 
4056 
4078  hash<string, hash<JoinOperatorInfo>> join_right_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4079 
4081 
4086 
4089  const OP_LIKE = "like";
4090 
4092 
4094  const OP_LT = "<";
4095 
4097 
4099  const OP_LE = "<=";
4100 
4102 
4104  const OP_GT = ">";
4105 
4107 
4109  const OP_GE = ">=";
4110 
4112 
4114  const OP_NE = "!=";
4115 
4117 
4119  const OP_EQ = "=";
4120 
4122 
4124  const OP_CLT = "C<";
4125 
4127 
4129  const OP_CLE = "C<=";
4130 
4132 
4134  const OP_CGT = "C>";
4135 
4137 
4139  const OP_CGE = "C>=";
4140 
4142 
4144  const OP_CNE = "C!=";
4145 
4147 
4149  const OP_CEQ = "C=";
4150 
4152 
4154  const OP_BETWEEN = "between";
4155 
4157 
4159  const OP_IN = "in";
4160 
4162 
4164  const OP_NOT = "not";
4165 
4167 
4169  const OP_SUBSTR = "substr";
4170 
4172 
4174  const OP_OR = "or";
4175 
4177 
4179  const OP_IN_SELECT = "in_select";
4180 
4182  const DefaultOpMap = ...;
4183 
4185 
4209  hash<OperatorInfo> make_op(string op, auto arg);
4211 
4212 
4214 
4223  hash<OperatorInfo> op_like(string str);
4224 
4225 
4227 
4238  hash<OperatorInfo> op_lt(auto arg);
4239 
4240 
4242 
4253  hash<OperatorInfo> op_le(auto arg);
4254 
4255 
4257 
4268  hash<OperatorInfo> op_gt(auto arg);
4269 
4270 
4272 
4283  hash<OperatorInfo> op_ge(auto arg);
4284 
4285 
4287 
4300  hash<OperatorInfo> op_ne(auto arg);
4301 
4302 
4304 
4317  hash<OperatorInfo> op_eq(auto arg);
4318 
4319 
4321 
4333  hash<OperatorInfo> op_between(auto l, auto r);
4334 
4335 
4337 
4346  hash<OperatorInfo> op_in();
4347 
4348 
4350 
4357  hash<OperatorInfo> op_in_select(string table, hash<auto> select_hash);
4358 
4359 
4361 
4368  hash<OperatorInfo> op_in_select(AbstractTable table, hash<auto> select_hash);
4369 
4370 
4372 
4379  hash<OperatorInfo> op_in_select(Table table, hash<auto> select_hash);
4380 
4381 
4383 
4394  hash<OperatorInfo> op_in(list<auto> args);
4395 
4396 
4398 
4405  hash<OperatorInfo> op_not(hash arg);
4406 
4407 
4409 
4420  hash<OperatorInfo> op_clt(string arg);
4421 
4422 
4424 
4435  hash<OperatorInfo> op_cle(string arg);
4436 
4437 
4439 
4450  hash<OperatorInfo> op_cgt(string arg);
4451 
4452 
4454 
4465  hash<OperatorInfo> op_cge(string arg);
4466 
4467 
4469 
4480  hash<OperatorInfo> op_cne(string arg);
4481 
4482 
4484 
4495  hash<OperatorInfo> op_ceq(string arg);
4496 
4497 
4499 
4510  hash<OperatorInfo> op_substr(int start, *int count, string text);
4511 
4512 
4514 
4524  hash<OperatorInfo> op_substr(int start, string text);
4525 
4526 
4528 
4545  hash<string, hash<OperatorInfo>> wop_or(hash h1, hash h2);
4546 
4548 
4555 
4558  const IOP_SEQ = "seq";
4559 
4561 
4563  const IOP_SEQ_CURRVAL = "seq_currval";
4564 
4566  const DefaultIopMap = {};
4568 
4574 
4582  hash<InsertOperatorInfo> make_iop(string iop, auto arg);
4583 
4584 
4586 
4595  hash<InsertOperatorInfo> iop_seq(string arg);
4596 
4597 
4599 
4608  hash<InsertOperatorInfo> iop_seq_currval(string arg);
4609 
4611 
4613  const SqlUtilDrivers = ...;
4614 
4615 
4616  // private variable to store the closure used to deserialize datasources (if any)
4617  extern code ds_get;
4618 
4619  // private variable to store the closure used to serialize datasources (if any)
4620  extern code ds_do;
4621 
4623  sqlutil_register_ds_deserializer(*code new_ds_get);
4624 
4625 
4627  sqlutil_register_ds_serializer(*code new_ds_do);
4628 
4629 
4630  // private function used to deserialize datasources
4631  AbstractDatasource sqlutil_get_ds(string type, string config);
4632 
4633 
4634  // private function used to serialize datasources
4635  hash<auto> sqlutil_ds(AbstractDatasource ds);
4636 
4637 
4639 class AbstractHashContainer : public Serializable {
4640 
4641 public:
4642 
4643 
4644 protected:
4647 
4648 public:
4649 
4651  constructor(*hash nh);
4652 
4653 
4656 
4657 
4660 
4661 
4663 
4678  auto memberGate(string k);
4679 
4680 
4682 
4688  clear();
4689 
4690 
4692  abstract auto take(string k);
4693 
4695  renameKey(string old_name, string new_name);
4696 
4697 
4699  *hash<auto> getHash();
4700 
4701 
4703 
4712  bool matchKeys(hash h1);
4713 
4714 
4716 
4725  bool matchKeys(list<auto> l);
4726 
4727 
4729 
4739 
4740 
4742 
4751  bool partialMatchKeys(hash h1);
4752 
4753 
4755 
4764  bool partialMatchKeys(list<auto> l);
4765 
4766 
4768 
4778 
4779 
4781 
4790  bool val();
4791 
4792 
4794 
4801  list<string> keys();
4802 
4803 
4805 
4812  list<auto> values();
4813 
4814 
4816 
4824 
4825 
4827 
4835 
4836 
4838 
4846 
4847 
4849  bool empty();
4850 
4851 
4853 
4860  int size();
4861 
4862 
4864 
4873  bool hasKey(string k);
4874 
4875 
4877 
4886  bool hasKeyValue(string k);
4887 
4888 
4890 
4899  *string firstKey();
4900 
4901 
4903 
4912  *string lastKey();
4913 
4914 
4916  abstract string getElementName();
4917  };
4918 
4920 class AbstractListContainer : public Serializable {
4921 
4922 public:
4923 
4924 
4925 protected:
4926  softlist l;
4927 
4928 public:
4929 
4931  constructor(softlist nl);
4932 
4933 
4935 
4946  abstract auto get(softint i);
4947 
4949  add(auto val);
4950 
4951 
4953  auto take(int i);
4954 
4955 
4957  list<auto> getList();
4958 
4959 
4961 
4970  bool val();
4971 
4972 
4974 
4982 
4983 
4985  bool empty();
4986 
4987 
4989 
4996  int size();
4997 
4998 
5000  abstract string getElementName();
5001 
5002 protected:
5003  checkIndex(int i);
5004 public:
5005 
5006  };
5007 
5010 
5011 public:
5013  constructor();
5014 
5015 
5017  constructor(AbstractDatasource ds, hash tables, *hash<auto> opt);
5018 
5019 
5021  constructor(AbstractDatasource ds);
5022 
5023 
5025  add(string k, Table val);
5026 
5027 
5029  add(string k, AbstractTable val);
5030 
5031 
5033  add(Table val);
5034 
5035 
5038 
5039 
5041  AbstractTable take(string k);
5042 
5043 
5045  populate(AbstractDatasource ds, hash<auto> tables, *hash<auto> opt);
5046 
5047 
5049  populate(AbstractDatasource ds);
5050 
5051 
5053 
5069  *list<auto> getDropAllForeignConstraintsOnTableSql(string name, *hash<auto> opt);
5070 
5071 
5073 
5088  AbstractTable memberGate(string k);
5089 
5090 
5092  string getElementName();
5093 
5094 
5096  *AbstractTable getIfExists(AbstractDatasource ds, string name);
5097 
5098 
5100  AbstractTable get(AbstractDatasource ds, string name);
5101 
5102 
5104 
5119  *string getRenameTableIfExistsSql(string old_name, string new_name, *hash<auto> opts);
5120 
5121 
5123 
5134  bool tableRenamed(string old_name, string new_name, string old_sql_name);
5135 
5136 
5137 protected:
5138  tableRenamedIntern(string old_name, string new_name, string oldsn);
5139 public:
5140 
5141 
5143 
5158  *string getDropConstraintIfExistsSql(string tname, string cname, *hash<auto> opts);
5159 
5160 
5161  list<auto> getCreateList();
5162 
5163 
5164  Qore::AbstractIterator createIterator();
5165 
5166 
5168 
5176  list<auto> getDropList();
5177 
5178 
5180 
5188 
5189 
5190 protected:
5191  getDependencies(reference<hash> tdh, reference<hash> sdh, *reference<hash> th);
5192 public:
5193 
5194  };
5195 
5198 
5199 public:
5201  constructor(*hash c) ;
5202 
5203 
5205  constructor(Columns old) ;
5206 
5207 
5209  add(string k, AbstractColumn val);
5210 
5211 
5213  AbstractColumn take(string k);
5214 
5215 
5217 
5232  AbstractColumn memberGate(string k);
5233 
5234 
5236  Columns subset(softlist l);
5237 
5238 
5240  string getElementName();
5241 
5242 
5244  bool equal(Columns cols);
5245 
5246 
5248  AbstractIterator getSqlColumnNameIterator();
5249 
5250  };
5251 
5253 class AbstractDdlObject : public Serializable {
5254 
5255 public:
5257  string name;
5258 
5260  string ddl_name;
5261 
5263 protected:
5264  constructor();
5265 public:
5266 
5267 
5269  constructor(string name);
5270 
5271 
5273 
5275  abstract string getDdlName(string name);
5276  };
5277 
5280 
5281 public:
5283  string native_type;
5284 
5286  *string qore_type;
5287 
5289  int size;
5290 
5292  bool nullable;
5293 
5295  *string def_val;
5296 
5298  *string comment;
5299 
5301 protected:
5302  constructor();
5303 public:
5304 
5305 
5306  constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string c)
5307  ;
5308 
5309 
5311  string getNativeTypeString();
5312 
5313 
5315  string getCreateSql(AbstractTable t);
5316 
5317 
5319 
5328  abstract list<auto> getAddColumnSql(AbstractTable t);
5329 
5331  string getDropSql(string table_name);
5332 
5333 
5335 
5348  list<auto> getModifySql(AbstractTable t, AbstractColumn c, *hash<auto> opt);
5349 
5350 
5352 
5362  abstract string getRenameSql(AbstractTable t, string new_name);
5363 
5365  bool equal(AbstractColumn c);
5366 
5367 
5369 protected:
5370  abstract bool equalImpl(AbstractColumn c);
5371 public:
5372 
5374 
5387 protected:
5388  abstract list<auto> getModifySqlImpl(AbstractTable t, AbstractColumn c, *hash<auto> opt);
5389 public:
5390  };
5391 
5393 class NumericColumnInfo : public Serializable {
5394 
5395 public:
5397  int scale;
5398 
5399  constructor(softint n_scale = 0);
5400 
5401 
5403  string getNativeTypeString(string native_type, int precision);
5404 
5405  };
5406 
5409 
5410 public:
5411  constructor(*hash c) ;
5412 
5413 
5415  add(string k, AbstractIndex val);
5416 
5417 
5420 
5421 
5423  AbstractIndex take(string k);
5424 
5425 
5427  *AbstractIndex tryTake(string k);
5428 
5429 
5431 
5446  AbstractIndex memberGate(string k);
5447 
5448 
5449  string getElementName();
5450 
5451  };
5452 
5454 class AbstractIndex : public Serializable {
5455 
5456 public:
5458  string name;
5459 
5461  bool unique;
5462 
5465 
5466 protected:
5469 
5472 
5473 public:
5474 
5476  constructor(string n, bool u, hash c);
5477 
5478 
5480  string getName();
5481 
5482 
5484  bool hasColumn(string cname);
5485 
5486 
5488  abstract string getCreateSql(string table_name, *hash<auto> opt);
5489 
5491  string getDropSql(string table_name);
5492 
5493 
5495  bool equal(AbstractIndex ix);
5496 
5497 
5499  bool equalExceptName(AbstractIndex ix);
5500 
5501 
5503  abstract bool equalImpl(AbstractIndex ix);
5504 
5506  abstract string getRenameSql(string table_name, string new_name);
5507 
5510 
5511 
5514 
5515 
5518 
5519 
5522 
5523 
5526 
5527 
5530 
5531 
5533  *list<AbstractColumnConstraint> getAllSupportingConstraints();
5534 
5535 
5537  list<auto> getRecreateSql(AbstractDatasource ds, string table_name, *hash<auto> opt);
5538 
5539  };
5540 
5543 
5544 public:
5545  constructor(*hash c) ;
5546 
5547 
5549  add(string k, AbstractConstraint val);
5550 
5551 
5553  AbstractConstraint take(string k);
5554 
5555 
5558 
5559 
5561 
5576  AbstractConstraint memberGate(string k);
5577 
5578 
5579  string getElementName();
5580 
5581  };
5582 
5584 class AbstractConstraint : public Serializable {
5585 
5586 public:
5587 
5588 
5589 protected:
5591  string name;
5592 
5593 public:
5594 
5596  constructor(string n);
5597 
5598 
5600  string getName();
5601 
5602 
5604  rename(string n);
5605 
5606 
5608  abstract string getCreateSql(string table_name, *hash<auto> opt);
5609 
5611  string getDropSql(string table_name);
5612 
5613 
5615  abstract list<auto> getRenameSql(string table_name, string new_name);
5616 
5618  string getDisableSql(string table_name);
5619 
5620 
5622  string getEnableSql(string table_name, *hash<auto> opt);
5623 
5624 
5626  bool equal(AbstractConstraint c);
5627 
5628 
5630 protected:
5631  abstract bool equalImpl(AbstractConstraint c);
5632 public:
5633 
5635  abstract bool setIndexBase(string ix);
5636 
5638  abstract clearIndex();
5639 
5641  bool hasColumn(string cname);
5642 
5643  };
5644 
5647 
5648 public:
5650  string src;
5651 
5653  constructor(string n, string n_src) ;
5654 
5655 
5657 protected:
5658  bool equalImpl(AbstractConstraint c);
5659 public:
5660 
5661 
5663  bool setIndexBase(string ix);
5664 
5665 
5667  clearIndex();
5668 
5669  };
5670 
5673 
5674 public:
5675 protected:
5677  *string index;
5678 
5679 public:
5680 
5682  constructor(string name, *hash<auto> cols, *string index) ;
5683 
5684 
5686  constructor(string name, Columns cols, *string index) ;
5687 
5688 
5690  bool setIndexBase(string ix);
5691 
5692 
5694  clearIndex();
5695 
5696  };
5697 
5700 
5701 public:
5702 protected:
5704  *hash<string, hash<string, AbstractForeignConstraint>> sourceConstraints;
5705 
5706 public:
5707 
5709  constructor(string name, *hash<auto> cols, *string index) ;
5710 
5711 
5713  constructor(string name, Columns cols, *string index) ;
5714 
5715 
5717 
5722 
5723 
5725  hash<auto> getDisableReenableSql(AbstractDatasource ds, string table_name, *hash<auto> opts);
5726 
5727 
5729  findMatchingIndex(*Indexes indexes);
5730 
5731 
5733 
5744 
5745 
5747  removeSourceConstraint(string tname, list<auto> cols);
5748 
5749 
5751  renameSourceConstraintTable(string old_name, string new_name);
5752 
5753 
5755  bool hasColumn(string cname);
5756 
5757 
5759  *string getIndex();
5760 
5761 
5763 protected:
5764  bool equalImpl(AbstractConstraint c);
5765 public:
5766 
5767 
5769  abstract string getCreateSql(string table_name, *hash<auto> opts);
5770  };
5771 
5774 
5775 public:
5777  constructor(string n, *hash<auto> c, *string n_index) ;
5778 
5779  };
5780 
5783 
5784 public:
5785  constructor() ;
5786 
5787 
5788  constructor(string n, *hash<auto> c) ;
5789 
5790  };
5791 
5794 
5795 public:
5796  constructor(*hash<auto> c) ;
5797 
5798 
5800  add(string k, AbstractForeignConstraint val);
5801 
5802 
5804  AbstractForeignConstraint take(string k);
5805 
5806 
5809 
5810 
5812 
5828 
5829 
5831  *hash<auto> findConstraintOn(string table, softlist<auto> cols);
5832 
5833 
5835  string getElementName();
5836 
5837  };
5838 
5840 class ForeignConstraintTarget : public Serializable {
5841 
5842 public:
5844  string table;
5845 
5848 
5850  constructor(string t, Columns c);
5851 
5852 
5854  bool equal(ForeignConstraintTarget targ);
5855 
5856  };
5857 
5860 
5861 public:
5864 
5865  constructor(string name, Columns cols, ForeignConstraintTarget t) ;
5866 
5867 
5869 protected:
5870  bool equalImpl(AbstractConstraint con);
5871 public:
5872 
5873  };
5874 
5876 class AbstractSequence : public Serializable {
5877 
5878 public:
5880  string name;
5881 
5884 
5887 
5890 
5892  constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_max);
5893 
5894 
5896  abstract string getCreateSql(*hash<auto> opt);
5897 
5899 
5901  string getDropSql(*hash<auto> opt);
5902 
5903 
5905 
5908  abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
5909  };
5910 
5912 class AbstractView : public Serializable {
5913 
5914 public:
5915  // ! potential object schema
5916  *string schema;
5917 
5919  string name;
5920 
5922  string src;
5923 
5926 
5928  constructor(string n_name, string n_src);
5929 
5930 
5932  abstract string getCreateSql(*hash<auto> opt);
5933 
5935 
5937  string getDropSql(*hash<auto> opt);
5938 
5939 
5941 
5944  abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
5945  };
5946 
5948 class AbstractFunctionBase : public Serializable {
5949 
5950 public:
5952  string name;
5953 
5955  string type;
5956 
5958  string src;
5959 
5961 
5965  constructor(string n, string n_type, string n_src);
5966 
5967 
5969  string getType();
5970 
5971 
5973 
5975  string getDropSql(*hash<auto> opt);
5976 
5977 
5979  bool equal(AbstractFunctionBase t);
5980 
5981 
5983  string getNormalizedSource(string src);
5984 
5985 
5987 protected:
5988  abstract bool equalImpl(AbstractFunctionBase t);
5989 public:
5990  };
5991 
5994 
5995 public:
5997 
6001  constructor(string n, string n_type, string n_src) ;
6002 
6003 
6005  abstract list<auto> getCreateSql(*hash<auto> opt);
6006 
6008 
6011  abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
6012 
6014  setName(string new_name);
6015 
6016  };
6017 
6020 
6021 public:
6022  constructor(*hash c) ;
6023 
6024 
6026  add(string k, AbstractFunction val);
6027 
6028 
6030  AbstractFunction take(string k);
6031 
6032 
6034 
6049  AbstractFunction memberGate(string k);
6050 
6051 
6052  string getElementName();
6053 
6054  };
6055 
6058 
6059 public:
6061  constructor(string n, string n_src) ;
6062 
6063 
6065  abstract list<auto> getCreateSql(string table_name, *hash<auto> opt);
6066 
6068  abstract softlist<auto> getRenameSql(string table_name, string new_name);
6069 
6071  abstract list<auto> getDropSql(string table_name);
6072  };
6073 
6076 
6077 public:
6078  constructor(*hash c) ;
6079 
6080 
6082  add(string k, AbstractTrigger val);
6083 
6084 
6086  AbstractTrigger take(string k);
6087 
6088 
6090 
6105  AbstractTrigger memberGate(string k);
6106 
6107 
6108  string getElementName();
6109 
6110  };
6111 };
abstract string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
string name
the name of the constraint
Definition: SqlUtil.qm.dox.h:5591
hash< string, hash< JoinOperatorInfo > > join_left(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for left outer joins with the given arguments
abstract string getCreateSql(*hash< auto > opt)
returns a string that can be used to create the sequence in the database
string ddl_name
the name of the object for DDL (in case it&#39;s a reserved word)
Definition: SqlUtil.qm.dox.h:5260
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_max)
creates the object from the arguments
string getElementName()
returns "column" since this object stores column objects
hash< ColumnOperatorInfo > cop_first_value(any column)
Analytic/window function: value evaluated at the row that is the first row of the window frame...
bool hasColumn(string cname)
returns True if the constraint references the named column
constructor()
creates an empty object
const NUMERIC
specifies a numeric column (equivalent to Qore::Type::Number)
Definition: SqlUtil.qm.dox.h:2269
string name
the name of the sequence
Definition: SqlUtil.qm.dox.h:5880
const COP_SEQ
to return the next value of a sequence
Definition: SqlUtil.qm.dox.h:2415
Qore::AbstractIterator pairIterator()
Returns a HashPairIterator object for the contained hash.
*TimeZone data_timezone
the timezone when converting dates from external data to the DB&#39;s date
Definition: SqlUtil.qm.dox.h:2207
const DefaultIopMap
a hash of default insert operator descriptions (currently empty, all operators are driver-dependent) ...
Definition: SqlUtil.qm.dox.h:4566
auto arg
optional argument
Definition: SqlUtil.qm.dox.h:2167
abstract container class that throws an exception if an unknown key is accessed
Definition: SqlUtil.qm.dox.h:4920
hash< ColumnOperatorInfo > cop_append(auto column, string arg)
returns a ColumnOperatorInfo hash for the "append" operator with the given argument ...
string native_type
the native database column type; if both native_type and qore_type are given then native_type is used...
Definition: SqlUtil.qm.dox.h:2145
copy(AbstractHashContainer old)
creates a "deep copy" of the object
string cop
the column operator string code
Definition: SqlUtil.qm.dox.h:2172
constructor(*hash nh)
creates the object with the hash argument passed
Qore::ListIterator iterator()
Returns a ListIterator object for the contained list.
bool hasColumn(string cname)
returns True if the constraint references the named column
string getElementName()
must return the name of the contained element
bool equal(ForeignConstraintTarget targ)
returns True if the argument is equal to the current object, False if not
hash< string, hash< JoinOperatorInfo > > join_right_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for right outer joins with the given arguments for use when joining with a table other...
const OP_IN
the SQL "in" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4159
constructor(*hash c)
creates the object from the argument
the base abstract class for the table implementation
Definition: AbstractTable.qc.dox.h:30
const DefaultCopMap
a hash of default column operator descriptions
Definition: SqlUtil.qm.dox.h:2505
bool equal(AbstractConstraint c)
returns True if the argument is equal to the current object, False if not
bool equalExceptName(AbstractIndex ix)
returns True if the argument is equal to the current index with the exception of the name...
hash< ColumnOperatorInfo > cop_cast(auto column, string arg, auto arg1, auto arg2)
returns a ColumnOperatorInfo hash for the "cast" operator with the given argument(s) ...
AbstractFunction memberGate(string k)
returns the AbstractFunction object corresponding to the key given or throws a KEY-ERROR exception ...
const COP_FIRST_VALUE
Analytic (window) function: FIRST_VALUE.
Definition: SqlUtil.qm.dox.h:2467
hash< ColumnOperatorInfo > cop_multiply(auto column1, auto column2)
returns a ColumnOperatorInfo hash for the "*" operator with the given arguments
the table container class stores a collection of tables in a schema
Definition: SqlUtil.qm.dox.h:5009
AbstractIterator getSqlColumnNameIterator()
returns an iterator for column SQL names
constructor(string n)
creates the object and sets its name
bool updatable
Flag showing if is the view updatable with DML commands.
Definition: SqlUtil.qm.dox.h:5925
AbstractIndex take(string k)
removes the given key from the contained hash and returns the value
hash< OperatorInfo > op_in_select(string table, hash< auto > select_hash)
returns an OperatorInfo hash for the "in" operator with a subquery as the argument; for use in where ...
insert operator info hash as returned by all insert operator functions
Definition: SqlUtil.qm.dox.h:2178
constructor(string t, Columns c)
creates the object and sets the target table name and the target columns
string getDropSql(*hash< auto > opt)
returns a string that can be used to drop the function from the database
constructor(string n_name, string n_src)
creates the object from the arguments
abstract list< auto > getDropSql(string table_name)
returns a string that can be used to drop the trigger in the database
hash< OperatorInfo > op_ne(auto arg)
returns an OperatorInfo hash for the "!=" or "<>" operator with the given argument for use in where c...
const OP_BETWEEN
the SQL "between" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4154
abstract bool equalImpl(AbstractConstraint c)
returns True if the argument is equal to the current object, False if not
*AbstractColumnSupportingConstraint constraint
the AbstractColumnSupportingConstraint that this index supports, if any
Definition: SqlUtil.qm.dox.h:5468
hash< ColumnOperatorInfo > make_cop(string cop, auto column, auto arg)
returns a ColumnOperatorInfo hash
any arg
optional argument
Definition: SqlUtil.qm.dox.h:2180
string getDisableSql(string table_name)
returns a string that can be used to temporarily disable the constraint from the database; if disabli...
the abstract base class for index information
Definition: SqlUtil.qm.dox.h:5454
*AbstractUniqueConstraint findEqualUniqueConstraint(AbstractUniqueConstraint uk)
finds a unique constraint with the same columns as the unique constraint passed
const OP_OR
to combine SQL expressions with "or" for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4174
removeSourceConstraint(string tname, list< auto > cols)
removes a source constraint
add(string k, AbstractColumn val)
adds the given value to the hash with the given key name
const COP_OVER
the SQL "over" clause
Definition: SqlUtil.qm.dox.h:2370
hash< ColumnOperatorInfo > cop_as(auto column, string arg)
returns a ColumnOperatorInfo hash for the "as" operator with the given argument
foreign constraint container class that throws an exception if an unknown constraint is accessed ...
Definition: SqlUtil.qm.dox.h:5793
hash< ColumnOperatorInfo > cop_minus(auto column1, auto column2)
returns a ColumnOperatorInfo hash for the "-" operator with the given arguments
*softbool mandatory
optional flag to overrude any nullable attribute and require data for the column
Definition: SqlUtil.qm.dox.h:2216
hash< ColumnOperatorInfo > cop_last_value(any column)
Analytic/window function: value evaluated at the row that is the last row of the window frame...
const COP_DENSE_RANK
Analytic (window) function: DENSE_RANK.
Definition: SqlUtil.qm.dox.h:2460
bool hasColumn(string cname)
returns True if the constraint references the named column
const OP_NE
the SQL not equals operator (!= or <>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4114
*AbstractForeignConstraint getForeignConstraint()
returns the supporting constraint, if any
abstract list< auto > getCreateSql(string table_name, *hash< auto > opt)
returns a string that can be used to create the trigger in the database
constructor(string name, *hash< auto > cols, *string index)
creates the object from the name and a hash of column information
hash< ColumnOperatorInfo > cop_rank()
Analytic/window function: rank of the current row with gaps.
setSupportingConstraint()
clears the supporting constraint
abstract string getCreateSql(*hash< auto > opt)
returns a string that can be used to create the view in the database
populate(AbstractDatasource ds, hash< auto > tables, *hash< auto > opt)
populates the object from a hash<auto> description
*string number_format
optional format string for converting strings to numeric / decimal / number columns ...
Definition: SqlUtil.qm.dox.h:2213
string getType()
returns the type of object
A hash describing SQL and arguments for an SQL DML command.
Definition: SqlUtil.qm.dox.h:2227
hash< InsertOperatorInfo > iop_seq_currval(string arg)
returns an InsertOperatorInfo hash for retrieving the current value of the given sequence in insert q...
const COP_SUM
to return the sum value
Definition: SqlUtil.qm.dox.h:2360
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
bool equalImpl(AbstractConstraint c)
returns True if the argument is equal to the current object, False if not
const CLOB
specifies a large variable-length character column (ie CLOB or TEXT, etc)
Definition: SqlUtil.qm.dox.h:2278
string name
the name of the object
Definition: SqlUtil.qm.dox.h:5952
abstract list< auto > getCreateSql(*hash< auto > opt)
returns a list of SQL strings that can be used to create the function in the database ...
a class describing a foreign constraint target
Definition: SqlUtil.qm.dox.h:5840
hash< ColumnOperatorInfo > cop_length(auto column)
returns a ColumnOperatorInfo hash for the "len" operator with the given argument; returns the length ...
*string qore_type
the equivalent qore type name of the column if known
Definition: SqlUtil.qm.dox.h:5286
setForeignConstraint()
clears the supporting constraint
add(string k, AbstractConstraint val)
adds the given value to the hash with the given key name
const COP_SEQ_CURRVAL
to return the last value of a sequence issued in the same session
Definition: SqlUtil.qm.dox.h:2420
the base class to use to extend AbstractColumn to implement numeric columns
Definition: SqlUtil.qm.dox.h:5393
const DB_TABLES
Feature: tables.
Definition: SqlUtil.qm.dox.h:2252
*list< auto > getDropAllForeignConstraintsOnTableSql(string name, *hash< auto > opt)
returns a list of SQL strings that can be used to drop all the foreign constraints on a particular ta...
add(string k, AbstractFunction val)
adds the given value to the hash with the given key name
const DB_FUNCTIONS
Features constants.
Definition: SqlUtil.qm.dox.h:2242
AbstractTrigger memberGate(string k)
returns the AbstractTrigger object corresponding to the key given or throws a KEY-ERROR exception ...
hash< InsertOperatorInfo > make_iop(string iop, auto arg)
returns an InsertOperatorInfo hash
abstract string getCreateSql(string table_name, *hash< auto > opt)
returns a string that can be used to create the index in the database
const JopMap
a hash of valid join operators
Definition: SqlUtil.qm.dox.h:3618
const SZ_MAND
the data type takes a mandatory size parameter
Definition: SqlUtil.qm.dox.h:2289
const OP_GT
the SQL greater than operator (>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4104
const COP_AVG
to return the average value
Definition: SqlUtil.qm.dox.h:2355
const JOP_LEFT
for left outer joins
Definition: SqlUtil.qm.dox.h:3610
sqlutil_register_ds_serializer(*code new_ds_do)
registers a closure or call reference taking a string type and string datasource configuration that w...
base class for sequences
Definition: SqlUtil.qm.dox.h:5876
abstract softlist< auto > getRenameSql(string new_name, *hash< auto > opt)
returns a list with command(s) that can be used to rename the view in the database ...
string getElementName()
must return the name of the contained element
const DB_TYPES
Feature: named types.
Definition: SqlUtil.qm.dox.h:2254
*softint maxlen
optional additional limit to the maximum length of the data
Definition: SqlUtil.qm.dox.h:2221
abstract string getElementName()
must return the name of the contained element
Columns subset(softlist l)
returns a subset of the current columns according to the list<auto> argument
const COP_LAST_VALUE
Analytic (window) function: LAST_VALUE.
Definition: SqlUtil.qm.dox.h:2474
hash< OperatorInfo > op_clt(string arg)
returns an OperatorInfo hash for the "<" operator with the given argument for use in where clauses wh...
bool nullable
True if the column can hold a NULL value, False if not
Definition: SqlUtil.qm.dox.h:5292
list< auto > getList()
returns the list contained by this object
number number(softnumber n)
const COP_DISTINCT
to return distinct values
Definition: SqlUtil.qm.dox.h:2340
hash< OperatorInfo > op_cge(string arg)
returns an OperatorInfo hash for the ">=" operator with the given argument for use in where clauses w...
add(auto val)
adds the given value to the list
const COP_YEAR_HOUR
to return a date value with year to hextern information
Definition: SqlUtil.qm.dox.h:2410
hash< UpdateOperatorInfo > uop_multiply(auto arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "*" operator with the given arguments
hash< ColumnOperatorInfo > cop_plus(auto column1, auto column2)
returns a ColumnOperatorInfo hash for the "+" operator with the given arguments
hash< ColumnOperatorInfo > cop_value(auto arg)
returns a ColumnOperatorInfo hash for the "value" (literal) operator with the given argument ...
constructor()
empty constructor for subclasses
hash< auto > getDisableReenableSql(AbstractDatasource ds, string table_name, *hash< auto > opts)
returns lists of SQL strings to disable this constraint plus any dependent constraints and another li...
hash< UpdateOperatorInfo > uop_substr(int start, *int count, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "substr" operator with the given arguments; returns a subs...
column data type options
Definition: SqlUtil.qm.dox.h:2202
string jop
the join operator string code
Definition: SqlUtil.qm.dox.h:2192
const IOP_SEQ_CURRVAL
for using the last value of a sequence issued in the current session
Definition: SqlUtil.qm.dox.h:4563
AbstractFunction take(string k)
removes the given key from the contained hash and returns the value
the API for a constraint with columns
Definition: SqlUtil.qm.dox.h:5672
hash< ColumnOperatorInfo > cop_year_day(auto column)
returns a ColumnOperatorInfo hash for the "year_day" operator with the given argument ...
auto default_value
the default value for the column
Definition: SqlUtil.qm.dox.h:2151
bool equal(Columns cols)
returns True if the argument has the same columns in the same order as the current object...
const OP_CNE
the SQL not equals operator (!= or <>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4144
hash< UpdateOperatorInfo > uop_prepend(string arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "prepend" operator with the given argument ...
const SqlUtilDrivers
known drivers
Definition: SqlUtil.qm.dox.h:4613
const OP_CGT
the SQL greater than operator (>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4134
the base class for foreign key constraint information
Definition: SqlUtil.qm.dox.h:5859
*string index
the index supporting the constraint
Definition: SqlUtil.qm.dox.h:5677
bool equalImpl(AbstractConstraint con)
returns True if the argument is equal to the current object, False if not
ForeignConstraintTarget target
a ForeignConstraintTarget object to describe the target table and columns
Definition: SqlUtil.qm.dox.h:5863
hash< OperatorInfo > op_le(auto arg)
returns an OperatorInfo hash for the "<=" operator with the given argument for use in where clauses w...
*AbstractColumnSupportingConstraint getSupportingConstraint()
returns the supporting constraint, if any
abstract bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
const False
bool setIndexBase(string ix)
returns True if the object supports an index property and is set, False if not
constructor(string n, string n_src)
creates the object and sets its name and the check clause source
AbstractConstraint memberGate(string k)
returns the AbstractConstraint object corresponding to the key given or throws a KEY-ERROR exception ...
auto arg
optional argument
Definition: SqlUtil.qm.dox.h:2174
int scale
the scale for numeric columns
Definition: SqlUtil.qm.dox.h:5397
abstract class for check constraints
Definition: SqlUtil.qm.dox.h:5646
hash< UpdateOperatorInfo > uop_divide(auto arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "/" operator with the given arguments
bool equal(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
constructor(string n, bool u, hash c)
creates the object from the name, a unique flag, and a hash of column information ...
const COP_COUNT
to return the row count
Definition: SqlUtil.qm.dox.h:2365
bool default_value_native
a boolean flag to say if a default_value should be validated against table column type (False) or use...
Definition: SqlUtil.qm.dox.h:2153
const OP_CEQ
the SQL equals operator (=) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4149
const COP_NTILE
Analytic (window) function: NTILE.
Definition: SqlUtil.qm.dox.h:2481
hash< UpdateOperatorInfo > uop_plus(auto arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "+" operator with the given arguments
softint scale
for numeric data types, this value gives the scale
Definition: SqlUtil.qm.dox.h:2149
abstract container class that throws an exception if an unknown key is accessed
Definition: SqlUtil.qm.dox.h:4639
hash< ColumnOperatorInfo > cop_year_hour(auto column)
returns a ColumnOperatorInfo hash for the "year_hour" operator with the given argument ...
join operator info hash as returned by all join operator functions
Definition: SqlUtil.qm.dox.h:2191
Qore AbstractDatabase class definition.
Definition: AbstractDatabase.qc.dox.h:32
hash< OperatorInfo > op_cne(string arg)
returns an OperatorInfo hash for the "!=" or "<>" operator with the given argument for use in where c...
trigger container class that throws an exception if an unknown trigger is accessed ...
Definition: SqlUtil.qm.dox.h:6075
hash< string, hash< JoinOperatorInfo > > join_inner(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for standard inner joins with the given arguments
string src
the source of the check clause
Definition: SqlUtil.qm.dox.h:5650
const DT_DAY
Format unit: day.
Definition: SqlUtil.qm.dox.h:3387
hash< OperatorInfo > op_cle(string arg)
returns an OperatorInfo hash for the "<=" operator with the given argument for use in where clauses w...
addSourceConstraint(string tname, AbstractForeignConstraint fk)
adds a foreign constraint source to the unique constraint
AbstractColumn take(string k)
removes the given key from the contained hash and returns the value
hash< ColumnOperatorInfo > cop_avg(auto column)
returns a ColumnOperatorInfo hash for the "avg" operator; returns average column values ...
const COP_UPPER
to return column value in upper case
Definition: SqlUtil.qm.dox.h:2330
abstract bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
hash< string, hash< JoinOperatorInfo > > join_left_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for left outer joins with the given arguments for use when joining with a table other ...
*hash cond
additional conditions for the join clause for the table argument; see Where Clauses for more informat...
Definition: SqlUtil.qm.dox.h:2196
const COP_PLUS
the SQL "plus" operator
Definition: SqlUtil.qm.dox.h:2380
abstract string getCreateSql(string table_name, *hash< auto > opt)
returns a string that can be used to create the constraint in the database
list< auto > values()
Returns a list of values of the contained hash.
const OP_GE
the SQL greater than or equals operator (>=) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4109
index container class that throws an exception if an unknown index is accessed
Definition: SqlUtil.qm.dox.h:5408
const SZ_NUM
the data type is numeric so takes an optional precision and scale
Definition: SqlUtil.qm.dox.h:2295
hash< OperatorInfo > op_between(auto l, auto r)
returns an OperatorInfo hash for the "between" operator with the given arguments, neither of which ca...
abstract bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
*bool auto_increment
True for DBs that support an auto-increment column
Definition: SqlUtil.qm.dox.h:2161
const DB_PACKAGES
Feature: packages.
Definition: SqlUtil.qm.dox.h:2246
abstract softlist< auto > getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
*string def_val
default value for column
Definition: SqlUtil.qm.dox.h:5295
string getCreateSql(AbstractTable t)
returns an sql string that can be used to add the column to a table
hash< UpdateOperatorInfo > uop_upper(*hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "upper" operator with the given argument; returns a column...
const COP_COALESCE
to return the first non-null argument in the list
Definition: SqlUtil.qm.dox.h:2425
string getEnableSql(string table_name, *hash< auto > opt)
returns a string that can be used to enable the constraint in the database; if disabling constraints ...
abstract list< auto > getRenameSql(string table_name, string new_name)
returns a list of SQL strings that can be used to rename the constraint in the database ...
string op
the operator string code
Definition: SqlUtil.qm.dox.h:2166
*AbstractIndex findEqual(AbstractIndex ix)
find an index with columns equal to the index passed
bool tableRenamed(string old_name, string new_name, string old_sql_name)
updates table names and internal references for renamed tables
hash< ColumnOperatorInfo > cop_min(auto column)
returns a ColumnOperatorInfo hash for the "min" operator; returns minimum column values ...
hash< string, hash< JoinOperatorInfo > > make_jop(string jop, AbstractTable table, *string alias, *hash jcols, *hash cond, *string ta, *hash< auto > opt)
returns hash keyed with the table name assigned to a JoinOperatorInfo hash
*string date_format
optional format string for converting strings to dates for date / timestamp columns ...
Definition: SqlUtil.qm.dox.h:2204
string getNativeTypeString(string native_type, int precision)
returns the string describing the native type that can be used in SQL (for example to add the column ...
hash< OperatorInfo > op_ge(auto arg)
returns an OperatorInfo hash for the ">=" operator with the given argument for use in where clauses w...
abstract string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
AbstractTable memberGate(string k)
returns the AbstractTable object corresponding to the key given or throws a KEY-ERROR exception ...
const OP_EQ
the SQL equals operator (=) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4119
generic column description hash in schema descriptions
Definition: SqlUtil.qm.dox.h:2141
AbstractForeignConstraint take(string k)
removes the given key from the contained hash and returns the value
abstract string getElementName()
must return the name of the contained element
*string comment
comment on the column
Definition: SqlUtil.qm.dox.h:5298
const VARCHAR
specifies a VARCHAR column (equivalent to Qore::Type::String)
Definition: SqlUtil.qm.dox.h:2266
Qore::AbstractIterator dropIterator()
returns an iterator for a list of cached table names in the order that can be used to drop the tables...
hash< ColumnOperatorInfo > cop_coalesce(auto col1, auto col2)
returns a ColumnOperatorInfo hash for the "coalesce" operator with the given column arguments; the fi...
bool val()
Returns False if the contained list is empty, True if not.
string src
the source code
Definition: SqlUtil.qm.dox.h:5922
bool unique
True if the index is a unique index, False if not
Definition: SqlUtil.qm.dox.h:5461
sqlutil_register_ds_deserializer(*code new_ds_get)
registers a closure or call reference taking a string type and string datasource configuration that w...
auto take(int i)
removes the given element from the contained list and returns the value
hash< ColumnOperatorInfo > cop_trunc_date(auto column, string mask)
Truncates a date column or value regarding the given mask. The resulting value remains Qore::date (no...
add(string k, Table val)
adds the given value to the hash with the given key name
hash< ColumnOperatorInfo > cop_dense_rank()
Analytic/window function: rank of the current row without gaps.
hash< OperatorInfo > op_eq(auto arg)
returns an OperatorInfo hash for the "=" operator with the given argument for use in where clauses wh...
string getNativeTypeString()
returns the string describing the native type that can be used in SQL (for example to add the colunn ...
Qore::AbstractIterator iterator()
Returns a HashIterator object for the contained hash.
constructor(string name, *hash< auto > cols, *string index)
creates the object from the name and a hash of column information
const COP_YEAR_MONTH
to return a date value with year to month information
Definition: SqlUtil.qm.dox.h:2400
string src
the source of the object
Definition: SqlUtil.qm.dox.h:5958
string getElementName()
must return the name of the contained element
auto table
the table to join with (either an AbstractTable object or a string table name)
Definition: SqlUtil.qm.dox.h:2193
const COP_MAX
to return the maximum value
Definition: SqlUtil.qm.dox.h:2350
hash< OperatorInfo > op_cgt(string arg)
returns an OperatorInfo hash for the ">" operator with the given argument for use in where clauses wh...
abstract list< auto > getModifySqlImpl(AbstractTable t, AbstractColumn c, *hash< auto > opt)
returns a list of sql strings that can be used to modify the column to the new definition; if the col...
const COP_LENGTH
to get the length of a text field
Definition: SqlUtil.qm.dox.h:2437
auto column
column sopecifier, may be a string or a complex hash
Definition: SqlUtil.qm.dox.h:2173
abstract softlist< auto > getRenameSql(string new_name, *hash< auto > opt)
returns a list of strings that can be used to rename the function in the database ...
const DB_SYNONYMS
Feature: synonyms.
Definition: SqlUtil.qm.dox.h:2258
const COP_AS
to rename a column on output
Definition: SqlUtil.qm.dox.h:2305
hash< ColumnOperatorInfo > cop_max(auto column)
returns a ColumnOperatorInfo hash for the "max" operator; returns maximum column values ...
*hash< auto > opt
optional join options (for example, to specify a partition for the join if supported) ...
Definition: SqlUtil.qm.dox.h:2198
const OP_LE
the SQL less than or equals (<=) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4099
const DB_PROCEDURES
Feature: procedures.
Definition: SqlUtil.qm.dox.h:2248
string name
the name of the index
Definition: SqlUtil.qm.dox.h:5458
string _iop
the insert operator string code
Definition: SqlUtil.qm.dox.h:2179
Columns columns
columns in the target table
Definition: SqlUtil.qm.dox.h:5847
string uop
the update operator string code
Definition: SqlUtil.qm.dox.h:2185
const OP_CLE
the SQL less than or equals (<=) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4129
the API for a constraint with columns
Definition: SqlUtil.qm.dox.h:5699
const BLOB
specifies a large variable-length binary column (ie BLOB or BYTEA, etc)
Definition: SqlUtil.qm.dox.h:2275
auto arg
optional argument
Definition: SqlUtil.qm.dox.h:2186
string getElementName()
must return the name of the contained element
hash< UpdateOperatorInfo > uop_append(string arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "append" or concatenate operator with the given argument ...
hash< UpdateOperatorInfo > uop_seq_currval(string seq)
returns an UpdateOperatorInfo hash for the "seq" operator with the given argument giving the sequence...
hash< ColumnOperatorInfo > cop_ntile(int value)
Analytic/window function: integer ranging from 1 to the argument value, dividing the partition as equ...
const OP_NOT
the SQL "not" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4164
*hash< string, hash< string, AbstractForeignConstraint > > sourceConstraints
a hash of ForeignConstraintSources, keyed by table name, the value is a hash of foreign constraints k...
Definition: SqlUtil.qm.dox.h:5704
clear()
purges the contained data
Columns columns
an object of class Columns representing the columns in the index
Definition: SqlUtil.qm.dox.h:5464
AbstractForeignConstraint memberGate(string k)
returns the AbstractForeignConstraint object corresponding to the key given or throws a KEY-ERROR exc...
base class for function or objects with code
Definition: SqlUtil.qm.dox.h:5948
update operator info hash as returned by all update operator functions
Definition: SqlUtil.qm.dox.h:2184
bool empty()
returns True if the container is empty, False if not
const COP_CUME_DIST
Analytic (window) function: CUME_DIST.
Definition: SqlUtil.qm.dox.h:2453
hash< ColumnOperatorInfo > cop_lower(auto column)
returns a ColumnOperatorInfo hash for the "lower" operator with the given argument; returns a column ...
hash< ColumnOperatorInfo > cop_distinct(auto column)
returns a ColumnOperatorInfo hash for the "distinct" operator with the given argument; returns distin...
list< auto > args
the arguments for the string
Definition: SqlUtil.qm.dox.h:2232
bool empty()
returns True if the container is empty, False if not
hash< ColumnOperatorInfo > cop_year(auto column)
returns a ColumnOperatorInfo hash for the "year" operator with the given argument ...
hash< UpdateOperatorInfo > uop_lower(*hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "lower" operator with the given argument; returns a column...
string getName()
returns the constraint name
hash< string, hash< OperatorInfo > > wop_or(hash h1, hash h2)
returns an OperatorInfo hash with a fake "_OR_" column name; the list of arguments to the function is...
string getName()
returns the index name
*hash h
the data to be contained
Definition: SqlUtil.qm.dox.h:4646
list< auto > getModifySql(AbstractTable t, AbstractColumn c, *hash< auto > opt)
returns a list of sql strings that can be used to modify the column to the new definition; if the col...
base class for functions
Definition: SqlUtil.qm.dox.h:5993
string sql
the SQL string for the update
Definition: SqlUtil.qm.dox.h:2229
const COP_MULTIPLY
the SQL "multiply" operator
Definition: SqlUtil.qm.dox.h:2390
column operator info hash as returned by all column operator functions
Definition: SqlUtil.qm.dox.h:2171
hash< ColumnOperatorInfo > cop_cume_dist()
Analytic/window function: relative rank of the current row.
const COP_PREPEND
to prepend a string to a column on output
Definition: SqlUtil.qm.dox.h:2315
bool notnull
if the column should have a "not null" constraint on it; if missing the default value is False ...
Definition: SqlUtil.qm.dox.h:2157
bool partialMatchKeys(hash h1)
returns True if the hash argument has at least the same keys (in any order, can have more keys)...
string type(auto arg)
const COP_TRUNC_DATE
to return the date with truncated value
Definition: SqlUtil.qm.dox.h:2446
abstract clearIndex()
clears any index base for the constraint
base class for views
Definition: SqlUtil.qm.dox.h:5912
bool hasKey(string k)
Returns True if the key exists in the contained hash (may or may not be assigned a value)...
bool equal(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
abstract auto take(string k)
removes the given key from the contained hash and returns the value
hash< OperatorInfo > op_like(string str)
returns an OperatorInfo hash for the "like" operator with the given argument for use in where clauses...
renameKey(string old_name, string new_name)
renames the given key; maintains the key order
hash< auto > hash(object obj)
*hash< auto > findConstraintOn(string table, softlist< auto > cols)
returns either a hash of AbstractColumn information or NOTHING if no foreign constraint can be found ...
AbstractTrigger take(string k)
removes the given key from the contained hash and returns the value
list< string > keys()
Returns a list of key names of the contained hash.
*list< AbstractColumnConstraint > getAllSupportingConstraints()
returns all supporting constraints, if any
string type
the type of object
Definition: SqlUtil.qm.dox.h:5955
constructor(string n, *hash< auto > c, *string n_index)
creates the object from the name an a hash of column information
hash< ColumnOperatorInfo > cop_seq(string seq, *string as)
returns a ColumnOperatorInfo hash for the "seq" operator with the given argument giving the sequence ...
*string getDropConstraintIfExistsSql(string tname, string cname, *hash< auto > opts)
returns an SQL string that can be used to drop an existing constraint on a table, if the table is not...
const COP_YEAR
to return a date value with year information only
Definition: SqlUtil.qm.dox.h:2395
constructor(softlist nl)
creates the object with the list<auto> argument passed
string getElementName()
returns "table" since this object stores AbstractTable objects
string getElementName()
returns "foreign constraint" for the type of object encapsulated
int size
the size of the column
Definition: SqlUtil.qm.dox.h:5289
hash< string, hash > driver
this key can optionally contain a hash keyed by driver name which contains a hash of values that will...
Definition: SqlUtil.qm.dox.h:2159
int size()
Returns the number of keys in the contained hash.
Qore::AbstractIterator keyIterator()
Returns a HashKeyIterator object for the contained hash.
string native_type
the native type name of the column
Definition: SqlUtil.qm.dox.h:5283
const COP_VALUE
to append a constant value (SQL Literal) to use as an output column value
Definition: SqlUtil.qm.dox.h:2325
hash< UpdateOperatorInfo > uop_seq(string seq)
returns an UpdateOperatorInfo hash for the "seq" operator with the given argument giving the sequence...
column container class that throws an exception if an unknown column is accessed
Definition: SqlUtil.qm.dox.h:5197
the base class for triggers
Definition: SqlUtil.qm.dox.h:6057
*string ta
optional table name or alias of the other table to join with when not joining with the primary table ...
Definition: SqlUtil.qm.dox.h:2197
Qore::AbstractIterator getSourceConstraintIterator()
returns an iterator through all known source foreign constraints on the current table ...
string getNormalizedSource(string src)
returns normalized source for comparisons
string name
the name of the object
Definition: SqlUtil.qm.dox.h:5257
const OP_LT
the SQL less than (<) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4094
hash< ColumnOperatorInfo > cop_sum(auto column)
returns a ColumnOperatorInfo hash for the "sum" operator; returns the total sum of a numeric column...
add(string k, AbstractForeignConstraint val)
adds the given value to the hash with the given key name
function container class that throws an exception if an unknown function is accessed ...
Definition: SqlUtil.qm.dox.h:6019
abstract list< auto > getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table ...
the base class for column information
Definition: SqlUtil.qm.dox.h:5279
const COP_CAST
to convert column value into another datatype
Definition: SqlUtil.qm.dox.h:2310
hash< OperatorInfo > op_in()
returns an OperatorInfo hash for the "in" operator with all arguments passed to the function; for use...
setName(string new_name)
sets the new name of the object
add(string k, AbstractTrigger val)
adds the given value to the hash with the given key name
const OP_CGE
the SQL greater than or equals operator (>=) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4139
const DT_MINUTE
Format unit: minute.
Definition: SqlUtil.qm.dox.h:3393
hash< ColumnOperatorInfo > cop_seq_currval(string seq, *string as)
returns a ColumnOperatorInfo hash for the "seq_currval" operator with the given argument giving the s...
clearIndex()
clears any index base for the constraint
const DT_HOUR
Format unit: hour.
Definition: SqlUtil.qm.dox.h:3390
represents a database table; this class embeds an AbstractTable object that is created automatically ...
Definition: Table.qc.dox.h:50
abstract string getDdlName(string name)
returns the column name with quoting in case the column name is a reserved word
*string comment
an optional comment for the column
Definition: SqlUtil.qm.dox.h:2155
const CHAR
specifies a CHAR column
Definition: SqlUtil.qm.dox.h:2272
hash< string, hash< JoinOperatorInfo > > join_inner_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for standard inner joins with the given arguments for use when joining with a table ot...
hash< ColumnOperatorInfo > cop_divide(auto column1, auto column2)
returns a ColumnOperatorInfo hash for the "/" operator with the given arguments
bool equal(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
const DefaultUopMap
a hash of valid update operators
Definition: SqlUtil.qm.dox.h:3407
AbstractTable take(string k)
removes the given key from the contained hash and returns the value
const COP_MIN
to return the minimum value
Definition: SqlUtil.qm.dox.h:2345
const COP_YEAR_DAY
to return a date value with year to day information
Definition: SqlUtil.qm.dox.h:2405
hash< OperatorInfo > op_gt(auto arg)
returns an OperatorInfo hash for the ">" operator with the given argument for use in where clauses wh...
add(string k, AbstractIndex val)
adds the given value to the hash with the given key name
bool setIndexBase(string ix)
returns True if the object supports an index property and is set, False if not
the base class for named objects
Definition: SqlUtil.qm.dox.h:5253
const DT_MONTH
Format unit: month.
Definition: SqlUtil.qm.dox.h:3384
string name
the name of the sequence
Definition: SqlUtil.qm.dox.h:5919
const COP_PERCENT_RANK
Analytic (window) function: PERCENT_RANK.
Definition: SqlUtil.qm.dox.h:2488
*string getRenameTableIfExistsSql(string old_name, string new_name, *hash< auto > opts)
returns an SQL string that can be used to rename the given table if it exists and the target does not...
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
*string getIndex()
returns the name of the associated index, if any
*hash jcols
the columns to use for the join, the keys will be columns in the source table and the values are colu...
Definition: SqlUtil.qm.dox.h:2195
*number max
the ending number
Definition: SqlUtil.qm.dox.h:5889
bool val()
Returns False if the contained hash has no keys, True if it does.
const COP_RANK
Analytic (window) function: RANK.
Definition: SqlUtil.qm.dox.h:2495
hash< ColumnOperatorInfo > cop_count(auto column='')
returns a ColumnOperatorInfo hash for the "count" operator; returns row counts
hash< OperatorInfo > op_not(hash arg)
returns an OperatorInfo hash for the "not" operator; for use in where clauses
number increment
the increment
Definition: SqlUtil.qm.dox.h:5886
AbstractColumn memberGate(string k)
returns the AbstractColumn object corresponding to the key given or throws a KEY-ERROR exception ...
bool matchKeys(hash h1)
returns True if the hash argument has the same keys (in any order), False if not
hash< ColumnOperatorInfo > cop_row_number()
Analytic/window function: number of the current row within its partition, counting from 1...
*hash< auto > getHash()
returns the hash contained by this object
const OP_LIKE
the SQL "like" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4089
findMatchingIndex(*Indexes indexes)
find an index that matches the constraint and marks both objects as related
hash< OperatorInfo > op_lt(auto arg)
returns an OperatorInfo hash for the "<" operator with the given argument for use in where clauses wh...
hash< OperatorInfo > make_op(string op, auto arg)
returns an OperatorInfo hash
hash< OperatorInfo > op_substr(int start, *int count, string text)
returns an OperatorInfo hash for the "substr" operator with the given arguments; for use in where cla...
const SZ_NONE
the data type does not take a size parameter
Definition: SqlUtil.qm.dox.h:2286
AbstractIndex memberGate(string k)
returns the AbstractIndex object corresponding to the key given or throws a KEY-ERROR exception ...
hash< UpdateOperatorInfo > uop_minus(auto arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash for the "-" operator with the given arguments
int size()
Returns the number of elements in the contained list.
constructor(string n, string n_type, string n_src)
creates the object from the arguments passed
hash< ColumnOperatorInfo > cop_upper(auto column)
returns a ColumnOperatorInfo hash for the "upper" operator with the given argument; returns a column ...
const OP_CLT
the SQL less than (<) operator for use in Where Clauses when comparing two columns ...
Definition: SqlUtil.qm.dox.h:4124
const DB_MVIEWS
Feature: materialized views / snapshots.
Definition: SqlUtil.qm.dox.h:2244
const COP_MINUS
the SQL "minus" operator
Definition: SqlUtil.qm.dox.h:2375
hash< ColumnOperatorInfo > cop_percent_rank()
Analytic/window function: relative rank of the current row.
constructor(string n, string n_type, string n_src)
creates the object from the arguments passed
clearIndex()
clears any index base for the constraint
string table
the name of the target table
Definition: SqlUtil.qm.dox.h:5844
hash< ColumnOperatorInfo > cop_over(auto column, *string partitionby, *string orderby)
returns a ColumnOperatorInfo hash for the "over" clause
hash< ColumnOperatorInfo > cop_year_month(auto column)
returns a ColumnOperatorInfo hash for the "year_month" operator with the given argument ...
string getDropSql(*hash< auto > opt)
returns a string that can be used to drop the sequence from the database
auto memberGate(string k)
returns the value of the given key in the contained hash if it exists, otherwise throws a KEY-ERROR e...
*string alias
optional alias for table in the query
Definition: SqlUtil.qm.dox.h:2194
const COP_SUBSTR
to extract a substring from a column
Definition: SqlUtil.qm.dox.h:2430
const JOP_RIGHT
for right outer joins
Definition: SqlUtil.qm.dox.h:3615
const OP_SUBSTR
the SQL "substr" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4169
*AbstractForeignConstraint foreign_constraint
Any foreign constraint that this index supports.
Definition: SqlUtil.qm.dox.h:5471
hash< ColumnOperatorInfo > cop_substr(auto column, int start, *int count)
returns a ColumnOperatorInfo hash for the "substr" operator with the given arguments; returns a subst...
const SZ_OPT
the data type takes an optional size parameter
Definition: SqlUtil.qm.dox.h:2292
hash< InsertOperatorInfo > iop_seq(string arg)
returns an InsertOperatorInfo hash for retrieving the value of the given sequence in insert queries ...
list< auto > getDropList()
returns a list of cached table names in the order that can be used to drop the tables, taking into account foreign constraint dependencies
list< auto > getRecreateSql(AbstractDatasource ds, string table_name, *hash< auto > opt)
returns a list of strings to drop and recreate the current index; if there are dependent constraints...
softint size
for data types requiring a size component, the size; for numeric columns this represents the precisio...
Definition: SqlUtil.qm.dox.h:2147
const DB_SEQUENCES
Feature: sequences.
Definition: SqlUtil.qm.dox.h:2250
abstract string getCreateSql(string table_name, *hash< auto > opts)
returns a string that can be used to create the constraint in the database
SQL operator info hash as returned by all operator functions.
Definition: SqlUtil.qm.dox.h:2165
number start
the starting number
Definition: SqlUtil.qm.dox.h:5883
const IOP_SEQ
for using the value of a sequence
Definition: SqlUtil.qm.dox.h:4558
hash< string, hash< JoinOperatorInfo > > join_right(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash< auto > opt)
returns a hash for right outer joins with the given arguments
const COP_ROW_NUMBER
Analytic (window) function: ROW_NUMBER.
Definition: SqlUtil.qm.dox.h:2502
const DT_YEAR
Format unit: year.
Definition: SqlUtil.qm.dox.h:3381
string getDropSql(string table_name)
returns a string that can be used to drop the index from the database
renameSourceConstraintTable(string old_name, string new_name)
renames a table in a source constraint
const DB_VIEWS
Feature: views.
Definition: SqlUtil.qm.dox.h:2256
*AbstractForeignConstraint findEqual(AbstractForeignConstraint fk)
find an index with columns equal to the index passed
*TimeZone db_timezone
the timezone to use when sending date/time values to the DB
Definition: SqlUtil.qm.dox.h:2210
represents a primary key
Definition: SqlUtil.qm.dox.h:5782
const JOP_INNER
for standard inner joins
Definition: SqlUtil.qm.dox.h:3605
const COP_LOWER
to return column value in lower case
Definition: SqlUtil.qm.dox.h:2335
const OP_IN_SELECT
the SQL "in" operator with a select query for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4179
hash< ColumnOperatorInfo > cop_prepend(auto column, string arg)
returns a ColumnOperatorInfo hash for the "prepend" operator with the given argument ...
*hash nest
option nested operation hash
Definition: SqlUtil.qm.dox.h:2187
const COP_DIVIDE
the SQL "divide" operator
Definition: SqlUtil.qm.dox.h:2385
abstract bool setIndexBase(string ix)
returns True if the object supports an index property and is set, False if not
constructor()
empty constructor for subclasses
string getDropSql(string table_name)
returns a string that can be used to drop the column from the table
*string lastKey()
Returns the last key name in the contained hash or NOTHING if the contained hash has no keys...
AbstractConstraint take(string k)
removes the given key from the contained hash and returns the value
*string firstKey()
Returns the first key name in the contained hash or NOTHING if the contained hash has no keys...
abstract softlist< auto > getRenameSql(string new_name, *hash< auto > opt)
returns a list of strings that can be used to rename the sequence in the database ...
bool hasKeyValue(string k)
Returns True if the key exists in the contained hash and is assigned a value, False if not...
string qore_type
a qore type string that will be converted to a native DB type with some default conversion ...
Definition: SqlUtil.qm.dox.h:2143
*AbstractTable getIfExists(AbstractDatasource ds, string name)
gets a table from the database or from the cache if already cached; if the table does not exist...
hash< UpdateOperatorInfo > make_uop(string uop, auto arg, *hash< UpdateOperatorInfo > nest)
returns an UpdateOperatorInfo hash
const DefaultOpMap
a hash of valid operators for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4182
represents a unique column constraint
Definition: SqlUtil.qm.dox.h:5773
rename(string n)
renames the constraint
string getDropSql(*hash< auto > opt)
returns a string that can be used to drop the view from the database
hash< OperatorInfo > op_ceq(string arg)
returns an OperatorInfo hash for the "=" operator with the given argument for use in where clauses wh...
*AbstractIndex tryTake(string k)
tries to remove the given key from the contained hash and returns the value if it exists ...
bool equalImpl(AbstractConstraint c)
returns True if the argument is equal to the current object, False if not
abstract base class for constraints
Definition: SqlUtil.qm.dox.h:5584
const DT_SECOND
Format unit: hour.
Definition: SqlUtil.qm.dox.h:3396
constraint container class that throws an exception if an unknown constraint is accessed ...
Definition: SqlUtil.qm.dox.h:5542
const COP_APPEND
to append a string to a column on output
Definition: SqlUtil.qm.dox.h:2320