symbol DB updated to support groups,tags for colorramp

This commit is contained in:
Arunmozhi 2012-07-26 08:19:34 +05:30
parent 3943e8a40d
commit ae031584c7
2 changed files with 8 additions and 3 deletions

Binary file not shown.

View File

@ -37,7 +37,8 @@ _symbol = "CREATE TABLE symbol("\
_colorramp = "CREATE TABLE colorramp("\ _colorramp = "CREATE TABLE colorramp("\
"id INTEGER PRIMARY KEY,"\ "id INTEGER PRIMARY KEY,"\
"name TEXT,"\ "name TEXT,"\
"xml TEXT)" "xml TEXT,"\
"groupid INTEGER)"
_tag = "CREATE TABLE tag("\ _tag = "CREATE TABLE tag("\
"id INTEGER PRIMARY KEY,"\ "id INTEGER PRIMARY KEY,"\
@ -57,7 +58,11 @@ _smartgroup = "CREATE TABLE smartgroup("\
"name TEXT,"\ "name TEXT,"\
"xml TEXT)" "xml TEXT)"
create_tables = [ _symbol, _colorramp, _tag, _tagmap, _symgroup, _smartgroup ] _ctagmap = "CREATE TABLE ctagmap("\
"tag_id INTEGER NOT NULL,"\
"colorramp_id INTEGER)"
create_tables = [ _symbol, _colorramp, _tag, _tagmap, _ctagmap, _symgroup, _smartgroup ]
# Create the DB with required Schema # Create the DB with required Schema
conn = sqlite3.connect( dbfile ) conn = sqlite3.connect( dbfile )
@ -93,7 +98,7 @@ conn.commit()
colorramps = dom.getElementsByTagName( "colorramp" ) colorramps = dom.getElementsByTagName( "colorramp" )
for ramp in colorramps: for ramp in colorramps:
ramp_name = ramp.getAttribute( "name" ) ramp_name = ramp.getAttribute( "name" )
c.execute( "INSERT INTO colorramp VALUES (?,?,?)", ( None, ramp_name, ramp.toxml() ) ) c.execute( "INSERT INTO colorramp VALUES (?,?,?,?)", ( None, ramp_name, ramp.toxml(), None ) )
conn.commit() conn.commit()
# Finally close the sqlite cursor # Finally close the sqlite cursor