Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv2559/SQLObject
Modified Files:
DBConnection.py
Log Message:
Removed PickleConnection
Index: DBConnection.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/DBConnection.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** DBConnection.py 21 Apr 2003 22:40:56 -0000 1.24
--- DBConnection.py 21 Apr 2003 22:43:25 -0000 1.25
***************
*** 38,42 ****
__all__ = ['MySQLConnection', 'PostgresConnection', 'SQLiteConnection',
! 'PickleConnection', 'DBMConnection']
_connections = {}
--- 38,42 ----
__all__ = ['MySQLConnection', 'PostgresConnection', 'SQLiteConnection',
! 'DBMConnection']
_connections = {}
***************
*** 688,769 ****
results.append((id,))
return results
-
- class PickleConnection(FileConnection):
-
- def __init__(self, path, **kw):
- self.path = path
- FileConnection.__init__(self, **kw)
-
- def _filename(self, table, id):
- return '%s-%i.pickle' % (table, id)
-
- def _newID(self, table):
- idFilename = os.path.join(self.path, "%s-ids.txt" % table)
- try:
- f = open(idFilename, "r+")
- except IOError:
- f = open(idFilename, "w")
- f.write("0")
- f.close()
- f = open(idFilename, "r+")
- fcntl.lockf(f, fcntl.LOCK_EX)
- id = int(f.read()) + 1
- # @@: Can I just close this and open it in write mode, while
- # retaining this lock?
- f.seek(0)
- f.write(str(id))
- fcntl.lockf(f, fcntl.LOCK_UN)
- f.close()
- return id
-
- def _fetchDict(self, table, id):
- f = open(self._filename(table, id), 'rb')
- d = pickle.load(f)
- f.close()
- return d
-
- def _saveDict(self, table, id, d):
- f = open(self._filename(table, id), 'wb')
- pickle.dump(d, f)
- f.close()
-
- def _fetchTables(self):
- filename = os.path.join(self.path, "table-list.txt")
- try:
- f = open(filename, "r")
- except IOError:
- return []
- lines = [l.strip() for l in f.readlines()]
- f.close()
- return lines
-
- def _saveTables(self, tables):
- filename = os.path.join(self.path, "table-list.txt")
- f = open(filename, "w")
- f.write('\n'.join(tables))
- f.close()
-
- def tableExists(self, table):
- return table in self._fetchTables()
-
- def createTable(self, soClass):
- tables = self._fetchTables()
- tables.append(soClass._table)
- self._saveTables(tables)
-
- def dropTable(self, tableName):
- tables = self._fetchTables()
- tables.remove(tableName)
- self._saveTables(tables)
- self.clearTable(tableName)
-
- def clearTable(self, tableName):
- for filename in os.listdir(self.path):
- if filename.startswith(tableName + "-"):
- os.unlink(os.path.join(self.path, filename))
-
- def _SO_delete(self, so):
- os.unlink(self._filename(so._table, so.id))
-
class DBMConnection(FileConnection):
--- 688,691 ----
|