Qore SqlUtil Module Reference  1.7.2
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 
2134 namespace SqlUtil {
2137  public struct GenericColumnInfo {
2139  string qore_type;
2141  string native_type;
2143  softint size;
2145  softint scale;
2151  *string comment;
2153  bool notnull = False;
2155  hash<string, hash> driver;
2158  };
2159 
2161  public struct OperatorInfo {
2162  string op;
2163  auto arg;
2164  };
2165 
2167  public struct ColumnOperatorInfo {
2168  string cop;
2169  auto column;
2170  auto arg;
2171  };
2172 
2174  public struct InsertOperatorInfo {
2175  string _iop;
2176  any arg;
2177  };
2178 
2180  public struct UpdateOperatorInfo {
2181  string uop;
2182  auto arg;
2184  };
2185 
2187  public struct JoinOperatorInfo {
2188  string jop;
2189  auto table;
2190  *string alias;
2193  *string ta;
2194  *hash<auto> opt;
2195  };
2196 
2200  *string date_format;
2201 
2203  *TimeZone data_timezone;
2204 
2206  *TimeZone db_timezone;
2207 
2209  *string number_format;
2210 
2212  *softbool mandatory;
2213 
2215 
2217  *softint maxlen;
2218  };
2219 
2221 
2223  public struct SqlCommandInfo {
2225  string sql;
2226 
2228  list<auto> args;
2229  };
2230 
2235 
2238  const DB_FUNCTIONS = "functions";
2240  const DB_MVIEWS = "materialized views";
2242  const DB_PACKAGES = "packages";
2244  const DB_PROCEDURES = "procedures";
2246  const DB_SEQUENCES = "sequences";
2248  const DB_TABLES = "tables";
2250  const DB_TYPES = "named types";
2252  const DB_VIEWS = "views";
2254  const DB_SYNONYMS = "synonyms";
2256 
2257  /* @defgroup SqlTypeConstants SQL Type Constants
2258  These constants can be used for the \c "qore_type" values when creating columns to specify additional SQL column types
2259  */
2261  const VARCHAR = "string";
2263 
2265  const NUMERIC = "number";
2266 
2268  const CHAR = "char";
2269 
2271  const BLOB = "blob";
2272 
2274  const CLOB = "clob";
2276 
2281  const SZ_NONE = 0;
2283 
2285  const SZ_MAND = 1;
2286 
2288  const SZ_OPT = 2;
2289 
2291  const SZ_NUM = 3;
2293 
2298 
2301  const COP_AS = "as";
2302 
2304 
2306  const COP_CAST = "cast";
2307 
2309 
2311  const COP_PREPEND = "prepend";
2312 
2314 
2316  const COP_APPEND = "append";
2317 
2319 
2321  const COP_VALUE = "value";
2322 
2324 
2326  const COP_UPPER = "upper";
2327 
2329 
2331  const COP_LOWER = "lower";
2332 
2334 
2336  const COP_DISTINCT = "distinct";
2337 
2339 
2341  const COP_MIN = "min";
2342 
2344 
2346  const COP_MAX = "max";
2347 
2349 
2351  const COP_AVG = "avg";
2352 
2354 
2356  const COP_SUM = "sum";
2357 
2359 
2361  const COP_COUNT = "count";
2362 
2364 
2366  const COP_OVER = "over";
2367 
2369 
2371  const COP_MINUS = "minus";
2372 
2374 
2376  const COP_PLUS = "plus";
2377 
2379 
2381  const COP_DIVIDE = "divide";
2382 
2384 
2386  const COP_MULTIPLY = "multiply";
2387 
2389 
2391  const COP_YEAR = "year";
2392 
2394 
2396  const COP_YEAR_MONTH = "year_month";
2397 
2399 
2401  const COP_YEAR_DAY = "year_day";
2402 
2404 
2406  const COP_YEAR_HOUR = "year_hour";
2407 
2409 
2411  const COP_SEQ = "seq";
2412 
2414 
2416  const COP_SEQ_CURRVAL = "seq_currval";
2417 
2419 
2421  const COP_COALESCE = "coalesce";
2422 
2424 
2426  const COP_SUBSTR = "substr";
2427 
2429 
2433  const COP_LENGTH = "length";
2434 
2436 
2442  const COP_TRUNC_DATE = "truncate_date";
2443 
2445 
2449  const COP_CUME_DIST = "cume_dist";
2450 
2452 
2456  const COP_DENSE_RANK = "dense_rank";
2457 
2459 
2463  const COP_FIRST_VALUE = "first_value";
2464 
2466 
2470  const COP_LAST_VALUE = "last_value";
2471 
2473 
2477  const COP_NTILE = "ntile";
2478 
2480 
2484  const COP_PERCENT_RANK = "percent_rank";
2485 
2487 
2491  const COP_RANK = "rank";
2492 
2494 
2498  const COP_ROW_NUMBER = "row_number";
2499 
2501  const DefaultCopMap = ...;
2502 
2504 
2546 
2555  hash<ColumnOperatorInfo> make_cop(string cop, auto column, auto arg);
2556 
2557 
2559 
2571  hash<ColumnOperatorInfo> cop_as(auto column, string arg);
2572 
2573 
2575 
2589  hash<ColumnOperatorInfo> cop_cast(auto column, string arg, auto arg1, auto arg2);
2590 
2591 
2593 
2603  hash<ColumnOperatorInfo> cop_prepend(auto column, string arg);
2604 
2605 
2607 
2617  hash<ColumnOperatorInfo> cop_append(auto column, string arg);
2618 
2619 
2621 
2749  hash<ColumnOperatorInfo> cop_value(auto arg);
2750 
2751 
2753 
2762  hash<ColumnOperatorInfo> cop_upper(auto column);
2763 
2764 
2766 
2775  hash<ColumnOperatorInfo> cop_lower(auto column);
2776 
2777 
2779 
2788  hash<ColumnOperatorInfo> cop_distinct(auto column);
2789 
2790 
2792 
2801  hash<ColumnOperatorInfo> cop_min(auto column);
2802 
2803 
2805 
2814  hash<ColumnOperatorInfo> cop_max(auto column);
2815 
2816 
2818 
2827  hash<ColumnOperatorInfo> cop_avg(auto column);
2828 
2829 
2831 
2840  hash<ColumnOperatorInfo> cop_sum(auto column);
2841 
2842 
2844 
2851  hash<ColumnOperatorInfo> cop_count(auto column = '');
2852 
2853 
2855 
2862  hash<ColumnOperatorInfo> cop_over(auto column, *string partitionby, *string orderby);
2863 
2864 
2866 
2876  hash<ColumnOperatorInfo> cop_minus(auto column1, auto column2);
2877 
2878 
2880 
2890  hash<ColumnOperatorInfo> cop_plus(auto column1, auto column2);
2891 
2892 
2894 
2904  hash<ColumnOperatorInfo> cop_divide(auto column1, auto column2);
2905 
2906 
2908 
2918  hash<ColumnOperatorInfo> cop_multiply(auto column1, auto column2);
2919 
2920 
2922 
2931  hash<ColumnOperatorInfo> cop_year(auto column);
2932 
2933 
2935 
2944  hash<ColumnOperatorInfo> cop_year_month(auto column);
2945 
2946 
2948 
2957  hash<ColumnOperatorInfo> cop_year_day(auto column);
2958 
2959 
2961 
2970  hash<ColumnOperatorInfo> cop_year_hour(auto column);
2971 
2972 
2974 
2984  hash<ColumnOperatorInfo> cop_seq(string seq, *string as);
2985 
2986 
2988 
2998  hash<ColumnOperatorInfo> cop_seq_currval(string seq, *string as);
2999 
3000 
3002 
3014  hash<ColumnOperatorInfo> cop_coalesce(auto col1, auto col2);
3015 
3016 
3018 
3029  hash<ColumnOperatorInfo> cop_substr(auto column, int start, *int count);
3030 
3031 
3033 
3044  hash<ColumnOperatorInfo> cop_length(auto column);
3045 
3046 
3048 
3062  hash<ColumnOperatorInfo> cop_trunc_date(auto column, string mask);
3063 
3064 
3065 
3067 
3095  hash<ColumnOperatorInfo> cop_cume_dist();
3096 
3097 
3099 
3127  hash<ColumnOperatorInfo> cop_dense_rank();
3128 
3129 
3131 
3159  hash<ColumnOperatorInfo> cop_first_value(any column);
3160 
3161 
3163 
3191  hash<ColumnOperatorInfo> cop_last_value(any column);
3192 
3193 
3195 
3225  hash<ColumnOperatorInfo> cop_ntile(int value);
3226 
3227 
3229 
3257  hash<ColumnOperatorInfo> cop_percent_rank();
3258 
3259 
3261 
3289  hash<ColumnOperatorInfo> cop_rank();
3290 
3291 
3293 
3321  hash<ColumnOperatorInfo> cop_row_number();
3322 
3323 
3325 
3376  const DT_YEAR = "Y";
3378 
3380  const DT_MONTH = "M";
3381 
3383  const DT_DAY = "D";
3384 
3386  const DT_HOUR = "H";
3387 
3389  const DT_MINUTE = "m";
3390 
3392  const DT_SECOND = "S";
3393 
3394  // let's simulate and enum here'
3395  const DT_ALL_VALUES = ( DT_YEAR, DT_MONTH, DT_DAY, DT_HOUR, DT_MINUTE, DT_SECOND );
3397 
3402  const DefaultUopMap = ...;
3404 
3406 
3428 
3437  hash<UpdateOperatorInfo> make_uop(string uop, auto arg, *hash<UpdateOperatorInfo> nest);
3438 
3439 
3441 
3451  hash<UpdateOperatorInfo> uop_prepend(string arg, *hash<UpdateOperatorInfo> nest);
3452 
3453 
3455 
3465  hash<UpdateOperatorInfo> uop_append(string arg, *hash<UpdateOperatorInfo> nest);
3466 
3467 
3469 
3478  hash<UpdateOperatorInfo> uop_upper(*hash<UpdateOperatorInfo> nest);
3479 
3480 
3482 
3491  hash<UpdateOperatorInfo> uop_lower(*hash<UpdateOperatorInfo> nest);
3492 
3493 
3495 
3506  hash<UpdateOperatorInfo> uop_substr(int start, *int count, *hash<UpdateOperatorInfo> nest);
3507 
3508 
3510 
3520  hash<UpdateOperatorInfo> uop_plus(auto arg, *hash<UpdateOperatorInfo> nest);
3521 
3522 
3524 
3534  hash<UpdateOperatorInfo> uop_minus(auto arg, *hash<UpdateOperatorInfo> nest);
3535 
3536 
3538 
3548  hash<UpdateOperatorInfo> uop_multiply(auto arg, *hash<UpdateOperatorInfo> nest);
3549 
3550 
3552 
3562  hash<UpdateOperatorInfo> uop_divide(auto arg, *hash<UpdateOperatorInfo> nest);
3563 
3564 
3566 
3575  hash<UpdateOperatorInfo> uop_seq(string seq);
3576 
3577 
3579 
3588  hash<UpdateOperatorInfo> uop_seq_currval(string seq);
3589 
3591 
3598 
3601  const JOP_INNER = "inner";
3602 
3604 
3606  const JOP_LEFT = "left";
3607 
3609 
3611  const JOP_RIGHT = "right";
3612 
3614  const JopMap = ...;
3615 
3617 
3627 
3631  hash<string, hash<JoinOperatorInfo>> make_jop(string jop, AbstractTable table, *string alias, *hash jcols, *hash cond, *string ta, *hash<auto> opt);
3632 
3633 
3635 
3639  hash<string, hash<JoinOperatorInfo>> make_jop(string jop, string table_name, *string alias, *hash jcols, *hash cond, *string ta, *hash<auto> opt);
3640 
3641 
3643 
3662  hash<string, hash<JoinOperatorInfo>> join_inner(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3663 
3664 
3666 
3685  hash<string, hash<JoinOperatorInfo>> join_inner(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3686 
3687 
3689 
3708  hash<string, hash<JoinOperatorInfo>> join_inner(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3709 
3710 
3712 
3734  hash<string, hash<JoinOperatorInfo>> join_inner(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3735 
3736 
3738 
3758  hash<string, hash<JoinOperatorInfo>> join_inner(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3759 
3760 
3762 
3784  hash<string, hash<JoinOperatorInfo>> join_inner_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3785 
3786 
3788 
3807  hash<string, hash<JoinOperatorInfo>> join_left(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3808 
3809 
3811 
3830  hash<string, hash<JoinOperatorInfo>> join_left(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3831 
3832 
3834 
3855  hash<string, hash<JoinOperatorInfo>> join_left(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3856 
3857 
3859 
3879  hash<string, hash<JoinOperatorInfo>> join_left(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3880 
3881 
3883 
3903  hash<string, hash<JoinOperatorInfo>> join_left(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3904 
3905 
3907 
3929  hash<string, hash<JoinOperatorInfo>> join_left_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3930 
3931 
3933 
3952  hash<string, hash<JoinOperatorInfo>> join_right(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3953 
3954 
3956 
3975  hash<string, hash<JoinOperatorInfo>> join_right(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3976 
3977 
3979 
4000  hash<string, hash<JoinOperatorInfo>> join_right(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4001 
4002 
4004 
4024  hash<string, hash<JoinOperatorInfo>> join_right(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4025 
4026 
4028 
4048  hash<string, hash<JoinOperatorInfo>> join_right(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4049 
4050 
4052 
4074  hash<string, hash<JoinOperatorInfo>> join_right_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4075 
4077 
4082 
4085  const OP_LIKE = "like";
4086 
4088 
4090  const OP_LT = "<";
4091 
4093 
4095  const OP_LE = "<=";
4096 
4098 
4100  const OP_GT = ">";
4101 
4103 
4105  const OP_GE = ">=";
4106 
4108 
4110  const OP_NE = "!=";
4111 
4113 
4115  const OP_EQ = "=";
4116 
4118 
4120  const OP_CLT = "C<";
4121 
4123 
4125  const OP_CLE = "C<=";
4126 
4128 
4130  const OP_CGT = "C>";
4131 
4133 
4135  const OP_CGE = "C>=";
4136 
4138 
4140  const OP_CNE = "C!=";
4141 
4143 
4145  const OP_CEQ = "C=";
4146 
4148 
4150  const OP_BETWEEN = "between";
4151 
4153 
4155  const OP_IN = "in";
4156 
4158 
4160  const OP_NOT = "not";
4161 
4163 
4165  const OP_SUBSTR = "substr";
4166 
4168 
4170  const OP_OR = "or";
4171 
4173 
4175  const OP_IN_SELECT = "in_select";
4176 
4178  const DefaultOpMap = ...;
4179 
4181 
4205  hash<OperatorInfo> make_op(string op, auto arg);
4207 
4208 
4210 
4219  hash<OperatorInfo> op_like(string str);
4220 
4221 
4223 
4234  hash<OperatorInfo> op_lt(auto arg);
4235 
4236 
4238 
4249  hash<OperatorInfo> op_le(auto arg);
4250 
4251 
4253 
4264  hash<OperatorInfo> op_gt(auto arg);
4265 
4266 
4268 
4279  hash<OperatorInfo> op_ge(auto arg);
4280 
4281 
4283 
4296  hash<OperatorInfo> op_ne(auto arg);
4297 
4298 
4300 
4313  hash<OperatorInfo> op_eq(auto arg);
4314 
4315 
4317 
4329  hash<OperatorInfo> op_between(auto l, auto r);
4330 
4331 
4333 
4342  hash<OperatorInfo> op_in();
4343 
4344 
4346 
4353  hash<OperatorInfo> op_in_select(string table, hash<auto> select_hash);
4354 
4355 
4357 
4364  hash<OperatorInfo> op_in_select(AbstractTable table, hash<auto> select_hash);
4365 
4366 
4368 
4375  hash<OperatorInfo> op_in_select(Table table, hash<auto> select_hash);
4376 
4377 
4379 
4390  hash<OperatorInfo> op_in(list<auto> args);
4391 
4392 
4394 
4401  hash<OperatorInfo> op_not(hash arg);
4402 
4403 
4405 
4416  hash<OperatorInfo> op_clt(string arg);
4417 
4418 
4420 
4431  hash<OperatorInfo> op_cle(string arg);
4432 
4433 
4435 
4446  hash<OperatorInfo> op_cgt(string arg);
4447 
4448 
4450 
4461  hash<OperatorInfo> op_cge(string arg);
4462 
4463 
4465 
4476  hash<OperatorInfo> op_cne(string arg);
4477 
4478 
4480 
4491  hash<OperatorInfo> op_ceq(string arg);
4492 
4493 
4495 
4506  hash<OperatorInfo> op_substr(int start, *int count, string text);
4507 
4508 
4510 
4520  hash<OperatorInfo> op_substr(int start, string text);
4521 
4522 
4524 
4541  hash<string, hash<OperatorInfo>> wop_or(hash h1, hash h2);
4542 
4544 
4551 
4554  const IOP_SEQ = "seq";
4555 
4557 
4559  const IOP_SEQ_CURRVAL = "seq_currval";
4560 
4562  const DefaultIopMap = {};
4564 
4570 
4578  hash<InsertOperatorInfo> make_iop(string iop, auto arg);
4579 
4580 
4582 
4591  hash<InsertOperatorInfo> iop_seq(string arg);
4592 
4593 
4595 
4604  hash<InsertOperatorInfo> iop_seq_currval(string arg);
4605 
4607 
4609  const SqlUtilDrivers = ...;
4610 
4611 
4612  // private variable to store the closure used to deserialize datasources (if any)
4613  extern code ds_get;
4614 
4615  // private variable to store the closure used to serialize datasources (if any)
4616  extern code ds_do;
4617 
4619  sqlutil_register_ds_deserializer(*code new_ds_get);
4620 
4621 
4623  sqlutil_register_ds_serializer(*code new_ds_do);
4624 
4625 
4626  // private function used to deserialize datasources
4627  AbstractDatasource sqlutil_get_ds(string type, string config);
4628 
4629 
4630  // private function used to serialize datasources
4631  hash<auto> sqlutil_ds(AbstractDatasource ds);
4632 
4633 
4635 class AbstractHashContainer : public Serializable {
4636 
4637 public:
4638 
4639 
4640 protected:
4643 
4644 public:
4645 
4647  constructor(*hash nh);
4648 
4649 
4652 
4653 
4656 
4657 
4659 
4674  auto memberGate(string k);
4675 
4676 
4678 
4684  clear();
4685 
4686 
4688  abstract auto take(string k);
4689 
4691  renameKey(string old_name, string new_name);
4692 
4693 
4695  *hash<auto> getHash();
4696 
4697 
4699 
4708  bool matchKeys(hash h1);
4709 
4710 
4712 
4721  bool matchKeys(list<auto> l);
4722 
4723 
4725 
4735 
4736 
4738 
4747  bool partialMatchKeys(hash h1);
4748 
4749 
4751 
4760  bool partialMatchKeys(list<auto> l);
4761 
4762 
4764 
4774 
4775 
4777 
4786  bool val();
4787 
4788 
4790 
4797  list<string> keys();
4798 
4799 
4801 
4808  list<auto> values();
4809 
4810 
4812 
4820 
4821 
4823 
4831 
4832 
4834 
4842 
4843 
4845  bool empty();
4846 
4847 
4849 
4856  int size();
4857 
4858 
4860 
4869  bool hasKey(string k);
4870 
4871 
4873 
4882  bool hasKeyValue(string k);
4883 
4884 
4886 
4895  *string firstKey();
4896 
4897 
4899 
4908  *string lastKey();
4909 
4910 
4912  abstract string getElementName();
4913  };
4914 
4916 class AbstractListContainer : public Serializable {
4917 
4918 public:
4919 
4920 
4921 protected:
4922  softlist l;
4923 
4924 public:
4925 
4927  constructor(softlist nl);
4928 
4929 
4931 
4942  abstract auto get(softint i);
4943 
4945  add(auto val);
4946 
4947 
4949  auto take(int i);
4950 
4951 
4953  list<auto> getList();
4954 
4955 
4957 
4966  bool val();
4967 
4968 
4970 
4978 
4979 
4981  bool empty();
4982 
4983 
4985 
4992  int size();
4993 
4994 
4996  abstract string getElementName();
4997 
4998 protected:
4999  checkIndex(int i);
5000 public:
5001 
5002  };
5003 
5006 
5007 public:
5009  constructor();
5010 
5011 
5013  constructor(AbstractDatasource ds, hash tables, *hash<auto> opt);
5014 
5015 
5017  constructor(AbstractDatasource ds);
5018 
5019 
5021  add(string k, Table val);
5022 
5023 
5025  add(string k, AbstractTable val);
5026 
5027 
5029  add(Table val);
5030 
5031 
5034 
5035 
5037  AbstractTable take(string k);
5038 
5039 
5041  populate(AbstractDatasource ds, hash<auto> tables, *hash<auto> opt);
5042 
5043 
5045  populate(AbstractDatasource ds);
5046 
5047 
5049 
5065  *list<auto> getDropAllForeignConstraintsOnTableSql(string name, *hash<auto> opt);
5066 
5067 
5069 
5084  AbstractTable memberGate(string k);
5085 
5086 
5088  string getElementName();
5089 
5090 
5092  *AbstractTable getIfExists(AbstractDatasource ds, string name);
5093 
5094 
5096  AbstractTable get(AbstractDatasource ds, string name);
5097 
5098 
5100 
5115  *string getRenameTableIfExistsSql(string old_name, string new_name, *hash<auto> opts);
5116 
5117 
5119 
5130  bool tableRenamed(string old_name, string new_name, string old_sql_name);
5131 
5132 
5133 protected:
5134  tableRenamedIntern(string old_name, string new_name, string oldsn);
5135 public:
5136 
5137 
5139 
5154  *string getDropConstraintIfExistsSql(string tname, string cname, *hash<auto> opts);
5155 
5156 
5157  list<auto> getCreateList();
5158 
5159 
5160  Qore::AbstractIterator createIterator();
5161 
5162 
5164 
5172  list<auto> getDropList();
5173 
5174 
5176 
5184 
5185 
5186 protected:
5187  getDependencies(reference<hash> tdh, reference<hash> sdh, *reference<hash> th);
5188 public:
5189 
5190  };
5191 
5194 
5195 public:
5197  constructor(*hash c) ;
5198 
5199 
5201  constructor(Columns old) ;
5202 
5203 
5205  add(string k, AbstractColumn val);
5206 
5207 
5209  AbstractColumn take(string k);
5210 
5211 
5213 
5228  AbstractColumn memberGate(string k);
5229 
5230 
5232  Columns subset(softlist l);
5233 
5234 
5236  string getElementName();
5237 
5238 
5240  bool equal(Columns cols);
5241 
5242 
5244  AbstractIterator getSqlColumnNameIterator();
5245 
5246  };
5247 
5249 class AbstractDdlObject : public Serializable {
5250 
5251 public:
5253  string name;
5254 
5256  string ddl_name;
5257 
5259 protected:
5260  constructor();
5261 public:
5262 
5263 
5265  constructor(string name);
5266 
5267 
5269 
5271  abstract string getDdlName(string name);
5272  };
5273 
5276 
5277 public:
5279  string native_type;
5280 
5282  *string qore_type;
5283 
5285  int size;
5286 
5288  bool nullable;
5289 
5291  *string def_val;
5292 
5294  *string comment;
5295 
5297 protected:
5298  constructor();
5299 public:
5300 
5301 
5302  constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string c)
5303  ;
5304 
5305 
5307  string getNativeTypeString();
5308 
5309 
5311  string getCreateSql(AbstractTable t);
5312 
5313 
5315 
5324  abstract list<auto> getAddColumnSql(AbstractTable t);
5325 
5327  string getDropSql(string table_name);
5328 
5329 
5331 
5344  list<auto> getModifySql(AbstractTable t, AbstractColumn c, *hash<auto> opt);
5345 
5346 
5348 
5358  abstract string getRenameSql(AbstractTable t, string new_name);
5359 
5361  bool equal(AbstractColumn c);
5362 
5363 
5365 protected:
5366  abstract bool equalImpl(AbstractColumn c);
5367 public:
5368 
5370 
5383 protected:
5384  abstract list<auto> getModifySqlImpl(AbstractTable t, AbstractColumn c, *hash<auto> opt);
5385 public:
5386  };
5387 
5389 class NumericColumnInfo : public Serializable {
5390 
5391 public:
5393  int scale;
5394 
5395  constructor(softint n_scale = 0);
5396 
5397 
5399  string getNativeTypeString(string native_type, int precision);
5400 
5401  };
5402 
5405 
5406 public:
5407  constructor(*hash c) ;
5408 
5409 
5411  add(string k, AbstractIndex val);
5412 
5413 
5416 
5417 
5419  AbstractIndex take(string k);
5420 
5421 
5423  *AbstractIndex tryTake(string k);
5424 
5425 
5427 
5442  AbstractIndex memberGate(string k);
5443 
5444 
5445  string getElementName();
5446 
5447  };
5448 
5450 class AbstractIndex : public Serializable {
5451 
5452 public:
5454  string name;
5455 
5457  bool unique;
5458 
5461 
5462 protected:
5465 
5468 
5469 public:
5470 
5472  constructor(string n, bool u, hash c);
5473 
5474 
5476  string getName();
5477 
5478 
5480  bool hasColumn(string cname);
5481 
5482 
5484  abstract string getCreateSql(string table_name, *hash<auto> opt);
5485 
5487  string getDropSql(string table_name);
5488 
5489 
5491  bool equal(AbstractIndex ix);
5492 
5493 
5495  bool equalExceptName(AbstractIndex ix);
5496 
5497 
5499  abstract bool equalImpl(AbstractIndex ix);
5500 
5502  abstract string getRenameSql(string table_name, string new_name);
5503 
5506 
5507 
5510 
5511 
5514 
5515 
5518 
5519 
5522 
5523 
5526 
5527 
5529  *list<AbstractColumnConstraint> getAllSupportingConstraints();
5530 
5531 
5533  list<auto> getRecreateSql(AbstractDatasource ds, string table_name, *hash<auto> opt);
5534 
5535  };
5536 
5539 
5540 public:
5541  constructor(*hash c) ;
5542 
5543 
5545  add(string k, AbstractConstraint val);
5546 
5547 
5549  AbstractConstraint take(string k);
5550 
5551 
5554 
5555 
5557 
5572  AbstractConstraint memberGate(string k);
5573 
5574 
5575  string getElementName();
5576 
5577  };
5578 
5580 class AbstractConstraint : public Serializable {
5581 
5582 public:
5583 
5584 
5585 protected:
5587  string name;
5588 
5589 public:
5590 
5592  constructor(string n);
5593 
5594 
5596  string getName();
5597 
5598 
5600  rename(string n);
5601 
5602 
5604  abstract string getCreateSql(string table_name, *hash<auto> opt);
5605 
5607  string getDropSql(string table_name);
5608 
5609 
5611  abstract list<auto> getRenameSql(string table_name, string new_name);
5612 
5614  string getDisableSql(string table_name);
5615 
5616 
5618  string getEnableSql(string table_name, *hash<auto> opt);
5619 
5620 
5622  bool equal(AbstractConstraint c);
5623 
5624 
5626 protected:
5627  abstract bool equalImpl(AbstractConstraint c);
5628 public:
5629 
5631  abstract bool setIndexBase(string ix);
5632 
5634  abstract clearIndex();
5635 
5637  bool hasColumn(string cname);
5638 
5639  };
5640 
5643 
5644 public:
5646  string src;
5647 
5649  constructor(string n, string n_src) ;
5650 
5651 
5653 protected:
5654  bool equalImpl(AbstractConstraint c);
5655 public:
5656 
5657 
5659  bool setIndexBase(string ix);
5660 
5661 
5663  clearIndex();
5664 
5665  };
5666 
5669 
5670 public:
5671 protected:
5673  *string index;
5674 
5675 public:
5676 
5678  constructor(string name, *hash<auto> cols, *string index) ;
5679 
5680 
5682  constructor(string name, Columns cols, *string index) ;
5683 
5684 
5686  bool setIndexBase(string ix);
5687 
5688 
5690  clearIndex();
5691 
5692  };
5693 
5696 
5697 public:
5698 protected:
5700  *hash<string, hash<string, AbstractForeignConstraint>> sourceConstraints;
5701 
5702 public:
5703 
5705  constructor(string name, *hash<auto> cols, *string index) ;
5706 
5707 
5709  constructor(string name, Columns cols, *string index) ;
5710 
5711 
5713 
5718 
5719 
5721  hash<auto> getDisableReenableSql(AbstractDatasource ds, string table_name, *hash<auto> opts);
5722 
5723 
5725  findMatchingIndex(*Indexes indexes);
5726 
5727 
5729 
5740 
5741 
5743  removeSourceConstraint(string tname, list<auto> cols);
5744 
5745 
5747  renameSourceConstraintTable(string old_name, string new_name);
5748 
5749 
5751  bool hasColumn(string cname);
5752 
5753 
5755  *string getIndex();
5756 
5757 
5759 protected:
5760  bool equalImpl(AbstractConstraint c);
5761 public:
5762 
5763 
5765  abstract string getCreateSql(string table_name, *hash<auto> opts);
5766  };
5767 
5770 
5771 public:
5773  constructor(string n, *hash<auto> c, *string n_index) ;
5774 
5775  };
5776 
5779 
5780 public:
5781  constructor() ;
5782 
5783 
5784  constructor(string n, *hash<auto> c) ;
5785 
5786  };
5787 
5790 
5791 public:
5792  constructor(*hash<auto> c) ;
5793 
5794 
5796  add(string k, AbstractForeignConstraint val);
5797 
5798 
5800  AbstractForeignConstraint take(string k);
5801 
5802 
5805 
5806 
5808 
5824 
5825 
5827  *hash<auto> findConstraintOn(string table, softlist<auto> cols);
5828 
5829 
5831  string getElementName();
5832 
5833  };
5834 
5836 class ForeignConstraintTarget : public Serializable {
5837 
5838 public:
5840  string table;
5841 
5844 
5846  constructor(string t, Columns c);
5847 
5848 
5850  bool equal(ForeignConstraintTarget targ);
5851 
5852  };
5853 
5856 
5857 public:
5860 
5861  constructor(string name, Columns cols, ForeignConstraintTarget t) ;
5862 
5863 
5865 protected:
5866  bool equalImpl(AbstractConstraint con);
5867 public:
5868 
5869  };
5870 
5872 class AbstractSequence : public Serializable {
5873 
5874 public:
5876  string name;
5877 
5880 
5883 
5886 
5888  constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_max);
5889 
5890 
5892  abstract string getCreateSql(*hash<auto> opt);
5893 
5895 
5897  string getDropSql(*hash<auto> opt);
5898 
5899 
5901 
5904  abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
5905  };
5906 
5908 class AbstractView : public Serializable {
5909 
5910 public:
5911  // ! potential object schema
5912  *string schema;
5913 
5915  string name;
5916 
5918  string src;
5919 
5922 
5924  constructor(string n_name, string n_src);
5925 
5926 
5928  abstract string getCreateSql(*hash<auto> opt);
5929 
5931 
5933  string getDropSql(*hash<auto> opt);
5934 
5935 
5937 
5940  abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
5941  };
5942 
5944 class AbstractFunctionBase : public Serializable {
5945 
5946 public:
5948  string name;
5949 
5951  string type;
5952 
5954  string src;
5955 
5957 
5961  constructor(string n, string n_type, string n_src);
5962 
5963 
5965  string getType();
5966 
5967 
5969 
5971  string getDropSql(*hash<auto> opt);
5972 
5973 
5975  bool equal(AbstractFunctionBase t);
5976 
5977 
5979  string getNormalizedSource(string src);
5980 
5981 
5983 protected:
5984  abstract bool equalImpl(AbstractFunctionBase t);
5985 public:
5986  };
5987 
5990 
5991 public:
5993 
5997  constructor(string n, string n_type, string n_src) ;
5998 
5999 
6001  abstract list<auto> getCreateSql(*hash<auto> opt);
6002 
6004 
6007  abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
6008 
6010  setName(string new_name);
6011 
6012  };
6013 
6016 
6017 public:
6018  constructor(*hash c) ;
6019 
6020 
6022  add(string k, AbstractFunction val);
6023 
6024 
6026  AbstractFunction take(string k);
6027 
6028 
6030 
6045  AbstractFunction memberGate(string k);
6046 
6047 
6048  string getElementName();
6049 
6050  };
6051 
6054 
6055 public:
6057  constructor(string n, string n_src) ;
6058 
6059 
6061  abstract list<auto> getCreateSql(string table_name, *hash<auto> opt);
6062 
6064  abstract softlist<auto> getRenameSql(string table_name, string new_name);
6065 
6067  abstract list<auto> getDropSql(string table_name);
6068  };
6069 
6072 
6073 public:
6074  constructor(*hash c) ;
6075 
6076 
6078  add(string k, AbstractTrigger val);
6079 
6080 
6082  AbstractTrigger take(string k);
6083 
6084 
6086 
6101  AbstractTrigger memberGate(string k);
6102 
6103 
6104  string getElementName();
6105 
6106  };
6107 };
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:5587
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:5256
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:2265
string name
the name of the sequence
Definition: SqlUtil.qm.dox.h:5876
const COP_SEQ
to return the next value of a sequence
Definition: SqlUtil.qm.dox.h:2411
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:2203
const DefaultIopMap
a hash of default insert operator descriptions (currently empty, all operators are driver-dependent) ...
Definition: SqlUtil.qm.dox.h:4562
auto arg
optional argument
Definition: SqlUtil.qm.dox.h:2163
abstract container class that throws an exception if an unknown key is accessed
Definition: SqlUtil.qm.dox.h:4916
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:2141
copy(AbstractHashContainer old)
creates a "deep copy" of the object
string cop
the column operator string code
Definition: SqlUtil.qm.dox.h:2168
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:4155
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:2501
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:2463
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:5005
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:5921
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:2174
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:4150
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:5464
hash< ColumnOperatorInfo > make_cop(string cop, auto column, auto arg)
returns a ColumnOperatorInfo hash
any arg
optional argument
Definition: SqlUtil.qm.dox.h:2176
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:5450
*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:4170
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:2366
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:5789
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:2212
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:2456
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:4110
*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:2209
string getType()
returns the type of object
A hash describing SQL and arguments for an SQL DML command.
Definition: SqlUtil.qm.dox.h:2223
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:2356
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:2274
string name
the name of the object
Definition: SqlUtil.qm.dox.h:5948
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:5836
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:5282
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:2416
the base class to use to extend AbstractColumn to implement numeric columns
Definition: SqlUtil.qm.dox.h:5389
const DB_TABLES
Feature: tables.
Definition: SqlUtil.qm.dox.h:2248
*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:2238
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:3614
const SZ_MAND
the data type takes a mandatory size parameter
Definition: SqlUtil.qm.dox.h:2285
const OP_GT
the SQL greater than operator (>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4100
const COP_AVG
to return the average value
Definition: SqlUtil.qm.dox.h:2351
const JOP_LEFT
for left outer joins
Definition: SqlUtil.qm.dox.h:3606
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:5872
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:2250
*softint maxlen
optional additional limit to the maximum length of the data
Definition: SqlUtil.qm.dox.h:2217
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:2470
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:5288
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:2336
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:2406
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:2198
string jop
the join operator string code
Definition: SqlUtil.qm.dox.h:2188
const IOP_SEQ_CURRVAL
for using the last value of a sequence issued in the current session
Definition: SqlUtil.qm.dox.h:4559
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:5668
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:2147
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:4140
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:4609
const OP_CGT
the SQL greater than operator (>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4130
the base class for foreign key constraint information
Definition: SqlUtil.qm.dox.h:5855
*string index
the index supporting the constraint
Definition: SqlUtil.qm.dox.h:5673
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:5859
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:2170
int scale
the scale for numeric columns
Definition: SqlUtil.qm.dox.h:5393
abstract class for check constraints
Definition: SqlUtil.qm.dox.h:5642
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:2361
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:2149
const OP_CEQ
the SQL equals operator (=) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4145
const COP_NTILE
Analytic (window) function: NTILE.
Definition: SqlUtil.qm.dox.h:2477
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:2145
abstract container class that throws an exception if an unknown key is accessed
Definition: SqlUtil.qm.dox.h:4635
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:2187
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:6071
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:5646
const DT_DAY
Format unit: day.
Definition: SqlUtil.qm.dox.h:3383
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:2326
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:2192
const COP_PLUS
the SQL "plus" operator
Definition: SqlUtil.qm.dox.h:2376
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:4105
index container class that throws an exception if an unknown index is accessed
Definition: SqlUtil.qm.dox.h:5404
const SZ_NUM
the data type is numeric so takes an optional precision and scale
Definition: SqlUtil.qm.dox.h:2291
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:2157
const DB_PACKAGES
Feature: packages.
Definition: SqlUtil.qm.dox.h:2242
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:5291
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:2421
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:2162
*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:2200
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:4115
generic column description hash in schema descriptions
Definition: SqlUtil.qm.dox.h:2137
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:5294
const VARCHAR
specifies a VARCHAR column (equivalent to Qore::Type::String)
Definition: SqlUtil.qm.dox.h:2262
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:5918
bool unique
True if the index is a unique index, False if not
Definition: SqlUtil.qm.dox.h:5457
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:2396
string src
the source of the object
Definition: SqlUtil.qm.dox.h:5954
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:2189
const COP_MAX
to return the maximum value
Definition: SqlUtil.qm.dox.h:2346
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:2433
auto column
column sopecifier, may be a string or a complex hash
Definition: SqlUtil.qm.dox.h:2169
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:2254
const COP_AS
to rename a column on output
Definition: SqlUtil.qm.dox.h:2301
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:2194
const OP_LE
the SQL less than or equals (<=) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4095
const DB_PROCEDURES
Feature: procedures.
Definition: SqlUtil.qm.dox.h:2244
string name
the name of the index
Definition: SqlUtil.qm.dox.h:5454
string _iop
the insert operator string code
Definition: SqlUtil.qm.dox.h:2175
Columns columns
columns in the target table
Definition: SqlUtil.qm.dox.h:5843
string uop
the update operator string code
Definition: SqlUtil.qm.dox.h:2181
const OP_CLE
the SQL less than or equals (<=) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4125
the API for a constraint with columns
Definition: SqlUtil.qm.dox.h:5695
const BLOB
specifies a large variable-length binary column (ie BLOB or BYTEA, etc)
Definition: SqlUtil.qm.dox.h:2271
auto arg
optional argument
Definition: SqlUtil.qm.dox.h:2182
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:4160
*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:5700
clear()
purges the contained data
Columns columns
an object of class Columns representing the columns in the index
Definition: SqlUtil.qm.dox.h:5460
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:5944
update operator info hash as returned by all update operator functions
Definition: SqlUtil.qm.dox.h:2180
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:2449
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:2228
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:4642
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:5989
string sql
the SQL string for the update
Definition: SqlUtil.qm.dox.h:2225
const COP_MULTIPLY
the SQL "multiply" operator
Definition: SqlUtil.qm.dox.h:2386
column operator info hash as returned by all column operator functions
Definition: SqlUtil.qm.dox.h:2167
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:2311
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:2153
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:2442
abstract clearIndex()
clears any index base for the constraint
base class for views
Definition: SqlUtil.qm.dox.h:5908
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:5951
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:2391
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:5285
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:2155
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:5279
const COP_VALUE
to append a constant value (SQL Literal) to use as an output column value
Definition: SqlUtil.qm.dox.h:2321
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:5193
the base class for triggers
Definition: SqlUtil.qm.dox.h:6053
*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:2193
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:5253
const OP_LT
the SQL less than (<) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4090
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:6015
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:5275
const COP_CAST
to convert column value into another datatype
Definition: SqlUtil.qm.dox.h:2306
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:4135
const DT_MINUTE
Format unit: minute.
Definition: SqlUtil.qm.dox.h:3389
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:3386
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:2151
const CHAR
specifies a CHAR column
Definition: SqlUtil.qm.dox.h:2268
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:3403
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:2341
const COP_YEAR_DAY
to return a date value with year to day information
Definition: SqlUtil.qm.dox.h:2401
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:5249
const DT_MONTH
Format unit: month.
Definition: SqlUtil.qm.dox.h:3380
string name
the name of the sequence
Definition: SqlUtil.qm.dox.h:5915
const COP_PERCENT_RANK
Analytic (window) function: PERCENT_RANK.
Definition: SqlUtil.qm.dox.h:2484
*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:2191
*number max
the ending number
Definition: SqlUtil.qm.dox.h:5885
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:2491
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:5882
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:4085
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:2282
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:4120
const DB_MVIEWS
Feature: materialized views / snapshots.
Definition: SqlUtil.qm.dox.h:2240
const COP_MINUS
the SQL "minus" operator
Definition: SqlUtil.qm.dox.h:2371
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:5840
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:2190
const COP_SUBSTR
to extract a substring from a column
Definition: SqlUtil.qm.dox.h:2426
const JOP_RIGHT
for right outer joins
Definition: SqlUtil.qm.dox.h:3611
const OP_SUBSTR
the SQL "substr" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4165
*AbstractForeignConstraint foreign_constraint
Any foreign constraint that this index supports.
Definition: SqlUtil.qm.dox.h:5467
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:2288
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:2143
const DB_SEQUENCES
Feature: sequences.
Definition: SqlUtil.qm.dox.h:2246
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:2161
number start
the starting number
Definition: SqlUtil.qm.dox.h:5879
const IOP_SEQ
for using the value of a sequence
Definition: SqlUtil.qm.dox.h:4554
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:2498
const DT_YEAR
Format unit: year.
Definition: SqlUtil.qm.dox.h:3377
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:2252
*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:2206
represents a primary key
Definition: SqlUtil.qm.dox.h:5778
const JOP_INNER
for standard inner joins
Definition: SqlUtil.qm.dox.h:3601
const COP_LOWER
to return column value in lower case
Definition: SqlUtil.qm.dox.h:2331
const OP_IN_SELECT
the SQL "in" operator with a select query for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4175
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:2183
const COP_DIVIDE
the SQL "divide" operator
Definition: SqlUtil.qm.dox.h:2381
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:2139
*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:4178
represents a unique column constraint
Definition: SqlUtil.qm.dox.h:5769
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:5580
const DT_SECOND
Format unit: hour.
Definition: SqlUtil.qm.dox.h:3392
constraint container class that throws an exception if an unknown constraint is accessed ...
Definition: SqlUtil.qm.dox.h:5538
const COP_APPEND
to append a string to a column on output
Definition: SqlUtil.qm.dox.h:2316