Skip to content
Permalink
Browse files
changed the ungrouped groupid to 0 from NULL
  • Loading branch information
Arunmozhi committed Dec 24, 2012
1 parent 6880a76 commit 2b7b5da76ecea2200310ced0a304782e63123769
Showing with 6 additions and 14 deletions.
  1. +2 −2 scripts/symbol_xml2db.py
  2. +4 −12 src/core/symbology-ng/qgsstylev2.cpp
@@ -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
@@ -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
{
@@ -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:

0 comments on commit 2b7b5da

Please sign in to comment.