Qore MssqlSqlUtilBase Module Reference 1.0
Loading...
Searching...
No Matches
MssqlSqlUtilBase.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* MssqlSqlUtilBase.qm Copyright (C) 2015 - 2023 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// requires the Util module
30
31// don't use "$" signs for variables and class members, assume local variable scope
32
33// require type definitions everywhere
34
35// enable all warnings
36
37
154 MssqlTable get_table(AbstractDatasource nds, string nname, *hash<auto> opts);
155
156
158 MssqlDatabase get_database(AbstractDatasource nds, *hash<auto> opts);
159
160
161parse_schema_name(string nname, reference<string> schema, reference<string> name, string default_schema = 'dbo');
162
163
165class MssqlSavepointHelper : public AbstractSavepointHelper {
166
167public:
169
173 constructor(AbstractDatasource ds, *string savepoint = 'x' + get_random_string(31)) ;
174
175
177protected:
179public:
180
181
183protected:
185public:
186
187
189protected:
191public:
192
193};
194
197
198public:
200 constructor(string native_type, bool nullable, *hash<auto> options) ;
201
202};
203
206
207public:
209 *string filegroup;
210
212 constructor(string n_name, bool n_unique, hash n_cols, *string n_filegroup) ;
213
214
216 string getCreateSql(string table_name, *hash opt);
217
218
220protected:
221 bool equalImpl(AbstractIndex ix);
222public:
223
224
226 string getRenameSql(string table_name, string new_name);
227
228};
229
232
233public:
235 constructor(string n, Columns c, ForeignConstraintTarget t) ;
236
237
239 string getCreateSql(string table_name, *hash opt);
240
241
242 softlist getRenameSql(string table_name, string new_name);
243
244
246 string getCreateSql(string name, string table_name, *hash opt);
247
248};
249
252
253public:
255 constructor(string n, string n_src) ;
256
257
259 string getCreateSql(string table_name, *hash opt);
260
261
262 list getRenameSql(string table_name, string new_name);
263
264
266 string getCreateSql(string name, string table_name, *hash opt);
267
268};
269
272
273public:
276
278protected:
280public:
281
282
284 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, *int scale) ;
285
286
288
295 softlist getAddColumnSql(AbstractTable t);
296
297
299
312 list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
313
314
316
326 string getRenameSql(AbstractTable t, string new_name);
327
328
330
332 string getDdlName(string name);
333
334
336protected:
337 bool equalImpl(AbstractColumn c);
338public:
339
340};
341
344
345public:
347 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint scale) ;
348
349};
350
353
354public:
355protected:
357 *string filegroup;
358
359public:
360
362protected:
364public:
365
366
368 constructor(*string ts);
369
370
372 *string getTablespace();
373
374
376 setTablespace(*string ts);
377
378
380 bool setIndexBase(string ix);
381
382
385
386
388 getIndexSql(reference<string> sql, string name, *hash opts);
389
390};
391
394
395public:
396protected:
399
400public:
401
403
408 constructor(string n, hash n_cols, bool e = True, *string ts) ;
409
410
412
428
429
431 string getCreateSql(string table_name, *hash opts);
432
433
434 list getRenameSql(string table_name, string new_name);
435
436
438 string getCreateSql(string name, string table_name, *hash opts);
439
440
442 bool isEnabled();
443
444};
445
448
449public:
452
453
455
459 constructor(string n, *hash c, *string ts) ;
460
461
463
479
480
482 string getCreateSql(string table_name, *hash opts);
483
484
486 softlist getRenameSql(string table_name, string new_name);
487
488};
489
492
493public:
495 constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
496
497
499 string getCreateSql(*hash opt);
500
501
503
507 softlist getRenameSql(string new_name, *hash opt);
508
509};
510
513
514public:
516 constructor(string n_name, string n_src, *string n_schemaname) ;
517
518
520 string getCreateSql(*hash opt);
521
522
524
528 softlist getRenameSql(string new_name, *hash opt);
529
530};
531
534
535public:
537 constructor(string n, string n_src) ;
538
539
541 softlist getCreateSql(string table_name, *hash opt);
542
543
545 softlist getDropSql(string table_name);
546
547
549protected:
550 bool equalImpl(AbstractFunctionBase t);
551public:
552
553
555 softlist getRenameSql(string table_name, string new_name);
556
557};
558
561
562public:
563 *string args;
564
565 constructor(string n, string n_src, *string a) ;
566
567
569 softlist getCreateSql(*hash opt);
570
571
573
575 string getDropSql(*hash opt);
576
577
579protected:
580 bool equalImpl(AbstractFunctionBase t);
581public:
582
583
585
588 softlist getRenameSql(string new_name, *hash opt);
589
590
592 setName(string new_name);
593
594};
595
598
599public:
602
604 string default_schema = "dbo";
605
607 const MssqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions;
608
609 const mssql_TempSavepoint = "qore_mssql_tmp_savepoint";
610
613
616
617
619 const MaxPrecision = 38;
620
621 constructor(AbstractDatasource nds, *hash opts) ;
622
623
625
630
631
633
638
639
640protected:
641 list<string> featuresImpl();
642public:
643
644
645protected:
646 MssqlSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
647public:
648
649
650protected:
651 *AbstractSequence getSequenceImpl(string name);
652public:
653
654
655protected:
656 *AbstractView getViewImpl(string name);
657public:
658
659
660protected:
661 MssqlFunction makeFunctionImpl(string name, string src, *hash opts);
662public:
663
664
665protected:
666 MssqlFunction makeProcedureImpl(string name, string src, *hash opts);
667public:
668
669
670protected:
671 *AbstractFunction getFunctionImpl(string name);
672public:
673
674
675protected:
676 AbstractFunction getProcedureImpl(string name);
677public:
678
679
680protected:
681 list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
682public:
683
684
685protected:
686 list getAlignSqlImpl(hash schema_hash, *hash opt);
687public:
688
689
691protected:
692 softlist<string> listTablesImpl();
693public:
694
695
697
701protected:
702 list<string> listFunctionsImpl();
703public:
704
705
707
709protected:
710 list<string> listProceduresImpl();
711public:
712
713
714protected:
715 list<string> listSequencesImpl();
716public:
717
718
719protected:
720 list<string> listViewsImpl();
721public:
722
723
725protected:
726 string getCreateSqlImpl(list l);
727public:
728
729
731 static bool isSybase(AbstractDatasource ds);
732
734 static string getCreateSql(list l);
735
737protected:
739public:
740
741
743protected:
745public:
746
747
749protected:
750 softint getNextSequenceValueImpl(string name);
751public:
752
753
755protected:
756 softint getCurrentSequenceValueImpl(string name);
757public:
758
759
761protected:
763public:
764
765
767protected:
769public:
770
771
773protected:
775public:
776
777
779protected:
780 bool rebuildIndexImpl(string name, *hash options);
781public:
782
783
785protected:
786 computeStatisticsImpl(*hash options);
787public:
788
789
791protected:
792 reclaimSpaceImpl(*hash options);
793public:
794
795
797protected:
799public:
800
801
803protected:
804 auto tryExecArgsImpl(string sql, *softlist<auto> args);
805public:
806
807
809protected:
810 auto tryExecRawImpl(string sql, *softlist<auto> args);
811public:
812
813
815 static auto tryExecArgs(AbstractDatasource ds, string sql, *softlist<auto> args);
816
818 static auto tryExecRaw(AbstractDatasource ds, string sql);
819};
820
823
824public:
827
829 bool ss_has_merge = False;
830
832 bool ss_has_sequences = False;
833
835 const MssqlTypeMap = ...;
836
837
839 const QoreTypeMap = ...;
840
841
844 SqlUtil::BLOB: "varbinary(max)",
845 "date": "datetime2",
846 };
847
850 "date": "datetime",
851 };
852
854 const MssqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions;
855
856 const MssqlColumnDescOptions = AbstractTable::ColumnDescOptions;
857
858 const MssqlIndexOptions = AbstractTable::IndexOptions;
859
860 const MssqlConstraintOptions = AbstractTable::ConstraintOptions + MssqlIndexOptions;
861
862 const MssqlTableCreationOptions = AbstractTable::TableCreationOptions + MssqlConstraintOptions;
863
864 const MssqlAlignTableOptions = AbstractTable::AlignTableOptions + MssqlTableCreationOptions;
865
868
869
872
873
875 const MssqlExpressionMap = DefaultExpressionMap + {
876 OP_SUBSTR: DefaultExpressionMap{OP_SUBSTR} + {
877 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
878 string exp0 = info.table.getExpressionArg(\info, role, args[0],
879 AbstractDataProviderTypeMap."string");
880 string exp1 = info.table.getExpressionArg(\info, role, args[1],
881 AbstractDataProviderTypeMap."int");
882 if (!exists args[2]) {
883 return sprintf("substring(%s,%s,32767)", exp0, exp1);
884 }
885 return sprintf("substring(%s,%s,%s)", exp0, exp1,
886 info.table.getExpressionArg(\info, role, args[2], AbstractDataProviderTypeMap."int"));
887 },
888 },
889 COP_PREPEND: DefaultExpressionMap{COP_PREPEND} + {
890 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
891 string exp0 = info.table.getExpressionArg(\info, role, args[0],
892 AbstractDataProviderTypeMap."string");
893 string exp1 = info.table.getExpressionArg(\info, role, args[1],
894 AbstractDataProviderTypeMap."string");
895 return sprintf("concat(%s, %s)", exp1, exp0);
896 },
897 },
898 COP_APPEND: DefaultExpressionMap{COP_APPEND} + {
899 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
900 string exp0 = info.table.getExpressionArg(\info, role, args[0],
901
902 AbstractDataProviderTypeMap."string");
903 string exp1 = info.table.getExpressionArg(\info, role, args[1],
904 AbstractDataProviderTypeMap."string");
905 return sprintf("concat(%s, %s)", exp0, exp1);
906 },
907 },
908 };
909
911 const MssqlOpMap = DefaultOpMap + {
912 OP_SUBSTR: {
913 "code": string sub (reference<hash<QueryInfo>> info, string cn, softlist arg) {
914 info.args += arg[0]; // start
915 if (!exists arg[1]) {
916 info.args += arg[2]; # text
917 return sprintf("substring(%s,%v,32767) = %v", cn); # NOTE: length arg is required
918 }
919 info.args += arg[1]; # count
920 info.args += arg[2]; # text
921 return sprintf("substring(%s,%v,%v) = %v", cn);
922 },
923 },
924 };
925
927 const MssqlCopMap = ...;
928
929
931 /* Impl. note here. There is shorter workaround for this, but it does not work with seconds
932 and with dates older than 1.1.1970. (minutes will overflow later too etc.).
933 So no usage for: dateadd(ss, datediff(ss, 0, %s), 0) for example
934 */
935 const MssqlTruncDate = ...;
936
937
939 const MssqlIopMap = ...;
940
941
943 const MssqlUopMap = ...;
944
945
946protected:
948 *string filegroup;
949
951 string schema;
952
955
957 string default_schema = "dbo";
958
959public:
960
961 constructor(AbstractDatasource nds, string nname, *hash opts) ;
962
963
966
967
970
971
973
977 code getUpsertClosure(hash<auto> row, int upsert_strategy = UpsertAuto, *hash opt);
978
979
982
983
985 string getSqlName();
986
987
989 hash<auto> getExpressionMap();
990
991
994
995
996protected:
997 string getFromIntern(string from, *hash qh);
998public:
999
1000
1001protected:
1002 hash getTableCreationOptions();
1003public:
1004
1005
1006protected:
1007 hash getTableDescriptionHashOptions();
1008public:
1009
1010
1011protected:
1012 hash getColumnDescOptions();
1013public:
1014
1015
1016protected:
1017 hash getIndexOptions();
1018public:
1019
1020
1021protected:
1022 hash getConstraintOptions();
1023public:
1024
1025
1026protected:
1027 hash getAlignTableOptions();
1028public:
1029
1030
1032protected:
1034public:
1035
1036
1038protected:
1040public:
1041
1042
1044protected:
1046public:
1047
1048
1050protected:
1052public:
1053
1054
1055protected:
1056 bool checkExistenceImpl();
1057public:
1058
1059
1060protected:
1061 Columns describeImpl();
1062public:
1063
1064
1065protected:
1066 Columns describeSybaseImpl();
1067public:
1068
1069
1070protected:
1071 Columns describeMssqlImpl();
1072public:
1073
1074
1075protected:
1076 MssqlPrimaryKey getPrimaryKeyImpl();
1077public:
1078
1079
1080protected:
1081 MssqlPrimaryKey getPrimaryKeySybaseImpl();
1082public:
1083
1084
1085protected:
1086 MssqlPrimaryKey getPrimaryKeyMssqlImpl();
1087public:
1088
1089
1090protected:
1091 Indexes getIndexesImpl();
1092public:
1093
1094
1095protected:
1096 Indexes getIndexesSybaseImpl();
1097public:
1098
1099
1100protected:
1101 Indexes getIndexesMssqlImpl();
1102public:
1103
1104
1105protected:
1106 ForeignConstraints getForeignConstraintsImpl(*hash opts);
1107public:
1108
1109
1110protected:
1111 ForeignConstraints getForeignConstraintsSybaseImpl();
1112public:
1113
1114
1115protected:
1116 ForeignConstraints getForeignConstraintsMssqlImpl();
1117public:
1118
1119
1120protected:
1121 Constraints getConstraintsImpl();
1122public:
1123
1124
1125protected:
1126 Constraints getConstraintsSybaseImpl();
1127public:
1128
1129
1130protected:
1131 Constraints getConstraintsMssqlImpl();
1132public:
1133
1134
1135protected:
1136 Triggers getTriggersImpl();
1137public:
1138
1139
1141protected:
1142 string getCreateTableSqlImpl(*hash opt);
1143public:
1144
1145
1146protected:
1147 *list getCreateMiscSqlImpl(*hash opt, bool cache);
1148public:
1149
1150
1151protected:
1152 *list getAlignSqlImpl(AbstractTable table, *hash opt);
1153public:
1154
1155
1157protected:
1158 string getCreateSqlImpl(list l);
1159public:
1160
1161
1162protected:
1163 string getRenameSqlImpl(string new_name);
1164public:
1165
1166
1167protected:
1168 AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
1169public:
1170
1171
1172protected:
1173 AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
1174public:
1175
1176
1177protected:
1178 AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
1179public:
1180
1181
1182protected:
1183 AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch, *hash opt);
1184public:
1185
1186
1187protected:
1188 AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
1189public:
1190
1191
1192protected:
1193 AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
1194public:
1195
1196
1197protected:
1198 AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
1199public:
1200
1201
1202protected:
1203 bool tryInsertImpl(string sql, hash<auto> row);
1204public:
1205
1206
1208
1210protected:
1211 bool isDuplicateRowErrorImpl(hash<ExceptionInfo> ex);
1212public:
1213
1214
1215protected:
1216 hash getQoreTypeMapImpl();
1217public:
1218
1219
1220protected:
1221 hash getTypeMapImpl();
1222public:
1223
1224
1226
1228protected:
1229 *string getSqlValueImpl(auto v);
1230public:
1231
1232
1234 string getColumnSqlName(string col);
1235
1236
1238 list getColumnSqlNames(softlist cols);
1239
1240
1241protected:
1242 bool emptyImpl();
1243public:
1244
1245
1247protected:
1249public:
1250
1251
1252protected:
1253 setupTableImpl(hash desc, *hash opt);
1254public:
1255
1256
1258protected:
1260public:
1261
1262
1264protected:
1266public:
1267
1268
1270protected:
1272public:
1273
1274
1276protected:
1277 doSelectLimitOnlyUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql);
1278public:
1279
1280
1282protected:
1283 doSelectOrderByWithOffsetSqlUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql, list<auto> coll);
1284public:
1285
1286
1288protected:
1289 auto tryExecArgsImpl(string sql, *softlist<auto> args);
1290public:
1291
1292
1294protected:
1295 auto tryExecRawImpl(string sql, *softlist<auto> args);
1296public:
1297
1298
1300protected:
1301 copyImpl(AbstractTable old);
1302public:
1303
1304
1305protected:
1306 *hash<auto> doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
1307public:
1308
1309
1310protected:
1311 softbool tryUpdate(string sql, hash<auto> row, Columns cols, list updc);
1312public:
1313
1314
1316protected:
1317 AbstractDataProviderType getNumericTypeImpl(string native_type, bool nullable, *hash<auto> options);
1318public:
1319
1320
1322
1326protected:
1327 AbstractSavepointHelper getSavepointHelperImpl(*string savepoint);
1328public:
1329
1330};
1331};
represents a Mssql-specific check constraint
Definition: MssqlSqlUtilBase.qm.dox.h:251
constructor(string n, string n_src)
creates the constraint from the supplied arguments
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in 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 Mssql-specific column
Definition: MssqlSqlUtilBase.qm.dox.h:271
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
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...
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
softlist getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table
int byte_size
byte size of the column
Definition: MssqlSqlUtilBase.qm.dox.h:275
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
constructor()
empty constructor for subclasses
provides the Mssql-specific implementation of the AbstractDatabase interface
Definition: MssqlSqlUtilBase.qm.dox.h:597
bool supportsTypesImpl()
returns True if the database supports named types
softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
int getPhysicalSizeImpl()
SqlUtil::AbstractDatabase::getPhysicalSize()
list< string > listFunctionsImpl()
returns a list of string function names in the database
bool requiresScale()
Returns True if the driver requires a scale to support decimal values in numeric or decimal columns.
static string getCreateSql(list l)
returns a string that can be used to create the schema in the database
const MssqlSchemaDescriptionOptions
Mssql-specific schema description keys.
Definition: MssqlSqlUtilBase.qm.dox.h:607
string default_schema
default schema for user
Definition: MssqlSqlUtilBase.qm.dox.h:604
const MssqlReservedWords
hash of reserved words
Definition: MssqlSqlUtilBase.qm.dox.h:615
computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics()
int getMaximumPrecision()
Returns the maximum precision for numeric or decimal columns.
softlist< string > listTablesImpl()
returns a list of string table names in the database
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
reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
bool supportsSequencesImpl()
returns True if the database supports sequences
bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
const MssqlReclaimSpaceOptions
Options for reclaimSpace()
Definition: MssqlSqlUtilBase.qm.dox.h:612
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 is_sybase
sybase flag
Definition: MssqlSqlUtilBase.qm.dox.h:601
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
list< string > listProceduresImpl()
since Mssql only supports functions, this method is identical to listFunctionsImpl()
const MaxPrecision
Maximum precision.
Definition: MssqlSqlUtilBase.qm.dox.h:619
hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
static bool isSybase(AbstractDatasource ds)
returns True if the DB is a Sybase database
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
bool supportsPackagesImpl()
returns True if the database supports packages
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
represents a Mssql-specific foreign constraint
Definition: MssqlSqlUtilBase.qm.dox.h:231
constructor(string n, Columns c, ForeignConstraintTarget t)
creates the constraint from the supplied arguments
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in 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 Mssql-specific function
Definition: MssqlSqlUtilBase.qm.dox.h:560
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the function in the database
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
setName(string new_name)
sets the new name of the function
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
string getDropSql(*hash opt)
returns a string that can be used to drop the function from the database
represents a Mssql-specific index
Definition: MssqlSqlUtilBase.qm.dox.h:205
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
*string filegroup
the tablespace (filegroup) name of the index
Definition: MssqlSqlUtilBase.qm.dox.h:209
constructor(string n_name, bool n_unique, hash n_cols, *string n_filegroup)
creates the object from the arguments
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
the data type for Mssql DECIMAL columns
Definition: MssqlSqlUtilBase.qm.dox.h:196
constructor(string native_type, bool nullable, *hash< auto > options)
creates the object
represents a Mssql-specific numeric column
Definition: MssqlSqlUtilBase.qm.dox.h:343
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 Mssql-specific primary key constraint
Definition: MssqlSqlUtilBase.qm.dox.h:447
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
constructor(string n, *hash c, *string ts)
creates the object with the given attributes
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the constraint
MssqlColumn memberGate(string k)
returns the MssqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
constructor()
creates an empty primary key object
Mssql savepoint helper.
Definition: MssqlSqlUtilBase.qm.dox.h:165
deleteSavepointImpl()
Deletes the savepoint.
createSavepointImpl()
Creates the savepoint.
constructor(AbstractDatasource ds, *string savepoint='x'+get_random_string(31))
Creates the object.
rollbackImpl()
Rolls back to the savepoint.
class for Mssql sequences
Definition: MssqlSqlUtilBase.qm.dox.h:491
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 Mssql-specific implementation of the SqlUtil::AbstractTable interface
Definition: MssqlSqlUtilBase.qm.dox.h:822
hash getSelectOptions()
returns the select options for this driver
const QoreTypeMap
maps qore type names to DB type names
Definition: MssqlSqlUtilBase.qm.dox.h:839
hash< auto > getWhereOperatorMap()
returns the "where" operator map for Mssql
bool supportsTablespacesImpl()
returns True if the database support tablespaces
copyImpl(AbstractTable old)
db-specific copy actions
const MssqlTruncDate
Map SqlUtil::cop_trunc_date() constants to Mssql internal masks.
Definition: MssqlSqlUtilBase.qm.dox.h:935
hash getColumnOperatorMapImpl()
returns the column operator map for this object
const MssqlTableDescriptionHashOptions
equal to SqlUtil::AbstractTable::TableDescriptionHashOptions
Definition: MssqlSqlUtilBase.qm.dox.h:854
list getColumnSqlNames(softlist cols)
returns a list of column names for use in SQL strings; subclasses can process the argument list in ca...
*string getTablespaceName()
returns the data filegroup name for the table or NOTHING if none is known
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
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: MssqlSqlUtilBase.qm.dox.h:954
bool hasArrayBind()
returns False because the Mssql driver does not support array binds / bulk DML operations
bool is_sybase
sybase flag
Definition: MssqlSqlUtilBase.qm.dox.h:826
const MssqlExpressionMap
Mssql Expression map.
Definition: MssqlSqlUtilBase.qm.dox.h:875
const MssqlCopMap
column operator specializations for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:927
code getUpsertClosure(hash< auto > row, int upsert_strategy=UpsertAuto, *hash opt)
returns a closure for performing upserts
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
doSelectLimitOnlyUnlockedImpl(reference< hash< QueryInfo > > info, reference< string > sql)
processes a string for use in SQL select statements with "limit" but no "orderby" or "offset"
*string filegroup
filegroup name for the table, if known
Definition: MssqlSqlUtilBase.qm.dox.h:948
*string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument
const SybaseQoreTypeMap
maps qore type names to Sybase/SAP type names
Definition: MssqlSqlUtilBase.qm.dox.h:849
bool isDuplicateRowErrorImpl(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
string getCreateTableSqlImpl(*hash opt)
returns a string that can be used to create the table in the database
bool ss_has_merge
"has merge" flag for SQL server
Definition: MssqlSqlUtilBase.qm.dox.h:829
const MssqlUopMap
a hash of default update operator definitions for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:943
const MssqlOpMap
where operator specializations for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:911
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 schema
schema name for the table
Definition: MssqlSqlUtilBase.qm.dox.h:951
hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
const MsSqlServerTableHints
query hints
Definition: MssqlSqlUtilBase.qm.dox.h:871
clearImpl()
clears Mssql-specific table information
hash< auto > getExpressionMap()
Returns the expression map for Mssql.
const MssqlIopMap
a hash of default value operator descriptions for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:939
const MsQoreTypeMap
maps qore type names to MS SQL Server type names
Definition: MssqlSqlUtilBase.qm.dox.h:843
AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
const MssqlSelectOptions
select options supported by MssqlSqlUtilBase
Definition: MssqlSqlUtilBase.qm.dox.h:867
string getCreateSqlImpl(list l)
returns a string that can be used to create the table in the database
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...
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
string getSchemaName()
returns the schema name
string default_schema
the default schema for the user
Definition: MssqlSqlUtilBase.qm.dox.h:957
hash getInsertOperatorMap()
returns the insert operator map for this object
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema,...
doSelectOrderByWithOffsetSqlUnlockedImpl(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
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint with a unique index
bool ss_has_sequences
"has sequences" flag for SQL server
Definition: MssqlSqlUtilBase.qm.dox.h:832
const MssqlTypeMap
maps postgresql type names to type configurations
Definition: MssqlSqlUtilBase.qm.dox.h:835
represents a Mssql-specific trigger
Definition: MssqlSqlUtilBase.qm.dox.h:533
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
softlist 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 getDropSql(string table_name)
returns a string that can be used to drop the trigger from the database
common base class for unique constraints
Definition: MssqlSqlUtilBase.qm.dox.h:352
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 filegroup
any filegroup for the unique key index
Definition: MssqlSqlUtilBase.qm.dox.h:357
constructor(*string ts)
creates the constraint with an optional filegroup name
constructor()
empty constructor for subclasses
setTablespace(*string ts)
sets or clears the filegroup name
bool setIndexBase(string ix)
sets the supporting index name
*string getTablespace()
returns the filegroup name used for this constraint, if known
class modeling a unique constraint
Definition: MssqlSqlUtilBase.qm.dox.h:393
bool isEnabled()
returns True if the constraint is enabled, False if not
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: MssqlSqlUtilBase.qm.dox.h:398
string getCreateSql(string name, string table_name, *hash opts)
returns a string that can be used to rename the constraint
constructor(string n, hash n_cols, bool e=True, *string ts)
creates the object with the given attributes
MssqlColumn memberGate(string k)
returns the MssqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
represents a Mssql view
Definition: MssqlSqlUtilBase.qm.dox.h:512
constructor(string n_name, string n_src, *string n_schemaname)
creates the object from the arguments
string getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the view in the database
transient AbstractDatasource ds
cache(*hash< auto > opts)
const BLOB
the MssqlSqlUtilBase namespace contains all the objects in the MssqlSqlUtilBase module
Definition: MssqlSqlUtilBase.qm.dox.h:152
MssqlDatabase get_database(AbstractDatasource nds, *hash< auto > opts)
returns a MssqlDatabase object corresponding to the arguments
MssqlTable get_table(AbstractDatasource nds, string nname, *hash< auto > opts)
returns a MssqlTable object corresponding to the arguments