Skip to content

Commit 1542231

Browse files
author
mhugent
committed
Patch from smizuno to fix bug #954. Thanks!
git-svn-id: http://svn.osgeo.org/qgis/trunk@8172 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 792f21d commit 1542231

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ bool QgsPostgresProvider::getNextFeature(QgsFeature& feature)
383383
}
384384
else
385385
{
386-
char* attribute = PQgetvalue(queryResult, row, PQfnumber(queryResult,*name_it));
386+
char* attribute = PQgetvalue(queryResult, row, PQfnumber(queryResult,"\""+*name_it+"\""));
387387
val = QString::fromUtf8(attribute);
388388
}
389389

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

19771977
QgsDebugMsg(sql);
19781978

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

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

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

20562056
// s end sql statement and do error handling

0 commit comments

Comments
 (0)