mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Postgres/SQLite/MSSQL provider: fix addAttributes() fail (wrong syntax/empty statement) when argument is an empty list
This commit is contained in:
parent
fdb0d20677
commit
762d28b8d4
@ -960,6 +960,9 @@ bool QgsMssqlProvider::addAttributes( const QList<QgsField> &attributes )
|
||||
{
|
||||
QString statement;
|
||||
|
||||
if ( attributes.count() == 0 )
|
||||
return true;
|
||||
|
||||
for ( QList<QgsField>::const_iterator it = attributes.begin(); it != attributes.end(); ++it )
|
||||
{
|
||||
QString type = it->typeName();
|
||||
|
@ -1938,6 +1938,9 @@ bool QgsPostgresProvider::addAttributes( const QList<QgsField> &attributes )
|
||||
if ( mIsQuery )
|
||||
return false;
|
||||
|
||||
if ( attributes.count() == 0 )
|
||||
return true;
|
||||
|
||||
QgsPostgresConn* conn = connectionRW();
|
||||
if ( !conn )
|
||||
{
|
||||
|
@ -3797,6 +3797,9 @@ bool QgsSpatiaLiteProvider::addAttributes( const QList<QgsField> &attributes )
|
||||
bool toCommit = false;
|
||||
QString sql;
|
||||
|
||||
if ( attributes.count() == 0 )
|
||||
return true;
|
||||
|
||||
int ret = sqlite3_exec( sqliteHandle, "BEGIN", NULL, NULL, &errMsg );
|
||||
if ( ret != SQLITE_OK )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user