Skip to content

Commit

Permalink
Patch from smizuno to fix bug #954. Thanks!
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8172 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Feb 21, 2008
1 parent ffdeca1 commit 4b9aa12
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -383,7 +383,7 @@ bool QgsPostgresProvider::getNextFeature(QgsFeature& feature)
}
else
{
char* attribute = PQgetvalue(queryResult, row, PQfnumber(queryResult,*name_it));
char* attribute = PQgetvalue(queryResult, row, PQfnumber(queryResult,"\""+*name_it+"\""));
val = QString::fromUtf8(attribute);
}

Expand Down Expand Up @@ -1972,7 +1972,7 @@ bool QgsPostgresProvider::addAttributes(const QgsNewAttributesMap & name)
PQexec(connection,"BEGIN");
for(QgsNewAttributesMap::const_iterator iter=name.begin();iter!=name.end();++iter)
{
QString sql="ALTER TABLE "+mSchemaTableName+" ADD COLUMN "+iter.key()+" "+iter.value();
QString sql="ALTER TABLE "+mSchemaTableName+" ADD COLUMN \""+iter.key()+"\" "+iter.value();

QgsDebugMsg(sql);

Expand Down Expand Up @@ -2006,7 +2006,7 @@ bool QgsPostgresProvider::deleteAttributes(const QgsAttributeIds& ids)
continue;
}
QString column = field_it->name();
QString sql="ALTER TABLE "+mSchemaTableName+" DROP COLUMN "+column;
QString sql="ALTER TABLE "+mSchemaTableName+" DROP COLUMN \""+column+"\"";

//send sql statement and do error handling
PGresult* result=PQexec(connection, (const char *)(sql.utf8()));
Expand Down Expand Up @@ -2050,7 +2050,7 @@ bool QgsPostgresProvider::changeAttributeValues(const QgsChangedAttributesMap &
// escape quotes
val.replace("'", "''");

QString sql="UPDATE "+mSchemaTableName+" SET "+fieldName+"='"+val+"' WHERE \"" +primaryKey+"\"="+QString::number(fid);
QString sql="UPDATE "+mSchemaTableName+" SET \""+fieldName+"\"='"+val+"' WHERE \"" +primaryKey+"\"="+QString::number(fid);
QgsDebugMsg(sql);

// s end sql statement and do error handling
Expand Down

0 comments on commit 4b9aa12

Please sign in to comment.