Skip to content

Commit

Permalink
Fix for problems with unique value dialog and some postgis tables
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7138 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 14, 2007
1 parent c666e72 commit f17eeac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/app/qgsuniquevaluedialog.cpp
Expand Up @@ -119,8 +119,19 @@ void QgsUniqueValueDialog::apply()
renderer->insertValue(it->first,newsymbol);
}

renderer->setClassificationField(mClassificationComboBox->currentItem());
mVectorLayer->setRenderer(renderer);
QgsVectorDataProvider *provider = dynamic_cast<QgsVectorDataProvider *>(mVectorLayer->getDataProvider());
if (provider)
{
int fieldIndex = provider->indexFromFieldName(mClassificationComboBox->currentText());
if(fieldIndex > 0)
{
renderer->setClassificationField(fieldIndex);
mVectorLayer->setRenderer(renderer);
return;
}
}

delete renderer; //something went wrong
}

void QgsUniqueValueDialog::changeClassificationAttribute()
Expand Down
3 changes: 3 additions & 0 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -1178,6 +1178,9 @@ int QgsPostgresProvider::SRCFromViewColumn(const QString& ns, const QString& rel

//relation is table, we just have to add the type
QString typeSql = "SELECT pg_type.typname FROM pg_attribute, pg_class, pg_namespace, pg_type WHERE pg_class.relname = '" + relname + "' AND pg_namespace.nspname = '" + ns + "' AND pg_attribute.attname = '" + attname_table + "' AND pg_attribute.attrelid = pg_class.oid AND pg_class.relnamespace = pg_namespace.oid AND pg_attribute.atttypid = pg_type.oid";
QgsDebugMsg("***********************************************************************************");
QgsDebugMsg(typeSql);
QgsDebugMsg("***********************************************************************************");
PGresult* typeSqlResult = PQexec(connection, (const char*)(typeSql.utf8()));
if(PQntuples(typeSqlResult) < 1)
{
Expand Down

0 comments on commit f17eeac

Please sign in to comment.