Postgres/SQLite/MSSQL provider: fix addAttributes() fail (wrong syntax/empty statement) when argument is an empty list

This commit is contained in:
Giuseppe Sucameli 2015-08-25 02:54:36 +02:00
parent fdb0d20677
commit 762d28b8d4
3 changed files with 9 additions and 0 deletions

View File

@ -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();

View File

@ -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 )
{

View File

@ -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 )
{