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
176
178protected:
180public:
181
182
184protected:
186public:
187
188
190protected:
192public:
193
194};
195
198
199public:
201 constructor(string native_type, bool nullable, *hash<auto> options)
202 ;
203
204};
205
208
209public:
211 *string filegroup;
212
214 constructor(string n_name, bool n_unique, hash n_cols, *string n_filegroup)
215 ;
216
217
219 string getCreateSql(string table_name, *hash opt);
220
221
223protected:
224 bool equalImpl(AbstractIndex ix);
225public:
226
227
229 string getRenameSql(string table_name, string new_name);
230
231};
232
235
236public:
238 constructor(string n, Columns c, ForeignConstraintTarget t) ;
239
240
242 string getCreateSql(string table_name, *hash opt);
243
244
245 softlist getRenameSql(string table_name, string new_name);
246
247
249 string getCreateSql(string name, string table_name, *hash opt);
250
251};
252
255
256public:
258 constructor(string n, string n_src) ;
259
260
262 string getCreateSql(string table_name, *hash opt);
263
264
265 list getRenameSql(string table_name, string new_name);
266
267
269 string getCreateSql(string name, string table_name, *hash opt);
270
271};
272
275
276public:
279
281protected:
283public:
284
285
287 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, *int scale)
288 ;
289
290
292
299 softlist getAddColumnSql(AbstractTable t);
300
301
303
316 list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
317
318
320
330 string getRenameSql(AbstractTable t, string new_name);
331
332
334
336 string getDdlName(string name);
337
338
340protected:
341 bool equalImpl(AbstractColumn c);
342public:
343
344};
345
348
349public:
351 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs,
352 softint scale) ;
353
354};
355
358
359public:
360protected:
362 *string filegroup;
363
364public:
365
367protected:
369public:
370
371
373 constructor(*string ts);
374
375
377 *string getTablespace();
378
379
381 setTablespace(*string ts);
382
383
385 bool setIndexBase(string ix);
386
387
390
391
393 getIndexSql(reference<string> sql, string name, *hash opts);
394
395};
396
399
400public:
401protected:
404
405public:
406
408
413 constructor(string n, hash n_cols, bool e = True, *string ts) ;
414
415
417
433
434
436 string getCreateSql(string table_name, *hash opts);
437
438
439 list getRenameSql(string table_name, string new_name);
440
441
443 string getCreateSql(string name, string table_name, *hash opts);
444
445
447 bool isEnabled();
448
449};
450
453
454public:
457
458
460
464 constructor(string n, *hash c, *string ts) ;
465
466
468
484
485
487 string getCreateSql(string table_name, *hash opts);
488
489
491 softlist getRenameSql(string table_name, string new_name);
492
493};
494
497
498public:
500 constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
501
502
504 string getCreateSql(*hash opt);
505
506
508
512 softlist getRenameSql(string new_name, *hash opt);
513
514};
515
518
519public:
521 constructor(string n_name, string n_src, *string n_schemaname) ;
522
523
525 string getCreateSql(*hash opt);
526
527
529
533 softlist getRenameSql(string new_name, *hash opt);
534
535};
536
539
540public:
542 constructor(string n, string n_src) ;
543
544
546 softlist getCreateSql(string table_name, *hash opt);
547
548
550 softlist getDropSql(string table_name);
551
552
554protected:
555 bool equalImpl(AbstractFunctionBase t);
556public:
557
558
560 softlist getRenameSql(string table_name, string new_name);
561
562};
563
566
567public:
568 *string args;
569
570 constructor(string n, string n_src, *string a) ;
571
572
574 softlist getCreateSql(*hash opt);
575
576
578
580 string getDropSql(*hash opt);
581
582
584protected:
585 bool equalImpl(AbstractFunctionBase t);
586public:
587
588
590
593 softlist getRenameSql(string new_name, *hash opt);
594
595
597 setName(string new_name);
598
599};
600
603
604public:
607
609 string default_schema = "dbo";
610
612 const MssqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions;
613
614 const mssql_TempSavepoint = "qore_mssql_tmp_savepoint";
615
618
621
622
624 const MaxPrecision = 38;
625
626 constructor(AbstractDatasource nds, *hash opts) ;
627
628
630
635
636
638
643
644
645protected:
646 list<string> featuresImpl();
647public:
648
649
650protected:
651 MssqlSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
652public:
653
654
655protected:
656 *AbstractSequence getSequenceImpl(string name);
657public:
658
659
660protected:
661 *AbstractView getViewImpl(string name);
662public:
663
664
665protected:
666 MssqlFunction makeFunctionImpl(string name, string src, *hash opts);
667public:
668
669
670protected:
671 MssqlFunction makeProcedureImpl(string name, string src, *hash opts);
672public:
673
674
675protected:
676 *AbstractFunction getFunctionImpl(string name);
677public:
678
679
680protected:
681 AbstractFunction getProcedureImpl(string name);
682public:
683
684
685protected:
686 list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
687public:
688
689
690protected:
691 list getAlignSqlImpl(hash schema_hash, *hash opt);
692public:
693
694
696protected:
697 softlist<string> listTablesImpl();
698public:
699
700
702
706protected:
707 list<string> listFunctionsImpl();
708public:
709
710
712
714protected:
715 list<string> listProceduresImpl();
716public:
717
718
719protected:
720 list<string> listSequencesImpl();
721public:
722
723
724protected:
725 list<string> listViewsImpl();
726public:
727
728
730protected:
731 string getCreateSqlImpl(list l);
732public:
733
734
736 static bool isSybase(AbstractDatasource ds);
737
739 static string getCreateSql(list l);
740
742protected:
744public:
745
746
748protected:
750public:
751
752
754protected:
755 softint getNextSequenceValueImpl(string name);
756public:
757
758
760protected:
761 softint getCurrentSequenceValueImpl(string name);
762public:
763
764
766protected:
768public:
769
770
772protected:
774public:
775
776
778protected:
780public:
781
782
784protected:
785 bool rebuildIndexImpl(string name, *hash options);
786public:
787
788
790protected:
791 computeStatisticsImpl(*hash options);
792public:
793
794
796protected:
797 reclaimSpaceImpl(*hash options);
798public:
799
800
802protected:
804public:
805
806
808protected:
809 auto tryExecArgsImpl(string sql, *softlist<auto> args);
810public:
811
812
814protected:
815 auto tryExecRawImpl(string sql, *softlist<auto> args);
816public:
817
818
820 static auto tryExecArgs(AbstractDatasource ds, string sql, *softlist<auto> args);
821
823 static auto tryExecRaw(AbstractDatasource ds, string sql);
824};
825
828
829public:
832
834 bool ss_has_merge = False;
835
837 bool ss_has_sequences = False;
838
840 const MssqlTypeMap = ...;
841
842
844 const QoreTypeMap = ...;
845
846
849 SqlUtil::BLOB: "varbinary(max)",
850 "date": "datetime2",
851 };
852
855 "date": "datetime",
856 };
857
859 const MssqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions;
860
861 const MssqlColumnDescOptions = AbstractTable::ColumnDescOptions;
862
863 const MssqlIndexOptions = AbstractTable::IndexOptions;
864
865 const MssqlConstraintOptions = AbstractTable::ConstraintOptions + MssqlIndexOptions;
866
867 const MssqlTableCreationOptions = AbstractTable::TableCreationOptions + MssqlConstraintOptions;
868
869 const MssqlAlignTableOptions = AbstractTable::AlignTableOptions + MssqlTableCreationOptions;
870
873
874
877
878
880 const MssqlExpressionMap = DefaultExpressionMap + {
881 OP_SUBSTR: DefaultExpressionMap{OP_SUBSTR} + {
882 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
883 string exp0 = info.table.getExpressionArg(\info, role, args[0],
884 AbstractDataProviderTypeMap."string");
885 string exp1 = info.table.getExpressionArg(\info, role, args[1],
886 AbstractDataProviderTypeMap."int");
887 if (!exists args[2]) {
888 return sprintf("substring(%s,%s,32767)", exp0, exp1);
889 }
890 return sprintf("substring(%s,%s,%s)", exp0, exp1,
891 info.table.getExpressionArg(\info, role, args[2], AbstractDataProviderTypeMap."int"));
892 },
893 },
894 COP_PREPEND: DefaultExpressionMap{COP_PREPEND} + {
895 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
896 string exp0 = info.table.getExpressionArg(\info, role, args[0],
897 AbstractDataProviderTypeMap."string");
898 string exp1 = info.table.getExpressionArg(\info, role, args[1],
899 AbstractDataProviderTypeMap."string");
900 return sprintf("concat(%s, %s)", exp1, exp0);
901 },
902 },
903 COP_APPEND: DefaultExpressionMap{COP_APPEND} + {
904 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
905 string exp0 = info.table.getExpressionArg(\info, role, args[0],
906
907 AbstractDataProviderTypeMap."string");
908 string exp1 = info.table.getExpressionArg(\info, role, args[1],
909 AbstractDataProviderTypeMap."string");
910 return sprintf("concat(%s, %s)", exp0, exp1);
911 },
912 },
913 };
914
916 const MssqlOpMap = DefaultOpMap + {
917 OP_SUBSTR: {
918 "code": string sub (reference<hash<QueryInfo>> info, string cn, softlist arg) {
919 info.args += arg[0]; // start
920 if (!exists arg[1]) {
921 info.args += arg[2]; # text
922 return sprintf("substring(%s,%v,32767) = %v", cn); # NOTE: length arg is required
923 }
924 info.args += arg[1]; # count
925 info.args += arg[2]; # text
926 return sprintf("substring(%s,%v,%v) = %v", cn);
927 },
928 },
929 };
930
932 const MssqlCopMap = ...;
933
934
936 /* Impl. note here. There is shorter workaround for this, but it does not work with seconds
937 and with dates older than 1.1.1970. (minutes will overflow later too etc.).
938 So no usage for: dateadd(ss, datediff(ss, 0, %s), 0) for example
939 */
940 const MssqlTruncDate = ...;
941
942
944 const MssqlIopMap = ...;
945
946
948 const MssqlUopMap = ...;
949
950
951protected:
953 *string filegroup;
954
956 string schema;
957
960
962 string default_schema = "dbo";
963
964public:
965
966 constructor(AbstractDatasource nds, string nname, *hash opts) ;
967
968
971
972
975
976
978
982 code getUpsertClosure(hash<auto> row, int upsert_strategy = UpsertAuto, *hash opt);
983
984
987
988
990 string getSqlName();
991
992
994 hash<auto> getExpressionMap();
995
996
999
1000
1001protected:
1002 string getFromIntern(string from, *hash qh);
1003public:
1004
1005
1006protected:
1007 hash getTableCreationOptions();
1008public:
1009
1010
1011protected:
1012 hash getTableDescriptionHashOptions();
1013public:
1014
1015
1016protected:
1017 hash getColumnDescOptions();
1018public:
1019
1020
1021protected:
1022 hash getIndexOptions();
1023public:
1024
1025
1026protected:
1027 hash getConstraintOptions();
1028public:
1029
1030
1031protected:
1032 hash getAlignTableOptions();
1033public:
1034
1035
1037protected:
1039public:
1040
1041
1043protected:
1045public:
1046
1047
1049protected:
1051public:
1052
1053
1055protected:
1057public:
1058
1059
1060protected:
1061 bool checkExistenceImpl();
1062public:
1063
1064
1065protected:
1066 Columns describeImpl();
1067public:
1068
1069
1070protected:
1071 Columns describeSybaseImpl();
1072public:
1073
1074
1075protected:
1076 Columns describeMssqlImpl();
1077public:
1078
1079
1080protected:
1081 MssqlPrimaryKey getPrimaryKeyImpl();
1082public:
1083
1084
1085protected:
1086 MssqlPrimaryKey getPrimaryKeySybaseImpl();
1087public:
1088
1089
1090protected:
1091 MssqlPrimaryKey getPrimaryKeyMssqlImpl();
1092public:
1093
1094
1095protected:
1096 Indexes getIndexesImpl();
1097public:
1098
1099
1100protected:
1101 Indexes getIndexesSybaseImpl();
1102public:
1103
1104
1105protected:
1106 Indexes getIndexesMssqlImpl();
1107public:
1108
1109
1110protected:
1111 ForeignConstraints getForeignConstraintsImpl(*hash opts);
1112public:
1113
1114
1115protected:
1116 ForeignConstraints getForeignConstraintsSybaseImpl();
1117public:
1118
1119
1120protected:
1121 ForeignConstraints getForeignConstraintsMssqlImpl();
1122public:
1123
1124
1125protected:
1126 Constraints getConstraintsImpl();
1127public:
1128
1129
1130protected:
1131 Constraints getConstraintsSybaseImpl();
1132public:
1133
1134
1135protected:
1136 Constraints getConstraintsMssqlImpl();
1137public:
1138
1139
1140protected:
1141 Triggers getTriggersImpl();
1142public:
1143
1144
1146protected:
1147 string getCreateTableSqlImpl(*hash opt);
1148public:
1149
1150
1151protected:
1152 *list getCreateMiscSqlImpl(*hash opt, bool cache);
1153public:
1154
1155
1156protected:
1157 *list getAlignSqlImpl(AbstractTable table, *hash opt);
1158public:
1159
1160
1162protected:
1163 string getCreateSqlImpl(list l);
1164public:
1165
1166
1167protected:
1168 string getRenameSqlImpl(string new_name);
1169public:
1170
1171
1172protected:
1173 AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
1174public:
1175
1176
1177protected:
1178 AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
1179public:
1180
1181
1182protected:
1183 AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
1184public:
1185
1186
1187 private AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch,
1188 *hash opt) {
1189 ForeignConstraintTarget fct(table, new Columns(tch));
1190 return new MssqlForeignConstraint(cname, new Columns(ch), fct);
1191 }
1192
1193protected:
1194 AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
1195public:
1196
1197
1198protected:
1199 AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
1200public:
1201
1202
1203protected:
1204 AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
1205public:
1206
1207
1208protected:
1209 bool tryInsertImpl(string sql, hash<auto> row);
1210public:
1211
1212
1214
1216protected:
1217 bool isDuplicateRowErrorImpl(hash<ExceptionInfo> ex);
1218public:
1219
1220
1221protected:
1222 hash getQoreTypeMapImpl();
1223public:
1224
1225
1226protected:
1227 hash getTypeMapImpl();
1228public:
1229
1230
1232
1234protected:
1235 *string getSqlValueImpl(auto v);
1236public:
1237
1238
1240 string getColumnSqlName(string col);
1241
1242
1244 list getColumnSqlNames(softlist cols);
1245
1246
1247protected:
1248 bool emptyImpl();
1249public:
1250
1251
1253protected:
1255public:
1256
1257
1258protected:
1259 setupTableImpl(hash desc, *hash opt);
1260public:
1261
1262
1264protected:
1266public:
1267
1268
1270protected:
1272public:
1273
1274
1276protected:
1278public:
1279
1280
1282protected:
1283 doSelectLimitOnlyUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql);
1284public:
1285
1286
1288 private doSelectOrderByWithOffsetSqlUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql,
1289 list<auto> coll) {
1290 if (is_sybase);
1291
1292
1293 doSelectOrderBySqlUnlocked(info, \sql, coll);
1294
1295 sql += " offset %v rows";
1296 info.args += info.query_hash.offset.toInt();
1297
1298 if (info.query_hash.limit);
1299
1300 }
1301
1303protected:
1304 auto tryExecArgsImpl(string sql, *softlist<auto> args);
1305public:
1306
1307
1309protected:
1310 auto tryExecRawImpl(string sql, *softlist<auto> args);
1311public:
1312
1313
1315protected:
1316 copyImpl(AbstractTable old);
1317public:
1318
1319
1320protected:
1321 *hash<auto> doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
1322public:
1323
1324
1325protected:
1326 softbool tryUpdate(string sql, hash<auto> row, Columns cols, list updc);
1327public:
1328
1329
1331protected:
1332 AbstractDataProviderType getNumericTypeImpl(string native_type, bool nullable, *hash<auto> options);
1333public:
1334
1335
1337
1341protected:
1342 AbstractSavepointHelper getSavepointHelperImpl(*string savepoint);
1343public:
1344
1345};
1346};
represents a Mssql-specific check constraint
Definition: MssqlSqlUtilBase.qm.dox.h:254
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:274
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:278
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:602
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:612
string default_schema
default schema for user
Definition: MssqlSqlUtilBase.qm.dox.h:609
const MssqlReservedWords
hash of reserved words
Definition: MssqlSqlUtilBase.qm.dox.h:620
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:617
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:606
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:624
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:234
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:565
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:207
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:211
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:197
constructor(string native_type, bool nullable, *hash< auto > options)
creates the object
represents a Mssql-specific numeric column
Definition: MssqlSqlUtilBase.qm.dox.h:347
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:452
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:496
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:827
hash getSelectOptions()
returns the select options for this driver
const QoreTypeMap
maps qore type names to DB type names
Definition: MssqlSqlUtilBase.qm.dox.h:844
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:940
hash getColumnOperatorMapImpl()
returns the column operator map for this object
const MssqlTableDescriptionHashOptions
equal to SqlUtil::AbstractTable::TableDescriptionHashOptions
Definition: MssqlSqlUtilBase.qm.dox.h:859
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:959
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:831
const MssqlExpressionMap
Mssql Expression map.
Definition: MssqlSqlUtilBase.qm.dox.h:880
const MssqlCopMap
column operator specializations for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:932
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:953
*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:854
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:834
const MssqlUopMap
a hash of default update operator definitions for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:948
const MssqlOpMap
where operator specializations for Mssql
Definition: MssqlSqlUtilBase.qm.dox.h:916
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
private 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
Definition: MssqlSqlUtilBase.qm.dox.h:1288
string schema
schema name for the table
Definition: MssqlSqlUtilBase.qm.dox.h:956
hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
const MsSqlServerTableHints
query hints
Definition: MssqlSqlUtilBase.qm.dox.h:876
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:944
const MsQoreTypeMap
maps qore type names to MS SQL Server type names
Definition: MssqlSqlUtilBase.qm.dox.h:848
AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
const MssqlSelectOptions
select options supported by MssqlSqlUtilBase
Definition: MssqlSqlUtilBase.qm.dox.h:872
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:962
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,...
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:837
const MssqlTypeMap
maps postgresql type names to type configurations
Definition: MssqlSqlUtilBase.qm.dox.h:840
represents a Mssql-specific trigger
Definition: MssqlSqlUtilBase.qm.dox.h:538
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:357
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:362
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:398
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:403
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:517
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