Skip to content

Commit

Permalink
changed the parent group id for main groups to 0 from NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
Arunmozhi committed Dec 24, 2012
1 parent 2b7b5da commit c41cf2e
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/core/symbology-ng/qgsstylev2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ QgsSymbolGroupMap QgsStyleV2::childGroupNames( QString parent )
// decide the query to be run based on parent group
if ( parent == "" || parent == QString() )
{
query = sqlite3_mprintf( "SELECT * FROM symgroup WHERE parent IS NULL" );
query = sqlite3_mprintf( "SELECT * FROM symgroup WHERE parent=0" );
}
else
{
Expand Down Expand Up @@ -592,9 +592,7 @@ int QgsStyleV2::addGroup( QString groupName, int parentid )
if ( !mCurrentDB )
return 0;

char *query = parentid == 0
? sqlite3_mprintf( "INSERT INTO symgroup VALUES (NULL, '%q', NULL)", groupName.toUtf8().constData() )
: sqlite3_mprintf( "INSERT INTO symgroup VALUES (NULL, '%q', %d)", groupName.toUtf8().constData(), parentid );
char *query = sqlite3_mprintf( "INSERT INTO symgroup VALUES (NULL, '%q', %d)", groupName.toUtf8().constData(), parentid );

sqlite3_stmt *ppStmt;
int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL );
Expand Down Expand Up @@ -662,13 +660,9 @@ char* QgsStyleV2::getGroupRemoveQuery( int id )

sqlite3_finalize( ppStmt );

return parentid
? sqlite3_mprintf( "UPDATE symbol SET groupid=%d WHERE groupid=%d;"
"UPDATE symgroup SET parent=%d WHERE parent=%d;"
"DELETE FROM symgroup WHERE id=%d", parentid, id, parentid, id, id )
: sqlite3_mprintf( "UPDATE symbol SET groupid=NULL WHERE groupid=%d;"
"UPDATE symgroup SET parent=NULL WHERE parent=%d;"
"DELETE FROM symgroup WHERE id=%d", id, id, id );
return sqlite3_mprintf( "UPDATE symbol SET groupid=%d WHERE groupid=%d;"
"UPDATE symgroup SET parent=%d WHERE parent=%d;"
"DELETE FROM symgroup WHERE id=%d", parentid, id, parentid, id, id );
}

void QgsStyleV2::remove( StyleEntity type, int id )
Expand Down

0 comments on commit c41cf2e

Please sign in to comment.