Skip to content

Commit 8ba6859

Browse files
author
mhugent
committedApr 20, 2007
Tried to fix problems with allAttributeList() in postgres provider
git-svn-id: http://svn.osgeo.org/qgis/trunk@6900 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 294ad9f commit 8ba6859

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed
 

‎src/core/qgsvectordataprovider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
251251
/**
252252
* Return list of indexes to fetch all attributes in getNextFeature()
253253
*/
254-
QgsAttributeList allAttributesList();
254+
virtual QgsAttributeList allAttributesList();
255255

256256
/**Returns the names of the numerical types*/
257257
const QSet<QString>& supportedNativeTypes() const;

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,6 @@ QgsPostgresProvider::QgsPostgresProvider(QString const & uri)
242242
QgsDebugMsg("Field: " + attnum + " maps to " + QString::number(i) + " " + fieldName + ", "
243243
+ fieldTypeName + " (" + QString::number(fldtyp) + "), " + fieldSize + ", " + QString::number(fieldModifier));
244244

245-
attributeFieldsIdMap[attnum.toInt()] = i;
246-
247245
if(fieldName!=geometryColumn)
248246
{
249247
QVariant::Type fieldType;
@@ -2123,6 +2121,16 @@ bool QgsPostgresProvider::changeGeometryValues(QgsGeometryMap & geometry_map)
21232121
return returnvalue;
21242122
}
21252123

2124+
QgsAttributeList QgsPostgresProvider::allAttributesList()
2125+
{
2126+
QgsAttributeList attributes;
2127+
for(QgsFieldMap::iterator it = attributeFields.begin(); it != attributeFields.end(); ++it)
2128+
{
2129+
attributes.push_back(it.key());
2130+
}
2131+
return attributes;
2132+
}
2133+
21262134

21272135
int QgsPostgresProvider::capabilities() const
21282136
{

‎src/providers/postgres/qgspostgresprovider.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ class QgsPostgresProvider:public QgsVectorDataProvider
195195
/**Returns true if layer is valid
196196
*/
197197
bool isValid();
198+
199+
QgsAttributeList allAttributesList();
198200

199201
//! get postgis version string
200202
QString postgisVersion(PGconn *);
@@ -328,7 +330,6 @@ class QgsPostgresProvider:public QgsVectorDataProvider
328330

329331
std::vector < QgsFeature > features;
330332
QgsFieldMap attributeFields;
331-
std::map < int, int > attributeFieldsIdMap;
332333
QString mDataComment;
333334

334335
//! Data source URI struct for this layer

0 commit comments

Comments
 (0)
Please sign in to comment.