QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsabstractdatabaseproviderconnection.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsabstractdatabaseproviderconnection.cpp - QgsAbstractDatabaseProviderConnection
3
4 ---------------------
5 begin : 2.8.2019
6 copyright : (C) 2019 by Alessandro Pasotti
7 email : elpaso at itopen dot it
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
17
18#include "qgsexception.h"
19#include "qgsfeedback.h"
21#include "qgssqlstatement.h"
22#include "qgsvectorlayer.h"
23#include "qgsweakrelation.h"
24
25#include <QObject>
26#include <QVariant>
27
28#include "moc_qgsabstractdatabaseproviderconnection.cpp"
29
35
41
46
51
56
61
63{
64 throw QgsProviderConnectionException( QObject::tr( "Operation 'createVectorLayerExporterDestinationUri' is not supported" ) );
65}
66
67QString QgsAbstractDatabaseProviderConnection::tableUri( const QString &schema, const QString &name ) const
68{
69 Q_UNUSED( schema )
70 Q_UNUSED( name )
71 throw QgsProviderConnectionException( QObject::tr( "Operation 'tableUri' is not supported" ) );
72}
73
74
76void QgsAbstractDatabaseProviderConnection::checkCapability( QgsAbstractDatabaseProviderConnection::Capability capability ) const
77{
78 if ( ! mCapabilities.testFlag( capability ) )
79 {
80 static QMetaEnum metaEnum = QMetaEnum::fromType<QgsAbstractDatabaseProviderConnection::Capability>();
81 const QString capName { metaEnum.valueToKey( capability ) };
82 throw QgsProviderConnectionException( QObject::tr( "Operation '%1' is not supported for this connection" ).arg( capName ) );
83 }
84}
85
86void QgsAbstractDatabaseProviderConnection::checkCapability( Qgis::DatabaseProviderConnectionCapability2 capability ) const
87{
88 if ( ! mCapabilities2.testFlag( capability ) )
89 {
90 throw QgsProviderConnectionException( QObject::tr( "Operation '%1' is not supported for this connection" ).arg( qgsEnumValueToKey( capability ) ) );
91 }
92}
93
94QString QgsAbstractDatabaseProviderConnection::sanitizeSqlForQueryLayer( const QString &sql ) const
95{
96 QString sanitizedSql { sql.trimmed() };
97 while ( sanitizedSql.endsWith( ';' ) )
98 {
99 sanitizedSql.chop( 1 );
100 }
101 return sanitizedSql;
102}
103
105
110
111QMultiMap<Qgis::SqlKeywordCategory, QStringList> QgsAbstractDatabaseProviderConnection::sqlDictionary()
112{
113 return
114 {
115 // Common constants
116 {
118 QStringLiteral( "NULL" ),
119 QStringLiteral( "FALSE" ),
120 QStringLiteral( "TRUE" ),
121 }
122 },
123 // Common SQL reserved words
124 // From: GET https://en.wikipedia.org/wiki/SQL_reserved_words| grep 'style="background: #ececec; color: black; font-weight: bold;'| sed -e 's/.*>//'|sort
125 {
127 {
128 QStringLiteral( "ABORT " ),
129 QStringLiteral( "ABORTSESSION" ),
130 QStringLiteral( "ABS" ),
131 QStringLiteral( "ABSOLUTE" ),
132 QStringLiteral( "ACCESS" ),
133 QStringLiteral( "ACCESSIBLE" ),
134 QStringLiteral( "ACCESS_LOCK" ),
135 QStringLiteral( "ACCOUNT" ),
136 QStringLiteral( "ACOS" ),
137 QStringLiteral( "ACOSH" ),
138 QStringLiteral( "ACTION" ),
139 QStringLiteral( "ADD" ),
140 QStringLiteral( "ADD_MONTHS" ),
141 QStringLiteral( "ADMIN" ),
142 QStringLiteral( "AFTER" ),
143 QStringLiteral( "AGGREGATE" ),
144 QStringLiteral( "ALIAS" ),
145 QStringLiteral( "ALL" ),
146 QStringLiteral( "ALLOCATE" ),
147 QStringLiteral( "ALLOW" ),
148 QStringLiteral( "ALTER" ),
149 QStringLiteral( "ALTERAND" ),
150 QStringLiteral( "AMP" ),
151 QStringLiteral( "ANALYSE" ),
152 QStringLiteral( "ANALYZE" ),
153 QStringLiteral( "AND" ),
154 QStringLiteral( "ANSIDATE" ),
155 QStringLiteral( "ANY" ),
156 QStringLiteral( "ARE" ),
157 QStringLiteral( "ARRAY" ),
158 QStringLiteral( "ARRAY_AGG" ),
159 QStringLiteral( "ARRAY_EXISTS" ),
160 QStringLiteral( "ARRAY_MAX_CARDINALITY" ),
161 QStringLiteral( "AS" ),
162 QStringLiteral( "ASC" ),
163 QStringLiteral( "ASENSITIVE" ),
164 QStringLiteral( "ASIN" ),
165 QStringLiteral( "ASINH" ),
166 QStringLiteral( "ASSERTION" ),
167 QStringLiteral( "ASSOCIATE" ),
168 QStringLiteral( "ASUTIME" ),
169 QStringLiteral( "ASYMMETRIC" ),
170 QStringLiteral( "AT" ),
171 QStringLiteral( "ATAN" ),
172 QStringLiteral( "ATAN2" ),
173 QStringLiteral( "ATANH" ),
174 QStringLiteral( "ATOMIC" ),
175 QStringLiteral( "AUDIT" ),
176 QStringLiteral( "AUTHORIZATION" ),
177 QStringLiteral( "AUX" ),
178 QStringLiteral( "AUXILIARY" ),
179 QStringLiteral( "AVE" ),
180 QStringLiteral( "AVERAGE" ),
181 QStringLiteral( "AVG" ),
182 QStringLiteral( "BACKUP" ),
183 QStringLiteral( "BEFORE" ),
184 QStringLiteral( "BEGIN" ),
185 QStringLiteral( "BEGIN_FRAME" ),
186 QStringLiteral( "BEGIN_PARTITION" ),
187 QStringLiteral( "BETWEEN" ),
188 QStringLiteral( "BIGINT" ),
189 QStringLiteral( "BINARY" ),
190 QStringLiteral( "BIT" ),
191 QStringLiteral( "BLOB" ),
192 QStringLiteral( "BOOLEAN" ),
193 QStringLiteral( "BOTH" ),
194 QStringLiteral( "BREADTH" ),
195 QStringLiteral( "BREAK" ),
196 QStringLiteral( "BROWSE" ),
197 QStringLiteral( "BT" ),
198 QStringLiteral( "BUFFERPOOL" ),
199 QStringLiteral( "BULK" ),
200 QStringLiteral( "BUT" ),
201 QStringLiteral( "BY" ),
202 QStringLiteral( "BYTE" ),
203 QStringLiteral( "BYTEINT" ),
204 QStringLiteral( "BYTES" ),
205 QStringLiteral( "CALL" ),
206 QStringLiteral( "CALLED" ),
207 QStringLiteral( "CAPTURE" ),
208 QStringLiteral( "CARDINALITY" ),
209 QStringLiteral( "CASCADE" ),
210 QStringLiteral( "CASCADED" ),
211 QStringLiteral( "CASE" ),
212 QStringLiteral( "CASE_N" ),
213 QStringLiteral( "CASESPECIFIC" ),
214 QStringLiteral( "CAST" ),
215 QStringLiteral( "CATALOG" ),
216 QStringLiteral( "CCSID" ),
217 QStringLiteral( "CD" ),
218 QStringLiteral( "CEIL" ),
219 QStringLiteral( "CEILING" ),
220 QStringLiteral( "CHANGE" ),
221 QStringLiteral( "CHAR" ),
222 QStringLiteral( "CHAR2HEXINT" ),
223 QStringLiteral( "CHARACTER" ),
224 QStringLiteral( "CHARACTER_LENGTH" ),
225 QStringLiteral( "CHARACTERS" ),
226 QStringLiteral( "CHAR_LENGTH" ),
227 QStringLiteral( "CHARS" ),
228 QStringLiteral( "CHECK" ),
229 QStringLiteral( "CHECKPOINT" ),
230 QStringLiteral( "CLASS" ),
231 QStringLiteral( "CLASSIFIER" ),
232 QStringLiteral( "CLOB" ),
233 QStringLiteral( "CLONE" ),
234 QStringLiteral( "CLOSE" ),
235 QStringLiteral( "CLUSTER" ),
236 QStringLiteral( "CLUSTERED" ),
237 QStringLiteral( "CM" ),
238 QStringLiteral( "COALESCE" ),
239 QStringLiteral( "COLLATE" ),
240 QStringLiteral( "COLLATION" ),
241 QStringLiteral( "COLLECT" ),
242 QStringLiteral( "COLLECTION" ),
243 QStringLiteral( "COLLID" ),
244 QStringLiteral( "COLUMN" ),
245 QStringLiteral( "COLUMN_VALUE" ),
246 QStringLiteral( "COMMENT" ),
247 QStringLiteral( "COMMIT" ),
248 QStringLiteral( "COMPLETION" ),
249 QStringLiteral( "COMPRESS" ),
250 QStringLiteral( "COMPUTE" ),
251 QStringLiteral( "CONCAT" ),
252 QStringLiteral( "CONCURRENTLY" ),
253 QStringLiteral( "CONDITION" ),
254 QStringLiteral( "CONNECT" ),
255 QStringLiteral( "CONNECTION" ),
256 QStringLiteral( "CONSTRAINT" ),
257 QStringLiteral( "CONSTRAINTS" ),
258 QStringLiteral( "CONSTRUCTOR" ),
259 QStringLiteral( "CONTAINS" ),
260 QStringLiteral( "CONTAINSTABLE" ),
261 QStringLiteral( "CONTENT" ),
262 QStringLiteral( "CONTINUE" ),
263 QStringLiteral( "CONVERT" ),
264 QStringLiteral( "CONVERT_TABLE_HEADER" ),
265 QStringLiteral( "COPY" ),
266 QStringLiteral( "CORR" ),
267 QStringLiteral( "CORRESPONDING" ),
268 QStringLiteral( "COS" ),
269 QStringLiteral( "COSH" ),
270 QStringLiteral( "COUNT" ),
271 QStringLiteral( "COVAR_POP" ),
272 QStringLiteral( "COVAR_SAMP" ),
273 QStringLiteral( "CREATE" ),
274 QStringLiteral( "CROSS" ),
275 QStringLiteral( "CS" ),
276 QStringLiteral( "CSUM" ),
277 QStringLiteral( "CT" ),
278 QStringLiteral( "CUBE" ),
279 QStringLiteral( "CUME_DIST" ),
280 QStringLiteral( "CURRENT" ),
281 QStringLiteral( "CURRENT_CATALOG" ),
282 QStringLiteral( "CURRENT_DATE" ),
283 QStringLiteral( "CURRENT_DEFAULT_TRANSFORM_GROUP" ),
284 QStringLiteral( "CURRENT_LC_CTYPE" ),
285 QStringLiteral( "CURRENT_PATH" ),
286 QStringLiteral( "CURRENT_ROLE" ),
287 QStringLiteral( "CURRENT_ROW" ),
288 QStringLiteral( "CURRENT_SCHEMA" ),
289 QStringLiteral( "CURRENT_SERVER" ),
290 QStringLiteral( "CURRENT_TIME" ),
291 QStringLiteral( "CURRENT_TIMESTAMP" ),
292 QStringLiteral( "CURRENT_TIMEZONE" ),
293 QStringLiteral( "CURRENT_TRANSFORM_GROUP_FOR_TYPE" ),
294 QStringLiteral( "CURRENT_USER" ),
295 QStringLiteral( "CURRVAL" ),
296 QStringLiteral( "CURSOR" ),
297 QStringLiteral( "CV" ),
298 QStringLiteral( "CYCLE" ),
299 QStringLiteral( "DATA" ),
300 QStringLiteral( "DATABASE" ),
301 QStringLiteral( "DATABASES" ),
302 QStringLiteral( "DATABLOCKSIZE" ),
303 QStringLiteral( "DATE" ),
304 QStringLiteral( "DATEFORM" ),
305 QStringLiteral( "DAY" ),
306 QStringLiteral( "DAY_HOUR" ),
307 QStringLiteral( "DAY_MICROSECOND" ),
308 QStringLiteral( "DAY_MINUTE" ),
309 QStringLiteral( "DAYS" ),
310 QStringLiteral( "DAY_SECOND" ),
311 QStringLiteral( "DBCC" ),
312 QStringLiteral( "DBINFO" ),
313 QStringLiteral( "DEALLOCATE" ),
314 QStringLiteral( "DEC" ),
315 QStringLiteral( "DECFLOAT" ),
316 QStringLiteral( "DECIMAL" ),
317 QStringLiteral( "DECLARE" ),
318 QStringLiteral( "DEFAULT" ),
319 QStringLiteral( "DEFERRABLE" ),
320 QStringLiteral( "DEFERRED" ),
321 QStringLiteral( "DEFINE" ),
322 QStringLiteral( "DEGREES" ),
323 QStringLiteral( "DEL" ),
324 QStringLiteral( "DELAYED" ),
325 QStringLiteral( "DELETE" ),
326 QStringLiteral( "DENSE_RANK" ),
327 QStringLiteral( "DENY" ),
328 QStringLiteral( "DEPTH" ),
329 QStringLiteral( "DEREF" ),
330 QStringLiteral( "DESC" ),
331 QStringLiteral( "DESCRIBE" ),
332 QStringLiteral( "DESCRIPTOR" ),
333 QStringLiteral( "DESTROY" ),
334 QStringLiteral( "DESTRUCTOR" ),
335 QStringLiteral( "DETERMINISTIC" ),
336 QStringLiteral( "DIAGNOSTIC" ),
337 QStringLiteral( "DIAGNOSTICS" ),
338 QStringLiteral( "DICTIONARY" ),
339 QStringLiteral( "DISABLE" ),
340 QStringLiteral( "DISABLED" ),
341 QStringLiteral( "DISALLOW" ),
342 QStringLiteral( "DISCONNECT" ),
343 QStringLiteral( "DISK" ),
344 QStringLiteral( "DISTINCT" ),
345 QStringLiteral( "DISTINCTROW" ),
346 QStringLiteral( "DISTRIBUTED" ),
347 QStringLiteral( "DIV" ),
348 QStringLiteral( "DO" ),
349 QStringLiteral( "DOCUMENT" ),
350 QStringLiteral( "DOMAIN" ),
351 QStringLiteral( "DOUBLE" ),
352 QStringLiteral( "DROP" ),
353 QStringLiteral( "DSSIZE" ),
354 QStringLiteral( "DUAL" ),
355 QStringLiteral( "DUMP" ),
356 QStringLiteral( "DYNAMIC" ),
357 QStringLiteral( "EACH" ),
358 QStringLiteral( "ECHO" ),
359 QStringLiteral( "EDITPROC" ),
360 QStringLiteral( "ELEMENT" ),
361 QStringLiteral( "ELSE" ),
362 QStringLiteral( "ELSEIF" ),
363 QStringLiteral( "EMPTY" ),
364 QStringLiteral( "ENABLED" ),
365 QStringLiteral( "ENCLOSED" ),
366 QStringLiteral( "ENCODING" ),
367 QStringLiteral( "ENCRYPTION" ),
368 QStringLiteral( "END" ),
369 QStringLiteral( "END-EXEC" ),
370 QStringLiteral( "END_FRAME" ),
371 QStringLiteral( "ENDING" ),
372 QStringLiteral( "END_PARTITION" ),
373 QStringLiteral( "EQ" ),
374 QStringLiteral( "EQUALS" ),
375 QStringLiteral( "ERASE" ),
376 QStringLiteral( "ERRLVL" ),
377 QStringLiteral( "ERROR" ),
378 QStringLiteral( "ERRORFILES" ),
379 QStringLiteral( "ERRORTABLES" ),
380 QStringLiteral( "ESCAPE" ),
381 QStringLiteral( "ESCAPED" ),
382 QStringLiteral( "ET" ),
383 QStringLiteral( "EVERY" ),
384 QStringLiteral( "EXCEPT" ),
385 QStringLiteral( "EXCEPTION" ),
386 QStringLiteral( "EXCLUSIVE" ),
387 QStringLiteral( "EXEC" ),
388 QStringLiteral( "EXECUTE" ),
389 QStringLiteral( "EXISTS" ),
390 QStringLiteral( "EXIT" ),
391 QStringLiteral( "EXP" ),
392 QStringLiteral( "EXPLAIN" ),
393 QStringLiteral( "EXTERNAL" ),
394 QStringLiteral( "EXTRACT" ),
395 QStringLiteral( "FALLBACK" ),
396 QStringLiteral( "FALSE" ),
397 QStringLiteral( "FASTEXPORT" ),
398 QStringLiteral( "FENCED" ),
399 QStringLiteral( "FETCH" ),
400 QStringLiteral( "FIELDPROC" ),
401 QStringLiteral( "FILE" ),
402 QStringLiteral( "FILLFACTOR" ),
403 QStringLiteral( "FILTER" ),
404 QStringLiteral( "FINAL" ),
405 QStringLiteral( "FIRST" ),
406 QStringLiteral( "FIRST_VALUE" ),
407 QStringLiteral( "FLOAT" ),
408 QStringLiteral( "FLOAT4" ),
409 QStringLiteral( "FLOAT8" ),
410 QStringLiteral( "FLOOR" ),
411 QStringLiteral( "FOR" ),
412 QStringLiteral( "FORCE" ),
413 QStringLiteral( "FOREIGN" ),
414 QStringLiteral( "FORMAT" ),
415 QStringLiteral( "FOUND" ),
416 QStringLiteral( "FRAME_ROW" ),
417 QStringLiteral( "FREE" ),
418 QStringLiteral( "FREESPACE" ),
419 QStringLiteral( "FREETEXT" ),
420 QStringLiteral( "FREETEXTTABLE" ),
421 QStringLiteral( "FREEZE" ),
422 QStringLiteral( "FROM" ),
423 QStringLiteral( "FULL" ),
424 QStringLiteral( "FULLTEXT" ),
425 QStringLiteral( "FUNCTION" ),
426 QStringLiteral( "FUSION" ),
427 QStringLiteral( "GE" ),
428 QStringLiteral( "GENERAL" ),
429 QStringLiteral( "GENERATED" ),
430 QStringLiteral( "GET" ),
431 QStringLiteral( "GIVE" ),
432 QStringLiteral( "GLOBAL" ),
433 QStringLiteral( "GO" ),
434 QStringLiteral( "GOTO" ),
435 QStringLiteral( "GRANT" ),
436 QStringLiteral( "GRAPHIC" ),
437 QStringLiteral( "GROUP" ),
438 QStringLiteral( "GROUPING" ),
439 QStringLiteral( "GROUPS" ),
440 QStringLiteral( "GT" ),
441 QStringLiteral( "HANDLER" ),
442 QStringLiteral( "HASH" ),
443 QStringLiteral( "HASHAMP" ),
444 QStringLiteral( "HASHBAKAMP" ),
445 QStringLiteral( "HASHBUCKET" ),
446 QStringLiteral( "HASHROW" ),
447 QStringLiteral( "HAVING" ),
448 QStringLiteral( "HELP" ),
449 QStringLiteral( "HIGH_PRIORITY" ),
450 QStringLiteral( "HOLD" ),
451 QStringLiteral( "HOLDLOCK" ),
452 QStringLiteral( "HOST" ),
453 QStringLiteral( "HOUR" ),
454 QStringLiteral( "HOUR_MICROSECOND" ),
455 QStringLiteral( "HOUR_MINUTE" ),
456 QStringLiteral( "HOURS" ),
457 QStringLiteral( "HOUR_SECOND" ),
458 QStringLiteral( "IDENTIFIED" ),
459 QStringLiteral( "IDENTITY" ),
460 QStringLiteral( "IDENTITYCOL" ),
461 QStringLiteral( "IDENTITY_INSERT" ),
462 QStringLiteral( "IF" ),
463 QStringLiteral( "IGNORE" ),
464 QStringLiteral( "ILIKE" ),
465 QStringLiteral( "IMMEDIATE" ),
466 QStringLiteral( "IN" ),
467 QStringLiteral( "INCLUSIVE" ),
468 QStringLiteral( "INCONSISTENT" ),
469 QStringLiteral( "INCREMENT" ),
470 QStringLiteral( "INDEX" ),
471 QStringLiteral( "INDICATOR" ),
472 QStringLiteral( "INFILE" ),
473 QStringLiteral( "INHERIT" ),
474 QStringLiteral( "INITIAL" ),
475 QStringLiteral( "INITIALIZE" ),
476 QStringLiteral( "INITIALLY" ),
477 QStringLiteral( "INITIATE" ),
478 QStringLiteral( "INNER" ),
479 QStringLiteral( "INOUT" ),
480 QStringLiteral( "INPUT" ),
481 QStringLiteral( "INS" ),
482 QStringLiteral( "INSENSITIVE" ),
483 QStringLiteral( "INSERT" ),
484 QStringLiteral( "INSTEAD" ),
485 QStringLiteral( "INT" ),
486 QStringLiteral( "INT1" ),
487 QStringLiteral( "INT2" ),
488 QStringLiteral( "INT3" ),
489 QStringLiteral( "INT4" ),
490 QStringLiteral( "INT8" ),
491 QStringLiteral( "INTEGER" ),
492 QStringLiteral( "INTEGERDATE" ),
493 QStringLiteral( "INTERSECT" ),
494 QStringLiteral( "INTERSECTION" ),
495 QStringLiteral( "INTERVAL" ),
496 QStringLiteral( "INTO" ),
497 QStringLiteral( "IO_AFTER_GTIDS" ),
498 QStringLiteral( "IO_BEFORE_GTIDS" ),
499 QStringLiteral( "IS" ),
500 QStringLiteral( "ISNULL" ),
501 QStringLiteral( "ISOBID" ),
502 QStringLiteral( "ISOLATION" ),
503 QStringLiteral( "ITERATE" ),
504 QStringLiteral( "JAR" ),
505 QStringLiteral( "JOIN" ),
506 QStringLiteral( "JOURNAL" ),
507 QStringLiteral( "JSON_ARRAY" ),
508 QStringLiteral( "JSON_ARRAYAGG" ),
509 QStringLiteral( "JSON_EXISTS" ),
510 QStringLiteral( "JSON_OBJECT" ),
511 QStringLiteral( "JSON_OBJECTAGG" ),
512 QStringLiteral( "JSON_QUERY" ),
513 QStringLiteral( "JSON_TABLE" ),
514 QStringLiteral( "JSON_TABLE_PRIMITIVE" ),
515 QStringLiteral( "JSON_VALUE" ),
516 QStringLiteral( "KEEP" ),
517 QStringLiteral( "KEY" ),
518 QStringLiteral( "KEYS" ),
519 QStringLiteral( "KILL" ),
520 QStringLiteral( "KURTOSIS" ),
521 QStringLiteral( "LABEL" ),
522 QStringLiteral( "LAG" ),
523 QStringLiteral( "LANGUAGE" ),
524 QStringLiteral( "LARGE" ),
525 QStringLiteral( "LAST" ),
526 QStringLiteral( "LAST_VALUE" ),
527 QStringLiteral( "LATERAL" ),
528 QStringLiteral( "LC_CTYPE" ),
529 QStringLiteral( "LE" ),
530 QStringLiteral( "LEAD" ),
531 QStringLiteral( "LEADING" ),
532 QStringLiteral( "LEAVE" ),
533 QStringLiteral( "LEFT" ),
534 QStringLiteral( "LESS" ),
535 QStringLiteral( "LEVEL" ),
536 QStringLiteral( "LIKE" ),
537 QStringLiteral( "LIKE_REGEX" ),
538 QStringLiteral( "LIMIT" ),
539 QStringLiteral( "LINEAR" ),
540 QStringLiteral( "LINENO" ),
541 QStringLiteral( "LINES" ),
542 QStringLiteral( "LISTAGG" ),
543 QStringLiteral( "LN" ),
544 QStringLiteral( "LOAD" ),
545 QStringLiteral( "LOADING" ),
546 QStringLiteral( "LOCAL" ),
547 QStringLiteral( "LOCALE" ),
548 QStringLiteral( "LOCALTIME" ),
549 QStringLiteral( "LOCALTIMESTAMP" ),
550 QStringLiteral( "LOCATOR" ),
551 QStringLiteral( "LOCATORS" ),
552 QStringLiteral( "LOCK" ),
553 QStringLiteral( "LOCKING" ),
554 QStringLiteral( "LOCKMAX" ),
555 QStringLiteral( "LOCKSIZE" ),
556 QStringLiteral( "LOG" ),
557 QStringLiteral( "LOG10" ),
558 QStringLiteral( "LOGGING" ),
559 QStringLiteral( "LOGON" ),
560 QStringLiteral( "LONG" ),
561 QStringLiteral( "LONGBLOB" ),
562 QStringLiteral( "LONGTEXT" ),
563 QStringLiteral( "LOOP" ),
564 QStringLiteral( "LOWER" ),
565 QStringLiteral( "LOW_PRIORITY" ),
566 QStringLiteral( "LT" ),
567 QStringLiteral( "MACRO" ),
568 QStringLiteral( "MAINTAINED" ),
569 QStringLiteral( "MAP" ),
570 QStringLiteral( "MASTER_BIND" ),
571 QStringLiteral( "MASTER_SSL_VERIFY_SERVER_CERT" ),
572 QStringLiteral( "MATCH" ),
573 QStringLiteral( "MATCHES" ),
574 QStringLiteral( "MATCH_NUMBER" ),
575 QStringLiteral( "MATCH_RECOGNIZE" ),
576 QStringLiteral( "MATERIALIZED" ),
577 QStringLiteral( "MAVG" ),
578 QStringLiteral( "MAX" ),
579 QStringLiteral( "MAXEXTENTS" ),
580 QStringLiteral( "MAXIMUM" ),
581 QStringLiteral( "MAXVALUE" ),
582 QStringLiteral( "MCHARACTERS" ),
583 QStringLiteral( "MDIFF" ),
584 QStringLiteral( "MEDIUMBLOB" ),
585 QStringLiteral( "MEDIUMINT" ),
586 QStringLiteral( "MEDIUMTEXT" ),
587 QStringLiteral( "MEMBER" ),
588 QStringLiteral( "MERGE" ),
589 QStringLiteral( "METHOD" ),
590 QStringLiteral( "MICROSECOND" ),
591 QStringLiteral( "MICROSECONDS" ),
592 QStringLiteral( "MIDDLEINT" ),
593 QStringLiteral( "MIN" ),
594 QStringLiteral( "MINDEX" ),
595 QStringLiteral( "MINIMUM" ),
596 QStringLiteral( "MINUS" ),
597 QStringLiteral( "MINUTE" ),
598 QStringLiteral( "MINUTE_MICROSECOND" ),
599 QStringLiteral( "MINUTES" ),
600 QStringLiteral( "MINUTE_SECOND" ),
601 QStringLiteral( "MLINREG" ),
602 QStringLiteral( "MLOAD" ),
603 QStringLiteral( "MLSLABEL" ),
604 QStringLiteral( "MOD" ),
605 QStringLiteral( "MODE" ),
606 QStringLiteral( "MODIFIES" ),
607 QStringLiteral( "MODIFY" ),
608 QStringLiteral( "MODULE" ),
609 QStringLiteral( "MONITOR" ),
610 QStringLiteral( "MONRESOURCE" ),
611 QStringLiteral( "MONSESSION" ),
612 QStringLiteral( "MONTH" ),
613 QStringLiteral( "MONTHS" ),
614 QStringLiteral( "MSUBSTR" ),
615 QStringLiteral( "MSUM" ),
616 QStringLiteral( "MULTISET" ),
617 QStringLiteral( "NAMED" ),
618 QStringLiteral( "NAMES" ),
619 QStringLiteral( "NATIONAL" ),
620 QStringLiteral( "NATURAL" ),
621 QStringLiteral( "NCHAR" ),
622 QStringLiteral( "NCLOB" ),
623 QStringLiteral( "NE" ),
624 QStringLiteral( "NESTED_TABLE_ID" ),
625 QStringLiteral( "NEW" ),
626 QStringLiteral( "NEW_TABLE" ),
627 QStringLiteral( "NEXT" ),
628 QStringLiteral( "NEXTVAL" ),
629 QStringLiteral( "NO" ),
630 QStringLiteral( "NOAUDIT" ),
631 QStringLiteral( "NOCHECK" ),
632 QStringLiteral( "NOCOMPRESS" ),
633 QStringLiteral( "NONCLUSTERED" ),
634 QStringLiteral( "NONE" ),
635 QStringLiteral( "NORMALIZE" ),
636 QStringLiteral( "NOT" ),
637 QStringLiteral( "NOTNULL" ),
638 QStringLiteral( "NOWAIT" ),
639 QStringLiteral( "NO_WRITE_TO_BINLOG" ),
640 QStringLiteral( "NTH_VALUE" ),
641 QStringLiteral( "NTILE" ),
642 QStringLiteral( "NULL" ),
643 QStringLiteral( "NULLIF" ),
644 QStringLiteral( "NULLIFZERO" ),
645 QStringLiteral( "NULLS" ),
646 QStringLiteral( "NUMBER" ),
647 QStringLiteral( "NUMERIC" ),
648 QStringLiteral( "NUMPARTS" ),
649 QStringLiteral( "OBID" ),
650 QStringLiteral( "OBJECT" ),
651 QStringLiteral( "OBJECTS" ),
652 QStringLiteral( "OCCURRENCES_REGEX" ),
653 QStringLiteral( "OCTET_LENGTH" ),
654 QStringLiteral( "OF" ),
655 QStringLiteral( "OFF" ),
656 QStringLiteral( "OFFLINE" ),
657 QStringLiteral( "OFFSET" ),
658 QStringLiteral( "OFFSETS" ),
659 QStringLiteral( "OLD" ),
660 QStringLiteral( "OLD_TABLE" ),
661 QStringLiteral( "OMIT" ),
662 QStringLiteral( "ON" ),
663 QStringLiteral( "ONE" ),
664 QStringLiteral( "ONLINE" ),
665 QStringLiteral( "ONLY" ),
666 QStringLiteral( "OPEN" ),
667 QStringLiteral( "OPENDATASOURCE" ),
668 QStringLiteral( "OPENQUERY" ),
669 QStringLiteral( "OPENROWSET" ),
670 QStringLiteral( "OPENXML" ),
671 QStringLiteral( "OPERATION" ),
672 QStringLiteral( "OPTIMIZATION" ),
673 QStringLiteral( "OPTIMIZE" ),
674 QStringLiteral( "OPTIMIZER_COSTS" ),
675 QStringLiteral( "OPTION" ),
676 QStringLiteral( "OPTIONALLY" ),
677 QStringLiteral( "OR" ),
678 QStringLiteral( "ORDER" ),
679 QStringLiteral( "ORDINALITY" ),
680 QStringLiteral( "ORGANIZATION" ),
681 QStringLiteral( "OUT" ),
682 QStringLiteral( "OUTER" ),
683 QStringLiteral( "OUTFILE" ),
684 QStringLiteral( "OUTPUT" ),
685 QStringLiteral( "OVER" ),
686 QStringLiteral( "OVERLAPS" ),
687 QStringLiteral( "OVERLAY" ),
688 QStringLiteral( "OVERRIDE" ),
689 QStringLiteral( "PACKAGE" ),
690 QStringLiteral( "PAD" ),
691 QStringLiteral( "PADDED" ),
692 QStringLiteral( "PARAMETER" ),
693 QStringLiteral( "PARAMETERS" ),
694 QStringLiteral( "PART" ),
695 QStringLiteral( "PARTIAL" ),
696 QStringLiteral( "PARTITION" ),
697 QStringLiteral( "PARTITIONED" ),
698 QStringLiteral( "PARTITIONING" ),
699 QStringLiteral( "PASSWORD" ),
700 QStringLiteral( "PATH" ),
701 QStringLiteral( "PATTERN" ),
702 QStringLiteral( "PCTFREE" ),
703 QStringLiteral( "PER" ),
704 QStringLiteral( "PERCENT" ),
705 QStringLiteral( "PERCENTILE_CONT" ),
706 QStringLiteral( "PERCENTILE_DISC" ),
707 QStringLiteral( "PERCENT_RANK" ),
708 QStringLiteral( "PERIOD" ),
709 QStringLiteral( "PERM" ),
710 QStringLiteral( "PERMANENT" ),
711 QStringLiteral( "PIECESIZE" ),
712 QStringLiteral( "PIVOT" ),
713 QStringLiteral( "PLACING" ),
714 QStringLiteral( "PLAN" ),
715 QStringLiteral( "PORTION" ),
716 QStringLiteral( "POSITION" ),
717 QStringLiteral( "POSITION_REGEX" ),
718 QStringLiteral( "POSTFIX" ),
719 QStringLiteral( "POWER" ),
720 QStringLiteral( "PRECEDES" ),
721 QStringLiteral( "PRECISION" ),
722 QStringLiteral( "PREFIX" ),
723 QStringLiteral( "PREORDER" ),
724 QStringLiteral( "PREPARE" ),
725 QStringLiteral( "PRESERVE" ),
726 QStringLiteral( "PREVVAL" ),
727 QStringLiteral( "PRIMARY" ),
728 QStringLiteral( "PRINT" ),
729 QStringLiteral( "PRIOR" ),
730 QStringLiteral( "PRIQTY" ),
731 QStringLiteral( "PRIVATE" ),
732 QStringLiteral( "PRIVILEGES" ),
733 QStringLiteral( "PROC" ),
734 QStringLiteral( "PROCEDURE" ),
735 QStringLiteral( "PROFILE" ),
736 QStringLiteral( "PROGRAM" ),
737 QStringLiteral( "PROPORTIONAL" ),
738 QStringLiteral( "PROTECTION" ),
739 QStringLiteral( "PSID" ),
740 QStringLiteral( "PTF" ),
741 QStringLiteral( "PUBLIC" ),
742 QStringLiteral( "PURGE" ),
743 QStringLiteral( "QUALIFIED" ),
744 QStringLiteral( "QUALIFY" ),
745 QStringLiteral( "QUANTILE" ),
746 QStringLiteral( "QUERY" ),
747 QStringLiteral( "QUERYNO" ),
748 QStringLiteral( "RADIANS" ),
749 QStringLiteral( "RAISERROR" ),
750 QStringLiteral( "RANDOM" ),
751 QStringLiteral( "RANGE" ),
752 QStringLiteral( "RANGE_N" ),
753 QStringLiteral( "RANK" ),
754 QStringLiteral( "RAW" ),
755 QStringLiteral( "READ" ),
756 QStringLiteral( "READS" ),
757 QStringLiteral( "READTEXT" ),
758 QStringLiteral( "READ_WRITE" ),
759 QStringLiteral( "REAL" ),
760 QStringLiteral( "RECONFIGURE" ),
761 QStringLiteral( "RECURSIVE" ),
762 QStringLiteral( "REF" ),
763 QStringLiteral( "REFERENCES" ),
764 QStringLiteral( "REFERENCING" ),
765 QStringLiteral( "REFRESH" ),
766 QStringLiteral( "REGEXP" ),
767 QStringLiteral( "REGR_AVGX" ),
768 QStringLiteral( "REGR_AVGY" ),
769 QStringLiteral( "REGR_COUNT" ),
770 QStringLiteral( "REGR_INTERCEPT" ),
771 QStringLiteral( "REGR_R2" ),
772 QStringLiteral( "REGR_SLOPE" ),
773 QStringLiteral( "REGR_SXX" ),
774 QStringLiteral( "REGR_SXY" ),
775 QStringLiteral( "REGR_SYY" ),
776 QStringLiteral( "RELATIVE" ),
777 QStringLiteral( "RELEASE" ),
778 QStringLiteral( "RENAME" ),
779 QStringLiteral( "REPEAT" ),
780 QStringLiteral( "REPLACE" ),
781 QStringLiteral( "REPLICATION" ),
782 QStringLiteral( "REPOVERRIDE" ),
783 QStringLiteral( "REQUEST" ),
784 QStringLiteral( "REQUIRE" ),
785 QStringLiteral( "RESIGNAL" ),
786 QStringLiteral( "RESOURCE" ),
787 QStringLiteral( "RESTART" ),
788 QStringLiteral( "RESTORE" ),
789 QStringLiteral( "RESTRICT" ),
790 QStringLiteral( "RESULT" ),
791 QStringLiteral( "RESULT_SET_LOCATOR" ),
792 QStringLiteral( "RESUME" ),
793 QStringLiteral( "RET" ),
794 QStringLiteral( "RETRIEVE" ),
795 QStringLiteral( "RETURN" ),
796 QStringLiteral( "RETURNING" ),
797 QStringLiteral( "RETURNS" ),
798 QStringLiteral( "REVALIDATE" ),
799 QStringLiteral( "REVERT" ),
800 QStringLiteral( "REVOKE" ),
801 QStringLiteral( "RIGHT" ),
802 QStringLiteral( "RIGHTS" ),
803 QStringLiteral( "RLIKE" ),
804 QStringLiteral( "ROLE" ),
805 QStringLiteral( "ROLLBACK" ),
806 QStringLiteral( "ROLLFORWARD" ),
807 QStringLiteral( "ROLLUP" ),
808 QStringLiteral( "ROUND_CEILING" ),
809 QStringLiteral( "ROUND_DOWN" ),
810 QStringLiteral( "ROUND_FLOOR" ),
811 QStringLiteral( "ROUND_HALF_DOWN" ),
812 QStringLiteral( "ROUND_HALF_EVEN" ),
813 QStringLiteral( "ROUND_HALF_UP" ),
814 QStringLiteral( "ROUND_UP" ),
815 QStringLiteral( "ROUTINE" ),
816 QStringLiteral( "ROW" ),
817 QStringLiteral( "ROWCOUNT" ),
818 QStringLiteral( "ROWGUIDCOL" ),
819 QStringLiteral( "ROWID" ),
820 QStringLiteral( "ROWNUM" ),
821 QStringLiteral( "ROW_NUMBER" ),
822 QStringLiteral( "ROWS" ),
823 QStringLiteral( "ROWSET" ),
824 QStringLiteral( "RULE" ),
825 QStringLiteral( "RUN" ),
826 QStringLiteral( "RUNNING" ),
827 QStringLiteral( "SAMPLE" ),
828 QStringLiteral( "SAMPLEID" ),
829 QStringLiteral( "SAVE" ),
830 QStringLiteral( "SAVEPOINT" ),
831 QStringLiteral( "SCHEMA" ),
832 QStringLiteral( "SCHEMAS" ),
833 QStringLiteral( "SCOPE" ),
834 QStringLiteral( "SCRATCHPAD" ),
835 QStringLiteral( "SCROLL" ),
836 QStringLiteral( "SEARCH" ),
837 QStringLiteral( "SECOND" ),
838 QStringLiteral( "SECOND_MICROSECOND" ),
839 QStringLiteral( "SECONDS" ),
840 QStringLiteral( "SECQTY" ),
841 QStringLiteral( "SECTION" ),
842 QStringLiteral( "SECURITY" ),
843 QStringLiteral( "SECURITYAUDIT" ),
844 QStringLiteral( "SEEK" ),
845 QStringLiteral( "SEL" ),
846 QStringLiteral( "SELECT" ),
847 QStringLiteral( "SEMANTICKEYPHRASETABLE" ),
848 QStringLiteral( "SEMANTICSIMILARITYDETAILSTABLE" ),
849 QStringLiteral( "SEMANTICSIMILARITYTABLE" ),
850 QStringLiteral( "SENSITIVE" ),
851 QStringLiteral( "SEPARATOR" ),
852 QStringLiteral( "SEQUENCE" ),
853 QStringLiteral( "SESSION" ),
854 QStringLiteral( "SESSION_USER" ),
855 QStringLiteral( "SET" ),
856 QStringLiteral( "SETRESRATE" ),
857 QStringLiteral( "SETS" ),
858 QStringLiteral( "SETSESSRATE" ),
859 QStringLiteral( "SETUSER" ),
860 QStringLiteral( "SHARE" ),
861 QStringLiteral( "SHOW" ),
862 QStringLiteral( "SHUTDOWN" ),
863 QStringLiteral( "SIGNAL" ),
864 QStringLiteral( "SIMILAR" ),
865 QStringLiteral( "SIMPLE" ),
866 QStringLiteral( "SIN" ),
867 QStringLiteral( "SINH" ),
868 QStringLiteral( "SIZE" ),
869 QStringLiteral( "SKEW" ),
870 QStringLiteral( "SKIP" ),
871 QStringLiteral( "SMALLINT" ),
872 QStringLiteral( "SOME" ),
873 QStringLiteral( "SOUNDEX" ),
874 QStringLiteral( "SOURCE" ),
875 QStringLiteral( "SPACE" ),
876 QStringLiteral( "SPATIAL" ),
877 QStringLiteral( "SPECIFIC" ),
878 QStringLiteral( "SPECIFICTYPE" ),
879 QStringLiteral( "SPOOL" ),
880 QStringLiteral( "SQL" ),
881 QStringLiteral( "SQL_BIG_RESULT" ),
882 QStringLiteral( "SQL_CALC_FOUND_ROWS" ),
883 QStringLiteral( "SQLEXCEPTION" ),
884 QStringLiteral( "SQL_SMALL_RESULT" ),
885 QStringLiteral( "SQLSTATE" ),
886 QStringLiteral( "SQLTEXT" ),
887 QStringLiteral( "SQLWARNING" ),
888 QStringLiteral( "SQRT" ),
889 QStringLiteral( "SS" ),
890 QStringLiteral( "SSL" ),
891 QStringLiteral( "STANDARD" ),
892 QStringLiteral( "START" ),
893 QStringLiteral( "STARTING" ),
894 QStringLiteral( "STARTUP" ),
895 QStringLiteral( "STATE" ),
896 QStringLiteral( "STATEMENT" ),
897 QStringLiteral( "STATIC" ),
898 QStringLiteral( "STATISTICS" ),
899 QStringLiteral( "STAY" ),
900 QStringLiteral( "STDDEV_POP" ),
901 QStringLiteral( "STDDEV_SAMP" ),
902 QStringLiteral( "STEPINFO" ),
903 QStringLiteral( "STOGROUP" ),
904 QStringLiteral( "STORED" ),
905 QStringLiteral( "STORES" ),
906 QStringLiteral( "STRAIGHT_JOIN" ),
907 QStringLiteral( "STRING_CS" ),
908 QStringLiteral( "STRUCTURE" ),
909 QStringLiteral( "STYLE" ),
910 QStringLiteral( "SUBMULTISET" ),
911 QStringLiteral( "SUBSCRIBER" ),
912 QStringLiteral( "SUBSET" ),
913 QStringLiteral( "SUBSTR" ),
914 QStringLiteral( "SUBSTRING" ),
915 QStringLiteral( "SUBSTRING_REGEX" ),
916 QStringLiteral( "SUCCEEDS" ),
917 QStringLiteral( "SUCCESSFUL" ),
918 QStringLiteral( "SUM" ),
919 QStringLiteral( "SUMMARY" ),
920 QStringLiteral( "SUSPEND" ),
921 QStringLiteral( "SYMMETRIC" ),
922 QStringLiteral( "SYNONYM" ),
923 QStringLiteral( "SYSDATE" ),
924 QStringLiteral( "SYSTEM" ),
925 QStringLiteral( "SYSTEM_TIME" ),
926 QStringLiteral( "SYSTEM_USER" ),
927 QStringLiteral( "SYSTIMESTAMP" ),
928 QStringLiteral( "TABLE" ),
929 QStringLiteral( "TABLESAMPLE" ),
930 QStringLiteral( "TABLESPACE" ),
931 QStringLiteral( "TAN" ),
932 QStringLiteral( "TANH" ),
933 QStringLiteral( "TBL_CS" ),
934 QStringLiteral( "TEMPORARY" ),
935 QStringLiteral( "TERMINATE" ),
936 QStringLiteral( "TERMINATED" ),
937 QStringLiteral( "TEXTSIZE" ),
938 QStringLiteral( "THAN" ),
939 QStringLiteral( "THEN" ),
940 QStringLiteral( "THRESHOLD" ),
941 QStringLiteral( "TIME" ),
942 QStringLiteral( "TIMESTAMP" ),
943 QStringLiteral( "TIMEZONE_HOUR" ),
944 QStringLiteral( "TIMEZONE_MINUTE" ),
945 QStringLiteral( "TINYBLOB" ),
946 QStringLiteral( "TINYINT" ),
947 QStringLiteral( "TINYTEXT" ),
948 QStringLiteral( "TITLE" ),
949 QStringLiteral( "TO" ),
950 QStringLiteral( "TOP" ),
951 QStringLiteral( "TRACE" ),
952 QStringLiteral( "TRAILING" ),
953 QStringLiteral( "TRAN" ),
954 QStringLiteral( "TRANSACTION" ),
955 QStringLiteral( "TRANSLATE" ),
956 QStringLiteral( "TRANSLATE_CHK" ),
957 QStringLiteral( "TRANSLATE_REGEX" ),
958 QStringLiteral( "TRANSLATION" ),
959 QStringLiteral( "TREAT" ),
960 QStringLiteral( "TRIGGER" ),
961 QStringLiteral( "TRIM" ),
962 QStringLiteral( "TRIM_ARRAY" ),
963 QStringLiteral( "TRUE" ),
964 QStringLiteral( "TRUNCATE" ),
965 QStringLiteral( "TRY_CONVERT" ),
966 QStringLiteral( "TSEQUAL" ),
967 QStringLiteral( "TYPE" ),
968 QStringLiteral( "UC" ),
969 QStringLiteral( "UESCAPE" ),
970 QStringLiteral( "UID" ),
971 QStringLiteral( "UNDEFINED" ),
972 QStringLiteral( "UNDER" ),
973 QStringLiteral( "UNDO" ),
974 QStringLiteral( "UNION" ),
975 QStringLiteral( "UNIQUE" ),
976 QStringLiteral( "UNKNOWN" ),
977 QStringLiteral( "UNLOCK" ),
978 QStringLiteral( "UNNEST" ),
979 QStringLiteral( "UNPIVOT" ),
980 QStringLiteral( "UNSIGNED" ),
981 QStringLiteral( "UNTIL" ),
982 QStringLiteral( "UPD" ),
983 QStringLiteral( "UPDATE" ),
984 QStringLiteral( "UPDATETEXT" ),
985 QStringLiteral( "UPPER" ),
986 QStringLiteral( "UPPERCASE" ),
987 QStringLiteral( "USAGE" ),
988 QStringLiteral( "USE" ),
989 QStringLiteral( "USER" ),
990 QStringLiteral( "USING" ),
991 QStringLiteral( "UTC_DATE" ),
992 QStringLiteral( "UTC_TIME" ),
993 QStringLiteral( "UTC_TIMESTAMP" ),
994 QStringLiteral( "VALIDATE" ),
995 QStringLiteral( "VALIDPROC" ),
996 QStringLiteral( "VALUE" ),
997 QStringLiteral( "VALUE_OF" ),
998 QStringLiteral( "VALUES" ),
999 QStringLiteral( "VARBINARY" ),
1000 QStringLiteral( "VARBYTE" ),
1001 QStringLiteral( "VARCHAR" ),
1002 QStringLiteral( "VARCHAR2" ),
1003 QStringLiteral( "VARCHARACTER" ),
1004 QStringLiteral( "VARGRAPHIC" ),
1005 QStringLiteral( "VARIABLE" ),
1006 QStringLiteral( "VARIADIC" ),
1007 QStringLiteral( "VARIANT" ),
1008 QStringLiteral( "VAR_POP" ),
1009 QStringLiteral( "VAR_SAMP" ),
1010 QStringLiteral( "VARYING" ),
1011 QStringLiteral( "VCAT" ),
1012 QStringLiteral( "VERBOSE" ),
1013 QStringLiteral( "VERSIONING" ),
1014 QStringLiteral( "VIEW" ),
1015 QStringLiteral( "VIRTUAL" ),
1016 QStringLiteral( "VOLATILE" ),
1017 QStringLiteral( "VOLUMES" ),
1018 QStringLiteral( "WAIT" ),
1019 QStringLiteral( "WAITFOR" ),
1020 QStringLiteral( "WHEN" ),
1021 QStringLiteral( "WHENEVER" ),
1022 QStringLiteral( "WHERE" ),
1023 QStringLiteral( "WHILE" ),
1024 QStringLiteral( "WIDTH_BUCKET" ),
1025 QStringLiteral( "WINDOW" ),
1026 QStringLiteral( "WITH" ),
1027 QStringLiteral( "WITHIN" ),
1028 QStringLiteral( "WITHIN_GROUP" ),
1029 QStringLiteral( "WITHOUT" ),
1030 QStringLiteral( "WLM" ),
1031 QStringLiteral( "WORK" ),
1032 QStringLiteral( "WRITE" ),
1033 QStringLiteral( "WRITETEXT" ),
1034 QStringLiteral( "XMLCAST" ),
1035 QStringLiteral( "XMLEXISTS" ),
1036 QStringLiteral( "XMLNAMESPACES" ),
1037 QStringLiteral( "XOR" ),
1038 QStringLiteral( "YEAR" ),
1039 QStringLiteral( "YEAR_MONTH" ),
1040 QStringLiteral( "YEARS" ),
1041 QStringLiteral( "ZEROFILL" ),
1042 QStringLiteral( "ZEROIFNULL" ),
1043 QStringLiteral( "ZONE" ),
1044 }
1045 }
1046 };
1047}
1048
1053
1055{
1056 return QStringLiteral( "pk" );
1057}
1058
1060{
1061 return QStringLiteral( "geom" );
1062}
1063
1065{
1066 return {};
1067}
1068
1070{
1071 return {};
1072}
1073
1075{
1076 return {};
1077}
1078
1083
1085{
1086 return {};
1087}
1088
1093
1095 const QString &name,
1096 const QgsFields &fields,
1097 Qgis::WkbType wkbType,
1099 bool overwrite,
1100 const QMap<QString, QVariant> *
1101 options ) const
1102{
1103 Q_UNUSED( schema );
1104 Q_UNUSED( name );
1105 Q_UNUSED( fields );
1106 Q_UNUSED( srs );
1107 Q_UNUSED( overwrite );
1108 Q_UNUSED( options );
1109 Q_UNUSED( wkbType );
1110 throw QgsProviderConnectionException( QObject::tr( "Operation 'createVectorTable' is not supported" ) );
1111}
1112
1113void QgsAbstractDatabaseProviderConnection::renameVectorTable( const QString &, const QString &, const QString & ) const
1114{
1115 checkCapability( Capability::RenameVectorTable );
1116}
1117
1118
1124
1125void QgsAbstractDatabaseProviderConnection::renameRasterTable( const QString &, const QString &, const QString & ) const
1126{
1127 checkCapability( Capability::RenameRasterTable );
1128}
1129
1130void QgsAbstractDatabaseProviderConnection::dropVectorTable( const QString &, const QString & ) const
1131{
1132 checkCapability( Capability::DropVectorTable );
1133}
1134
1135bool QgsAbstractDatabaseProviderConnection::tableExists( const QString &schema, const QString &name ) const
1136{
1137 checkCapability( Capability::TableExists );
1138 const QList<QgsAbstractDatabaseProviderConnection::TableProperty> constTables { tables( schema ) };
1139 for ( const auto &t : constTables )
1140 {
1141 if ( t.tableName() == name )
1142 {
1143 return true;
1144 }
1145 }
1146 return false;
1147}
1148
1149
1150QList<QgsLayerMetadataProviderResult> QgsAbstractDatabaseProviderConnection::searchLayerMetadata( const QgsMetadataSearchContext &searchContext, const QString &searchString, const QgsRectangle &geographicExtent, QgsFeedback *feedback ) const
1151{
1152 Q_UNUSED( feedback );
1153 Q_UNUSED( searchContext );
1154 Q_UNUSED( searchString );
1155 Q_UNUSED( geographicExtent );
1156 throw QgsNotSupportedException( QObject::tr( "Provider %1 has no %2 method" ).arg( providerKey(), QStringLiteral( "searchLayerMetadata" ) ) );
1157}
1158
1159void QgsAbstractDatabaseProviderConnection::dropRasterTable( const QString &, const QString & ) const
1160{
1161 checkCapability( Capability::DropRasterTable );
1162}
1163
1165{
1166 checkCapability( Capability::CreateSchema );
1167}
1168
1169void QgsAbstractDatabaseProviderConnection::dropSchema( const QString &, bool ) const
1170{
1171 checkCapability( Capability::DropSchema );
1172}
1173
1174void QgsAbstractDatabaseProviderConnection::renameSchema( const QString &, const QString & ) const
1175{
1176 checkCapability( Capability::RenameSchema );
1177}
1178
1179QList<QList<QVariant>> QgsAbstractDatabaseProviderConnection::executeSql( const QString &sql, QgsFeedback *feedback ) const
1180{
1181 return execSql( sql, feedback ).rows();
1182}
1183
1184
1190
1191
1192void QgsAbstractDatabaseProviderConnection::vacuum( const QString &, const QString & ) const
1193{
1194 checkCapability( Capability::Vacuum );
1195}
1196
1201
1203{
1204 checkCapability( Capability::SqlLayers );
1205 return nullptr;
1206}
1207
1209{
1210 checkCapability( Capability::SqlLayers );
1211 return true;
1212}
1213
1214void QgsAbstractDatabaseProviderConnection::deleteSpatialIndex( const QString &, const QString &, const QString & ) const
1215{
1216 checkCapability( Capability::DeleteSpatialIndex );
1217}
1218
1219bool QgsAbstractDatabaseProviderConnection::spatialIndexExists( const QString &, const QString &, const QString & ) const
1220{
1221 checkCapability( Capability::SpatialIndexExists );
1222 return false;
1223}
1224
1225void QgsAbstractDatabaseProviderConnection::deleteField( const QString &fieldName, const QString &schema, const QString &tableName, bool ) const
1226{
1227 checkCapability( Capability::DeleteField );
1228
1229 QgsVectorLayer::LayerOptions options { false, false };
1230 options.skipCrsValidation = true;
1231 std::unique_ptr<QgsVectorLayer> vl { std::make_unique<QgsVectorLayer>( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) };
1232 if ( ! vl->isValid() )
1233 {
1234 throw QgsProviderConnectionException( QObject::tr( "Could not create a vector layer for table '%1' in schema '%2'" )
1235 .arg( tableName, schema ) );
1236 }
1237 if ( vl->fields().lookupField( fieldName ) == -1 )
1238 {
1239 throw QgsProviderConnectionException( QObject::tr( "Could not find field '%1' in table '%2' in schema '%3'" )
1240 .arg( fieldName, tableName, schema ) );
1241
1242 }
1243 if ( ! vl->dataProvider()->deleteAttributes( { vl->fields().lookupField( fieldName ) } ) )
1244 {
1245 throw QgsProviderConnectionException( QObject::tr( "Unknown error deleting field '%1' in table '%2' in schema '%3'" )
1246 .arg( fieldName, tableName, schema ) );
1247 }
1248}
1249
1250void QgsAbstractDatabaseProviderConnection::addField( const QgsField &field, const QString &schema, const QString &tableName ) const
1251{
1252 checkCapability( Capability::AddField );
1253
1254 QgsVectorLayer::LayerOptions options { false, false };
1255 options.skipCrsValidation = true;
1256 auto vl = std::make_unique<QgsVectorLayer>( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) ;
1257 if ( ! vl->isValid() )
1258 {
1259 throw QgsProviderConnectionException( QObject::tr( "Could not create a vector layer for table '%1' in schema '%2'" )
1260 .arg( tableName, schema ) );
1261 }
1262 if ( vl->fields().lookupField( field.name() ) != -1 )
1263 {
1264 throw QgsProviderConnectionException( QObject::tr( "Field '%1' in table '%2' in schema '%3' already exists" )
1265 .arg( field.name(), tableName, schema ) );
1266
1267 }
1268 if ( ! vl->dataProvider()->addAttributes( { field } ) )
1269 {
1270 throw QgsProviderConnectionException( QObject::tr( "Unknown error adding field '%1' in table '%2' in schema '%3'" )
1271 .arg( field.name(), tableName, schema ) );
1272 }
1273}
1274
1275void QgsAbstractDatabaseProviderConnection::renameField( const QString &schema, const QString &tableName, const QString &name, const QString &newName ) const
1276{
1277 checkCapability( Capability::RenameField );
1278
1279 QgsVectorLayer::LayerOptions options { false, false };
1280 options.skipCrsValidation = true;
1281 auto vl = std::make_unique<QgsVectorLayer>( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) ;
1282 if ( ! vl->isValid() )
1283 {
1284 throw QgsProviderConnectionException( QObject::tr( "Could not create a vector layer for table '%1' in schema '%2'" )
1285 .arg( tableName, schema ) );
1286 }
1287 int existingIndex = vl->fields().lookupField( name );
1288 if ( existingIndex == -1 )
1289 {
1290 throw QgsProviderConnectionException( QObject::tr( "Field '%1' in table '%2' in does not exist" )
1291 .arg( name, tableName ) );
1292
1293 }
1294 if ( vl->fields().lookupField( newName ) != -1 )
1295 {
1296 throw QgsProviderConnectionException( QObject::tr( "A field with name '%1' already exists in table '%2'" )
1297 .arg( newName, tableName ) );
1298
1299 }
1300 if ( ! vl->dataProvider()->renameAttributes( {{existingIndex, newName}} ) )
1301 {
1302 throw QgsProviderConnectionException( QObject::tr( "Unknown error renaming field '%1' in table '%2' to '%3'" )
1303 .arg( name, tableName, newName ) );
1304 }
1305}
1306
1307QList<QgsAbstractDatabaseProviderConnection::TableProperty> QgsAbstractDatabaseProviderConnection::tables( const QString &, const QgsAbstractDatabaseProviderConnection::TableFlags &, QgsFeedback * ) const
1308{
1309 checkCapability( Capability::Tables );
1310 return QList<QgsAbstractDatabaseProviderConnection::TableProperty>();
1311}
1312
1313
1315{
1316 checkCapability( Capability::Tables );
1317 const QList<QgsAbstractDatabaseProviderConnection::TableProperty> constTables { tables( schema, TableFlags(), feedback ) };
1318 for ( const auto &t : constTables )
1319 {
1320 if ( t.tableName() == name )
1321 {
1322 return t;
1323 }
1324 }
1325 throw QgsProviderConnectionException( QObject::tr( "Table '%1' was not found in schema '%2'" )
1326 .arg( name, schema ) );
1327}
1328
1329QList<QgsAbstractDatabaseProviderConnection::TableProperty> QgsAbstractDatabaseProviderConnection::tablesInt( const QString &schema, const int flags ) const
1330{
1331 return tables( schema, static_cast<QgsAbstractDatabaseProviderConnection::TableFlags>( flags ) );
1332}
1333
1334
1336{
1337 checkCapability( Capability::Schemas );
1338 return QStringList();
1339}
1340
1342{
1343 return mTableName;
1344}
1345
1347{
1348 mTableName = name;
1349}
1350
1352{
1353 // Do not add the type if it's already present
1355 for ( const auto &t : std::as_const( mGeometryColumnTypes ) )
1356 {
1357 if ( t == toAdd )
1358 {
1359 return;
1360 }
1361 }
1362 mGeometryColumnTypes.push_back( toAdd );
1363}
1364
1365QList<QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType> QgsAbstractDatabaseProviderConnection::TableProperty::geometryColumnTypes() const
1366{
1367 return mGeometryColumnTypes;
1368}
1369
1370
1371QgsFields QgsAbstractDatabaseProviderConnection::fields( const QString &schema, const QString &tableName, QgsFeedback * ) const
1372{
1373 QgsVectorLayer::LayerOptions options { false, true };
1374 options.skipCrsValidation = true;
1375 QgsVectorLayer vl { tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options };
1376 if ( vl.isValid() )
1377 {
1378 // Note: this implementation works for providers that do not hide any "special" field (geometry or PKs)
1379 return vl.fields();
1380 }
1381 else
1382 {
1383 throw QgsProviderConnectionException( QObject::tr( "Error retrieving fields information for uri: %1" ).arg( vl.publicSource() ) );
1384 }
1385}
1386
1388{
1389 checkCapability( Capability::ListFieldDomains );
1390 return QStringList();
1391}
1392
1394{
1395 checkCapability( Capability::RetrieveFieldDomain );
1396 return nullptr;
1397}
1398
1399void QgsAbstractDatabaseProviderConnection::setFieldDomainName( const QString &, const QString &, const QString &, const QString & ) const
1400{
1401 checkCapability( Capability::SetFieldDomain );
1402}
1403
1405{
1406 checkCapability( Capability::AddFieldDomain );
1407}
1408
1413
1414void QgsAbstractDatabaseProviderConnection::deleteFieldDomain( const QString &, const QString & ) const
1415{
1417}
1418
1419void QgsAbstractDatabaseProviderConnection::setFieldAlias( const QString &, const QString &, const QString &, const QString & ) const
1420{
1422}
1423
1424void QgsAbstractDatabaseProviderConnection::setTableComment( const QString &, const QString &, const QString & ) const
1425{
1427}
1428
1429void QgsAbstractDatabaseProviderConnection::setFieldComment( const QString &, const QString &, const QString &, const QString & ) const
1430{
1432}
1433
1434QList< QgsWeakRelation > QgsAbstractDatabaseProviderConnection::relationships( const QString &, const QString & ) const
1435{
1436 checkCapability( Capability::RetrieveRelationships );
1437 return {};
1438}
1439
1444
1449
1454
1456{
1457 QString n = mTableName;
1458 if ( mGeometryColumnCount > 1 ) n += '.' + mGeometryColumn;
1459 return n;
1460}
1461
1462void QgsAbstractDatabaseProviderConnection::moveTableToSchema( const QString &schema, const QString &tableName, const QString &targetSchema ) const
1463{
1464 Q_UNUSED( schema );
1465 Q_UNUSED( tableName );
1466 Q_UNUSED( targetSchema );
1467 checkCapability( Capability::MoveTableToSchema );
1468}
1469
1471{
1472 TableProperty property;
1473
1474 Q_ASSERT( index >= 0 && index < mGeometryColumnTypes.size() );
1475
1476 property.mGeometryColumnTypes << mGeometryColumnTypes[ index ];
1477 property.mSchema = mSchema;
1478 property.mTableName = mTableName;
1479 property.mGeometryColumn = mGeometryColumn;
1480 property.mPkColumns = mPkColumns;
1481 property.mGeometryColumnCount = mGeometryColumnCount;
1482 property.mFlags = mFlags;
1483 property.mComment = mComment;
1484 property.mInfo = mInfo;
1485 return property;
1486}
1487
1492
1494{
1495 int res = 0;
1496 for ( const TableProperty::GeometryColumnType &ct : std::as_const( mGeometryColumnTypes ) )
1497 {
1498 res = std::max( res, QgsWkbTypes::coordDimensions( ct.wkbType ) );
1499 }
1500 return res;
1501}
1502
1504{
1505 return mSchema == other.mSchema &&
1506 mTableName == other.mTableName &&
1507 mGeometryColumn == other.mGeometryColumn &&
1508 mGeometryColumnCount == other.mGeometryColumnCount &&
1509 mPkColumns == other.mPkColumns &&
1510 mFlags == other.mFlags &&
1511 mComment == other.mComment &&
1512 mInfo == other.mInfo;
1513}
1514
1515
1516void QgsAbstractDatabaseProviderConnection::TableProperty::setGeometryColumnTypes( const QList<QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType> &columnTypes )
1517{
1518 mGeometryColumnTypes = columnTypes;
1519}
1520
1521
1523{
1524 return mGeometryColumnCount;
1525}
1526
1531
1533{
1534 return mInfo;
1535}
1536
1538{
1539 mInfo = info;
1540}
1541
1543{
1544 return mComment;
1545}
1546
1551
1556
1561
1562QList<QgsCoordinateReferenceSystem> QgsAbstractDatabaseProviderConnection::TableProperty::crsList() const
1563{
1564 QList<QgsCoordinateReferenceSystem> crss;
1565 for ( const auto &t : std::as_const( mGeometryColumnTypes ) )
1566 {
1567 crss.push_back( t.crs );
1568 }
1569 return crss;
1570}
1571
1573{
1574 return mPkColumns;
1575}
1576
1578{
1579 mPkColumns = pkColumns;
1580}
1581
1583{
1584 return mGeometryColumn;
1585}
1586
1591
1593{
1594 return mSchema;
1595}
1596
1598{
1599 mSchema = schema;
1600}
1601
1603
1605{
1606 return mColumns;
1607}
1608
1610{
1611
1612 QList<QList<QVariant> > rows;
1613
1614 while ( mResultIterator &&
1615 mResultIterator->hasNextRow() &&
1616 ( ! feedback || ! feedback->isCanceled() ) )
1617 {
1618 const QVariantList row( mResultIterator->nextRow() );
1619 if ( row.isEmpty() )
1620 {
1621 break;
1622 }
1623 else
1624 {
1625 rows.push_back( row );
1626 }
1627 }
1628 return rows;
1629}
1630
1632{
1633 if ( ! mResultIterator )
1634 {
1635 return QList<QVariant>();
1636 }
1637 return mResultIterator->nextRow();
1638}
1639
1640
1642{
1643 if ( ! mResultIterator )
1644 {
1645 return 0;
1646 }
1647 return mResultIterator->fetchedRowCount();
1648}
1649
1651{
1652 if ( ! mResultIterator )
1653 {
1654 return static_cast<long long>( Qgis::FeatureCountState::UnknownCount );
1655 }
1656 return mResultIterator->rowCount();
1657}
1658
1659bool QgsAbstractDatabaseProviderConnection::splitSimpleQuery( const QString &sql, QStringList &columns, QStringList &tables, QString &where )
1660{
1661 const QgsSQLStatement statement { sql };
1662 if ( statement.hasParserError() )
1663 {
1664 return false;
1665 }
1666
1667 const QgsSQLStatement::NodeSelect *nodeSelect = dynamic_cast<const QgsSQLStatement::NodeSelect *>( statement.rootNode() );
1668
1669 if ( !nodeSelect || !nodeSelect->joins().empty() || !nodeSelect->orderBy().empty() )
1670 {
1671 return false;
1672 }
1673
1674 const QList<QgsSQLStatement::NodeTableDef *> tablesList { nodeSelect->tables() };
1675
1676 if ( tablesList.empty() )
1677 {
1678 return false;
1679 }
1680
1681 for ( const QgsSQLStatement::NodeTableDef *tableDef : tablesList )
1682 {
1683 tables.append( tableDef->name() );
1684 }
1685
1686 const QList<QgsSQLStatement::NodeSelectedColumn *> columnsList { nodeSelect->columns() };
1687
1688 if ( columnsList.empty() )
1689 {
1690 return false;
1691 }
1692
1693 for ( const QgsSQLStatement::NodeSelectedColumn *colDef : columnsList )
1694 {
1695 columns.append( colDef->dump() );
1696 }
1697
1698 if ( nodeSelect->where() )
1699 {
1700 where = nodeSelect->where()->dump();
1701 }
1702
1703 return true;
1704}
1705
1706
1708{
1709 if ( ! mResultIterator )
1710 {
1711 return false;
1712 }
1713 return mResultIterator->hasNextRow();
1714}
1715
1716void QgsAbstractDatabaseProviderConnection::QueryResult::appendColumn( const QString &columnName )
1717{
1718 mColumns.push_back( columnName );
1719}
1720
1721
1722QgsAbstractDatabaseProviderConnection::QueryResult::QueryResult( std::shared_ptr<QgsAbstractDatabaseProviderConnection::QueryResult::QueryResultIterator> iterator )
1723 : mResultIterator( std::move( iterator ) )
1724{}
1725
1726double QgsAbstractDatabaseProviderConnection::QueryResult::queryExecutionTime() const
1727{
1728 return mQueryExecutionTime;
1729}
1730
1731void QgsAbstractDatabaseProviderConnection::QueryResult::setQueryExecutionTime( double queryExecutionTime )
1732{
1733 mQueryExecutionTime = queryExecutionTime;
1734}
1735
1736
1737QVariantList QgsAbstractDatabaseProviderConnection::QueryResult::QueryResultIterator::nextRow()
1738{
1739 QMutexLocker lock( &mMutex );
1740 const QVariantList row = nextRowPrivate();
1741 if ( ! row.isEmpty() )
1742 {
1743 mFetchedRowCount++;
1744 }
1745 return row;
1746}
1747
1748bool QgsAbstractDatabaseProviderConnection::QueryResult::QueryResultIterator::hasNextRow() const
1749{
1750 QMutexLocker lock( &mMutex );
1751 return hasNextRowPrivate();
1752}
1753
1754long long QgsAbstractDatabaseProviderConnection::QueryResult::QueryResultIterator::fetchedRowCount()
1755{
1756 QMutexLocker lock( &mMutex );
1757 return mFetchedRowCount;
1758}
1759
1760long long QgsAbstractDatabaseProviderConnection::QueryResult::QueryResultIterator::rowCount()
1761{
1762 QMutexLocker lock( &mMutex );
1763 return rowCountPrivate();
1764}
1765
1767
DatabaseProviderConnectionCapability2
The Capability enum represents the extended operations supported by the connection.
Definition qgis.h:5390
@ SetTableComment
Can set comments for tables via setTableComment().
Definition qgis.h:5393
@ DeleteFieldDomain
Can delete existing field domain.
Definition qgis.h:5395
@ SetFieldComment
Can set comments for fields via setFieldComment().
Definition qgis.h:5391
@ EditFieldDomain
Can edit existing field domain.
Definition qgis.h:5394
@ SetFieldAlias
Can set aliases for fields via setFieldAlias().
Definition qgis.h:5392
@ Keyword
SQL keyword.
Definition qgis.h:1109
@ Constant
SQL constant.
Definition qgis.h:1110
QFlags< RelationshipCapability > RelationshipCapabilities
Relationship capabilities.
Definition qgis.h:4443
QFlags< DatabaseProviderConnectionCapability2 > DatabaseProviderConnectionCapabilities2
Definition qgis.h:5398
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:277
QFlags< SqlLayerDefinitionCapability > SqlLayerDefinitionCapabilities
SQL layer definition capabilities.
Definition qgis.h:1099
virtual QString defaultGeometryColumnName() const
Returns the default name to use for a geometry column for the connection.
virtual void setFieldComment(const QString &fieldName, const QString &schema, const QString &tableName, const QString &comment) const
Sets the comment for the existing field with the specified name.
virtual QList< QgsWeakRelation > relationships(const QString &schema=QString(), const QString &tableName=QString()) const
Returns a list of relationships detected in the database.
virtual void createVectorTable(const QString &schema, const QString &name, const QgsFields &fields, Qgis::WkbType wkbType, const QgsCoordinateReferenceSystem &srs, bool overwrite, const QMap< QString, QVariant > *options) const
Creates an empty table with name in the given schema (schema is ignored if not supported by the backe...
virtual QgsVectorLayer * createSqlVectorLayer(const SqlVectorLayerOptions &options) const
Creates and returns a (possibly invalid) vector layer based on a SQL statement and options.
virtual bool tableExists(const QString &schema, const QString &name) const
Checks whether a table name exists in the given schema.
QList< QgsAbstractDatabaseProviderConnection::TableProperty > tablesInt(const QString &schema=QString(), const int flags=0) const
Returns information on the tables in the given schema.
virtual void updateRelationship(const QgsWeakRelation &relationship) const
Updates an existing relationship in the database.
virtual void renameField(const QString &schema, const QString &tableName, const QString &name, const QString &newName) const
Renames an existing field.
virtual void deleteFieldDomain(const QString &name, const QString &schema) const
Deletes the field domain with the specified name from the provider.
virtual void dropSchema(const QString &name, bool force=false) const
Drops an entire schema with the specified name.
Qgis::SqlLayerDefinitionCapabilities mSqlLayerDefinitionCapabilities
virtual void addField(const QgsField &field, const QString &schema, const QString &tableName) const
Adds a field.
virtual QList< QgsAbstractDatabaseProviderConnection::TableProperty > tables(const QString &schema=QString(), const QgsAbstractDatabaseProviderConnection::TableFlags &flags=QgsAbstractDatabaseProviderConnection::TableFlags(), QgsFeedback *feedback=nullptr) const
Returns information on the tables in the given schema.
Qgis::DatabaseProviderConnectionCapabilities2 mCapabilities2
virtual void vacuum(const QString &schema, const QString &name) const
Vacuum the database table with given schema and name (schema is ignored if not supported by the backe...
virtual QList< Qgis::FieldDomainType > supportedFieldDomainTypes() const
Returns a list of field domain types which are supported by the provider.
virtual void renameVectorTable(const QString &schema, const QString &name, const QString &newName) const
Renames a vector or aspatial table with given schema (schema is ignored if not supported by the backe...
virtual void createSchema(const QString &name) const
Creates a new schema with the specified name.
virtual void deleteSpatialIndex(const QString &schema, const QString &name, const QString &geometryColumn) const
Deletes the existing spatial index for the database table with given schema, name and geometryColumn ...
virtual void dropRasterTable(const QString &schema, const QString &name) const
Drops a raster table with given schema (schema is ignored if not supported by the backend) and name.
Qgis::DatabaseProviderConnectionCapabilities2 capabilities2() const
Returns extended connection capabilities.
virtual QueryResult execSql(const QString &sql, QgsFeedback *feedback=nullptr) const
Executes raw sql and returns the (possibly empty) query results, optionally feedback can be provided.
virtual QgsProviderSqlQueryBuilder * queryBuilder() const
Returns a SQL query builder for the connection, which provides an interface for provider-specific cre...
virtual void setFieldDomainName(const QString &fieldName, const QString &schema, const QString &tableName, const QString &domainName) const
Sets the field domain name for the existing field with the specified name.
virtual void deleteField(const QString &fieldName, const QString &schema, const QString &tableName, bool force=false) const
Deletes the field with the specified name.
virtual QString tableUri(const QString &schema, const QString &name) const
Returns the URI string for the given table and schema.
QFlags< GeometryColumnCapability > GeometryColumnCapabilities
virtual void deleteRelationship(const QgsWeakRelation &relationship) const
Deletes an existing relationship in the database.
Capability
The Capability enum represents the operations supported by the connection.
@ RetrieveFieldDomain
Can retrieve field domain details from provider via fieldDomain().
@ CreateSpatialIndex
The connection can create spatial indices.
@ AddRelationship
Can add new relationships to the database via addRelationship().
@ SqlLayers
Can create vector layers from SQL SELECT queries.
@ DropVectorTable
Can DROP a vector (or aspatial) table/layer.
@ DeleteSpatialIndex
The connection can delete spatial indices for tables.
@ RetrieveRelationships
Can retrieve relationships from the database.
@ SetFieldDomain
Can set the domain for an existing field via setFieldDomainName().
@ AddFieldDomain
Can add new field domains to the database via addFieldDomain().
@ DeleteRelationship
Can delete existing relationships from the database via deleteRelationship().
@ RenameVectorTable
Can RENAME a vector (or aspatial) table/layer.
@ RenameField
Can rename existing fields via renameField().
@ MoveTableToSchema
Can move table to another schema via moveTableToAnotherSchema().
@ ExecuteSql
Can execute raw SQL queries (without returning results).
@ UpdateRelationship
Can update existing relationships in the database via updateRelationship().
@ SpatialIndexExists
The connection can determine if a spatial index exists.
@ ListFieldDomains
Can return a list of field domain names via fieldDomainNames().
@ Schemas
Can list schemas (if not set, the connection does not support schemas).
virtual void createSpatialIndex(const QString &schema, const QString &name, const QgsAbstractDatabaseProviderConnection::SpatialIndexOptions &options=QgsAbstractDatabaseProviderConnection::SpatialIndexOptions()) const
Creates a spatial index for the database table with given schema and name (schema is ignored if not s...
virtual QStringList relatedTableTypes() const
Returns a list of the related table types supported by the database format.
static bool splitSimpleQuery(const QString &sql, QStringList &columns, QStringList &tables, QString &where)
Splits a simple query in the form "SELECT column(s) FROM table(s) [WHERE ...]" into its components.
virtual GeometryColumnCapabilities geometryColumnCapabilities()
Returns connection geometry column capabilities (Z, M, SinglePart, Curves).
virtual Qgis::SqlLayerDefinitionCapabilities sqlLayerDefinitionCapabilities()
Returns SQL layer definition capabilities (Filters, GeometryColumn, PrimaryKeys).
virtual void renameRasterTable(const QString &schema, const QString &name, const QString &newName) const
Renames a raster table with given schema (schema is ignored if not supported by the backend) and name...
virtual void dropVectorTable(const QString &schema, const QString &name) const
Drops a vector (or aspatial) table with given schema (schema is ignored if not supported by the backe...
virtual QStringList fieldDomainNames() const
Returns a list of field domain names present on the provider.
virtual void setFieldAlias(const QString &fieldName, const QString &schema, const QString &tableName, const QString &alias) const
Sets the alias for the existing field with the specified name.
virtual void renameSchema(const QString &name, const QString &newName) const
Renames a schema with the specified name.
virtual void addFieldDomain(const QgsFieldDomain &domain, const QString &schema) const
Adds a new field domain to the database.
virtual QList< QList< QVariant > > executeSql(const QString &sql, QgsFeedback *feedback=nullptr) const
Executes raw sql and returns the (possibly empty) list of results in a multi-dimensional array,...
virtual bool spatialIndexExists(const QString &schema, const QString &name, const QString &geometryColumn) const
Determines whether a spatial index exists for the database table with given schema,...
virtual QgsAbstractDatabaseProviderConnection::TableProperty table(const QString &schema, const QString &table, QgsFeedback *feedback=nullptr) const
Returns information on a table in the given schema.
virtual QMultiMap< Qgis::SqlKeywordCategory, QStringList > sqlDictionary()
Returns a dictionary of SQL keywords supported by the provider.
virtual Qgis::RelationshipCapabilities supportedRelationshipCapabilities() const
Returns the relationship capabilities supported by the provider.
virtual SqlVectorLayerOptions sqlOptions(const QString &layerSource)
Returns the SQL layer options from a layerSource.
virtual QSet< QString > illegalFieldNames() const
Returns a list of field names which are considered illegal by the connection and should not be used w...
virtual QStringList schemas() const
Returns information about the existing schemas.
virtual QList< Qgis::RelationshipCardinality > supportedRelationshipCardinalities() const
Returns a list of relationship cardinalities which are supported by the provider.
virtual QString createVectorLayerExporterDestinationUri(const QgsAbstractDatabaseProviderConnection::VectorLayerExporterOptions &options, QVariantMap &providerOptions) const
Creates a URI for use with QgsVectorLayerExporter corresponding to given destination table options fo...
virtual void moveTableToSchema(const QString &sourceSchema, const QString &tableName, const QString &targetSchema) const
Move table to a different schema.
virtual QList< Qgis::RelationshipStrength > supportedRelationshipStrengths() const
Returns a list of relationship strengths which are supported by the provider.
virtual QList< QgsLayerMetadataProviderResult > searchLayerMetadata(const QgsMetadataSearchContext &searchContext, const QString &searchString=QString(), const QgsRectangle &geographicExtent=QgsRectangle(), QgsFeedback *feedback=nullptr) const
Search the stored layer metadata in the connection, optionally limiting the search to the metadata id...
virtual void addRelationship(const QgsWeakRelation &relationship) const
Adds a new field relationship to the database.
virtual void updateFieldDomain(QgsFieldDomain *domain, const QString &schema) const
Update an existing field domain in the database, the domain is identified by name.
virtual QgsFieldDomain * fieldDomain(const QString &name) const
Returns the field domain with the specified name from the provider.
QgsAbstractDatabaseProviderConnection(const QString &name)
Creates a new connection with name by reading its configuration from the settings.
virtual void setTableComment(const QString &schema, const QString &tableName, const QString &comment) const
Sets the comment for the existing table with the specified name.
virtual QString defaultPrimaryKeyColumnName() const
Returns the default name to use for a primary key column for the connection.
virtual bool validateSqlVectorLayer(const SqlVectorLayerOptions &options, QString &message) const
Validates the SQL query options to determine if it is possible to create a vector layer based on a SQ...
Capabilities capabilities() const
Returns connection capabilities.
virtual QgsFields fields(const QString &schema, const QString &table, QgsFeedback *feedback=nullptr) const
Returns the fields of a table and schema.
QVariantMap configuration() const
Returns the connection configuration parameters.
QgsAbstractProviderConnection(const QString &name)
Creates a new connection with name by reading its configuration from the settings.
QString uri() const
Returns the connection data source URI string representation.
Represents a coordinate reference system (CRS).
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
bool isCanceled() const
Tells whether the operation has been canceled already.
Definition qgsfeedback.h:53
Base class for field domains.
Encapsulate a field in an attribute table or data source.
Definition qgsfield.h:54
QString name
Definition qgsfield.h:63
Container of fields for a vector layer.
Definition qgsfields.h:46
QString publicSource(bool hidePassword=false) const
Gets a version of the internal layer definition that has sensitive bits removed (for example,...
Custom exception class which is raised when an operation is not supported.
Custom exception class for provider connection related exceptions.
Provides an interface for provider-specific creation of SQL queries.
A rectangle specified with double values.
QList< QgsSQLStatement::NodeColumnSorted * > orderBy() const
Returns the list of order by columns.
QList< QgsSQLStatement::NodeSelectedColumn * > columns() const
Returns the list of columns.
QList< QgsSQLStatement::NodeJoin * > joins() const
Returns the list of joins.
QgsSQLStatement::Node * where() const
Returns the where clause.
QList< QgsSQLStatement::NodeTableDef * > tables() const
Returns the list of tables.
virtual QString dump() const =0
Abstract virtual dump method.
bool hasParserError() const
Returns true if an error occurred when parsing the input statement.
const QgsSQLStatement::Node * rootNode() const
Returns the root node of the statement.
Represents a vector layer which manages a vector based dataset.
Represent a QgsRelation with possibly unresolved layers or unmatched fields.
static Q_INVOKABLE int coordDimensions(Qgis::WkbType type)
Returns the coordinate dimension of the geometry type as an integer.
@ UnknownCount
Provider returned an unknown feature count.
Definition qgis.h:547
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition qgis.h:6798
The QueryResult class represents the result of a query executed by execSql().
QList< QList< QVariant > > rows(QgsFeedback *feedback=nullptr)
Returns the result rows by calling the iterator internally and fetching all the rows,...
long long fetchedRowCount() const
Returns the number of fetched rows.
bool hasNextRow() const
Returns true if there are more rows to fetch.
QList< QVariant > nextRow() const
Returns the next result row or an empty row if there are no rows left.
long long rowCount() const
Returns the number of rows returned by a SELECT query or Qgis::FeatureCountState::UnknownCount if unk...
QStringList columns() const
Returns the column names.
The SpatialIndexOptions contains extra options relating to spatial index creation.
The SqlVectorLayerOptions stores all information required to create a SQL (query) layer.
The GeometryColumnType struct represents the combination of geometry type and CRS for the table geome...
The TableProperty class represents a database table or view.
void setTableName(const QString &name)
Sets the table name to name.
bool operator==(const QgsAbstractDatabaseProviderConnection::TableProperty &other) const
void setPrimaryKeyColumns(const QStringList &primaryKeyColumns)
Sets the primary key column names to primaryKeyColumns.
QString defaultName() const
Returns the default name for the table entry.
QList< QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType > geometryColumnTypes() const
Returns the list of geometry column types and CRSs.
void setGeometryColumn(const QString &geometryColumn)
Sets the geometry column name to geometryColumn.
TableProperty at(int index) const
Returns the table property corresponding to the geometry type at the given index.
int maxCoordinateDimensions() const
Returns the maximum coordinate dimensions of the geometries of a vector table.
int geometryColumnCount() const
Returns the number of geometry columns in the original table this entry refers to.
QList< QgsCoordinateReferenceSystem > crsList() const
Returns the list of CRSs supported by the geometry column.
QVariantMap info() const
Returns additional information about the table.
void setInfo(const QVariantMap &info)
Sets additional information about the table to info.
QStringList primaryKeyColumns() const
Returns the list of primary key column names.
void setGeometryColumnTypes(const QList< QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType > &geometryColumnTypes)
Sets the geometry column types to geometryColumnTypes.
QString schema() const
Returns the schema or an empty string for backends that do not support a schema.
void setGeometryColumnCount(int geometryColumnCount)
Sets the geometryColumnCount.
void addGeometryColumnType(Qgis::WkbType type, const QgsCoordinateReferenceSystem &crs)
Appends the geometry column type with the given srid to the geometry column types list.
Stores all information required to create a QgsVectorLayerExporter for the backend.
Setting options for loading vector layers.
bool skipCrsValidation
Controls whether the layer is allowed to have an invalid/unknown CRS.