Skip to content
Permalink
Browse files
Fix for creation of SQL query in postgres provider.
Was doing problems when exporting to shapefile (see #706)


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6890 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Apr 17, 2007
1 parent 6edc963 commit 63bd8b5c7ed2e90565fdda2fb5b75b219ae2fe22
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/providers/postgres/qgspostgresprovider.cpp
@@ -488,6 +488,8 @@ void QgsPostgresProvider::select(QgsAttributeList fetchAttributes,

QgsDebugMsg("Binary cursor: " + declare);

bool hasWhere = FALSE;

if(!rect.isEmpty())
{
if(useIntersect)
@@ -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);

0 comments on commit 63bd8b5

Please sign in to comment.