Skip to content

Commit

Permalink
Fix for creation of SQL query in postgres provider.
Browse files Browse the repository at this point in the history
Was doing problems when exporting to shapefile (see #706)


git-svn-id: http://svn.osgeo.org/qgis/trunk@6890 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Apr 17, 2007
1 parent cc862d4 commit 6114f06
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -488,6 +488,8 @@ void QgsPostgresProvider::select(QgsAttributeList fetchAttributes,

QgsDebugMsg("Binary cursor: " + declare);

bool hasWhere = FALSE;

if(!rect.isEmpty())
{
if(useIntersect)
Expand All @@ -513,11 +515,17 @@ void QgsPostgresProvider::select(QgsAttributeList fetchAttributes,
declare += srid;
declare += ")";
}
hasWhere = TRUE;
}

if(sqlWhereClause.length() > 0)
{
declare += " and (" + sqlWhereClause + ")";
if (hasWhere)
declare += " and ";
else
declare += " where ";
declare += "(" + sqlWhereClause + ")";
hasWhere = TRUE;
}

QgsDebugMsg("Selecting features using: " + declare);
Expand Down

0 comments on commit 6114f06

Please sign in to comment.