QGIS API Documentation
3.39.0-Master (9ea1ddbe645)
Loading...
Searching...
No Matches
src
core
providers
qgsprovidersqlquerybuilder.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsprovidersqlquerybuilder.cpp
3
begin : August 2022
4
copyright : (C) 2022 by Nyall Dawson
5
email : nyall dot dawson at gmail dot com
6
***************************************************************************/
7
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
***************************************************************************/
16
17
#include "
qgsprovidersqlquerybuilder.h
"
18
#include "
qgssqliteutils.h
"
19
20
QgsProviderSqlQueryBuilder::~QgsProviderSqlQueryBuilder
() =
default
;
21
22
QString
QgsProviderSqlQueryBuilder::createLimitQueryForTable
(
const
QString &schema,
const
QString &name,
int
limit )
const
23
{
24
if
( schema.isEmpty() )
25
return
QStringLiteral(
"SELECT * FROM %1 LIMIT %2"
).arg(
quoteIdentifier
( name ) ).arg( limit );
26
else
27
return
QStringLiteral(
"SELECT * FROM %1.%2 LIMIT %3"
).arg(
quoteIdentifier
( schema ),
quoteIdentifier
( name ) ).arg( limit );
28
}
29
30
QString
QgsProviderSqlQueryBuilder::quoteIdentifier
(
const
QString &identifier )
const
31
{
32
// TODO: handle backend-specific identifier quoting...
33
return
QgsSqliteUtils::quotedIdentifier
( identifier );
34
}
QgsProviderSqlQueryBuilder::~QgsProviderSqlQueryBuilder
virtual ~QgsProviderSqlQueryBuilder()
QgsProviderSqlQueryBuilder::quoteIdentifier
virtual QString quoteIdentifier(const QString &identifier) const
Returns a properly quoted version of a table/schema identifier.
Definition
qgsprovidersqlquerybuilder.cpp:30
QgsProviderSqlQueryBuilder::createLimitQueryForTable
virtual QString createLimitQueryForTable(const QString &schema, const QString &name, int limit=10) const
Returns a result size limited SQL query string generated for the given schema and table name,...
Definition
qgsprovidersqlquerybuilder.cpp:22
QgsSqliteUtils::quotedIdentifier
static QString quotedIdentifier(const QString &identifier)
Returns a properly quoted version of identifier.
Definition
qgssqliteutils.cpp:260
qgsprovidersqlquerybuilder.h
qgssqliteutils.h
Generated on Mon Sep 2 2024 12:44:24 for QGIS API Documentation by
1.9.8