Skip to content

Commit

Permalink
fix #6142
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Aug 2, 2012
1 parent 0926c35 commit 5988a9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
mRequestedGeomType = mUri.wkbType();
mIsGeography = false;

if ( mSchemaName.isEmpty() &&
mTableName.startsWith( "(SELECT", Qt::CaseInsensitive ) &&
mTableName.endsWith( ")" ) )
if ( mSchemaName.isEmpty() && mTableName.startsWith( "(" ) && mTableName.endsWith( ")" ) )
{
mIsQuery = true;
mQuery = mTableName;
Expand Down Expand Up @@ -1308,8 +1306,7 @@ bool QgsPostgresProvider::hasSufficientPermsAndCapabilities()
else
{
// Check if the sql is a select query
if ( !mQuery.startsWith( "(SELECT", Qt::CaseInsensitive ) &&
!mQuery.endsWith( ")" ) )
if ( !mQuery.startsWith( "(" ) && !mQuery.endsWith( ")" ) )
{
QgsMessageLog::logMessage( tr( "The custom query is not a select query." ), tr( "PostGIS" ) );
return false;
Expand Down
3 changes: 1 addition & 2 deletions src/providers/spatialite/qgsspatialiteprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4280,8 +4280,7 @@ bool QgsSpatiaLiteProvider::checkLayerType()
}
sqlite3_free_table( results );
}
else if ( mQuery.startsWith( "(select", Qt::CaseInsensitive ) &&
mQuery.endsWith( ")" ) )
else if ( mQuery.startsWith( "(" ) && mQuery.endsWith( ")" ) )
{
// checking if this one is a select query

Expand Down

0 comments on commit 5988a9c

Please sign in to comment.