Qore SqlUtil Module Reference  1.7
SqlUtil.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* SqlUtil.qm Copyright (C) 2013 - 2020 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 
2125 namespace SqlUtil {
2128  public struct GenericColumnInfo {
2130  string qore_type;
2132  string native_type;
2134  softint size;
2136  softint scale;
2142  *string comment;
2144  bool notnull = False;
2146  hash<string, hash> driver;
2149  };
2150 
2152  public struct OperatorInfo {
2153  string op;
2154  auto arg;
2155  };
2156 
2158  public struct ColumnOperatorInfo {
2159  string cop;
2160  auto column;
2161  auto arg;
2162  };
2163 
2165  public struct InsertOperatorInfo {
2166  string _iop;
2167  any arg;
2168  };
2169 
2171  public struct UpdateOperatorInfo {
2172  string uop;
2173  auto arg;
2175  };
2176 
2178  public struct JoinOperatorInfo {
2179  string jop;
2180  auto table;
2181  *string alias;
2184  *string ta;
2185  *hash<auto> opt;
2186  };
2187 
2191  *string date_format;
2192 
2194  *TimeZone data_timezone;
2195 
2197  *TimeZone db_timezone;
2198 
2200  *string number_format;
2201 
2203  *softbool mandatory;
2204 
2206 
2208  *softint maxlen;
2209  };
2210 
2212 
2214  public struct SqlCommandInfo {
2216  string sql;
2217 
2219  list<auto> args;
2220  };
2221 
2226 
2229  const DB_FUNCTIONS = "functions";
2231  const DB_MVIEWS = "materialized views";
2233  const DB_PACKAGES = "packages";
2235  const DB_PROCEDURES = "procedures";
2237  const DB_SEQUENCES = "sequences";
2239  const DB_TABLES = "tables";
2241  const DB_TYPES = "named types";
2243  const DB_VIEWS = "views";
2245  const DB_SYNONYMS = "synonyms";
2247 
2248  /* @defgroup SqlTypeConstants SQL Type Constants
2249  These constants can be used for the \c "qore_type" values when creating columns to specify additional SQL column types
2250  */
2252  const VARCHAR = "string";
2254 
2256  const NUMERIC = "number";
2257 
2259  const CHAR = "char";
2260 
2262  const BLOB = "blob";
2263 
2265  const CLOB = "clob";
2267 
2272  const SZ_NONE = 0;
2274 
2276  const SZ_MAND = 1;
2277 
2279  const SZ_OPT = 2;
2280 
2282  const SZ_NUM = 3;
2284 
2289 
2292  const COP_AS = "as";
2293 
2295 
2297  const COP_CAST = "cast";
2298 
2300 
2302  const COP_PREPEND = "prepend";
2303 
2305 
2307  const COP_APPEND = "append";
2308 
2310 
2312  const COP_VALUE = "value";
2313 
2315 
2317  const COP_UPPER = "upper";
2318 
2320 
2322  const COP_LOWER = "lower";
2323 
2325 
2327  const COP_DISTINCT = "distinct";
2328 
2330 
2332  const COP_MIN = "min";
2333 
2335 
2337  const COP_MAX = "max";
2338 
2340 
2342  const COP_AVG = "avg";
2343 
2345 
2347  const COP_SUM = "sum";
2348 
2350 
2352  const COP_COUNT = "count";
2353 
2355 
2357  const COP_OVER = "over";
2358 
2360 
2362  const COP_MINUS = "minus";
2363 
2365 
2367  const COP_PLUS = "plus";
2368 
2370 
2372  const COP_DIVIDE = "divide";
2373 
2375 
2377  const COP_MULTIPLY = "multiply";
2378 
2380 
2382  const COP_YEAR = "year";
2383 
2385 
2387  const COP_YEAR_MONTH = "year_month";
2388 
2390 
2392  const COP_YEAR_DAY = "year_day";
2393 
2395 
2397  const COP_YEAR_HOUR = "year_hour";
2398 
2400 
2402  const COP_SEQ = "seq";
2403 
2405 
2407  const COP_SEQ_CURRVAL = "seq_currval";
2408 
2410 
2412  const COP_COALESCE = "coalesce";
2413 
2415 
2417  const COP_SUBSTR = "substr";
2418 
2420 
2424  const COP_LENGTH = "length";
2425 
2427 
2433  const COP_TRUNC_DATE = "truncate_date";
2434 
2436 
2440  const COP_CUME_DIST = "cume_dist";
2441 
2443 
2447  const COP_DENSE_RANK = "dense_rank";
2448 
2450 
2454  const COP_FIRST_VALUE = "first_value";
2455 
2457 
2461  const COP_LAST_VALUE = "last_value";
2462 
2464 
2468  const COP_NTILE = "ntile";
2469 
2471 
2475  const COP_PERCENT_RANK = "percent_rank";
2476 
2478 
2482  const COP_RANK = "rank";
2483 
2485 
2489  const COP_ROW_NUMBER = "row_number";
2490 
2492  const DefaultCopMap = ...;
2493 
2495 
2537 
2546  hash<ColumnOperatorInfo> make_cop(string cop, auto column, auto arg);
2547 
2548 
2550 
2562  hash<ColumnOperatorInfo> cop_as(auto column, string arg);
2563 
2564 
2566 
2580  hash<ColumnOperatorInfo> cop_cast(auto column, string arg, auto arg1, auto arg2);
2581 
2582 
2584 
2594  hash<ColumnOperatorInfo> cop_prepend(auto column, string arg);
2595 
2596 
2598 
2608  hash<ColumnOperatorInfo> cop_append(auto column, string arg);
2609 
2610 
2612 
2740  hash<ColumnOperatorInfo> cop_value(auto arg);
2741 
2742 
2744 
2753  hash<ColumnOperatorInfo> cop_upper(auto column);
2754 
2755 
2757 
2766  hash<ColumnOperatorInfo> cop_lower(auto column);
2767 
2768 
2770 
2779  hash<ColumnOperatorInfo> cop_distinct(auto column);
2780 
2781 
2783 
2792  hash<ColumnOperatorInfo> cop_min(auto column);
2793 
2794 
2796 
2805  hash<ColumnOperatorInfo> cop_max(auto column);
2806 
2807 
2809 
2818  hash<ColumnOperatorInfo> cop_avg(auto column);
2819 
2820 
2822 
2831  hash<ColumnOperatorInfo> cop_sum(auto column);
2832 
2833 
2835 
2842  hash<ColumnOperatorInfo> cop_count(auto column = '');
2843 
2844 
2846 
2853  hash<ColumnOperatorInfo> cop_over(auto column, *string partitionby, *string orderby);
2854 
2855 
2857 
2867  hash<ColumnOperatorInfo> cop_minus(auto column1, auto column2);
2868 
2869 
2871 
2881  hash<ColumnOperatorInfo> cop_plus(auto column1, auto column2);
2882 
2883 
2885 
2895  hash<ColumnOperatorInfo> cop_divide(auto column1, auto column2);
2896 
2897 
2899 
2909  hash<ColumnOperatorInfo> cop_multiply(auto column1, auto column2);
2910 
2911 
2913 
2922  hash<ColumnOperatorInfo> cop_year(auto column);
2923 
2924 
2926 
2935  hash<ColumnOperatorInfo> cop_year_month(auto column);
2936 
2937 
2939 
2948  hash<ColumnOperatorInfo> cop_year_day(auto column);
2949 
2950 
2952 
2961  hash<ColumnOperatorInfo> cop_year_hour(auto column);
2962 
2963 
2965 
2975  hash<ColumnOperatorInfo> cop_seq(string seq, *string as);
2976 
2977 
2979 
2989  hash<ColumnOperatorInfo> cop_seq_currval(string seq, *string as);
2990 
2991 
2993 
3005  hash<ColumnOperatorInfo> cop_coalesce(auto col1, auto col2);
3006 
3007 
3009 
3020  hash<ColumnOperatorInfo> cop_substr(auto column, int start, *int count);
3021 
3022 
3024 
3035  hash<ColumnOperatorInfo> cop_length(auto column);
3036 
3037 
3039 
3053  hash<ColumnOperatorInfo> cop_trunc_date(auto column, string mask);
3054 
3055 
3056 
3058 
3086  hash<ColumnOperatorInfo> cop_cume_dist();
3087 
3088 
3090 
3118  hash<ColumnOperatorInfo> cop_dense_rank();
3119 
3120 
3122 
3150  hash<ColumnOperatorInfo> cop_first_value(any column);
3151 
3152 
3154 
3182  hash<ColumnOperatorInfo> cop_last_value(any column);
3183 
3184 
3186 
3216  hash<ColumnOperatorInfo> cop_ntile(int value);
3217 
3218 
3220 
3248  hash<ColumnOperatorInfo> cop_percent_rank();
3249 
3250 
3252 
3280  hash<ColumnOperatorInfo> cop_rank();
3281 
3282 
3284 
3312  hash<ColumnOperatorInfo> cop_row_number();
3313 
3314 
3316 
3367  const DT_YEAR = "Y";
3369 
3371  const DT_MONTH = "M";
3372 
3374  const DT_DAY = "D";
3375 
3377  const DT_HOUR = "H";
3378 
3380  const DT_MINUTE = "m";
3381 
3383  const DT_SECOND = "S";
3384 
3385  // let's simulate and enum here'
3386  const DT_ALL_VALUES = ( DT_YEAR, DT_MONTH, DT_DAY, DT_HOUR, DT_MINUTE, DT_SECOND );
3388 
3393  const DefaultUopMap = ...;
3395 
3397 
3419 
3428  hash<UpdateOperatorInfo> make_uop(string uop, auto arg, *hash<UpdateOperatorInfo> nest);
3429 
3430 
3432 
3442  hash<UpdateOperatorInfo> uop_prepend(string arg, *hash<UpdateOperatorInfo> nest);
3443 
3444 
3446 
3456  hash<UpdateOperatorInfo> uop_append(string arg, *hash<UpdateOperatorInfo> nest);
3457 
3458 
3460 
3469  hash<UpdateOperatorInfo> uop_upper(*hash<UpdateOperatorInfo> nest);
3470 
3471 
3473 
3482  hash<UpdateOperatorInfo> uop_lower(*hash<UpdateOperatorInfo> nest);
3483 
3484 
3486 
3497  hash<UpdateOperatorInfo> uop_substr(int start, *int count, *hash<UpdateOperatorInfo> nest);
3498 
3499 
3501 
3511  hash<UpdateOperatorInfo> uop_plus(auto arg, *hash<UpdateOperatorInfo> nest);
3512 
3513 
3515 
3525  hash<UpdateOperatorInfo> uop_minus(auto arg, *hash<UpdateOperatorInfo> nest);
3526 
3527 
3529 
3539  hash<UpdateOperatorInfo> uop_multiply(auto arg, *hash<UpdateOperatorInfo> nest);
3540 
3541 
3543 
3553  hash<UpdateOperatorInfo> uop_divide(auto arg, *hash<UpdateOperatorInfo> nest);
3554 
3555 
3557 
3566  hash<UpdateOperatorInfo> uop_seq(string seq);
3567 
3568 
3570 
3579  hash<UpdateOperatorInfo> uop_seq_currval(string seq);
3580 
3582 
3589 
3592  const JOP_INNER = "inner";
3593 
3595 
3597  const JOP_LEFT = "left";
3598 
3600 
3602  const JOP_RIGHT = "right";
3603 
3605  const JopMap = ...;
3606 
3608 
3618 
3622  hash<string, hash<JoinOperatorInfo>> make_jop(string jop, AbstractTable table, *string alias, *hash jcols, *hash cond, *string ta, *hash<auto> opt);
3623 
3624 
3626 
3630  hash<string, hash<JoinOperatorInfo>> make_jop(string jop, string table_name, *string alias, *hash jcols, *hash cond, *string ta, *hash<auto> opt);
3631 
3632 
3634 
3653  hash<string, hash<JoinOperatorInfo>> join_inner(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3654 
3655 
3657 
3676  hash<string, hash<JoinOperatorInfo>> join_inner(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3677 
3678 
3680 
3699  hash<string, hash<JoinOperatorInfo>> join_inner(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3700 
3701 
3703 
3725  hash<string, hash<JoinOperatorInfo>> join_inner(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3726 
3727 
3729 
3749  hash<string, hash<JoinOperatorInfo>> join_inner(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3750 
3751 
3753 
3775  hash<string, hash<JoinOperatorInfo>> join_inner_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3776 
3777 
3779 
3798  hash<string, hash<JoinOperatorInfo>> join_left(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3799 
3800 
3802 
3821  hash<string, hash<JoinOperatorInfo>> join_left(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3822 
3823 
3825 
3846  hash<string, hash<JoinOperatorInfo>> join_left(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3847 
3848 
3850 
3870  hash<string, hash<JoinOperatorInfo>> join_left(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3871 
3872 
3874 
3894  hash<string, hash<JoinOperatorInfo>> join_left(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3895 
3896 
3898 
3920  hash<string, hash<JoinOperatorInfo>> join_left_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3921 
3922 
3924 
3943  hash<string, hash<JoinOperatorInfo>> join_right(AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3944 
3945 
3947 
3966  hash<string, hash<JoinOperatorInfo>> join_right(Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3967 
3968 
3970 
3991  hash<string, hash<JoinOperatorInfo>> join_right(string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
3992 
3993 
3995 
4015  hash<string, hash<JoinOperatorInfo>> join_right(string ta, AbstractTable table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4016 
4017 
4019 
4039  hash<string, hash<JoinOperatorInfo>> join_right(string ta, Table table, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4040 
4041 
4043 
4065  hash<string, hash<JoinOperatorInfo>> join_right_alias(string ta, string table_name, *string alias, *hash jcols, *hash cond, *hash<auto> opt);
4066 
4068 
4073 
4076  const OP_LIKE = "like";
4077 
4079 
4081  const OP_LT = "<";
4082 
4084 
4086  const OP_LE = "<=";
4087 
4089 
4091  const OP_GT = ">";
4092 
4094 
4096  const OP_GE = ">=";
4097 
4099 
4101  const OP_NE = "!=";
4102 
4104 
4106  const OP_EQ = "=";
4107 
4109 
4111  const OP_CLT = "C<";
4112 
4114 
4116  const OP_CLE = "C<=";
4117 
4119 
4121  const OP_CGT = "C>";
4122 
4124 
4126  const OP_CGE = "C>=";
4127 
4129 
4131  const OP_CNE = "C!=";
4132 
4134 
4136  const OP_CEQ = "C=";
4137 
4139 
4141  const OP_BETWEEN = "between";
4142 
4144 
4146  const OP_IN = "in";
4147 
4149 
4151  const OP_NOT = "not";
4152 
4154 
4156  const OP_SUBSTR = "substr";
4157 
4159 
4161  const OP_OR = "or";
4162 
4164 
4166  const OP_IN_SELECT = "in_select";
4167 
4169  const DefaultOpMap = ...;
4170 
4172 
4196  hash<OperatorInfo> make_op(string op, auto arg);
4198 
4199 
4201 
4210  hash<OperatorInfo> op_like(string str);
4211 
4212 
4214 
4225  hash<OperatorInfo> op_lt(auto arg);
4226 
4227 
4229 
4240  hash<OperatorInfo> op_le(auto arg);
4241 
4242 
4244 
4255  hash<OperatorInfo> op_gt(auto arg);
4256 
4257 
4259 
4270  hash<OperatorInfo> op_ge(auto arg);
4271 
4272 
4274 
4287  hash<OperatorInfo> op_ne(auto arg);
4288 
4289 
4291 
4304  hash<OperatorInfo> op_eq(auto arg);
4305 
4306 
4308 
4320  hash<OperatorInfo> op_between(auto l, auto r);
4321 
4322 
4324 
4333  hash<OperatorInfo> op_in();
4334 
4335 
4337 
4344  hash<OperatorInfo> op_in_select(string table, hash<auto> select_hash);
4345 
4346 
4348 
4355  hash<OperatorInfo> op_in_select(AbstractTable table, hash<auto> select_hash);
4356 
4357 
4359 
4366  hash<OperatorInfo> op_in_select(Table table, hash<auto> select_hash);
4367 
4368 
4370 
4381  hash<OperatorInfo> op_in(list<auto> args);
4382 
4383 
4385 
4392  hash<OperatorInfo> op_not(hash arg);
4393 
4394 
4396 
4407  hash<OperatorInfo> op_clt(string arg);
4408 
4409 
4411 
4422  hash<OperatorInfo> op_cle(string arg);
4423 
4424 
4426 
4437  hash<OperatorInfo> op_cgt(string arg);
4438 
4439 
4441 
4452  hash<OperatorInfo> op_cge(string arg);
4453 
4454 
4456 
4467  hash<OperatorInfo> op_cne(string arg);
4468 
4469 
4471 
4482  hash<OperatorInfo> op_ceq(string arg);
4483 
4484 
4486 
4497  hash<OperatorInfo> op_substr(int start, *int count, string text);
4498 
4499 
4501 
4511  hash<OperatorInfo> op_substr(int start, string text);
4512 
4513 
4515 
4532  hash<string, hash<OperatorInfo>> wop_or(hash h1, hash h2);
4533 
4535 
4542 
4545  const IOP_SEQ = "seq";
4546 
4548 
4550  const IOP_SEQ_CURRVAL = "seq_currval";
4551 
4553  const DefaultIopMap = {};
4555 
4561 
4569  hash<InsertOperatorInfo> make_iop(string iop, auto arg);
4570 
4571 
4573 
4582  hash<InsertOperatorInfo> iop_seq(string arg);
4583 
4584 
4586 
4595  hash<InsertOperatorInfo> iop_seq_currval(string arg);
4596 
4598 
4600  const SqlUtilDrivers = ...;
4601 
4602 
4603  // private variable to store the closure used to deserialize datasources (if any)
4604  extern code ds_get;
4605 
4606  // private variable to store the closure used to serialize datasources (if any)
4607  extern code ds_do;
4608 
4610  sqlutil_register_ds_deserializer(*code new_ds_get);
4611 
4612 
4614  sqlutil_register_ds_serializer(*code new_ds_do);
4615 
4616 
4617  // private function used to deserialize datasources
4618  AbstractDatasource sqlutil_get_ds(string type, string config);
4619 
4620 
4621  // private function used to serialize datasources
4622  hash<auto> sqlutil_ds(AbstractDatasource ds);
4623 
4624 
4626 class AbstractHashContainer : public Serializable {
4627 
4628 public:
4629 
4630 
4631 protected:
4634 
4635 public:
4636 
4638  constructor(*hash nh);
4639 
4640 
4643 
4644 
4647 
4648 
4650 
4665  auto memberGate(string k);
4666 
4667 
4669 
4675  clear();
4676 
4677 
4679  abstract auto take(string k);
4680 
4682  renameKey(string old_name, string new_name);
4683 
4684 
4686  *hash<auto> getHash();
4687 
4688 
4690 
4699  bool matchKeys(hash h1);
4700 
4701 
4703 
4712  bool matchKeys(list<auto> l);
4713 
4714 
4716 
4726 
4727 
4729 
4738  bool partialMatchKeys(hash h1);
4739 
4740 
4742 
4751  bool partialMatchKeys(list<auto> l);
4752 
4753 
4755 
4765 
4766 
4768 
4777  bool val();
4778 
4779 
4781 
4788  list<string> keys();
4789 
4790 
4792 
4799  list<auto> values();
4800 
4801 
4803 
4811 
4812 
4814 
4822 
4823 
4825 
4833 
4834 
4836  bool empty();
4837 
4838 
4840 
4847  int size();
4848 
4849 
4851 
4860  bool hasKey(string k);
4861 
4862 
4864 
4873  bool hasKeyValue(string k);
4874 
4875 
4877 
4886  *string firstKey();
4887 
4888 
4890 
4899  *string lastKey();
4900 
4901 
4903  abstract string getElementName();
4904  };
4905 
4907 class AbstractListContainer : public Serializable {
4908 
4909 public:
4910 
4911 
4912 protected:
4913  softlist l;
4914 
4915 public:
4916 
4918  constructor(softlist nl);
4919 
4920 
4922 
4933  abstract auto get(softint i);
4934 
4936  add(auto val);
4937 
4938 
4940  auto take(int i);
4941 
4942 
4944  list<auto> getList();
4945 
4946 
4948 
4957  bool val();
4958 
4959 
4961 
4969 
4970 
4972  bool empty();
4973 
4974 
4976 
4983  int size();
4984 
4985 
4987  abstract string getElementName();
4988 
4989 protected:
4990  checkIndex(int i);
4991 public:
4992 
4993  };
4994 
4997 
4998 public:
5000  constructor();
5001 
5002 
5004  constructor(AbstractDatasource ds, hash tables, *hash<auto> opt);
5005 
5006 
5008  constructor(AbstractDatasource ds);
5009 
5010 
5012  add(string k, Table val);
5013 
5014 
5016  add(string k, AbstractTable val);
5017 
5018 
5020  add(Table val);
5021 
5022 
5025 
5026 
5028  AbstractTable take(string k);
5029 
5030 
5032  populate(AbstractDatasource ds, hash<auto> tables, *hash<auto> opt);
5033 
5034 
5036  populate(AbstractDatasource ds);
5037 
5038 
5040 
5054  *list<auto> getDropAllForeignConstraintsOnTableSql(string name, *hash<auto> opt);
5055 
5056 
5058 
5073  AbstractTable memberGate(string k);
5074 
5075 
5077  string getElementName();
5078 
5079 
5081  *AbstractTable getIfExists(AbstractDatasource ds, string name);
5082 
5083 
5085  AbstractTable get(AbstractDatasource ds, string name);
5086 
5087 
5089 
5104  *string getRenameTableIfExistsSql(string old_name, string new_name, *hash<auto> opts);
5105 
5106 
5108 
5119  bool tableRenamed(string old_name, string new_name, string old_sql_name);
5120 
5121 
5122 protected:
5123  tableRenamedIntern(string old_name, string new_name, string oldsn);
5124 public:
5125 
5126 
5128 
5143  *string getDropConstraintIfExistsSql(string tname, string cname, *hash<auto> opts);
5144 
5145 
5146  list<auto> getCreateList();
5147 
5148 
5149  Qore::AbstractIterator createIterator();
5150 
5151 
5153 
5161  list<auto> getDropList();
5162 
5163 
5165 
5173 
5174 
5175 protected:
5176  getDependencies(reference<hash> tdh, reference<hash> sdh, *reference<hash> th);
5177 public:
5178 
5179  };
5180 
5183 
5184 public:
5186  constructor(*hash c) ;
5187 
5188 
5190  constructor(Columns old) ;
5191 
5192 
5194  add(string k, AbstractColumn val);
5195 
5196 
5198  AbstractColumn take(string k);
5199 
5200 
5202 
5217  AbstractColumn memberGate(string k);
5218 
5219 
5221  Columns subset(softlist l);
5222 
5223 
5225  string getElementName();
5226 
5227 
5229  bool equal(Columns cols);
5230 
5231 
5233  AbstractIterator getSqlColumnNameIterator();
5234 
5235  };
5236 
5238 class AbstractDdlObject : public Serializable {
5239 
5240 public:
5242  string name;
5243 
5245  string ddl_name;
5246 
5248 protected:
5249  constructor();
5250 public:
5251 
5252 
5254  constructor(string name);
5255 
5256 
5258 
5260  abstract string getDdlName(string name);
5261  };
5262 
5265 
5266 public:
5268  string native_type;
5269 
5271  *string qore_type;
5272 
5274  int size;
5275 
5277  bool nullable;
5278 
5280  *string def_val;
5281 
5283  *string comment;
5284 
5286 protected:
5287  constructor();
5288 public:
5289 
5290 
5291  constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string c)
5292  ;
5293 
5294 
5296  string getNativeTypeString();
5297 
5298 
5300  string getCreateSql(AbstractTable t);
5301 
5302 
5304 
5313  abstract list<auto> getAddColumnSql(AbstractTable t);
5314 
5316  string getDropSql(string table_name);
5317 
5318 
5320 
5333  list<auto> getModifySql(AbstractTable t, AbstractColumn c, *hash<auto> opt);
5334 
5335 
5337 
5347  abstract string getRenameSql(AbstractTable t, string new_name);
5348 
5350  bool equal(AbstractColumn c);
5351 
5352 
5354 protected:
5355  abstract bool equalImpl(AbstractColumn c);
5356 public:
5357 
5359 
5372 protected:
5373  abstract list<auto> getModifySqlImpl(AbstractTable t, AbstractColumn c, *hash<auto> opt);
5374 public:
5375  };
5376 
5378 class NumericColumnInfo : public Serializable {
5379 
5380 public:
5382  int scale;
5383 
5384  constructor(softint n_scale = 0);
5385 
5386 
5388  string getNativeTypeString(string native_type, int precision);
5389 
5390  };
5391 
5394 
5395 public:
5396  constructor(*hash c) ;
5397 
5398 
5400  add(string k, AbstractIndex val);
5401 
5402 
5405 
5406 
5408  AbstractIndex take(string k);
5409 
5410 
5412  *AbstractIndex tryTake(string k);
5413 
5414 
5416 
5431  AbstractIndex memberGate(string k);
5432 
5433 
5434  string getElementName();
5435 
5436  };
5437 
5439 class AbstractIndex : public Serializable {
5440 
5441 public:
5443  string name;
5444 
5446  bool unique;
5447 
5450 
5451 protected:
5454 
5455 public:
5456 
5458  constructor(string n, bool u, hash c);
5459 
5460 
5462  string getName();
5463 
5464 
5466  bool hasColumn(string cname);
5467 
5468 
5470  abstract string getCreateSql(string table_name, *hash<auto> opt);
5471 
5473  string getDropSql(string table_name);
5474 
5475 
5477  bool equal(AbstractIndex ix);
5478 
5479 
5481  bool equalExceptName(AbstractIndex ix);
5482 
5483 
5485  abstract bool equalImpl(AbstractIndex ix);
5486 
5488  abstract string getRenameSql(string table_name, string new_name);
5489 
5492 
5493 
5496 
5497 
5500 
5501 
5503  list<auto> getRecreateSql(AbstractDatasource ds, string table_name, *hash<auto> opt);
5504 
5505  };
5506 
5509 
5510 public:
5511  constructor(*hash c) ;
5512 
5513 
5515  add(string k, AbstractConstraint val);
5516 
5517 
5519  AbstractConstraint take(string k);
5520 
5521 
5524 
5525 
5527 
5542  AbstractConstraint memberGate(string k);
5543 
5544 
5545  string getElementName();
5546 
5547  };
5548 
5550 class AbstractConstraint : public Serializable {
5551 
5552 public:
5553 
5554 
5555 protected:
5557  string name;
5558 
5559 public:
5560 
5562  constructor(string n);
5563 
5564 
5566  string getName();
5567 
5568 
5570  rename(string n);
5571 
5572 
5574  abstract string getCreateSql(string table_name, *hash<auto> opt);
5575 
5577  string getDropSql(string table_name);
5578 
5579 
5581  abstract list<auto> getRenameSql(string table_name, string new_name);
5582 
5584  string getDisableSql(string table_name);
5585 
5586 
5588  string getEnableSql(string table_name, *hash<auto> opt);
5589 
5590 
5592  bool equal(AbstractConstraint c);
5593 
5594 
5596 protected:
5597  abstract bool equalImpl(AbstractConstraint c);
5598 public:
5599 
5601  abstract bool setIndexBase(string ix);
5602 
5604  abstract clearIndex();
5605 
5607  bool hasColumn(string cname);
5608 
5609  };
5610 
5613 
5614 public:
5616  string src;
5617 
5619  constructor(string n, string n_src) ;
5620 
5621 
5623 protected:
5624  bool equalImpl(AbstractConstraint c);
5625 public:
5626 
5627 
5629  bool setIndexBase(string ix);
5630 
5631 
5633  clearIndex();
5634 
5635  };
5636 
5639 
5640 public:
5641 protected:
5644 
5646  *string index;
5647 
5648 public:
5649 
5651  constructor(string n, *hash c, *string n_index) ;
5652 
5653 
5655  constructor(string n, Columns c, *string n_index) ;
5656 
5657 
5659 
5664 
5665 
5667  hash<auto> getDisableReenableSql(AbstractDatasource ds, string table_name, *hash<auto> opts);
5668 
5669 
5671  findMatchingIndex(*Indexes indexes);
5672 
5673 
5675 
5686 
5687 
5689  removeSourceConstraint(string tname, list cols);
5690 
5691 
5693  renameSourceConstraintTable(string old_name, string new_name);
5694 
5695 
5697  bool hasColumn(string cname);
5698 
5699 
5701  *string getIndex();
5702 
5703 
5705 protected:
5706  bool equalImpl(AbstractConstraint c);
5707 public:
5708 
5709 
5711  bool setIndexBase(string ix);
5712 
5713 
5715  clearIndex();
5716 
5717 
5719  abstract string getCreateSql(string table_name, *hash<auto> opts);
5720  };
5721 
5724 
5725 public:
5727  constructor(string n, *hash c, *string n_index) ;
5728 
5729  };
5730 
5733 
5734 public:
5735  constructor() ;
5736 
5737 
5738  constructor(string n, *hash c) ;
5739 
5740  };
5741 
5744 
5745 public:
5746  constructor(*hash c) ;
5747 
5748 
5750  add(string k, AbstractForeignConstraint val);
5751 
5752 
5754  AbstractForeignConstraint take(string k);
5755 
5756 
5759 
5760 
5762 
5778 
5779 
5781  *hash findConstraintOn(string table, softlist cols);
5782 
5783 
5785  string getElementName();
5786 
5787  };
5788 
5790 class ForeignConstraintTarget : public Serializable {
5791 
5792 public:
5794  string table;
5795 
5798 
5800  constructor(string t, Columns c);
5801 
5802 
5804  bool equal(ForeignConstraintTarget targ);
5805 
5806  };
5807 
5810 
5811 public:
5814 
5815  constructor(string n, Columns c, ForeignConstraintTarget t) ;
5816 
5817 
5819 protected:
5820  bool equalImpl(AbstractConstraint con);
5821 public:
5822 
5823  };
5824 
5826 class AbstractSequence : public Serializable {
5827 
5828 public:
5830  string name;
5831 
5834 
5837 
5840 
5842  constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_max);
5843 
5844 
5846  abstract string getCreateSql(*hash<auto> opt);
5847 
5849 
5851  string getDropSql(*hash<auto> opt);
5852 
5853 
5855 
5858  abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
5859  };
5860 
5862 class AbstractView : public Serializable {
5863 
5864 public:
5865  // ! potential object schema
5866  *string schema;
5867 
5869  string name;
5870 
5872  string src;
5873 
5876 
5878  constructor(string n_name, string n_src);
5879 
5880 
5882  abstract string getCreateSql(*hash<auto> opt);
5883 
5885 
5887  string getDropSql(*hash<auto> opt);
5888 
5889 
5891 
5894  abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
5895  };
5896 
5898 class AbstractFunctionBase : public Serializable {
5899 
5900 public:
5902  string name;
5903 
5905  string type;
5906 
5908  string src;
5909 
5911 
5915  constructor(string n, string n_type, string n_src);
5916 
5917 
5919  string getType();
5920 
5921 
5923 
5925  string getDropSql(*hash<auto> opt);
5926 
5927 
5929  bool equal(AbstractFunctionBase t);
5930 
5931 
5933  string getNormalizedSource(string src);
5934 
5935 
5937 protected:
5938  abstract bool equalImpl(AbstractFunctionBase t);
5939 public:
5940  };
5941 
5944 
5945 public:
5947 
5951  constructor(string n, string n_type, string n_src) ;
5952 
5953 
5955  abstract list<auto> getCreateSql(*hash<auto> opt);
5956 
5958 
5961  abstract softlist<auto> getRenameSql(string new_name, *hash<auto> opt);
5962 
5964  setName(string new_name);
5965 
5966  };
5967 
5970 
5971 public:
5972  constructor(*hash c) ;
5973 
5974 
5976  add(string k, AbstractFunction val);
5977 
5978 
5980  AbstractFunction take(string k);
5981 
5982 
5984 
5999  AbstractFunction memberGate(string k);
6000 
6001 
6002  string getElementName();
6003 
6004  };
6005 
6008 
6009 public:
6011  constructor(string n, string n_src) ;
6012 
6013 
6015  abstract list<auto> getCreateSql(string table_name, *hash<auto> opt);
6016 
6018  abstract softlist<auto> getRenameSql(string table_name, string new_name);
6019 
6021  abstract list<auto> getDropSql(string table_name);
6022  };
6023 
6026 
6027 public:
6028  constructor(*hash c) ;
6029 
6030 
6032  add(string k, AbstractTrigger val);
6033 
6034 
6036  AbstractTrigger take(string k);
6037 
6038 
6040 
6055  AbstractTrigger memberGate(string k);
6056 
6057 
6058  string getElementName();
6059 
6060  };
6061 };
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:5557
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:5245
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:2256
string name
the name of the sequence
Definition: SqlUtil.qm.dox.h:5830
const COP_SEQ
to return the next value of a sequence
Definition: SqlUtil.qm.dox.h:2402
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:2194
const DefaultIopMap
a hash of default insert operator descriptions (currently empty, all operators are driver-dependent) ...
Definition: SqlUtil.qm.dox.h:4553
auto arg
optional argument
Definition: SqlUtil.qm.dox.h:2154
abstract container class that throws an exception if an unknown key is accessed
Definition: SqlUtil.qm.dox.h:4907
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:2132
copy(AbstractHashContainer old)
creates a "deep copy" of the object
string cop
the column operator string code
Definition: SqlUtil.qm.dox.h:2159
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:4146
constructor(*hash c)
creates the object from the argument
the base abstract class for the table implementation
Definition: AbstractTable.qc.dox.h:36
const DefaultCopMap
a hash of default column operator descriptions
Definition: SqlUtil.qm.dox.h:2492
bool equal(AbstractConstraint c)
returns True if the argument is equal to the current object, False if not
bool setIndexBase(string ix)
returns True if the object supports an index property and is set, 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:2454
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:4996
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:5875
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:2165
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:4141
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:5453
hash< ColumnOperatorInfo > make_cop(string cop, auto column, auto arg)
returns a ColumnOperatorInfo hash
any arg
optional argument
Definition: SqlUtil.qm.dox.h:2167
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:5439
*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:4161
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:2357
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:5743
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:2203
hash< ColumnOperatorInfo > cop_last_value(any column)
Analytic/window function: value evaluated at the row that is the last row of the window frame...
constructor(string n, *hash c, *string n_index)
creates the object from the name an a hash of column information
const COP_DENSE_RANK
Analytic (window) function: DENSE_RANK.
Definition: SqlUtil.qm.dox.h:2447
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:4101
abstract list< auto > getCreateSql(string table_name, *hash< auto > opt)
returns a string that can be used to create the trigger in the database
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:2200
string getType()
returns the type of object
A hash describing SQL and arguments for an SQL DML command.
Definition: SqlUtil.qm.dox.h:2214
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:2347
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:2265
string name
the name of the object
Definition: SqlUtil.qm.dox.h:5902
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:5790
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:5271
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:2407
the base class to use to extend AbstractColumn to implement numeric columns
Definition: SqlUtil.qm.dox.h:5378
const DB_TABLES
Feature: tables.
Definition: SqlUtil.qm.dox.h:2239
*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:2229
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:3605
const SZ_MAND
the data type takes a mandatory size parameter
Definition: SqlUtil.qm.dox.h:2276
const OP_GT
the SQL greater than operator (>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4091
const COP_AVG
to return the average value
Definition: SqlUtil.qm.dox.h:2342
const JOP_LEFT
for left outer joins
Definition: SqlUtil.qm.dox.h:3597
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:5826
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:2241
*softint maxlen
optional additional limit to the maximum length of the data
Definition: SqlUtil.qm.dox.h:2208
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:2461
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:5277
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:2327
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:2397
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:2189
string jop
the join operator string code
Definition: SqlUtil.qm.dox.h:2179
const IOP_SEQ_CURRVAL
for using the last value of a sequence issued in the current session
Definition: SqlUtil.qm.dox.h:4550
AbstractFunction take(string k)
removes the given key from the contained hash and returns the value
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:2138
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:4131
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:4600
const OP_CGT
the SQL greater than operator (>) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4121
the base class for foreign key constraint information
Definition: SqlUtil.qm.dox.h:5809
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:5813
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:2161
int scale
the scale for numeric columns
Definition: SqlUtil.qm.dox.h:5382
abstract class for check constraints
Definition: SqlUtil.qm.dox.h:5612
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:2352
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:2140
const OP_CEQ
the SQL equals operator (=) for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4136
const COP_NTILE
Analytic (window) function: NTILE.
Definition: SqlUtil.qm.dox.h:2468
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:2136
abstract container class that throws an exception if an unknown key is accessed
Definition: SqlUtil.qm.dox.h:4626
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:2178
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:6025
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:5616
const DT_DAY
Format unit: day.
Definition: SqlUtil.qm.dox.h:3374
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:2317
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:2183
const COP_PLUS
the SQL "plus" operator
Definition: SqlUtil.qm.dox.h:2367
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:4096
index container class that throws an exception if an unknown index is accessed
Definition: SqlUtil.qm.dox.h:5393
const SZ_NUM
the data type is numeric so takes an optional precision and scale
Definition: SqlUtil.qm.dox.h:2282
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:2148
const DB_PACKAGES
Feature: packages.
Definition: SqlUtil.qm.dox.h:2233
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:5280
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:2412
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 ...
list< auto > list(...)
string op
the operator string code
Definition: SqlUtil.qm.dox.h:2153
*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:2191
removeSourceConstraint(string tname, list cols)
removes a source constraint
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:4106
generic column description hash in schema descriptions
Definition: SqlUtil.qm.dox.h:2128
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:5283
const VARCHAR
specifies a VARCHAR column (equivalent to Qore::Type::String)
Definition: SqlUtil.qm.dox.h:2253
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:5872
bool unique
True if the index is a unique index, False if not
Definition: SqlUtil.qm.dox.h:5446
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.
const COP_YEAR_MONTH
to return a date value with year to month information
Definition: SqlUtil.qm.dox.h:2387
string src
the source of the object
Definition: SqlUtil.qm.dox.h:5908
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:2180
const COP_MAX
to return the maximum value
Definition: SqlUtil.qm.dox.h:2337
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:2424
auto column
column sopecifier, may be a string or a complex hash
Definition: SqlUtil.qm.dox.h:2160
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:2245
const COP_AS
to rename a column on output
Definition: SqlUtil.qm.dox.h:2292
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:2185
const OP_LE
the SQL less than or equals (<=) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4086
const DB_PROCEDURES
Feature: procedures.
Definition: SqlUtil.qm.dox.h:2235
string name
the name of the index
Definition: SqlUtil.qm.dox.h:5443
string _iop
the insert operator string code
Definition: SqlUtil.qm.dox.h:2166
Columns columns
columns in the target table
Definition: SqlUtil.qm.dox.h:5797
string uop
the update operator string code
Definition: SqlUtil.qm.dox.h:2172
const OP_CLE
the SQL less than or equals (<=) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4116
the API for a constraint with columns
Definition: SqlUtil.qm.dox.h:5638
const BLOB
specifies a large variable-length binary column (ie BLOB or BYTEA, etc)
Definition: SqlUtil.qm.dox.h:2262
auto arg
optional argument
Definition: SqlUtil.qm.dox.h:2173
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:4151
clear()
purges the contained data
Columns columns
an object of class Columns representing the columns in the index
Definition: SqlUtil.qm.dox.h:5449
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:5898
update operator info hash as returned by all update operator functions
Definition: SqlUtil.qm.dox.h:2171
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:2440
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:2219
bool empty()
returns True if the container is empty, False if not
clearIndex()
clears any index base for the constraint
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:4633
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:5943
string sql
the SQL string for the update
Definition: SqlUtil.qm.dox.h:2216
const COP_MULTIPLY
the SQL "multiply" operator
Definition: SqlUtil.qm.dox.h:2377
column operator info hash as returned by all column operator functions
Definition: SqlUtil.qm.dox.h:2158
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:2302
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:2144
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:2433
abstract clearIndex()
clears any index base for the constraint
base class for views
Definition: SqlUtil.qm.dox.h:5862
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)
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.
string type
the type of object
Definition: SqlUtil.qm.dox.h:5905
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:2382
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:5274
constructor(string n, *hash c, *string n_index)
creates the object from the name and a hash of column information
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:2146
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:5268
const COP_VALUE
to append a constant value (SQL Literal) to use as an output column value
Definition: SqlUtil.qm.dox.h:2312
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:5182
the base class for triggers
Definition: SqlUtil.qm.dox.h:6007
*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:2184
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:5242
const OP_LT
the SQL less than (<) operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4081
*hash findConstraintOn(string table, softlist cols)
returns either a hash of AbstractColumn information or NOTHING if no foreign constraint can be found ...
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:5969
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:5264
const COP_CAST
to convert column value into another datatype
Definition: SqlUtil.qm.dox.h:2297
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:4126
const DT_MINUTE
Format unit: minute.
Definition: SqlUtil.qm.dox.h:3380
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...
const DT_HOUR
Format unit: hour.
Definition: SqlUtil.qm.dox.h:3377
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:2142
const CHAR
specifies a CHAR column
Definition: SqlUtil.qm.dox.h:2259
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:3394
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:2332
const COP_YEAR_DAY
to return a date value with year to day information
Definition: SqlUtil.qm.dox.h:2392
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
the base class for named objects
Definition: SqlUtil.qm.dox.h:5238
const DT_MONTH
Format unit: month.
Definition: SqlUtil.qm.dox.h:3371
string name
the name of the sequence
Definition: SqlUtil.qm.dox.h:5869
const COP_PERCENT_RANK
Analytic (window) function: PERCENT_RANK.
Definition: SqlUtil.qm.dox.h:2475
*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:2182
*number max
the ending number
Definition: SqlUtil.qm.dox.h:5839
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:2482
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:5836
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:4076
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:2273
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:4111
const DB_MVIEWS
Feature: materialized views / snapshots.
Definition: SqlUtil.qm.dox.h:2231
const COP_MINUS
the SQL "minus" operator
Definition: SqlUtil.qm.dox.h:2362
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:5794
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:2181
const COP_SUBSTR
to extract a substring from a column
Definition: SqlUtil.qm.dox.h:2417
const JOP_RIGHT
for right outer joins
Definition: SqlUtil.qm.dox.h:3602
const OP_SUBSTR
the SQL "substr" operator for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4156
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:2279
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:2134
const DB_SEQUENCES
Feature: sequences.
Definition: SqlUtil.qm.dox.h:2237
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:2152
number start
the starting number
Definition: SqlUtil.qm.dox.h:5833
const IOP_SEQ
for using the value of a sequence
Definition: SqlUtil.qm.dox.h:4545
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:2489
const DT_YEAR
Format unit: year.
Definition: SqlUtil.qm.dox.h:3368
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:2243
*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:2197
*string index
the index supporting the constraint
Definition: SqlUtil.qm.dox.h:5646
represents a primary key
Definition: SqlUtil.qm.dox.h:5732
const JOP_INNER
for standard inner joins
Definition: SqlUtil.qm.dox.h:3592
const COP_LOWER
to return column value in lower case
Definition: SqlUtil.qm.dox.h:2322
const OP_IN_SELECT
the SQL "in" operator with a select query for use in Where Clauses
Definition: SqlUtil.qm.dox.h:4166
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:2174
const COP_DIVIDE
the SQL "divide" operator
Definition: SqlUtil.qm.dox.h:2372
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
*hash sourceConstraints
a hash of ForeignConstraintSources, keyed by table name, the value is a hash of foreign constraints k...
Definition: SqlUtil.qm.dox.h:5643
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:2130
*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:4169
represents a unique column constraint
Definition: SqlUtil.qm.dox.h:5723
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:5550
const DT_SECOND
Format unit: hour.
Definition: SqlUtil.qm.dox.h:3383
constraint container class that throws an exception if an unknown constraint is accessed ...
Definition: SqlUtil.qm.dox.h:5508
const COP_APPEND
to append a string to a column on output
Definition: SqlUtil.qm.dox.h:2307