Skip to content

Commit

Permalink
changed the ungrouped groupid 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 6880a76 commit 2b7b5da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
4 changes: 2 additions & 2 deletions scripts/symbol_xml2db.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@
symdom.getElementsByTagName( "layer" )[ layerno ].appendChild( symbol )
c.execute( "UPDATE symbol SET xml=? WHERE name=?", ( symdom.toxml(), parent_name ))
else:
c.execute( "INSERT INTO symbol VALUES (?,?,?,?)", ( None, symbol_name, symbol.toxml(), None ) )
c.execute( "INSERT INTO symbol VALUES (?,?,?,?)", ( None, symbol_name, symbol.toxml(), 0 ) )
conn.commit()


# ColorRamps
colorramps = dom.getElementsByTagName( "colorramp" )
for ramp in colorramps:
ramp_name = ramp.getAttribute( "name" )
c.execute( "INSERT INTO colorramp VALUES (?,?,?,?)", ( None, ramp_name, ramp.toxml(), None ) )
c.execute( "INSERT INTO colorramp VALUES (?,?,?,?)", ( None, ramp_name, ramp.toxml(), 0 ) )
conn.commit()

# Finally close the sqlite cursor
Expand Down
16 changes: 4 additions & 12 deletions src/core/symbology-ng/qgsstylev2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,11 @@ QStringList QgsStyleV2::symbolsOfGroup( StyleEntity type, int groupid )
char *query;
if ( type == SymbolEntity )
{
query = groupid
? sqlite3_mprintf( "SELECT name FROM symbol WHERE groupid=%d", groupid )
: sqlite3_mprintf( "SELECT name FROM symbol WHERE groupid IS NULL" );
query = sqlite3_mprintf( "SELECT name FROM symbol WHERE groupid=%d", groupid );
}
else if ( type == ColorrampEntity )
{
query = groupid
? sqlite3_mprintf( "SELECT name FROM colorramp WHERE groupid=%d", groupid )
: sqlite3_mprintf( "SELECT name FROM colorramp WHERE groupid IS NULL" );
query = sqlite3_mprintf( "SELECT name FROM colorramp WHERE groupid=%d", groupid );
}
else
{
Expand Down Expand Up @@ -734,14 +730,10 @@ bool QgsStyleV2::group( StyleEntity type, QString name, int groupid )
switch ( type )
{
case SymbolEntity:
query = groupid
? sqlite3_mprintf( "UPDATE symbol SET groupid=%d WHERE name='%q'", groupid, name.toUtf8().constData() )
: sqlite3_mprintf( "UPDATE symbol SET groupid=NULL WHERE name='%q'", name.toUtf8().constData() );
query = sqlite3_mprintf( "UPDATE symbol SET groupid=%d WHERE name='%q'", groupid, name.toUtf8().constData() );
break;
case ColorrampEntity:
query = groupid
? sqlite3_mprintf( "UPDATE colorramp SET groupid=%d WHERE name='%q'", groupid, name.toUtf8().constData() )
: sqlite3_mprintf( "UPDATE colorramp SET groupid=NULL WHERE name='%q'", name.toUtf8().constData() );
query = sqlite3_mprintf( "UPDATE colorramp SET groupid=%d WHERE name='%q'", groupid, name.toUtf8().constData() );
break;

default:
Expand Down

0 comments on commit 2b7b5da

Please sign in to comment.