Qore PgsqlSqlUtil Module Reference 1.0

- Main Page
- Related Pages
- Namespaces
- Classes

All Classes Namespaces Functions Variables Groups Pages
PgsqlSqlUtil.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
2 // @file PgsqlSqlUtil.qm Qore user module for working with PostgreSQL SQL data
3
4 /* PgsqlSqlUtil.qm Copyright 2013 Qore Technologies, sro
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24
25 // this module requires Qore 0.8.8 or better
26
27 // requires the SqlUtil module
28
29 // don't use "$" signs for variables and class members, assume local variable scope
30
31 // require type definitions everywhere
32
33 // enable all warnings
34
35
36 /* Version History
37 * 2013-10-04 v1.0: David Nichols <david@qore.org>
38 + the initial version of the PgsqlSqlUtil module
39 */
40
192 namespace PgsqlSqlUtil {
195 PgsqlTable get_table(AbstractDatasource nds, string nname, *hash opts);
196
197
199 PgsqlDatabase get_database(AbstractDatasource nds, *hash opts);
200
201
203 class PgsqlType {
204
205 public:
206 public :
208 string name;
209
211 string src;
212
213 public:
214
215 constructor(string n_name, string n_src);
216
217
218 list getTypeList();
219
220
221 list getModifySql(PgsqlType old, *hash opt);
222
223
224 string getCreateSql(*hash opt);
225
226
227 string getDropSql(*hash opt);
228
229
230 string getRenameSql(string new_name);
231
232
233 bool equal(PgsqlType type);
234
235 };
236
238 class PgsqlIndex : public SqlUtil::AbstractIndex {
239
240 public:
241 public :
243 *string tablespace;
244
245 public:
246
248 constructor(string n_name, bool n_unique, hash n_cols, *string n_tablespace);
249
250
252 string getCreateSql(string table_name, *hash opt);
253
254
256
257 private:
258 bool equalImpl(AbstractIndex ix);
259 public:
260
261
263 string getRenameSql(string table_name, string new_name);
264
265 };
266
268 class PgsqlForeignConstraint : public SqlUtil::AbstractForeignConstraint {
269
270 public:
271 constructor(string n, Columns c, ForeignConstraintTarget t);
272
273
274 string getCreateSql(string table_name, *hash opt);
275
276
277 softlist getRenameSql(string table_name, string new_name);
278
279
280 string getCreateSql(string name, string table_name, *hash opt);
281
282 };
283
285 class PgsqlCheckConstraint : public SqlUtil::AbstractCheckConstraint {
286
287 public:
288 constructor(string n, string n_src);
289
290
291 string getCreateSql(string table_name, *hash opt);
292
293
294 list getRenameSql(string table_name, string new_name);
295
296
297 string getCreateSql(string name, string table_name, *hash opt);
298
299 };
300
302 class PgsqlColumn : public SqlUtil::AbstractColumn {
303
304 public:
305 public :
307 int byte_size;
308
309 public:
310
311 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs);
312
313
314 string getNativeTypeString();
315
316
318
325 list getCreateSql(AbstractTable t);
326
327
329
341 list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
342
343
345
355 string getRenameSql(AbstractTable t, string new_name);
356
357
359
360 private:
361 bool equalImpl(AbstractColumn c);
362 public:
363
364 };
365
367 class PgsqlNumericColumn : public PgsqlColumn,public SqlUtil::NumericColumnInfo {
368
369 public:
370 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint n_scale);
371
372
373 string getNativeTypeString();
374
375 };
376
377 class PgsqlUniqueConstraintCommon : public SqlUtil::AbstractUniqueConstraint {
378
379 public:
380 private :
382 *string tablespace;
383
384 public:
385
386 constructor(*string ts);
387
388
389 bool setIndexBase(string ix);
390
391
393 clearIndex();
394
395
396 abstract AbstractIterator keyIterator();
397
399 getIndexSql(reference sql, string name, *hash opts);
400
401 };
402
403 class PgsqlUniqueConstraint : public SqlUtil::AbstractUniqueConstraint,public PgsqlUniqueConstraintCommon {
404
405 public:
406 private :
408 bool enabled;
409
410 public:
411
412 constructor(string n, hash n_cols, bool e = True, *string ts);
413
414
416
431 PgsqlColumn memberGate(string k);
432
433
434 string getCreateSql(string table_name, *hash opts);
435
436
437 list getRenameSql(string table_name, string new_name);
438
439
440 string getCreateSql(string name, string table_name, *hash opts);
441
442 };
443
445 class PgsqlPrimaryKey : public SqlUtil::AbstractPrimaryKey,public PgsqlUniqueConstraintCommon {
446
447 public:
448 constructor();
449
450
451 constructor(string n, *hash c, *string ts);
452
453
455
470 PgsqlColumn memberGate(string k);
471
472
473 string getCreateSql(string table_name, *hash opts);
474
475
476 softlist getRenameSql(string table_name, string new_name);
477
478 };
479
481 class PgsqlSequence : public SqlUtil::AbstractSequence {
482
483 public:
485 constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end);
486
487
489 string getCreateSql(*hash opt);
490
491
493 string getRenameSql(string new_name);
494
495 };
496
498 class PgsqlTrigger : public SqlUtil::AbstractTrigger {
499
500 public:
502 constructor(string n, string n_src);
503
504
506 softlist getCreateSql(string table_name, *hash opt);
507
508
510 softlist getDropSql(string table_name);
511
512
514
515 private:
516 bool equalImpl(AbstractFunctionBase t);
517 public:
518
519
521 softlist getRenameSql(string table_name, string new_name);
522
523 };
524
526 class PgsqlFunction : public SqlUtil::AbstractFunction {
527
528 public:
529 public :
530 *string args;
531
532 public:
533
534 constructor(string n, string n_src, *string a);
535
536
538 softlist getCreateSql(*hash opt);
539
540
542 string getDropSql();
543
544
546
547 private:
548 bool equalImpl(AbstractFunctionBase t);
549 public:
550
551
553 softlist getRenameSql(string new_name);
554
555
557 setName(string new_name);
558
559 };
560
562 class PgsqlTriggerFunction : public PgsqlFunction {
563
564 public:
565 public :
567 string trigger;
568
569 public:
570
571 constructor(string n, string n_src, string n_trigger);
572
573 };
574
576 class PgsqlDatabase : public SqlUtil::AbstractDatabase {
577
578 public:
579 public :
581 const PgsqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + (
582 "types": Type::Hash,
583 "type_map": Type::Hash,
584 );
585
586 const PGSQL_TempSavepoint = "qore_pgsql_tmp_savepoint";
587
588 public:
589
590 constructor(AbstractDatasource nds, *hash opts);
591
592
593
594 private:
595 list featuresImpl();
596 public:
597
598
599 PgsqlType makeType(string name, string src, *hash opts);
600
601
602 *PgsqlType getType(string name);
603
604
605
606 private:
607 PgsqlSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
608 public:
609
610
611
612 private:
613 *AbstractSequence getSequenceImpl(string name);
614 public:
615
616
617
618 private:
619 PgsqlFunction makeFunctionImpl(string name, string src, *hash opts);
620 public:
621
622
623
624 private:
625 PgsqlFunction makeProcedureImpl(string name, string src, *hash opts);
626 public:
627
628
629
630 private:
631 *AbstractFunction getFunctionImpl(string name);
632 public:
633
634
635
636 private:
637 AbstractFunction getProcedureImpl(string name);
638 public:
639
640
641 static *string getFunctionArgs(string err, reference src);
642
643 static PgsqlFunction processFunction(hash row, bool native_case);
644
645
646 private:
647 list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
648 public:
649
650
651
652 private:
653 list getAlignSqlImpl(hash schema_hash, *hash opt);
654 public:
655
656
658
659 private:
660 list listTablesImpl();
661 public:
662
663
665
670 private:
671 list listFunctionsImpl();
672 public:
673
674
676
679 private:
680 list listProceduresImpl();
681 public:
682
683
684
685 private:
686 list listSequencesImpl();
687 public:
688
689
690
691 private:
692 list listViewsImpl();
693 public:
694
695
696
697 private:
698 string getCreateSqlImpl(list l);
699 public:
700
701
702 static string getCreateSql(list l);
703
705
706 private:
707 hash getSchemaDescriptionOptions();
708 public:
709
710
712
713 private:
714 softint getNextSequenceValueImpl(string name);
715 public:
716
717
719
720 private:
721 bool supportsSequencesImpl();
722 public:
723
724
726
727 private:
728 bool supportsTypesImpl();
729 public:
730
731
733
734 private:
735 bool supportsPackagesImpl();
736 public:
737
738
740
741 private:
742 any tryExecArgsImpl(string sql, *softlist args);
743 public:
744
745
747
748 private:
749 any tryExecRawImpl(string sql, *softlist args);
750 public:
751
752
754 static any tryExecArgs(AbstractDatasource ds, string sql, *softlist args);
755
757 static any tryExecRaw(AbstractDatasource ds, string sql);
758 };
759
761 class PgsqlTable : public SqlUtil::AbstractTable {
762
763 public:
764 public :
766 const PgsqlTypeMap = (
767 "numeric": ("qore": Type::Number, "size": SZ_NUM,),
768 "decimal": ("qore": Type::Number, "size": SZ_NUM,),
769 "money": ("qore": Type::Number,),
770 "smallint": ("qore": Type::Int,),
771 "integer": ("qore": Type::Int,),
772 "bigint": ("qore": Type::Int,),
773 "smallserial": ("qore": Type::Int,),
774 "serial": ("qore": Type::Int,),
775 "bigserial": ("qore": Type::Int,),
776 "real": ("qore": Type::Float,),
777 "double precision": ("qore": Type::Float,),
778 "oid": ("qore": Type::Number,),
779 "character": ("qore": Type::String, "size": SZ_MAND,),
780 "char": ("qore": Type::String, "size": SZ_MAND,),
781 "character varying": ("qore": Type::String, "size": SZ_MAND,),
782 "varchar": ("qore": Type::String, "size": SZ_MAND,),
783 "date": ("qore": Type::Date,),
784 "timestamp without time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
785 "timestamp": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
786 "timestamp with time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
787 "time without time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
788 "time": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
789 "time with time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
790 "interval": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
791 "abstime": ("qore": Type::Date,),
792 "reltime": ("qore": Type::Date,),
793 "text": ("qore": Type::String,),
794 "bytea": ("qore": Type::Binary,),
795 "bit": ("qore": Type::Binary,),
796 "bit varying": ("qore": Type::Binary,),
797 "boolean": ("qore": Type::Boolean,),
798 "macaddr": ("qore": Type::String,),
799 "inet": ("qore": Type::String,),
800 "cidr": ("qore": Type::String,),
801 );
802
804 const PgsqlNameMap = (
805 "character varying": "varchar",
806 "character": "char",
807 "timestamp without time zone": "timestamp",
808 "time without time zone": "time",
809 );
810
812 const QoreTypeMap = (
813 "integer": "bigint",
814 "float": "double precision",
815 "number": "numeric",
816 "string": "varchar",
817 "date": "timestamp",
818 "binary": "bytea",
819 "bool": "boolean",
820 SqlUtil::CHAR: "char",
821 SqlUtil::CLOB: "text",
822 SqlUtil::BLOB: "bytea",
823 );
824
826 const PgsqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions + (
827 "functions": Type::Hash,
828 );
829
830 const PgsqlColumnDescOptions = AbstractTable::ColumnDescOptions;
831
832 const PgsqlIndexOptions = AbstractTable::IndexOptions;
833
834 const PgsqlConstraintOptions = AbstractTable::ConstraintOptions + PgsqlIndexOptions + (
835 "index": Type::String,
836 );
837
838 const PgsqlTableCreationOptions = AbstractTable::TableCreationOptions + PgsqlConstraintOptions + (
839 "omit_trigger_functions": Type::Boolean,
840 );
841
842 const PgsqlAlignTableOptions = AbstractTable::AlignTableOptions + PgsqlTableCreationOptions;
843
845 const PgsqlCopMap = DefaultCopMap + (
846 COP_OVER: (
847 "argcolumn": True,
848 "argoptional": True,
849 "code": string (*string cve, *string arg) {
850 string sql = cve + " over (";
851 if (arg)
852 sql += sprintf("partition by %s", arg);
853 sql += ")";
854 return sql;
855
856 public:
857 ),
858 COP_YEAR: (
859 "code": string (string arg1, any arg) {
860 return sprintf("to_char(%s, 'YYYY')", arg1);
861 }
862 ),
863 COP_YEAR_MONTH: (
864 "code": string (string arg1, any arg) {
865 return sprintf("to_char(%s, 'YYYY-MM')", arg1);
866 }
867 ),
868 COP_YEAR_DAY: (
869 "code": string (string arg1, any arg) {
870 return sprintf("to_char(%s, 'YYYY-MM-DD')", arg1);
871 }
872 ),
873 COP_YEAR_HOUR: (
874 "code": string (string arg1, any arg) {
875 return sprintf("to_char(%s, 'YYYY-MM-DD HH24')", arg1);
876 }
877 ),
878 );
879 }
880
881 private :
883 *string tablespace;
884
886 string schema;
887
889 Functions triggerFunctions;
890
891 public:
892
893 constructor(AbstractDatasource nds, string nname, *hash opts);
894
895
897 string getSchemaName();
898
899
901 *string getTablespaceName();
902
903
904 PgsqlFunction addTriggerFunction(string tfname, string src, string trigger);
905
906
907
908 private:
909 PgsqlFunction addTriggerFunctionUnlocked(string tfname, string src, string trigger);
910 public:
911
912
914 string getSqlName();
915
916
917
918 private:
919 hash getTableCreationOptions();
920 public:
921
922
923
924 private:
925 hash getTableDescriptionHashOptions();
926 public:
927
928
929
930 private:
931 hash getColumnDescOptions();
932 public:
933
934
935
936 private:
937 hash getIndexOptions();
938 public:
939
940
941
942 private:
943 hash getConstraintOptions();
944 public:
945
946
947
948 private:
949 hash getAlignTableOptions();
950 public:
951
952
954
955 private:
956 hash getColumnOperatorMap();
957 public:
958
959
960
961 private:
962 bool checkExistenceImpl();
963 public:
964
965
966
967 private:
968 Columns describeImpl();
969 public:
970
971
972
973 private:
974 PgsqlPrimaryKey getPrimaryKeyImpl();
975 public:
976
977
978
979 private:
980 Indexes getIndexesImpl();
981 public:
982
983
984
985 private:
986 ForeignConstraints getForeignConstraintsImpl(*hash opts);
987 public:
988
989
990
991 private:
992 Constraints getConstraintsImpl();
993 public:
994
995
996
997 private:
998 Triggers getTriggersImpl();
999 public:
1000
1001
1002
1003 private:
1004 string getCreateTableSqlImpl(*hash opt);
1005 public:
1006
1007
1008
1009 private:
1010 *list getCreateMiscSqlImpl(*hash opt, bool cache);
1011 public:
1012
1013
1014
1015 private:
1016 *list getAlignSqlImpl(AbstractTable table, *hash opt);
1017 public:
1018
1019
1020
1021 private:
1022 string getCreateSqlImpl(list l);
1023 public:
1024
1025
1026
1027 private:
1028 string getRenameSqlImpl(string new_name);
1029 public:
1030
1031
1032
1033 private:
1034 AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
1035 public:
1036
1037
1038
1039 private:
1040 AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
1041 public:
1042
1043
1044
1045 private:
1046 AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
1047 public:
1048
1049
1050
1051 private:
1052 AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch, *hash opt);
1053 public:
1054
1055
1056
1057 private:
1058 AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
1059 public:
1060
1061
1062
1063 private:
1064 AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
1065 public:
1066
1067
1068
1069 private:
1070 AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
1071 public:
1072
1073
1074
1075 private:
1076 bool tryInsertImpl(string sql, hash row);
1077 public:
1078
1079
1080
1081 private:
1082 hash getQoreTypeMapImpl();
1083 public:
1084
1085
1086
1087 private:
1088 hash getTypeMapImpl();
1089 public:
1090
1091
1093
1094 private:
1095 *string getSqlValueImpl(any v);
1096 public:
1097
1098
1099
1100 private:
1101 bool emptyImpl();
1102 public:
1103
1104
1106
1107 private:
1108 clearImpl();
1109 public:
1110
1111
1112
1113 private:
1114 softlist getDropSqlImpl();
1115 public:
1116
1117
1118
1119 private:
1120 setupTableImpl(hash desc, *hash opt);
1121 public:
1122
1123
1125
1126 private:
1127 bool constraintsLinkedToIndexesImpl();
1128 public:
1129
1130
1132
1133 private:
1134 bool uniqueIndexCreatesConstraintImpl();
1135 public:
1136
1137
1139
1140 private:
1141 bool supportsTablespacesImpl();
1142 public:
1143
1144
1146
1147 private:
1148 doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh);
1149 public:
1150
1151
1153
1154 private:
1155 doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch);
1156 public:
1157
1158
1160
1161 private:
1162 any tryExecArgsImpl(string sql, *softlist args);
1163 public:
1164
1165
1167
1168 private:
1169 any tryExecRawImpl(string sql, *softlist args);
1170 public:
1171
1172
1174
1175 private:
1176 copyImpl(AbstractTable old);
1177 public:
1178
1179 };
1180 };
SqlUtil::AbstractConstraint::name
string name
Date
const Date
PgsqlSqlUtil::PgsqlTable::getTablespaceName
*string getTablespaceName()
returns the data tablespace name for the table or NOTHING if none is known
Hash
const Hash
String
const String
PgsqlSqlUtil::PgsqlCheckConstraint
represents a PostgreSQL-specific check constraint
Definition: PgsqlSqlUtil.qm.dox.h:285
sprintf
string sprintf(string fmt,...)
SqlUtil::AbstractTable
DefaultCopMap
const DefaultCopMap
PgsqlSqlUtil::PgsqlDatabase::supportsSequencesImpl
bool supportsSequencesImpl()
returns True if the database supports sequences
PgsqlSqlUtil::PgsqlDatabase::getSchemaDescriptionOptions
hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
PgsqlSqlUtil::PgsqlDatabase
provides the PostgreSQL-specific implementation of the AbstractDatabase interface ...
Definition: PgsqlSqlUtil.qm.dox.h:576
PgsqlSqlUtil::PgsqlSequence::getRenameSql
string getRenameSql(string new_name)
returns a string that can be used to rename the sequence in the database
PgsqlSqlUtil::PgsqlTable::tryExecArgsImpl
any tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
SqlUtil::AbstractTable::cache
cache(*hash opts)
PgsqlSqlUtil::PgsqlSequence::getCreateSql
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
PgsqlSqlUtil::PgsqlDatabase::listProceduresImpl
list listProceduresImpl()
since PostgreSQL only supports functions, this method is identical to listFunctionsImpl() ...
PgsqlSqlUtil::PgsqlIndex::getCreateSql
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
SqlUtil::AbstractIndex
PgsqlSqlUtil::PgsqlColumn
represents a PostgreSQL-specific column
Definition: PgsqlSqlUtil.qm.dox.h:302
PgsqlSqlUtil::PgsqlTable::PgsqlNameMap
const PgsqlNameMap
maps from verbose type names to simple type names
Definition: PgsqlSqlUtil.qm.dox.h:804
COP_OVER
const COP_OVER
PgsqlSqlUtil::PgsqlTable::doSelectLimitOnlyUnlockedImpl
doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh)
processes a string for use in SQL select statements when there is a &quot;limit&quot; argument, but no &quot;orderby&quot; or &quot;offset&quot; arguments
PgsqlSqlUtil::PgsqlTable::tryExecRawImpl
any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
PgsqlSqlUtil::PgsqlTrigger
represents a PostgreSQL-specific trigger
Definition: PgsqlSqlUtil.qm.dox.h:498
PgsqlSqlUtil::PgsqlFunction::getCreateSql
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
PgsqlSqlUtil::PgsqlFunction::setName
setName(string new_name)
sets the new name of the function
PgsqlSqlUtil::PgsqlType
represents a PostgreSQL type
Definition: PgsqlSqlUtil.qm.dox.h:203
PgsqlSqlUtil::PgsqlTable::uniqueIndexCreatesConstraintImpl
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
SqlUtil::NumericColumnInfo
PgsqlSqlUtil::PgsqlTrigger::equalImpl
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
True
const True
PgsqlSqlUtil::PgsqlDatabase::listTablesImpl
list listTablesImpl()
returns a list of string table names in the database
SZ_MAND
const SZ_MAND
PgsqlSqlUtil::PgsqlPrimaryKey::memberGate
PgsqlColumn memberGate(string k)
returns the PgsqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception ...
SqlUtil::CHAR
const CHAR
PgsqlSqlUtil::PgsqlTriggerFunction::trigger
string trigger
trigger name
Definition: PgsqlSqlUtil.qm.dox.h:567
SqlUtil::AbstractSequence
PgsqlSqlUtil::PgsqlDatabase::tryExecArgs
static any tryExecArgs(AbstractDatasource ds, string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
PgsqlSqlUtil::PgsqlIndex
represents a PostgreSQL-specific index
Definition: PgsqlSqlUtil.qm.dox.h:238
PgsqlSqlUtil::PgsqlIndex::equalImpl
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
PgsqlSqlUtil::PgsqlTable::PgsqlTableDescriptionHashOptions
const PgsqlTableDescriptionHashOptions
extends SqlUtil::AbstractTable::TableDescriptionHashOptions with &quot;functions&quot; for table functions requ...
Definition: PgsqlSqlUtil.qm.dox.h:826
number
number number(softnumber n)
COP_YEAR_HOUR
const COP_YEAR_HOUR
PgsqlSqlUtil::PgsqlTriggerFunction
represents a PostgreSQL-specific trigger function
Definition: PgsqlSqlUtil.qm.dox.h:562
PgsqlSqlUtil::PgsqlColumn::byte_size
int byte_size
byte size of the column
Definition: PgsqlSqlUtil.qm.dox.h:307
PgsqlSqlUtil::PgsqlIndex::tablespace
*string tablespace
the tablespace name of the index
Definition: PgsqlSqlUtil.qm.dox.h:243
PgsqlSqlUtil::PgsqlTable::doSelectOrderByWithOffsetSqlUnlockedImpl
doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch)
processes a string for use in SQL select statements when there is an &quot;order by&quot; and &quot;offset&quot; argument...
SqlUtil::AbstractForeignConstraint
PgsqlSqlUtil::PgsqlNumericColumn
represents a PostgreSQL-specific numeric column
Definition: PgsqlSqlUtil.qm.dox.h:367
SqlUtil::AbstractSqlUtilBase::l
Mutex l()
SqlUtil::AbstractCheckConstraint
list
list list(...)
Float
const Float
PgsqlSqlUtil::PgsqlTable::QoreTypeMap
const QoreTypeMap
maps qore type names to postgresql type names
Definition: PgsqlSqlUtil.qm.dox.h:812
PgsqlSqlUtil::PgsqlDatabase::tryExecRaw
static any tryExecRaw(AbstractDatasource ds, string sql)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
PgsqlSqlUtil::PgsqlTable::getSchemaName
string getSchemaName()
returns the schema name
Boolean
const Boolean
PgsqlSqlUtil::PgsqlTable::getSqlName
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
SZ_NUM
const SZ_NUM
PgsqlSqlUtil::PgsqlSequence::constructor
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_end)
creates the object from the arguments
PgsqlSqlUtil::PgsqlType::name
string name
the name of the type
Definition: PgsqlSqlUtil.qm.dox.h:208
SqlUtil::AbstractColumn::getCreateSql
string getCreateSql()
PgsqlSqlUtil::PgsqlTrigger::getDropSql
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from the database
PgsqlSqlUtil::PgsqlTrigger::getCreateSql
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
Binary
const Binary
PgsqlSqlUtil::PgsqlDatabase::supportsTypesImpl
bool supportsTypesImpl()
returns True if the database supports named types
PgsqlSqlUtil::PgsqlDatabase::tryExecRawImpl
any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
PgsqlSqlUtil::PgsqlColumn::getRenameSql
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
PgsqlSqlUtil::PgsqlFunction::equalImpl
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
PgsqlSqlUtil::PgsqlTable::clearImpl
clearImpl()
clears PostgreSQL-specific table information
PgsqlSqlUtil::PgsqlTable::PgsqlTypeMap
const PgsqlTypeMap
maps postgresql type names to type configurations
Definition: PgsqlSqlUtil.qm.dox.h:766
PgsqlSqlUtil::PgsqlIndex::getRenameSql
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
COP_YEAR_MONTH
const COP_YEAR_MONTH
PgsqlSqlUtil::PgsqlTable::triggerFunctions
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: PgsqlSqlUtil.qm.dox.h:889
PgsqlSqlUtil::PgsqlDatabase::PgsqlSchemaDescriptionOptions
const PgsqlSchemaDescriptionOptions
PostgreSQL-specific schema description keys.
Definition: PgsqlSqlUtil.qm.dox.h:581
SqlUtil::BLOB
const BLOB
PgsqlSqlUtil::PgsqlTrigger::getRenameSql
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
type
string type(any arg)
SqlUtil::CLOB
const CLOB
PgsqlSqlUtil::PgsqlType::src
string src
the source of the type
Definition: PgsqlSqlUtil.qm.dox.h:211
PgsqlSqlUtil::PgsqlPrimaryKey
represents a PostgreSQL-specific primary key constraint
Definition: PgsqlSqlUtil.qm.dox.h:445
string
string string(softstring str)
SqlUtil::AbstractSqlUtilBase::ds
AbstractDatasource ds
SqlUtil::AbstractFunction
SqlUtil::AbstractSqlUtilBase::opts
*hash opts
SqlUtil::AbstractDatabase::native_case
bool native_case
PgsqlSqlUtil::PgsqlDatabase::getNextSequenceValueImpl
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
Int
const Int
COP_YEAR
const COP_YEAR
PgsqlSqlUtil::PgsqlTable::tablespace
*string tablespace
tablespace name for the table, if known
Definition: PgsqlSqlUtil.qm.dox.h:883
SqlUtil::AbstractTrigger
PgsqlSqlUtil::PgsqlDatabase::supportsPackagesImpl
bool supportsPackagesImpl()
returns True if the database supports packages
PgsqlSqlUtil::PgsqlForeignConstraint
represents a PostgreSQL-specific foreign constraint
Definition: PgsqlSqlUtil.qm.dox.h:268
SqlUtil::AbstractColumn
COP_YEAR_DAY
const COP_YEAR_DAY
PgsqlSqlUtil::PgsqlTable::constraintsLinkedToIndexesImpl
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
PgsqlSqlUtil::PgsqlFunction::getDropSql
string getDropSql()
returns a string that can be used to drop the function from the database
PgsqlSqlUtil::PgsqlTrigger::constructor
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
PgsqlSqlUtil::PgsqlIndex::constructor
constructor(string n_name, bool n_unique, hash n_cols, *string n_tablespace)
creates the object from the arguments
PgsqlSqlUtil::PgsqlTable::schema
string schema
schema name for the table
Definition: PgsqlSqlUtil.qm.dox.h:886
hash
hash hash(object obj)
PgsqlSqlUtil::PgsqlColumn::equalImpl
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
PgsqlSqlUtil::PgsqlTable::PgsqlCopMap
const PgsqlCopMap
column operator specializations for PostgreSQL
Definition: PgsqlSqlUtil.qm.dox.h:845
PgsqlSqlUtil::PgsqlColumn::getModifySqlImpl
list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt)
returns a list of sql strings that can be used to modify the column to the new definition; if the col...
SZ_OPT
const SZ_OPT
PgsqlSqlUtil::PgsqlSequence
class for PostgreSQL sequences
Definition: PgsqlSqlUtil.qm.dox.h:481
PgsqlSqlUtil::PgsqlDatabase::listFunctionsImpl
list listFunctionsImpl()
returns a list of string function names in the database
PgsqlSqlUtil::PgsqlTable::supportsTablespacesImpl
bool supportsTablespacesImpl()
returns True if the database support tablespaces
PgsqlSqlUtil::PgsqlTable::copyImpl
copyImpl(AbstractTable old)
db-specific copy actions
SqlUtil::AbstractDatabase
PgsqlSqlUtil::PgsqlDatabase::tryExecArgsImpl
any tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
PgsqlSqlUtil::get_table
PgsqlTable get_table(AbstractDatasource nds, string nname, *hash opts)
returns a PgsqlTable object corresponding to the arguments
PgsqlSqlUtil::PgsqlTable
provides the PostgreSQL-specific implementation of the SqlUtil::AbstractTable interface ...
Definition: PgsqlSqlUtil.qm.dox.h:761
PgsqlSqlUtil::PgsqlTable::getSqlValueImpl
*string getSqlValueImpl(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
SqlUtil::AbstractPrimaryKey
PgsqlSqlUtil::PgsqlFunction::getRenameSql
softlist getRenameSql(string new_name)
returns a string that can be used to rename the function in the database
Number
const Number
PgsqlSqlUtil::PgsqlTable::getColumnOperatorMap
hash getColumnOperatorMap()
returns the column operator map for this object
PgsqlSqlUtil::get_database
PgsqlDatabase get_database(AbstractDatasource nds, *hash opts)
returns a PgsqlDatabase object corresponding to the arguments
PgsqlSqlUtil::PgsqlFunction
represents a PostgreSQL-specific function
Definition: PgsqlSqlUtil.qm.dox.h:526
SqlUtil::AbstractUniqueConstraint