Qore FreetdsSqlUtil Module Reference 1.5
Loading...
Searching...
No Matches
FreetdsSqlUtil.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* FreetdsSqlUtil.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
38// version history is included below in the docs
39
201namespace FreetdsSqlUtil {
203 FreetdsTable get_table(AbstractDatasource nds, string nname, *hash<auto> opts);
204
205
207 FreetdsDatabase get_database(AbstractDatasource nds, *hash<auto> opts);
208
209
210 parse_schema_name(string nname, reference<string> schema, reference<string> name, string default_schema = 'dbo');
211
212
214class FreetdsSavepointHelper : public AbstractSavepointHelper {
215
216public:
218
222 constructor(AbstractDatasource ds, *string savepoint = 'x' + get_random_string(31))
223 ;
224
225
227protected:
229public:
230
231
233protected:
235public:
236
237
239protected:
241public:
242
243 };
244
247
248public:
250 constructor(string native_type, bool nullable, *hash<auto> options)
251 ;
252
253 };
254
257
258public:
260 *string filegroup;
261
263 constructor(string n_name, bool n_unique, hash n_cols, *string n_filegroup)
264 ;
265
266
268 string getCreateSql(string table_name, *hash opt);
269
270
272protected:
273 bool equalImpl(AbstractIndex ix);
274public:
275
276
278 string getRenameSql(string table_name, string new_name);
279
280 };
281
284
285public:
287 constructor(string n, Columns c, ForeignConstraintTarget t) ;
288
289
291 string getCreateSql(string table_name, *hash opt);
292
293
294 softlist getRenameSql(string table_name, string new_name);
295
296
298 string getCreateSql(string name, string table_name, *hash opt);
299
300 };
301
304
305public:
307 constructor(string n, string n_src) ;
308
309
311 string getCreateSql(string table_name, *hash opt);
312
313
314 list getRenameSql(string table_name, string new_name);
315
316
318 string getCreateSql(string name, string table_name, *hash opt);
319
320 };
321
324
325public:
328
330protected:
332public:
333
334
336 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, *int scale)
337 ;
338
339
341
348 softlist getAddColumnSql(AbstractTable t);
349
350
352
365 list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt);
366
367
369
379 string getRenameSql(AbstractTable t, string new_name);
380
381
383
385 string getDdlName(string name);
386
387
389protected:
390 bool equalImpl(AbstractColumn c);
391public:
392
393 };
394
397
398public:
400 constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs,
401 softint scale) ;
402
403 };
404
407
408public:
409protected:
411 *string filegroup;
412
413public:
414
416protected:
418public:
419
420
422 constructor(*string ts);
423
424
426 *string getTablespace();
427
428
430 setTablespace(*string ts);
431
432
434 bool setIndexBase(string ix);
435
436
439
440
442 getIndexSql(reference<string> sql, string name, *hash opts);
443
444 };
445
448
449public:
450protected:
453
454public:
455
457
462 constructor(string n, hash n_cols, bool e = True, *string ts) ;
463
464
466
482
483
485 string getCreateSql(string table_name, *hash opts);
486
487
488 list getRenameSql(string table_name, string new_name);
489
490
492 string getCreateSql(string name, string table_name, *hash opts);
493
494
496 bool isEnabled();
497
498 };
499
502
503public:
506
507
509
513 constructor(string n, *hash c, *string ts) ;
514
515
517
533
534
536 string getCreateSql(string table_name, *hash opts);
537
538
540 softlist getRenameSql(string table_name, string new_name);
541
542 };
543
546
547public:
549 constructor(string n_name, number n_start = 1, number n_increment = 1, *softnumber n_end) ;
550
551
553 string getCreateSql(*hash opt);
554
555
557
561 softlist getRenameSql(string new_name, *hash opt);
562
563 };
564
567
568public:
570 constructor(string n_name, string n_src, *string n_schemaname) ;
571
572
574 string getCreateSql(*hash opt);
575
576
578
582 softlist getRenameSql(string new_name, *hash opt);
583
584 };
585
588
589public:
591 constructor(string n, string n_src) ;
592
593
595 softlist getCreateSql(string table_name, *hash opt);
596
597
599 softlist getDropSql(string table_name);
600
601
603protected:
604 bool equalImpl(AbstractFunctionBase t);
605public:
606
607
609 softlist getRenameSql(string table_name, string new_name);
610
611 };
612
615
616public:
617 *string args;
618
619 constructor(string n, string n_src, *string a) ;
620
621
623 softlist getCreateSql(*hash opt);
624
625
627
629 string getDropSql(*hash opt);
630
631
633protected:
634 bool equalImpl(AbstractFunctionBase t);
635public:
636
637
639
642 softlist getRenameSql(string new_name, *hash opt);
643
644
646 setName(string new_name);
647
648 };
649
652
653public:
656
658 string default_schema = "dbo";
659
661 const FreetdsSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions;
662
663 const FreeTDS_TempSavepoint = "qore_freetds_tmp_savepoint";
664
667
670
671
673 const MaxPrecision = 38;
674
675 constructor(AbstractDatasource nds, *hash opts) ;
676
677
679
684
685
687
692
693
694protected:
695 list<string> featuresImpl();
696public:
697
698
699protected:
700 FreetdsSequence makeSequenceImpl(string name, number start = 1, number increment = 1, *softnumber end, *hash opts);
701public:
702
703
704protected:
705 *AbstractSequence getSequenceImpl(string name);
706public:
707
708
709protected:
710 *AbstractView getViewImpl(string name);
711public:
712
713
714protected:
715 FreetdsFunction makeFunctionImpl(string name, string src, *hash opts);
716public:
717
718
719protected:
720 FreetdsFunction makeProcedureImpl(string name, string src, *hash opts);
721public:
722
723
724protected:
725 *AbstractFunction getFunctionImpl(string name);
726public:
727
728
729protected:
730 AbstractFunction getProcedureImpl(string name);
731public:
732
733
734protected:
735 list getDropSchemaSqlImpl(hash schema_hash, *hash opt);
736public:
737
738
739protected:
740 list getAlignSqlImpl(hash schema_hash, *hash opt);
741public:
742
743
745protected:
746 softlist<string> listTablesImpl();
747public:
748
749
751
755protected:
756 list<string> listFunctionsImpl();
757public:
758
759
761
763protected:
764 list<string> listProceduresImpl();
765public:
766
767
768protected:
769 list<string> listSequencesImpl();
770public:
771
772
773protected:
774 list<string> listViewsImpl();
775public:
776
777
779protected:
780 string getCreateSqlImpl(list l);
781public:
782
783
785 static bool isSybase(AbstractDatasource ds);
786
788 static string getCreateSql(list l);
789
791protected:
793public:
794
795
797protected:
799public:
800
801
803protected:
804 softint getNextSequenceValueImpl(string name);
805public:
806
807
809protected:
810 softint getCurrentSequenceValueImpl(string name);
811public:
812
813
815protected:
817public:
818
819
821protected:
823public:
824
825
827protected:
829public:
830
831
833protected:
834 bool rebuildIndexImpl(string name, *hash options);
835public:
836
837
839protected:
840 computeStatisticsImpl(*hash options);
841public:
842
843
845protected:
846 reclaimSpaceImpl(*hash options);
847public:
848
849
851protected:
853public:
854
855
857protected:
858 auto tryExecArgsImpl(string sql, *softlist<auto> args);
859public:
860
861
863protected:
864 auto tryExecRawImpl(string sql, *softlist<auto> args);
865public:
866
867
869 static auto tryExecArgs(AbstractDatasource ds, string sql, *softlist<auto> args);
870
872 static auto tryExecRaw(AbstractDatasource ds, string sql);
873 };
874
877
878public:
881
883 bool ss_has_merge = False;
884
886 bool ss_has_sequences = False;
887
889 const FreetdsTypeMap = ...;
890
891
893 const QoreTypeMap = ...;
894
895
898 SqlUtil::BLOB: "varbinary(max)",
899 "date": "datetime2",
900 };
901
904 "date": "datetime",
905 };
906
908 const FreetdsTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions;
909
910 const FreetdsColumnDescOptions = AbstractTable::ColumnDescOptions;
911
912 const FreetdsIndexOptions = AbstractTable::IndexOptions;
913
914 const FreetdsConstraintOptions = AbstractTable::ConstraintOptions + FreetdsIndexOptions;
915
916 const FreetdsTableCreationOptions = AbstractTable::TableCreationOptions + FreetdsConstraintOptions;
917
918 const FreetdsAlignTableOptions = AbstractTable::AlignTableOptions + FreetdsTableCreationOptions;
919
922
923
926
927
929 const FreetdsExpressionMap = DefaultExpressionMap + {
930 OP_SUBSTR: DefaultExpressionMap{OP_SUBSTR} + {
931 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
932 string exp0 = info.table.getExpressionArg(\info, role, args[0],
933 AbstractDataProviderTypeMap."string");
934 string exp1 = info.table.getExpressionArg(\info, role, args[1],
935 AbstractDataProviderTypeMap."int");
936 if (!exists args[2]) {
937 return sprintf("substring(%s,%s,32767)", exp0, exp1);
938 }
939 return sprintf("substring(%s,%s,%s)", exp0, exp1,
940 info.table.getExpressionArg(\info, role, args[2], AbstractDataProviderTypeMap."int"));
941 },
942 },
943 COP_PREPEND: DefaultExpressionMap{COP_PREPEND} + {
944 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
945 string exp0 = info.table.getExpressionArg(\info, role, args[0],
946 AbstractDataProviderTypeMap."string");
947 string exp1 = info.table.getExpressionArg(\info, role, args[1],
948 AbstractDataProviderTypeMap."string");
949 return sprintf("concat(%s, %s)", exp1, exp0);
950 },
951 },
952 COP_APPEND: DefaultExpressionMap{COP_APPEND} + {
953 "code": string sub (reference<hash<QueryInfo>> info, int role, list<auto> args) {
954 string exp0 = info.table.getExpressionArg(\info, role, args[0],
955
956 AbstractDataProviderTypeMap."string");
957 string exp1 = info.table.getExpressionArg(\info, role, args[1],
958 AbstractDataProviderTypeMap."string");
959 return sprintf("concat(%s, %s)", exp0, exp1);
960 },
961 },
962 };
963
965 const FreetdsOpMap = DefaultOpMap + {
966 OP_SUBSTR: {
967 "code": string sub (reference<hash<QueryInfo>> info, string cn, softlist arg) {
968 info.args += arg[0]; // start
969 if (!exists arg[1]) {
970 info.args += arg[2]; # text
971 return sprintf("substring(%s,%v,32767) = %v", cn); # NOTE: length arg is required
972 }
973 info.args += arg[1]; # count
974 info.args += arg[2]; # text
975 return sprintf("substring(%s,%v,%v) = %v", cn);
976 },
977 },
978 };
979
981 const FreetdsCopMap = ...;
982
983
985 /* Impl. note here. There is shorter workaround for this, but it does not work with seconds
986 and with dates older than 1.1.1970. (minutes will overflow later too etc.).
987 So no usage for: dateadd(ss, datediff(ss, 0, %s), 0) for example
988 */
989 const FreetdsTruncDate = ...;
990
991
993 const FreetdsIopMap = ...;
994
995
997 const FreetdsUopMap = ...;
998
999
1000protected:
1002 *string filegroup;
1003
1005 string schema;
1006
1009
1011 string default_schema = "dbo";
1012
1013public:
1014
1015 constructor(AbstractDatasource nds, string nname, *hash opts) ;
1016
1017
1020
1021
1024
1025
1027
1031 code getUpsertClosure(hash<auto> row, int upsert_strategy = UpsertAuto, *hash opt);
1032
1033
1036
1037
1039 string getSqlName();
1040
1041
1043 hash<auto> getExpressionMap();
1044
1045
1048
1049
1050protected:
1051 string getFromIntern(string from, *hash qh);
1052public:
1053
1054
1055protected:
1056 hash getTableCreationOptions();
1057public:
1058
1059
1060protected:
1061 hash getTableDescriptionHashOptions();
1062public:
1063
1064
1065protected:
1066 hash getColumnDescOptions();
1067public:
1068
1069
1070protected:
1071 hash getIndexOptions();
1072public:
1073
1074
1075protected:
1076 hash getConstraintOptions();
1077public:
1078
1079
1080protected:
1081 hash getAlignTableOptions();
1082public:
1083
1084
1086protected:
1088public:
1089
1090
1092protected:
1094public:
1095
1096
1098protected:
1100public:
1101
1102
1104protected:
1106public:
1107
1108
1109protected:
1110 bool checkExistenceImpl();
1111public:
1112
1113
1114protected:
1115 Columns describeImpl();
1116public:
1117
1118
1119protected:
1120 Columns describeSybaseImpl();
1121public:
1122
1123
1124protected:
1125 Columns describeMssqlImpl();
1126public:
1127
1128
1129protected:
1130 FreetdsPrimaryKey getPrimaryKeyImpl();
1131public:
1132
1133
1134protected:
1135 FreetdsPrimaryKey getPrimaryKeySybaseImpl();
1136public:
1137
1138
1139protected:
1140 FreetdsPrimaryKey getPrimaryKeyMssqlImpl();
1141public:
1142
1143
1144protected:
1145 Indexes getIndexesImpl();
1146public:
1147
1148
1149protected:
1150 Indexes getIndexesSybaseImpl();
1151public:
1152
1153
1154protected:
1155 Indexes getIndexesMssqlImpl();
1156public:
1157
1158
1159protected:
1160 ForeignConstraints getForeignConstraintsImpl(*hash opts);
1161public:
1162
1163
1164protected:
1165 ForeignConstraints getForeignConstraintsSybaseImpl();
1166public:
1167
1168
1169protected:
1170 ForeignConstraints getForeignConstraintsMssqlImpl();
1171public:
1172
1173
1174protected:
1175 Constraints getConstraintsImpl();
1176public:
1177
1178
1179protected:
1180 Constraints getConstraintsSybaseImpl();
1181public:
1182
1183
1184protected:
1185 Constraints getConstraintsMssqlImpl();
1186public:
1187
1188
1189protected:
1190 Triggers getTriggersImpl();
1191public:
1192
1193
1195protected:
1196 string getCreateTableSqlImpl(*hash opt);
1197public:
1198
1199
1200protected:
1201 *list getCreateMiscSqlImpl(*hash opt, bool cache);
1202public:
1203
1204
1205protected:
1206 *list getAlignSqlImpl(AbstractTable table, *hash opt);
1207public:
1208
1209
1211protected:
1212 string getCreateSqlImpl(list l);
1213public:
1214
1215
1216protected:
1217 string getRenameSqlImpl(string new_name);
1218public:
1219
1220
1221protected:
1222 AbstractColumn addColumnImpl(string cname, hash opt, bool nullable = True);
1223public:
1224
1225
1226protected:
1227 AbstractPrimaryKey addPrimaryKeyImpl(string cname, hash ch, *hash opt);
1228public:
1229
1230
1231protected:
1232 AbstractIndex addIndexImpl(string iname, bool enabled, hash ch, *hash opt);
1233public:
1234
1235
1236 private AbstractForeignConstraint addForeignConstraintImpl(string cname, hash ch, string table, hash tch,
1237 *hash opt) {
1238 ForeignConstraintTarget fct(table, new Columns(tch));
1239 return new FreetdsForeignConstraint(cname, new Columns(ch), fct);
1240 }
1241
1242protected:
1243 AbstractCheckConstraint addCheckConstraintImpl(string cname, string src, *hash opt);
1244public:
1245
1246
1247protected:
1248 AbstractUniqueConstraint addUniqueConstraintImpl(string cname, hash ch, *hash opt);
1249public:
1250
1251
1252protected:
1253 AbstractTrigger addTriggerImpl(string tname, string src, *hash opt);
1254public:
1255
1256
1257protected:
1258 bool tryInsertImpl(string sql, hash<auto> row);
1259public:
1260
1261
1263
1265protected:
1266 bool isDuplicateRowErrorImpl(hash<ExceptionInfo> ex);
1267public:
1268
1269
1270protected:
1271 hash getQoreTypeMapImpl();
1272public:
1273
1274
1275protected:
1276 hash getTypeMapImpl();
1277public:
1278
1279
1281
1283protected:
1284 *string getSqlValueImpl(auto v);
1285public:
1286
1287
1289 string getColumnSqlName(string col);
1290
1291
1293 list getColumnSqlNames(softlist cols);
1294
1295
1296protected:
1297 bool emptyImpl();
1298public:
1299
1300
1302protected:
1304public:
1305
1306
1307protected:
1308 setupTableImpl(hash desc, *hash opt);
1309public:
1310
1311
1313protected:
1315public:
1316
1317
1319protected:
1321public:
1322
1323
1325protected:
1327public:
1328
1329
1331protected:
1332 doSelectLimitOnlyUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql);
1333public:
1334
1335
1337 private doSelectOrderByWithOffsetSqlUnlockedImpl(reference<hash<QueryInfo>> info, reference<string> sql,
1338 list<auto> coll) {
1339 if (is_sybase);
1340
1341
1342 doSelectOrderBySqlUnlocked(info, \sql, coll);
1343
1344 sql += " offset %v rows";
1345 info.args += info.query_hash.offset.toInt();
1346
1347 if (info.query_hash.limit);
1348
1349 }
1350
1352protected:
1353 auto tryExecArgsImpl(string sql, *softlist<auto> args);
1354public:
1355
1356
1358protected:
1359 auto tryExecRawImpl(string sql, *softlist<auto> args);
1360public:
1361
1362
1364protected:
1365 copyImpl(AbstractTable old);
1366public:
1367
1368
1369protected:
1370 *hash<auto> doReturningImpl(hash<auto> opt, reference<string> sql, list<auto> args);
1371public:
1372
1373
1374protected:
1375 softbool tryUpdate(string sql, hash<auto> row, Columns cols, list updc);
1376public:
1377
1378
1380protected:
1381 AbstractDataProviderType getNumericTypeImpl(string native_type, bool nullable, *hash<auto> options);
1382public:
1383
1384
1386
1390protected:
1391 AbstractSavepointHelper getSavepointHelperImpl(*string savepoint);
1392public:
1393
1394 };
1395};
represents a FreeTDS-specific check constraint
Definition: FreetdsSqlUtil.qm.dox.h:303
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
constructor(string n, string n_src)
creates the constraint from the supplied arguments
represents a FreeTDS-specific column
Definition: FreetdsSqlUtil.qm.dox.h:323
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt)
returns a list of sql strings that can be used to modify the column to the new definition; if the col...
softlist getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, *int scale)
creates the column from the supplied arguments
string getDdlName(string name)
returns the column name with quoting in case the column name is a reserved word
constructor()
empty constructor for subclasses
int byte_size
byte size of the column
Definition: FreetdsSqlUtil.qm.dox.h:327
bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
provides the FreeTDS-specific implementation of the AbstractDatabase interface
Definition: FreetdsSqlUtil.qm.dox.h:651
string default_schema
default schema for user
Definition: FreetdsSqlUtil.qm.dox.h:658
hash getReclaimSpaceOptions()
returns driver-specific options to the base abstract class
bool is_sybase
sybase flag
Definition: FreetdsSqlUtil.qm.dox.h:655
bool supportsPackagesImpl()
returns True if the database supports packages
int getPhysicalSizeImpl()
SqlUtil::AbstractDatabase::getPhysicalSize()
bool requiresScale()
Returns True if the driver requires a scale to support decimal values in numeric or decimal columns.
static bool isSybase(AbstractDatasource ds)
returns True if the DB is a Sybase database
list< string > listProceduresImpl()
since FreeTDS only supports functions, this method is identical to listFunctionsImpl()
auto tryExecArgsImpl(string sql, *softlist< auto > args)
tries to execute a command so that if an error occurs the current transaction status is not lost
static string getCreateSql(list l)
returns a string that can be used to create the schema in the database
list< string > listFunctionsImpl()
returns a list of string function names in the database
bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
const FreetdsReservedWords
hash of reserved words
Definition: FreetdsSqlUtil.qm.dox.h:669
int getMaximumPrecision()
Returns the maximum precision for numeric or decimal columns.
reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
bool supportsSequencesImpl()
returns True if the database supports sequences
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 getCreateSqlImpl(list l)
returns a string that can be used to create the schema 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
const FreetdsReclaimSpaceOptions
Options for reclaimSpace()
Definition: FreetdsSqlUtil.qm.dox.h:666
bool supportsTypesImpl()
returns True if the database supports named types
const MaxPrecision
Maximum precision.
Definition: FreetdsSqlUtil.qm.dox.h:673
softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics()
hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
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
const FreetdsSchemaDescriptionOptions
FreeTDS-specific schema description keys.
Definition: FreetdsSqlUtil.qm.dox.h:661
softlist< string > listTablesImpl()
returns a list of string table names in the database
represents a FreeTDS-specific foreign constraint
Definition: FreetdsSqlUtil.qm.dox.h:283
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
constructor(string n, Columns c, ForeignConstraintTarget t)
creates the constraint from the supplied arguments
string getCreateSql(string name, string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
represents a FreeTDS-specific function
Definition: FreetdsSqlUtil.qm.dox.h:614
bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
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
string getDropSql(*hash opt)
returns a string that can be used to drop the function from the database
softlist getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename the function in the database
represents a FreeTDS-specific index
Definition: FreetdsSqlUtil.qm.dox.h:256
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
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: FreetdsSqlUtil.qm.dox.h:260
bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
constructor(string n_name, bool n_unique, hash n_cols, *string n_filegroup)
creates the object from the arguments
the data type for FreeTDS DECIMAL columns
Definition: FreetdsSqlUtil.qm.dox.h:246
constructor(string native_type, bool nullable, *hash< auto > options)
creates the object
represents a FreeTDS-specific numeric column
Definition: FreetdsSqlUtil.qm.dox.h:396
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 FreeTDS-specific primary key constraint
Definition: FreetdsSqlUtil.qm.dox.h:501
FreetdsColumn memberGate(string k)
returns the FreetdsColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the constraint
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
constructor()
creates an empty primary key object
constructor(string n, *hash c, *string ts)
creates the object with the given attributes
FreeTDS savepoint helper.
Definition: FreetdsSqlUtil.qm.dox.h:214
rollbackImpl()
Rolls back to the savepoint.
deleteSavepointImpl()
Deletes the savepoint.
constructor(AbstractDatasource ds, *string savepoint='x'+get_random_string(31))
Creates the object.
createSavepointImpl()
Creates the savepoint.
class for FreeTDS sequences
Definition: FreetdsSqlUtil.qm.dox.h:545
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 FreeTDS-specific implementation of the SqlUtil::AbstractTable interface
Definition: FreetdsSqlUtil.qm.dox.h:876
const FreetdsTableDescriptionHashOptions
equal to SqlUtil::AbstractTable::TableDescriptionHashOptions
Definition: FreetdsSqlUtil.qm.dox.h:908
list getColumnSqlNames(softlist cols)
returns a list of column names for use in SQL strings; subclasses can process the argument list in ca...
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema,...
const FreetdsIopMap
a hash of default value operator descriptions for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:993
bool is_sybase
sybase flag
Definition: FreetdsSqlUtil.qm.dox.h:880
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: FreetdsSqlUtil.qm.dox.h:1337
*string getTablespaceName()
returns the data filegroup name for the table or NOTHING if none is known
hash< auto > getWhereOperatorMap()
returns the "where" operator map for FreeTDS
doSelectLimitOnlyUnlockedImpl(reference< hash< QueryInfo > > info, reference< string > sql)
processes a string for use in SQL select statements with "limit" but no "orderby" or "offset"
const MsSqlServerTableHints
query hints
Definition: FreetdsSqlUtil.qm.dox.h:925
hash< auto > getExpressionMap()
Returns the expression map for FreeTDS.
hash getInsertOperatorMap()
returns the insert operator map for this object
hash getColumnOperatorMapImpl()
returns the column operator map for this object
const SybaseQoreTypeMap
maps qore type names to Sybase/SAP type names
Definition: FreetdsSqlUtil.qm.dox.h:903
bool ss_has_sequences
"has sequences" flag for SQL server
Definition: FreetdsSqlUtil.qm.dox.h:886
const FreetdsCopMap
column operator specializations for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:981
string schema
schema name for the table
Definition: FreetdsSqlUtil.qm.dox.h:1005
const FreetdsUopMap
a hash of default update operator definitions for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:997
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 filegroup
filegroup name for the table, if known
Definition: FreetdsSqlUtil.qm.dox.h:1002
bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
AbstractDataProviderType getNumericTypeImpl(string native_type, bool nullable, *hash< auto > options)
returns the type for number / numeric columns for the database so that data conversions can be handle...
const FreetdsSelectOptions
select options supported by FreetdsSqlUtil
Definition: FreetdsSqlUtil.qm.dox.h:921
const FreetdsExpressionMap
FreeTDS Expression map.
Definition: FreetdsSqlUtil.qm.dox.h:929
const QoreTypeMap
maps qore type names to DB type names
Definition: FreetdsSqlUtil.qm.dox.h:893
clearImpl()
clears FreeTDS-specific table information
const MsQoreTypeMap
maps qore type names to MS SQL Server type names
Definition: FreetdsSqlUtil.qm.dox.h:897
bool ss_has_merge
"has merge" flag for SQL server
Definition: FreetdsSqlUtil.qm.dox.h:883
string getColumnSqlName(string col)
returns the column name for use in SQL strings; subclasses can return a special string in case the co...
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
copyImpl(AbstractTable old)
db-specific copy actions
string getCreateTableSqlImpl(*hash opt)
returns a string that can be used to create the table in the database
bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint with a unique index
bool isDuplicateRowErrorImpl(hash< ExceptionInfo > ex)
Returns True if the exception was raised because of a duplicate row / key error.
const FreetdsTypeMap
maps postgresql type names to type configurations
Definition: FreetdsSqlUtil.qm.dox.h:889
const FreetdsOpMap
where operator specializations for FreeTDS
Definition: FreetdsSqlUtil.qm.dox.h:965
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: FreetdsSqlUtil.qm.dox.h:1008
const FreetdsTruncDate
Map SqlUtil::cop_trunc_date() constants to FreeTDS internal masks.
Definition: FreetdsSqlUtil.qm.dox.h:989
string getSchemaName()
returns the schema name
string getCreateSqlImpl(list l)
returns a string that can be used to create the table in the database
*string getSqlValueImpl(auto v)
returns a string for use in SQL queries representing the DB-specific value of the argument
code getUpsertClosure(hash< auto > row, int upsert_strategy=UpsertAuto, *hash opt)
returns a closure for performing upserts
AbstractSavepointHelper getSavepointHelperImpl(*string savepoint)
get DB-specific savepoint helper
bool supportsTablespacesImpl()
returns True if the database support tablespaces
string default_schema
the default schema for the user
Definition: FreetdsSqlUtil.qm.dox.h:1011
hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
bool hasArrayBind()
returns False because the freetds driver does not support array binds / bulk DML operations
hash getSelectOptions()
returns the select options for this driver
represents a FreeTDS-specific trigger
Definition: FreetdsSqlUtil.qm.dox.h:587
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
softlist getDropSql(string table_name)
returns a string that can be used to drop the trigger from 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 getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
common base class for unique constraints
Definition: FreetdsSqlUtil.qm.dox.h:406
bool setIndexBase(string ix)
sets the supporting index name
*string filegroup
any filegroup for the unique key index
Definition: FreetdsSqlUtil.qm.dox.h:411
getIndexSql(reference< string > sql, string name, *hash opts)
adds index options onto the sql creation string
constructor(*string ts)
creates the constraint with an optional filegroup name
constructor()
empty constructor for subclasses
clearIndex()
clears any index base for the constraint
*string getTablespace()
returns the filegroup name used for this constraint, if known
setTablespace(*string ts)
sets or clears the filegroup name
class modeling a unique constraint
Definition: FreetdsSqlUtil.qm.dox.h:447
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
bool isEnabled()
returns True if the constraint is enabled, False if not
FreetdsColumn memberGate(string k)
returns the FreetdsColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception
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
bool enabled
True if the constraint is enabled, False if not
Definition: FreetdsSqlUtil.qm.dox.h:452
represents a FreeTDS view
Definition: FreetdsSqlUtil.qm.dox.h:566
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 FreetdsSqlUtil namespace contains all the objects in the FreetdsSqlUtil module
Definition: FreetdsSqlUtil.qm.dox.h:201
FreetdsDatabase get_database(AbstractDatasource nds, *hash< auto > opts)
returns a FreetdsDatabase object corresponding to the arguments
FreetdsTable get_table(AbstractDatasource nds, string nname, *hash< auto > opts)
returns a FreetdsTable object corresponding to the arguments