Qore PgsqlSqlUtilBase Module Reference 1.8
Loading...
Searching...
No Matches
PgsqlSqlUtilBase.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* PgsqlSqlUtilBase.qm Copyright (C) 2013 - 2024 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 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 is included below in the docs
37
291 PgsqlTable get_table(AbstractDatasource nds, string nname, *hash<auto> opts);
292
293
295 PgsqlDatabase get_database(AbstractDatasource nds, *hash<auto> opts);
296
297
300
301public:
303 constructor(string native_type, bool nullable, *hash<auto> options) ;
304
305 };
306
307 parse_schema_name(string nname, reference<string> schema, reference<string> name);
308
309
311class PgsqlSavepointHelper : public AbstractSavepointHelper {
312
313public:
315 constructor(AbstractDatasource ds, *string savepoint) ;
316
317
319protected:
321public:
322
323
325protected:
327public:
328
329
331protected:
333public:
334
335 };
336
339
340public:
342 string name;
343
345 string src;
346
348 constructor(string n_name, string n_src);
349
350
351 list<hash<auto>> getTypeList();
352
353
354 list<string> getModifySql(PgsqlType old, *hash opt);
355
356
358 string getCreateSql(*hash opt);
359
360
362
364 string getDropSql(*hash opt);
365
366
368
371 string getRenameSql(string new_name, *hash opt);
372
373
375 bool equal(PgsqlType type);
376
377 };
378
381
382public:
384 *string tablespace;
385
387 constructor(string n_name, bool n_unique, hash n_cols, *string n_tablespace) ;
388
389
391 string getCreateSql(string table_name, *hash opt);
392
393
395 string getDropSql(string table_name);
396
397
399protected:
400 bool equalImpl(AbstractIndex ix);
401public:
402
403
405 string getRenameSql(string table_name, string new_name);
406
407
408 };
409
412
413public:
415 constructor(string n, Columns c, ForeignConstraintTarget t) ;
416
417
419 string getCreateSql(string table_name, *hash opt);
420
421
423 string getDropSql(string table_name);
424
425
426 softlist getRenameSql(string table_name, string new_name);
427
428
430 string getCreateSql(string name, string table_name, *hash<auto> opt);
431
432 };
433
436
437public:
439 constructor(string n, string n_src) ;
440
441
443 string getDropSql(string table_name);
444
445
447 string getCreateSql(string table_name, *hash opt);
448
449
450 list getRenameSql(string table_name, string new_name);
451
452
454 string getCreateSql(string name, string table_name, *hash opt);
455
456 };
457
460
461public:
464
466protected:
468public:
469
470
472 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, *int scale) ;
473
474
477
478
480
487 list getAddColumnSql(AbstractTable t);
488
489
491
507 list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
508
509
511
521 string getRenameSql(AbstractTable t, string new_name);
522
523
525
527 string getDdlName(string name);
528
529
531protected:
532 bool equalImpl(AbstractColumn c);
533public:
534
535 };
536
539
540public:
542 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint scale) ;
543
544
547
548 };
549
552
553public:
554protected:
556 *string tablespace;
557
558public:
559
561 constructor(*string ts);
562
563
565 *string getTablespace();
566
567
569 setTablespace(*string ts);
570
571
573 bool setIndexBase(string ix);
574
575
578
579
581 getIndexSql(reference<string> sql, string name, *hash opts);
582
583
585 string getDropSql(string table_name);
586
587 };
588
591
592public:
593protected:
596
597public:
598
600
605 constructor(string n, hash n_cols, bool e = True, *string ts) ;
606
607
609
625
626
628 string getCreateSql(string table_name, *hash opts);
629
630
631 list<auto> getRenameSql(string table_name, string new_name);
632
633
635 string getCreateSql(string name, string table_name, *hash<auto> opts);
636
637
639 string getDropSql(string table_name);
640
641
643 bool isEnabled();
644
645 };
646
649
650public:
653
654
656
660 constructor(string n, *hash c, *string ts) ;
661
662
664
680
681
683 string getCreateSql(string table_name, *hash<auto> opts);
684
685
687 softlist getRenameSql(string table_name, string new_name);
688
689
691 string getDropSql(string table_name);
692
693 };
694
697
698public:
700 constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
701
702
704 string getCreateSql(*hash opt);
705
706
708
712 softlist getRenameSql(string new_name, *hash opt);
713
714 };
715
718
719public:
721 *string viewowner;
722
724 constructor(string n_name, string n_src, *string n_schemaname, *string n_viewowner)
725 ;
726
727
729 string getCreateSql(*hash opt);
730
731
733
737 softlist getRenameSql(string new_name, *hash opt);
738
739 };
740
743
744public:
746 constructor(string n, string n_src) ;
747
748
750 softlist<string> getCreateSql(string table_name, *hash opt);
751
752
754 softlist<string> getDropSql(string table_name);
755
756
758protected:
759 bool equalImpl(AbstractFunctionBase t);
760public:
761
762
764 softlist<string> getRenameSql(string table_name, string new_name);
765
766
768 string getNormalizedSource(string src);
769
770 };
771
774
775public:
776 *string args;
777
778 constructor(string n, string n_src, *string a) ;
779
780
782 softlist<string> getCreateSql(*hash opt);
783
784
786
789 string getDropSql(*hash opt);
790
791
793protected:
794 bool equalImpl(AbstractFunctionBase t);
795public:
796
797
799
802 softlist<string> getRenameSql(string new_name, *hash opt);
803
804
806 setName(string new_name);
807
808 };
809
812
813public:
815 string trigger;
816
817 constructor(string n, string n_src, string n_trigger) ;
818
819 };
820
823
824public:
827
828
829 const PGSQL_TempSavepoint = "qore_pgsql_tmp_savepoint";
830
833
834
837
838
839 constructor(AbstractDatasource nds, *hash opts) ;
840
841
842protected:
843 list<string> featuresImpl();
844public:
845
846
847 PgsqlType makeType(string name, string src, *hash opts);
848
849
850 *PgsqlType getType(string name);
851
852
853protected:
854 PgsqlSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
855public:
856
857
858protected:
859 *AbstractSequence getSequenceImpl(string name);
860public:
861
862
863protected:
864 *AbstractView getViewImpl(string name);
865public:
866
867
868protected:
869 PgsqlFunction makeFunctionImpl(string name, string src, *hash opts);
870public:
871
872
873protected:
874 PgsqlFunction makeProcedureImpl(string name, string src, *hash opts);
875public:
876
877
878protected:
879 *AbstractFunction getFunctionImpl(string name);
880public:
881
882
883protected:
884 AbstractFunction getProcedureImpl(string name);
885public:
886
887
888 static *string getFunctionArgs(string err, reference<string> src);
889
890 static PgsqlFunction processFunction(hash<auto> row, bool native_case);
891
892protected:
893 list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
894public:
895
896
897protected:
898 list getAlignSqlImpl(hash schema_hash, *hash opt);
899public:
900
901
903protected:
904 list<string> listTablesImpl();
905public:
906
907
909
913protected:
914 list<string> listFunctionsImpl();
915public:
916
917
919
921protected:
922 list<string> listProceduresImpl();
923public:
924
925
926protected:
927 list<string> listSequencesImpl();
928public:
929
930
931protected:
932 list<string> listViewsImpl();
933public:
934
935
937 list<string> listMaterializedViews();
938
939
942
943
945 list<string> listTypes();
946
947
949 ListIterator typeIterator();
950
951
953protected:
954 string getCreateSqlImpl(list l);
955public:
956
957
959 static string getCreateSql(list l);
960
962protected:
964public:
965
966
968protected:
970public:
971
972
974protected:
975 softint getNextSequenceValueImpl(string name);
976public:
977
978
980protected:
981 softint getCurrentSequenceValueImpl(string name);
982public:
983
984
986protected:
988public:
989
990
992protected:
994public:
995
996
998protected:
1000public:
1001
1002
1004protected:
1005 bool rebuildIndexImpl(string name, *hash options);
1006public:
1007
1008
1010protected:
1012public:
1013
1014
1016protected:
1017 reclaimSpaceImpl(*hash options);
1018public:
1019
1020
1021protected:
1022 *string getDbName();
1023public:
1024
1025
1027protected:
1029public:
1030
1031
1033protected:
1034 auto tryExecArgsImpl(string sql, *softlist<auto> args);
1035public:
1036
1037
1039protected:
1040 auto tryExecRawImpl(string sql, *softlist<auto> args);
1041public:
1042
1043
1045 static auto tryExecArgs(AbstractDatasource ds, string sql, *softlist<auto> args);
1046
1048 static auto tryExecRaw(AbstractDatasource ds, string sql);
1049 };
1050
1053
1054public:
1056 const PgsqlTypeMap = ...;
1057
1058
1060 const PgsqlNameMap = ...;
1061
1062
1064 const QoreTypeMap = ...;
1065
1066
1068
1071
1072
1073 const PgsqlColumnDescOptions = AbstractTable::ColumnDescOptions;
1074
1075 const PgsqlIndexOptions = AbstractTable::IndexOptions;
1076
1077 const PgsqlConstraintOptions = ...;
1078
1079
1080 const PgsqlTableCreationOptions = ...;
1081
1082
1083 const PgsqlAlignTableOptions = AbstractTable::AlignTableOptions + PgsqlTableCreationOptions;
1084
1087
1088
1090 const PgsqlCopMap = ...;
1091
1092
1094 const PgsqlTruncDate = ...;
1095
1096
1098 const PgsqlIopMap = ...;
1099
1100
1102 const PgsqlUopMap = ...;
1103
1104
1105protected:
1107 *string tablespace;
1108
1110 string schema;
1111
1114
1117
1120
1123
1126
1129
1131 transient Mutex pg_state();
1132
1133public:
1134
1136 constructor(AbstractDatasource nds, string nname, *hash opts) ;
1137
1138
1141
1142
1145
1146
1147 PgsqlFunction addTriggerFunction(string tfname, string src, string trigger);
1148
1149
1152
1153
1155 string getColumnSqlName(string col);
1156
1157
1159
1161 list<auto> getColumnSqlNames(softlist<auto> cols);
1162
1163
1165
1169 code getUpsertClosure(hash<auto> row, int upsert_strategy = UpsertAuto, *hash<auto> opt);
1170
1171
1174
1175
1177protected:
1179public:
1180
1181
1182protected:
1183 code getUpsertAuto(Columns cols, hash<auto> row, *hash<auto> opt);
1184public:
1185
1186
1187protected:
1188 PgsqlFunction addTriggerFunctionUnlocked(string tfname, string src, string trigger);
1189public:
1190
1191
1193 string getSqlName();
1194
1195
1196protected:
1197 hash getTableCreationOptions();
1198public:
1199
1200
1201protected:
1202 hash getTableDescriptionHashOptions();
1203public:
1204
1205
1206protected:
1207 hash getColumnDescOptions();
1208public:
1209
1210
1211protected:
1212 hash getIndexOptions();
1213public:
1214
1215
1216protected:
1217 hash getConstraintOptions();
1218public:
1219
1220
1221protected:
1222 hash getAlignTableOptions();
1223public:
1224
1225
1227protected:
1229public:
1230
1231
1233protected:
1235public:
1236
1237
1239protected:
1241public:
1242
1243
1245 hash<auto> getExpressionMap();
1246
1247
1248protected:
1249 bool checkExistenceImpl();
1250public:
1251
1252
1253protected:
1254 Columns describeImpl();
1255public:
1256
1257
1258protected:
1259 PgsqlPrimaryKey getPrimaryKeyImpl();
1260public:
1261
1262
1263protected:
1264 Indexes getIndexesImpl();
1265public:
1266
1267
1268protected:
1269 ForeignConstraints getForeignConstraintsImpl(*hash<auto> opts);
1270public:
1271
1272
1273protected:
1274 Constraints getConstraintsImpl();
1275public:
1276
1277
1278protected:
1279 Triggers getTriggersImpl();
1280public:
1281
1282
1284protected:
1285 string getCreateTableSqlImpl(*hash opt);
1286public:
1287
1288
1289protected:
1290 *list getCreateMiscSqlImpl(*hash opt, bool cache);
1291public:
1292
1293
1294protected:
1295 *list getAlignSqlImpl(AbstractTable table, *hash<auto> opt);
1296public:
1297
1298
1300protected:
1301 string getCreateSqlImpl(list l);
1302public:
1303
1304
1305protected:
1306 string getRenameSqlImpl(string new_name);
1307public:
1308
1309
1310protected:
1311 AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
1312public:
1313
1314
1315protected:
1316 AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
1317public:
1318
1319
1320protected:
1321 AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
1322public:
1323
1324
1325protected:
1326 AbstractForeignConstraint addForeignConstraintImpl(string cname, hash<auto> ch, string table, hash<auto> tch, *hash<auto> opt);
1327public:
1328
1329
1330protected:
1331 AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
1332public:
1333
1334
1335protected:
1336 AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
1337public:
1338
1339
1340protected:
1341 AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
1342public:
1343
1344
1345protected:
1346 bool tryInsertImpl(string sql, hash<auto> row);
1347public:
1348
1349
1351
1353protected:
1354 bool isDuplicateRowErrorImpl(hash<ExceptionInfo> ex);
1355public:
1356
1357
1358protected:
1359 hash<auto> getQoreTypeMapImpl();
1360public:
1361
1362
1363protected:
1364 hash<auto> getTypeMapImpl();
1365public:
1366
1367
1369
1371protected:
1372 *string getSqlValueImpl(auto v);
1373public:
1374
1375
1376protected:
1377 bool emptyImpl();
1378public:
1379
1380
1382protected:
1384public:
1385
1386
1387protected:
1388 softlist getDropSqlImpl();
1389public:
1390
1391
1392protected:
1393 setupTableImpl(hash<auto> desc, *hash<auto> opt);
1394public:
1395
1396
1398protected:
1400public:
1401
1402
1404protected:
1406public:
1407
1408
1410protected:
1412public:
1413
1414
1416protected:
1417 doSelectLimitOnlyInternImpl(reference<hash<QueryInfo>> info, reference<string> sql);
1418public:
1419
1420
1422protected:
1423 doSelectOrderByWithOffsetSqlInternImpl(reference<hash<QueryInfo>> info, reference<string> sql, list<auto> coll);
1424public:
1425
1426
1428protected:
1429 auto tryExecArgsImpl(string sql, *softlist<auto> args);
1430public:
1431
1432
1434protected:
1435 auto tryExecRawImpl(string sql, *softlist<auto> args);
1436public:
1437
1438
1440protected:
1441 copyImpl(AbstractTable old);
1442public:
1443
1444
1445protected:
1446 *hash<auto> doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
1447public:
1448
1449
1450protected:
1451 list<auto> getGroupOrderByListUnlocked(hash<QueryInfo> info, string key, list<auto> coll);
1452public:
1453
1454
1456protected:
1457 AbstractDataProviderType getNumericTypeImpl(string native_type, bool nullable, *hash<auto> options);
1458public:
1459
1460
1462
1466protected:
1467 AbstractSavepointHelper getSavepointHelperImpl(*string savepoint);
1468public:
1469
1470 };
1471};
represents a PostgreSQL-specific check constraint
Definition PgsqlSqlUtilBase.qm.dox.h:435
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
constructor(string n, string n_src)
creates the constraint from the supplied arguments
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
string getCreateSql(string name, string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
represents a PostgreSQL-specific column
Definition PgsqlSqlUtilBase.qm.dox.h:459
int byte_size
byte size of the column
Definition PgsqlSqlUtilBase.qm.dox.h:463
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, *int scale)
creates the column from the supplied arguments
string getNativeTypeString()
returns a string giving the native type of the column
constructor()
empty constructor for subclasses
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
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
list getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table
string getDdlName(string name)
returns the column name with quoting in case the column name is a reserved word
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
provides the PostgreSQL-specific implementation of the AbstractDatabase interface
Definition PgsqlSqlUtilBase.qm.dox.h:822
auto tryExecRawImpl(string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
ListIterator materializedViewIterator()
returns an iterator listing the string materialized view names in the database
const PgsqlReservedWords
hash (set) of reserved words
Definition PgsqlSqlUtilBase.qm.dox.h:836
ListIterator typeIterator()
returns an iterator listing the string type names in the database
hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
const PgsqlReclaimSpaceOptions
Options for reclaimSpace()
Definition PgsqlSqlUtilBase.qm.dox.h:832
list< string > listFunctionsImpl()
returns a list of string function names in the database
bool supportsTypesImpl()
returns True if the database supports named types
list< string > listTablesImpl()
returns a list of string table names in the database
list< string > listMaterializedViews()
returns a list of string materialized view names in the database
reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
list< string > listProceduresImpl()
since PostgreSQL only supports functions, this method is identical to listFunctionsImpl()
auto tryExecArgsImpl(string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
static string getCreateSql(list l)
returns a string that can be used to create the schema in the database
int getPhysicalSizeImpl()
SqlUtil::AbstractDatabase::getPhysicalSize()
bool supportsSequencesImpl()
returns True if the database supports sequences
hash getReclaimSpaceOptions()
returns driver-specific options to the base abstract class
string getCreateSqlImpl(list l)
returns a string that can be used to create the schema in the database
bool supportsPackagesImpl()
returns True if the database supports packages
const PgsqlSchemaDescriptionOptions
PostgreSQL-specific schema description keys.
Definition PgsqlSqlUtilBase.qm.dox.h:826
static auto tryExecRaw(AbstractDatasource ds, string sql)
tries to execute a command so that if an error occurs the current transaction status is not lost
computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics()
static auto tryExecArgs(AbstractDatasource ds, string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
list< string > listTypes()
returns a list of string type names in the database
represents a PostgreSQL-specific foreign constraint
Definition PgsqlSqlUtilBase.qm.dox.h:411
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
constructor(string n, Columns c, ForeignConstraintTarget t)
creates the constraint from the supplied arguments
string getCreateSql(string name, string table_name, *hash< auto > opt)
returns a string that can be used to create the constraint in the database
represents a PostgreSQL-specific function
Definition PgsqlSqlUtilBase.qm.dox.h:773
setName(string new_name)
sets the new name of the function
string getDropSql(*hash opt)
returns a string that can be used to drop the function from the database
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
softlist< string > getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the function in the database
softlist< string > getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
represents a PostgreSQL-specific index
Definition PgsqlSqlUtilBase.qm.dox.h:380
constructor(string n_name, bool n_unique, hash n_cols, *string n_tablespace)
creates the object from the arguments
*string tablespace
the tablespace name of the index
Definition PgsqlSqlUtilBase.qm.dox.h:384
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
string getDropSql(string table_name)
returns a string that can be used to drop the index from the database
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
the data type for PostgreSQL NUMBER columns
Definition PgsqlSqlUtilBase.qm.dox.h:299
constructor(string native_type, bool nullable, *hash< auto > options)
creates the object
represents a PostgreSQL-specific numeric column
Definition PgsqlSqlUtilBase.qm.dox.h:538
string getNativeTypeString()
returns a string giving the native type of the column
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint scale)
creates the column from the supplied arguments
represents a PostgreSQL-specific primary key constraint
Definition PgsqlSqlUtilBase.qm.dox.h:648
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the constraint
string getCreateSql(string table_name, *hash< auto > opts)
returns a string that can be used to create the constraint
PgsqlColumn memberGate(string k)
returns the PgsqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
constructor(string n, *hash c, *string ts)
creates the object with the given attributes
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
constructor()
creates an empty primary key object
PostgreSQL savepoint helper.
Definition PgsqlSqlUtilBase.qm.dox.h:311
constructor(AbstractDatasource ds, *string savepoint)
Creates the object.
deleteSavepointImpl()
Deletes the savepoint.
createSavepointImpl()
Creates the savepoint.
rollbackImpl()
Rolls back to the savepoint.
class for PostgreSQL sequences
Definition PgsqlSqlUtilBase.qm.dox.h:696
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_end)
creates the object from the arguments
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the sequence in the database
provides the PostgreSQL-specific implementation of the SqlUtil::AbstractTable interface
Definition PgsqlSqlUtilBase.qm.dox.h:1052
const PgsqlNameMap
maps from verbose type names to simple type names
Definition PgsqlSqlUtilBase.qm.dox.h:1060
copyImpl(AbstractTable old)
db-specific copy actions
int server_version_sub
PostgreSQL server version.
Definition PgsqlSqlUtilBase.qm.dox.h:1128
hash< auto > getExpressionMap()
Returns the expression map for PostgreSQL.
const PgsqlIopMap
a hash of default value operator descriptions for PostgreSQL
Definition PgsqlSqlUtilBase.qm.dox.h:1098
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema,...
bool isDuplicateRowErrorImpl(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
const PgsqlUopMap
a hash of default update operator definitions for PostgreSQL
Definition PgsqlSqlUtilBase.qm.dox.h:1102
hash getInsertOperatorMap()
returns the insert operator map for this object
bool has_atomic_merge
Set based on the postgreSQL server version.
Definition PgsqlSqlUtilBase.qm.dox.h:1116
int server_version_major
PostgreSQL server major version.
Definition PgsqlSqlUtilBase.qm.dox.h:1122
constructor(AbstractDatasource nds, string nname, *hash opts)
Creates the object from the arguments.
doSelectLimitOnlyInternImpl(reference< hash< QueryInfo > > info, reference< string > sql)
processes a string for use in SQL select statements when there is a "limit" argument,...
auto tryExecArgsImpl(string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
AbstractDataProviderType getNumericTypeImpl(string native_type, bool nullable, *hash< auto > options)
returns the type for number / numeric columns for the database so that data conversions can be handle...
const PgsqlCopMap
column operator specializations for PostgreSQL
Definition PgsqlSqlUtilBase.qm.dox.h:1090
doSelectOrderByWithOffsetSqlInternImpl(reference< hash< QueryInfo > > info, reference< string > sql, list< auto > coll)
processes a string for use in SQL select statements when there is an "order by" and "offset" argument
string getSchemaName()
returns the schema name
bool hasArrayBind()
returns False because the pgsql driver does not support array binds / bulk DML operations
const PgsqlTableDescriptionHashOptions
extends SqlUtil::AbstractTable::TableDescriptionHashOptions with "functions"
Definition PgsqlSqlUtilBase.qm.dox.h:1070
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
string getCreateSqlImpl(list l)
returns a string that can be used to create the table in the database
bool supportsTablespacesImpl()
returns True if the database support tablespaces
string getCreateTableSqlImpl(*hash opt)
returns a string that can be used to create the table in the database
int server_version_minor
PostgreSQL server minor version.
Definition PgsqlSqlUtilBase.qm.dox.h:1125
const PgsqlTypeMap
maps PostgreSQL type names to type configurations
Definition PgsqlSqlUtilBase.qm.dox.h:1056
AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
string schema
schema name for the table
Definition PgsqlSqlUtilBase.qm.dox.h:1110
transient Mutex pg_state()
Lock for atomicity for setting state info.
clearImpl()
clears PostgreSQL-specific table information
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
code getUpsertClosure(hash< auto > row, int upsert_strategy=UpsertAuto, *hash< auto > opt)
returns a closure for performing upserts
getServerVersion()
Sets the internal PostgreSQL server version.
auto tryExecRawImpl(string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
*string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument
const PgsqlTruncDate
Map SqlUtil::cop_trunc_date() constants to PostgreSQL internal masks.
Definition PgsqlSqlUtilBase.qm.dox.h:1094
bool hasAtomicUpsert()
Returns True if the server supports atomic upsert/merge operations.
*string getTablespaceName()
returns the data tablespace name for the table or NOTHING if none is known
int server_version
PostgreSQL server full version code.
Definition PgsqlSqlUtilBase.qm.dox.h:1119
list< auto > getColumnSqlNames(softlist< auto > cols)
returns a list of column names for use in SQL strings
hash getColumnOperatorMapImpl()
returns the column operator map for this object
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition PgsqlSqlUtilBase.qm.dox.h:1113
const QoreTypeMap
maps qore type names to PostgreSQL type names
Definition PgsqlSqlUtilBase.qm.dox.h:1064
hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
const PgsqlExpressionMap
Expression map for PostgreSQL.
Definition PgsqlSqlUtilBase.qm.dox.h:1086
*string tablespace
tablespace name for the table, if known
Definition PgsqlSqlUtilBase.qm.dox.h:1107
represents a PostgreSQL-specific trigger function
Definition PgsqlSqlUtilBase.qm.dox.h:811
string trigger
trigger name
Definition PgsqlSqlUtilBase.qm.dox.h:815
represents a PostgreSQL-specific trigger
Definition PgsqlSqlUtilBase.qm.dox.h:742
softlist< string > getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
string getNormalizedSource(string src)
returns normalized source for comparisons
softlist< string > getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
softlist< string > getDropSql(string table_name)
returns a string that can be used to drop the trigger from the database
represents a PostgreSQL type
Definition PgsqlSqlUtilBase.qm.dox.h:338
string getDropSql(*hash opt)
returns a string that can be used to drop the function from the database
string name
the name of the type
Definition PgsqlSqlUtilBase.qm.dox.h:342
string getCreateSql(*hash opt)
returns a string that can be used to create the type in the database
string getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename a type
constructor(string n_name, string n_src)
creates the type from the supplied arguments
string src
the source of the type
Definition PgsqlSqlUtilBase.qm.dox.h:345
bool equal(PgsqlType type)
returns True if the types are equal
common base class for unique constraints
Definition PgsqlSqlUtilBase.qm.dox.h:551
bool setIndexBase(string ix)
sets the supporting index name
getIndexSql(reference< string > sql, string name, *hash opts)
adds index options onto the sql creation string
clearIndex()
clears any index base for the constraint
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
constructor(*string ts)
creates the constraint with an optional tablespace name
setTablespace(*string ts)
sets or clears the tablespace name
*string getTablespace()
returns the tablespace name used for this constraint, if known
*string tablespace
any tablespace for the unique key index
Definition PgsqlSqlUtilBase.qm.dox.h:556
class modeling a unique constraint
Definition PgsqlSqlUtilBase.qm.dox.h:590
constructor(string n, hash n_cols, bool e=True, *string ts)
creates the object with the given attributes
bool isEnabled()
returns True if the constraint is enabled, False if not
string getCreateSql(string name, string table_name, *hash< auto > opts)
returns a string that can be used to rename the constraint
PgsqlColumn memberGate(string k)
returns the PgsqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
string getDropSql(string table_name)
returns a string that can be used to drop the constraint from the database
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
bool enabled
True if the constraint is enabled, False if not
Definition PgsqlSqlUtilBase.qm.dox.h:595
represents a PostgreSQL view
Definition PgsqlSqlUtilBase.qm.dox.h:717
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the view in the database
constructor(string n_name, string n_src, *string n_schemaname, *string n_viewowner)
creates the object from the arguments
*string viewowner
Owner of the view.
Definition PgsqlSqlUtilBase.qm.dox.h:721
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
transient AbstractDatasource ds
cache(*hash< auto > opts)
the PgsqlSqlUtilBase namespace contains all the objects in the PgsqlSqlUtilBase module
Definition PgsqlSqlUtilBase.qm.dox.h:289
PgsqlTable get_table(AbstractDatasource nds, string nname, *hash< auto > opts)
returns a PgsqlTable object corresponding to the arguments
PgsqlDatabase get_database(AbstractDatasource nds, *hash< auto > opts)
returns a PgsqlDatabase object corresponding to the arguments