From: <tre...@us...> - 2010-09-05 01:48:01
|
Revision: 305 http://spd.svn.sourceforge.net/spd/?rev=305&view=rev Author: treibholz Date: 2010-09-05 01:47:55 +0000 (Sun, 05 Sep 2010) Log Message: ----------- first bunch of methods Modified Paths: -------------- branches/spd-ng/src/spdCore.py branches/spd-ng/src/test.db Added Paths: ----------- branches/spd-ng/src/spdStore.py Modified: branches/spd-ng/src/spdCore.py =================================================================== --- branches/spd-ng/src/spdCore.py 2010-09-05 01:46:43 UTC (rev 304) +++ branches/spd-ng/src/spdCore.py 2010-09-05 01:47:55 UTC (rev 305) @@ -1,32 +1,58 @@ #!/usr/bin/python +import sqlite3 + class Core(object): - - def __init__(ConfigSection='Main'): - pass - def __del__(): - pass + # create the database from the stuff out of the store + def __init__(self,ConfigSection='Main'): # {{{ + self.ConfigSection = ConfigSection + self.db = sqlite3.connect('test.db') + self.dbc = self.db.cursor() + self.deletedColumns = [] - def searchEntry(SearchList): + # }}} + + + # Writes back to the Store + def __del__(self): + self.db.commit() + + + def searchEntry(self,SearchList): pass - def addEntry(NewDict): + def addEntry(self,NewDict): pass - def delEntry(ID): + def delEntry(self,ID): pass + def getColumns(self): # {{{ + query = "pragma Table_info('" + self.ConfigSection + "')" + self.dbc.execute(query) - def getCollumns(): - pass + result = [] + for i in self.dbc: + if i[1] not in self.deletedColumns: + result.append(i[1]) - def addCollumn(Name): - pass + return result + + # }}} + + def addColumn(self,Name): # {{{ + query='alter table ' + self.ConfigSection + ' add column ' + Name + ' text ' + self.db.execute(query) + + # }}} - def delCollumn(Name): - pass + def delColumn(self,Name): # {{{ + # it's not possible, to delete a column in SQLite + self.deletedColumns.append(Name) + # }}} - +# EOF +# vim:foldmethod=marker:tabstop=3:autoindent:shiftwidth=3 Property changes on: branches/spd-ng/src/spdStore.py ___________________________________________________________________ Added: svn:eol-style + native Modified: branches/spd-ng/src/test.db =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |