[SQL-CVS] r694 - trunk/SQLObject/sqlobject/sqlite
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2005-03-30 15:23:55
|
Author: phd
Date: 2005-03-30 15:23:45 +0000 (Wed, 30 Mar 2005)
New Revision: 694
Modified:
trunk/SQLObject/sqlobject/sqlite/sqliteconnection.py
Log:
Applied patch 1172964, and added "mode" and "encoding" parameters.
Modified: trunk/SQLObject/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- trunk/SQLObject/sqlobject/sqlite/sqliteconnection.py 2005-03-30 11:54:36 UTC (rev 693)
+++ trunk/SQLObject/sqlobject/sqlite/sqliteconnection.py 2005-03-30 15:23:45 UTC (rev 694)
@@ -1,4 +1,5 @@
from sqlobject.dbconnection import DBAPI
+from sqlobject.col import popKey
sqlite = None
class SQLiteConnection(DBAPI):
@@ -16,9 +17,17 @@
if not autoCommit and not kw.has_key('pool'):
# Pooling doesn't work with transactions...
kw['pool'] = 0
- # use only one connection for sqlite - supports multiple
+ # connection options
+ opts = {'autocommit': autoCommit}
+ if 'encoding' in kw:
+ opts['encoding'] = popKey(kw, 'encoding')
+ if 'mode' in kw:
+ opts['mode'] = int(popKey(kw, 'mode'), 0)
+ if 'timeout' in kw:
+ opts['timeout'] = float(popKey(kw, 'timeout'))
+ # use only one connection for sqlite - supports multiple)
# cursors per connection
- self._conn = sqlite.connect(self.filename, autocommit=autoCommit)
+ self._conn = sqlite.connect(self.filename, **opts)
DBAPI.__init__(self, **kw)
def connectionFromURI(cls, uri):
|