Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixes #8212
  • Loading branch information
tecoholic committed May 4, 2015
1 parent bae9cea commit 51c180b
Showing 1 changed file with 1 addition and 49 deletions.
50 changes: 1 addition & 49 deletions src/core/symbology-ng/qgsstylev2.cpp
Expand Up @@ -770,7 +770,7 @@ QStringList QgsStyleV2::findSymbols( StyleEntity type, QString qword )
}

QString item = ( type == SymbolEntity ) ? "symbol" : "colorramp";
char *query = sqlite3_mprintf( "SELECT name FROM %q WHERE xml LIKE '%%%q%%'",
char *query = sqlite3_mprintf( "SELECT name FROM %q WHERE name LIKE '%%%q%%'",
item.toUtf8().constData(), qword.toUtf8().constData() );

sqlite3_stmt *ppStmt;
Expand All @@ -784,54 +784,6 @@ QStringList QgsStyleV2::findSymbols( StyleEntity type, QString qword )

sqlite3_finalize( ppStmt );

query = sqlite3_mprintf( "SELECT id FROM tag WHERE name LIKE '%%%q%%'", qword.toUtf8().constData() );
nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL );

QStringList tagids;
while ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
{
tagids << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, 0 ) );
}

sqlite3_finalize( ppStmt );


QString dummy = tagids.join( ", " );

if ( type == SymbolEntity )
{
query = sqlite3_mprintf( "SELECT symbol_id FROM tagmap WHERE tag_id IN (%q)",
dummy.toUtf8().constData() );
}
else
{
query = sqlite3_mprintf( "SELECT colorramp_id FROM ctagmap WHERE tag_id IN (%q)",
dummy.toUtf8().constData() );
}
nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL );

QStringList symbolids;
while ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
{
symbolids << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, 0 ) );
}

sqlite3_finalize( ppStmt );


dummy = symbolids.join( ", " );
query = sqlite3_mprintf( "SELECT name FROM %q WHERE id IN (%q)",
item.toUtf8().constData(), dummy.toUtf8().constData() );
nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL );
while ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
{
QString symbolName = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, 0 ) );
if ( !symbols.contains( symbolName ) )
symbols << symbolName;
}

sqlite3_finalize( ppStmt );

return symbols;
}

Expand Down

0 comments on commit 51c180b

Please sign in to comment.