Skip to content
Permalink
Browse files

Postgres/SQLite/MSSQL provider: fix addAttributes() fail (wrong synta…

…x/empty statement) when argument is an empty list
  • Loading branch information
brushtyler committed Aug 25, 2015
1 parent fdb0d20 commit 762d28b8d42af4968c6a2faa646190b41e9f1f1b
@@ -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 )
{

0 comments on commit 762d28b

Please sign in to comment.
You can’t perform that action at this time.