Skip to content

Commit

Permalink
Tried to fix problems with allAttributeList() in postgres provider
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6900 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 20, 2007
1 parent b2c945b commit 3d2c245
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/qgsvectordataprovider.h
Expand Up @@ -251,7 +251,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
/**
* Return list of indexes to fetch all attributes in getNextFeature()
*/
QgsAttributeList allAttributesList();
virtual QgsAttributeList allAttributesList();

/**Returns the names of the numerical types*/
const QSet<QString>& supportedNativeTypes() const;
Expand Down
12 changes: 10 additions & 2 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -242,8 +242,6 @@ QgsPostgresProvider::QgsPostgresProvider(QString const & uri)
QgsDebugMsg("Field: " + attnum + " maps to " + QString::number(i) + " " + fieldName + ", "
+ fieldTypeName + " (" + QString::number(fldtyp) + "), " + fieldSize + ", " + QString::number(fieldModifier));

attributeFieldsIdMap[attnum.toInt()] = i;

if(fieldName!=geometryColumn)
{
QVariant::Type fieldType;
Expand Down Expand Up @@ -2123,6 +2121,16 @@ bool QgsPostgresProvider::changeGeometryValues(QgsGeometryMap & geometry_map)
return returnvalue;
}

QgsAttributeList QgsPostgresProvider::allAttributesList()
{
QgsAttributeList attributes;
for(QgsFieldMap::iterator it = attributeFields.begin(); it != attributeFields.end(); ++it)
{
attributes.push_back(it.key());
}
return attributes;
}


int QgsPostgresProvider::capabilities() const
{
Expand Down
3 changes: 2 additions & 1 deletion src/providers/postgres/qgspostgresprovider.h
Expand Up @@ -195,6 +195,8 @@ class QgsPostgresProvider:public QgsVectorDataProvider
/**Returns true if layer is valid
*/
bool isValid();

QgsAttributeList allAttributesList();

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

std::vector < QgsFeature > features;
QgsFieldMap attributeFields;
std::map < int, int > attributeFieldsIdMap;
QString mDataComment;

//! Data source URI struct for this layer
Expand Down

0 comments on commit 3d2c245

Please sign in to comment.