Skip to content
Permalink
Browse files
put out a warning message when no accessible postgis tables were found
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8286 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Mar 27, 2008
1 parent d5bdbb4 commit 6440138c7f50f411304892129887ad73265e842e
Showing with 23 additions and 14 deletions.
  1. +23 −14 src/app/qgsdbsourceselect.cpp
@@ -536,30 +536,39 @@ bool QgsDbSourceSelect::getTableInfo(PGconn *pg, bool searchGeometryColumnsOnly,
PGresult *result = PQexec(pg, sql.toUtf8());
if (result)
{
for (int idx = 0; idx < PQntuples(result); idx++)
if( PQntuples(result)==0 )
{
QMessageBox::warning(this, tr("No accessible tables found"),
tr
("Database connection was successful, but no accessible tables were found.\n\n"
"Please verify that you have SELECT privilege on a PostGIS' geometry_columns\n"
"table and at least one table carrying PostGIS geometry."));
}
else
{
QString tableName = QString::fromUtf8(PQgetvalue(result, idx, PQfnumber(result, QString("f_table_name").toUtf8())));
QString schemaName = QString::fromUtf8(PQgetvalue(result, idx, PQfnumber(result, QString("f_table_schema").toUtf8())));
for (int idx = 0; idx < PQntuples(result); idx++)
{
QString tableName = QString::fromUtf8(PQgetvalue(result, idx, PQfnumber(result, QString("f_table_name").toUtf8())));
QString schemaName = QString::fromUtf8(PQgetvalue(result, idx, PQfnumber(result, QString("f_table_schema").toUtf8())));

QString column = QString::fromUtf8(PQgetvalue(result, idx, PQfnumber(result, QString("f_geometry_column").toUtf8())));
QString type = QString::fromUtf8(PQgetvalue(result, idx, PQfnumber(result, QString("type").toUtf8())));
QString column = QString::fromUtf8(PQgetvalue(result, idx, PQfnumber(result, QString("f_geometry_column").toUtf8())));
QString type = QString::fromUtf8(PQgetvalue(result, idx, PQfnumber(result, QString("type").toUtf8())));

QString as = "";
if(type=="GEOMETRY" && !searchGeometryColumnsOnly)
{
addSearchGeometryColumn(schemaName, tableName, column);
as=type="WAITING";
}
QString as = "";
if(type=="GEOMETRY" && !searchGeometryColumnsOnly)
{
addSearchGeometryColumn(schemaName, tableName, column);
as=type="WAITING";
}

mTableModel.addTableEntry(type, schemaName, tableName, column, "");
mTableModel.addTableEntry(type, schemaName, tableName, column, "");
}
}
ok = true;
}
PQclear(result);

//search for geometry columns in tables that are not in the geometry_columns metatable


QApplication::restoreOverrideCursor();
if (searchGeometryColumnsOnly)
{

0 comments on commit 6440138

Please sign in to comment.