Qore PgsqlSqlUtil Module Reference 1.1

- 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 (C) 2013 - 2014 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 // minimum 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
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
202 parse_schema_name(string nname, reference schema, reference name);
203
204
206 class PgsqlType {
207
208 public:
209 public :
211 string name;
212
214 string src;
215
216 public:
217
218 constructor(string n_name, string n_src);
219
220
221 list getTypeList();
222
223
224 list getModifySql(PgsqlType old, *hash opt);
225
226
227 string getCreateSql(*hash opt);
228
229
230 string getDropSql(*hash opt);
231
232
233 string getRenameSql(string new_name);
234
235
236 bool equal(PgsqlType type);
237
238 };
239
241 class PgsqlIndex : public SqlUtil::AbstractIndex {
242
243 public:
244 public :
246 *string tablespace;
247
248 public:
249
251 constructor(string n_name, bool n_unique, hash n_cols, *string n_tablespace);
252
253
255 string getCreateSql(string table_name, *hash opt);
256
257
259 private bool equalImpl(AbstractIndex ix);
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 getAddColumnSql(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 private bool equalImpl(AbstractColumn c);
360
361 };
362
364 class PgsqlNumericColumn : public PgsqlColumn,public SqlUtil::NumericColumnInfo {
365
366 public:
367 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint n_scale);
368
369
370 string getNativeTypeString();
371
372 };
373
374 class PgsqlUniqueConstraintCommon : public SqlUtil::AbstractUniqueConstraint {
375
376 public:
377 private :
379 *string tablespace;
380
381 public:
382
383 constructor(*string ts);
384
385
386 bool setIndexBase(string ix);
387
388
390 clearIndex();
391
392
393 abstract AbstractIterator keyIterator();
394
396 getIndexSql(reference sql, string name, *hash opts);
397
398 };
399
400 class PgsqlUniqueConstraint : public SqlUtil::AbstractUniqueConstraint,public PgsqlUniqueConstraintCommon {
401
402 public:
403 private :
405 bool enabled;
406
407 public:
408
409 constructor(string n, hash n_cols, bool e = True, *string ts);
410
411
413
428 PgsqlColumn memberGate(string k);
429
430
431 string getCreateSql(string table_name, *hash opts);
432
433
434 list getRenameSql(string table_name, string new_name);
435
436
437 string getCreateSql(string name, string table_name, *hash opts);
438
439 };
440
442 class PgsqlPrimaryKey : public SqlUtil::AbstractPrimaryKey,public PgsqlUniqueConstraintCommon {
443
444 public:
445 constructor();
446
447
448 constructor(string n, *hash c, *string ts);
449
450
452
467 PgsqlColumn memberGate(string k);
468
469
470 string getCreateSql(string table_name, *hash opts);
471
472
473 softlist getRenameSql(string table_name, string new_name);
474
475 };
476
478 class PgsqlSequence : public SqlUtil::AbstractSequence {
479
480 public:
482 constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end);
483
484
486 string getCreateSql(*hash opt);
487
488
490 string getRenameSql(string new_name);
491
492 };
493
495 class PgsqlView : public SqlUtil::AbstractView {
496
497 public:
498
499 public :
501 *string viewowner;
502
503 public:
504
506 constructor(string n_name, string n_src, *string n_schemaname,
507 *string n_viewowner)
508 ;
509
510
512 string getCreateSql(*hash opt);
513
514
516 softlist getRenameSql(string new_name);
517
518 };
519
521 class PgsqlTrigger : public SqlUtil::AbstractTrigger {
522
523 public:
525 constructor(string n, string n_src);
526
527
529 softlist getCreateSql(string table_name, *hash opt);
530
531
533 softlist getDropSql(string table_name);
534
535
537 private bool equalImpl(AbstractFunctionBase t);
538
539
541 softlist getRenameSql(string table_name, string new_name);
542
543 };
544
546 class PgsqlFunction : public SqlUtil::AbstractFunction {
547
548 public:
549 public :
550 *string args;
551
552 public:
553
554 constructor(string n, string n_src, *string a);
555
556
558 softlist getCreateSql(*hash opt);
559
560
562 string getDropSql();
563
564
566 private bool equalImpl(AbstractFunctionBase t);
567
568
570 softlist getRenameSql(string new_name);
571
572
574 setName(string new_name);
575
576 };
577
579 class PgsqlTriggerFunction : public PgsqlFunction {
580
581 public:
582 public :
584 string trigger;
585
586 public:
587
588 constructor(string n, string n_src, string n_trigger);
589
590 };
591
593 class PgsqlDatabase : public SqlUtil::AbstractDatabase {
594
595 public:
596 public :
598 const PgsqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + (
599 "types": Type::Hash,
600 "type_map": Type::Hash,
601 );
602
603 const PGSQL_TempSavepoint = "qore_pgsql_tmp_savepoint";
604
605 public:
606
607 constructor(AbstractDatasource nds, *hash opts);
608
609
610 private list featuresImpl();
611
612
613 PgsqlType makeType(string name, string src, *hash opts);
614
615
616 *PgsqlType getType(string name);
617
618
619 private PgsqlSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
620
621
622 private *AbstractSequence getSequenceImpl(string name);
623
624
625 private *AbstractView getViewImpl(string name);
626
627
628 private PgsqlFunction makeFunctionImpl(string name, string src, *hash opts);
629
630
631 private PgsqlFunction makeProcedureImpl(string name, string src, *hash opts);
632
633
634 private *AbstractFunction getFunctionImpl(string name);
635
636
637 private AbstractFunction getProcedureImpl(string name);
638
639
640 static *string getFunctionArgs(string err, reference src);
641
642 static PgsqlFunction processFunction(hash row, bool native_case);
643
644 private list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
645
646
647 private list getAlignSqlImpl(hash schema_hash, *hash opt);
648
649
651 private list listTablesImpl();
652
653
655
659 private list listFunctionsImpl();
660
661
663
665 private list listProceduresImpl();
666
667
668 private list listSequencesImpl();
669
670
671 private list listViewsImpl();
672
673
674 private string getCreateSqlImpl(list l);
675
676
677 static string getCreateSql(list l);
678
680 private hash getSchemaDescriptionOptions();
681
682
684 private softint getNextSequenceValueImpl(string name);
685
686
688 private bool supportsSequencesImpl();
689
690
692 private bool supportsTypesImpl();
693
694
696 private bool supportsPackagesImpl();
697
698
700 private any tryExecArgsImpl(string sql, *softlist args);
701
702
704 private any tryExecRawImpl(string sql, *softlist args);
705
706
708 static any tryExecArgs(AbstractDatasource ds, string sql, *softlist args);
709
711 static any tryExecRaw(AbstractDatasource ds, string sql);
712 };
713
715 class PgsqlTable : public SqlUtil::AbstractTable {
716
717 public:
718 public :
720 const PgsqlTypeMap = (
721 "numeric": ("qore": Type::Number, "size": SZ_NUM,),
722 "decimal": ("qore": Type::Number, "size": SZ_NUM,),
723 "money": ("qore": Type::Number,),
724 "smallint": ("qore": Type::Int,),
725 "integer": ("qore": Type::Int,),
726 "bigint": ("qore": Type::Int,),
727 "smallserial": ("qore": Type::Int,),
728 "serial": ("qore": Type::Int,),
729 "bigserial": ("qore": Type::Int,),
730 "real": ("qore": Type::Float,),
731 "double precision": ("qore": Type::Float,),
732 "oid": ("qore": Type::Number,),
733 "character": ("qore": Type::String, "size": SZ_MAND,),
734 "char": ("qore": Type::String, "size": SZ_MAND,),
735 "character varying": ("qore": Type::String, "size": SZ_MAND,),
736 "varchar": ("qore": Type::String, "size": SZ_MAND,),
737 "date": ("qore": Type::Date,),
738 "timestamp without time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6), "default_size": 6,),
739 "timestamp": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
740 "timestamp with time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
741 "time without time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
742 "time": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
743 "time with time zone": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
744 "interval": ("qore": Type::Date, "size": SZ_OPT, "size_range": (0, 6),"default_size": 6,),
745 "abstime": ("qore": Type::Date,),
746 "reltime": ("qore": Type::Date,),
747 "text": ("qore": Type::String,),
748 "bytea": ("qore": Type::Binary,),
749 "bit": ("qore": Type::Binary,),
750 "bit varying": ("qore": Type::Binary,),
751 "boolean": ("qore": Type::Boolean,),
752 "macaddr": ("qore": Type::String,),
753 "inet": ("qore": Type::String,),
754 "cidr": ("qore": Type::String,),
755 );
756
758 const PgsqlNameMap = (
759 "character varying": "varchar",
760 "character": "char",
761 "timestamp without time zone": "timestamp",
762 "time without time zone": "time",
763 );
764
766 const QoreTypeMap = (
767 "integer": "bigint",
768 "float": "double precision",
769 "number": "numeric",
770 "string": "varchar",
771 "date": "timestamp",
772 "binary": "bytea",
773 "bool": "boolean",
774 SqlUtil::CHAR: "char",
775 SqlUtil::CLOB: "text",
776 SqlUtil::BLOB: "bytea",
777 );
778
780 const PgsqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions + (
781 "functions": Type::Hash,
782 );
783
784 const PgsqlColumnDescOptions = AbstractTable::ColumnDescOptions;
785
786 const PgsqlIndexOptions = AbstractTable::IndexOptions;
787
788 const PgsqlConstraintOptions = AbstractTable::ConstraintOptions + PgsqlIndexOptions + (
789 "index": Type::String,
790 );
791
792 const PgsqlTableCreationOptions = AbstractTable::TableCreationOptions + PgsqlConstraintOptions + (
793 "omit_trigger_functions": Type::Boolean,
794 );
795
796 const PgsqlAlignTableOptions = AbstractTable::AlignTableOptions + PgsqlTableCreationOptions;
797
799 const PgsqlCopMap = DefaultCopMap + (
800 COP_OVER: (
801 "argcolumn": True,
802 "argoptional": True,
803 "code": string (*string cve, *string arg) {
804 string sql = cve + " over (";
805 if (arg)
806 sql += sprintf("partition by %s", arg);
807 sql += ")";
808 return sql;
809 },
810 ),
811 COP_YEAR: (
812 "code": string (string arg1, any arg) {
813 return sprintf("to_char(%s, 'YYYY')", arg1);
814 }
815 ),
816 COP_YEAR_MONTH: (
817 "code": string (string arg1, any arg) {
818 return sprintf("to_char(%s, 'YYYY-MM')", arg1);
819 }
820 ),
821 COP_YEAR_DAY: (
822 "code": string (string arg1, any arg) {
823 return sprintf("to_char(%s, 'YYYY-MM-DD')", arg1);
824 }
825 ),
826 COP_YEAR_HOUR: (
827 "code": string (string arg1, any arg) {
828 return sprintf("to_char(%s, 'YYYY-MM-DD HH24')", arg1);
829 }
830 ),
831 COP_SEQ: (
832 "code": string (string arg1, string arg) {
833 return sprintf("nextval('%s')", arg);
834 }
835 ),
836 );
837
839 const PgsqlIopMap = DefaultIopMap + (
840 IOP_SEQ: (
841 "arg": Type::String,
842 "placeholder": "nextval(%v)",
843 ),
844 );
845
846 public:
847
848 private :
850 *string tablespace;
851
853 string schema;
854
856 Functions triggerFunctions;
857
858 public:
859
860 constructor(AbstractDatasource nds, string nname, *hash opts);
861
862
864 string getSchemaName();
865
866
868 *string getTablespaceName();
869
870
871 PgsqlFunction addTriggerFunction(string tfname, string src, string trigger);
872
873
874 private PgsqlFunction addTriggerFunctionUnlocked(string tfname, string src, string trigger);
875
876
878 string getSqlName();
879
880
881 private hash getTableCreationOptions();
882
883
884 private hash getTableDescriptionHashOptions();
885
886
887 private hash getColumnDescOptions();
888
889
890 private hash getIndexOptions();
891
892
893 private hash getConstraintOptions();
894
895
896 private hash getAlignTableOptions();
897
898
900 private hash getColumnOperatorMap();
901
902
904 private hash getInsertOperatorMap();
905
906
907 private bool checkExistenceImpl();
908
909
910 private Columns describeImpl();
911
912
913 private PgsqlPrimaryKey getPrimaryKeyImpl();
914
915
916 private Indexes getIndexesImpl();
917
918
919 private ForeignConstraints getForeignConstraintsImpl(*hash opts);
920
921
922 private Constraints getConstraintsImpl();
923
924
925 private Triggers getTriggersImpl();
926
927
928 private string getCreateTableSqlImpl(*hash opt);
929
930
931 private *list getCreateMiscSqlImpl(*hash opt, bool cache);
932
933
934 private *list getAlignSqlImpl(AbstractTable table, *hash opt);
935
936
937 private string getCreateSqlImpl(list l);
938
939
940 private string getRenameSqlImpl(string new_name);
941
942
943 private AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
944
945
946 private AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
947
948
949 private AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
950
951
952 private AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch, *hash opt);
953
954
955 private AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
956
957
958 private AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
959
960
961 private AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
962
963
964 private bool tryInsertImpl(string sql, hash row);
965
966
967 private hash getQoreTypeMapImpl();
968
969
970 private hash getTypeMapImpl();
971
972
974 private *string getSqlValueImpl(any v);
975
976
977 private bool emptyImpl();
978
979
981 private clearImpl();
982
983
984 private softlist getDropSqlImpl();
985
986
987 private setupTableImpl(hash desc, *hash opt);
988
989
991 private bool constraintsLinkedToIndexesImpl();
992
993
995 private bool uniqueIndexCreatesConstraintImpl();
996
997
999 private bool supportsTablespacesImpl();
1000
1001
1003 private doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh);
1004
1005
1007 private doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch);
1008
1009
1011 private any tryExecArgsImpl(string sql, *softlist args);
1012
1013
1015 private any tryExecRawImpl(string sql, *softlist args);
1016
1017
1019 private copyImpl(AbstractTable old);
1020
1021 };
1022 };
SqlUtil::AbstractConstraint::name
string name
PgsqlSqlUtil::PgsqlTable::PgsqlIopMap
const PgsqlIopMap
a hash of default value operator descriptions for PostgreSQL
Definition: PgsqlSqlUtil.qm.dox.h:839
PgsqlSqlUtil::PgsqlView::viewowner
*string viewowner
Owner of the view.
Definition: PgsqlSqlUtil.qm.dox.h:501
Date
const Date
PgsqlSqlUtil::PgsqlDatabase::supportsPackagesImpl
private bool supportsPackagesImpl()
returns True if the database supports packages
COP_SEQ
const COP_SEQ
PgsqlSqlUtil::PgsqlTable::getTablespaceName
*string getTablespaceName()
returns the data tablespace name for the table or NOTHING if none is known
Hash
const Hash
PgsqlSqlUtil::PgsqlView
represents a PostgreSQL view
Definition: PgsqlSqlUtil.qm.dox.h:495
String
const String
DefaultIopMap
const DefaultIopMap
PgsqlSqlUtil::PgsqlDatabase::tryExecArgsImpl
private 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::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::listProceduresImpl
private list listProceduresImpl()
since PostgreSQL only supports functions, this method is identical to listFunctionsImpl() ...
PgsqlSqlUtil::PgsqlDatabase
provides the PostgreSQL-specific implementation of the AbstractDatabase interface ...
Definition: PgsqlSqlUtil.qm.dox.h:593
PgsqlSqlUtil::PgsqlTable::supportsTablespacesImpl
private bool supportsTablespacesImpl()
returns True if the database support tablespaces
PgsqlSqlUtil::PgsqlTable::uniqueIndexCreatesConstraintImpl
private bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
PgsqlSqlUtil::PgsqlSequence::getRenameSql
string getRenameSql(string new_name)
returns a string that can be used to rename the sequence in the database
PgsqlSqlUtil::PgsqlTable::constraintsLinkedToIndexesImpl
private bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
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::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:758
PgsqlSqlUtil::PgsqlTrigger::equalImpl
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
COP_OVER
const COP_OVER
PgsqlSqlUtil::PgsqlTrigger
represents a PostgreSQL-specific trigger
Definition: PgsqlSqlUtil.qm.dox.h:521
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:206
PgsqlSqlUtil::PgsqlTable::clearImpl
private clearImpl()
clears PostgreSQL-specific table information
SqlUtil::NumericColumnInfo
True
const True
PgsqlSqlUtil::PgsqlTable::getColumnOperatorMap
private hash getColumnOperatorMap()
returns the column operator map for this object
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:584
PgsqlSqlUtil::PgsqlFunction::equalImpl
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
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:241
PgsqlSqlUtil::PgsqlTable::PgsqlTableDescriptionHashOptions
const PgsqlTableDescriptionHashOptions
extends SqlUtil::AbstractTable::TableDescriptionHashOptions with &quot;functions&quot; for table functions requ...
Definition: PgsqlSqlUtil.qm.dox.h:780
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:579
PgsqlSqlUtil::PgsqlTable::tryExecArgsImpl
private 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::PgsqlColumn::byte_size
int byte_size
byte size of the column
Definition: PgsqlSqlUtil.qm.dox.h:307
PgsqlSqlUtil::PgsqlView::getCreateSql
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
PgsqlSqlUtil::PgsqlIndex::tablespace
*string tablespace
the tablespace name of the index
Definition: PgsqlSqlUtil.qm.dox.h:246
SqlUtil::AbstractForeignConstraint
PgsqlSqlUtil::PgsqlNumericColumn
represents a PostgreSQL-specific numeric column
Definition: PgsqlSqlUtil.qm.dox.h:364
SqlUtil::AbstractSqlUtilBase::l
Mutex l()
SqlUtil::AbstractCheckConstraint
list
list list(...)
Float
const Float
PgsqlSqlUtil::PgsqlTable::getInsertOperatorMap
private hash getInsertOperatorMap()
returns the insert operator map for this object
PgsqlSqlUtil::PgsqlTable::QoreTypeMap
const QoreTypeMap
maps qore type names to postgresql type names
Definition: PgsqlSqlUtil.qm.dox.h:766
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)
PgsqlSqlUtil::PgsqlDatabase::tryExecRawImpl
private any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
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:211
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::PgsqlTable::doSelectLimitOnlyUnlockedImpl
private 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::PgsqlDatabase::supportsSequencesImpl
private bool supportsSequencesImpl()
returns True if the database supports sequences
PgsqlSqlUtil::PgsqlColumn::getRenameSql
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
PgsqlSqlUtil::PgsqlTable::PgsqlTypeMap
const PgsqlTypeMap
maps postgresql type names to type configurations
Definition: PgsqlSqlUtil.qm.dox.h:720
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::tryExecRawImpl
private 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::PgsqlTable::triggerFunctions
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: PgsqlSqlUtil.qm.dox.h:856
PgsqlSqlUtil::PgsqlTable::getSqlValueImpl
private *string getSqlValueImpl(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
PgsqlSqlUtil::PgsqlDatabase::PgsqlSchemaDescriptionOptions
const PgsqlSchemaDescriptionOptions
PostgreSQL-specific schema description keys.
Definition: PgsqlSqlUtil.qm.dox.h:598
SqlUtil::BLOB
const BLOB
PgsqlSqlUtil::PgsqlDatabase::supportsTypesImpl
private bool supportsTypesImpl()
returns True if the database supports named types
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:214
PgsqlSqlUtil::PgsqlPrimaryKey
represents a PostgreSQL-specific primary key constraint
Definition: PgsqlSqlUtil.qm.dox.h:442
string
string string(softstring str)
SqlUtil::AbstractSqlUtilBase::ds
AbstractDatasource ds
SqlUtil::AbstractFunction
SqlUtil::AbstractView
SqlUtil::AbstractSqlUtilBase::opts
*hash opts
SqlUtil::AbstractDatabase::native_case
bool native_case
PgsqlSqlUtil::PgsqlColumn::equalImpl
private bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
PgsqlSqlUtil::PgsqlIndex::equalImpl
private bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
PgsqlSqlUtil::PgsqlView::getRenameSql
softlist getRenameSql(string new_name)
returns a string that can be used to rename the view in the database
Int
const Int
PgsqlSqlUtil::PgsqlDatabase::listTablesImpl
private list listTablesImpl()
returns a list of string table names in the database
COP_YEAR
const COP_YEAR
PgsqlSqlUtil::PgsqlTable::tablespace
*string tablespace
tablespace name for the table, if known
Definition: PgsqlSqlUtil.qm.dox.h:850
SqlUtil::AbstractTrigger
PgsqlSqlUtil::PgsqlDatabase::getNextSequenceValueImpl
private softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
PgsqlSqlUtil::PgsqlForeignConstraint
represents a PostgreSQL-specific foreign constraint
Definition: PgsqlSqlUtil.qm.dox.h:268
SqlUtil::AbstractColumn
COP_YEAR_DAY
const COP_YEAR_DAY
PgsqlSqlUtil::PgsqlColumn::getAddColumnSql
list getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table ...
PgsqlSqlUtil::PgsqlView::constructor
constructor(string n_name, string n_src, *string n_schemaname, *string n_viewowner)
creates the object from the arguments
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:853
hash
hash hash(object obj)
PgsqlSqlUtil::PgsqlTable::PgsqlCopMap
const PgsqlCopMap
column operator specializations for PostgreSQL
Definition: PgsqlSqlUtil.qm.dox.h:799
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::PgsqlTable::doSelectOrderByWithOffsetSqlUnlockedImpl
private 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...
PgsqlSqlUtil::PgsqlSequence
class for PostgreSQL sequences
Definition: PgsqlSqlUtil.qm.dox.h:478
IOP_SEQ
const IOP_SEQ
SqlUtil::AbstractDatabase
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:715
SqlUtil::AbstractPrimaryKey
PgsqlSqlUtil::PgsqlDatabase::getSchemaDescriptionOptions
private hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
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::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:546
PgsqlSqlUtil::PgsqlTable::copyImpl
private copyImpl(AbstractTable old)
db-specific copy actions
SqlUtil::AbstractUniqueConstraint
PgsqlSqlUtil::PgsqlDatabase::listFunctionsImpl
private list listFunctionsImpl()
returns a list of string function names in the database