commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5945 - in trunk: gnue-appserver/src gnue-common/src/datasources/drivers


From: johannes
Subject: r5945 - in trunk: gnue-appserver/src gnue-common/src/datasources/drivers/sqlite/sqlite
Date: Wed, 7 Jul 2004 17:14:23 -0500 (CDT)

Author: johannes
Date: 2004-07-06 09:08:15 -0500 (Tue, 06 Jul 2004)
New Revision: 5945

Modified:
   trunk/gnue-appserver/src/data.py
   trunk/gnue-common/src/datasources/drivers/sqlite/sqlite/Connection.py
Log:
sqlite is now usable with appserver


Modified: trunk/gnue-appserver/src/data.py
===================================================================
--- trunk/gnue-appserver/src/data.py    2004-07-06 13:19:38 UTC (rev 5944)
+++ trunk/gnue-appserver/src/data.py    2004-07-06 14:08:15 UTC (rev 5945)
@@ -258,10 +258,14 @@
 
   # prepare attributes of the datasource
   attributes = {}
-  attributes ['name']     = ''
-  attributes ['database'] = database
-  attributes ['table']    = string.join (tables, ', ')
+  attributes ['name']      = ''
+  attributes ['database']  = database
+  attributes ['table']     = string.join (tables, ', ')
 
+  # give the backend a hint that it's working for appserver :)
+  datacon = connections.getConnection (database)
+  datacon.parameters ['appserver'] = True
+
   if order is not None:
     if order != []:
       attributes ['order_by'] = string.joinfields (order, ',')

Modified: trunk/gnue-common/src/datasources/drivers/sqlite/sqlite/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sqlite/sqlite/Connection.py       
2004-07-06 13:19:38 UTC (rev 5944)
+++ trunk/gnue-common/src/datasources/drivers/sqlite/sqlite/Connection.py       
2004-07-06 14:08:15 UTC (rev 5945)
@@ -86,6 +86,9 @@
     'sql':    DataObject_SQL
   }
 
+  def __init__ (self, connections, name, parameters):
+    DBSIG2.Connection.__init__ (self, connections, name, parameters)
+    self.noTransactions = False
 
   # ---------------------------------------------------------------------------
   # Connect to a given database according to the connectData dictionary
@@ -104,9 +107,11 @@
         self._DatabaseError = self._driver.DatabaseError
 
     try:
+      self.noTransactions = connectData.get ('appserver', False)
       self.native = SIG2api.connect (db = connectData['dbname'],
                                      mode = 0777,
-                                     encoding = self._encoding)
+                                     encoding = self._encoding,
+                                     autocommit = self.noTransactions)
 
     except self._DatabaseError, value:
       GDebug.printMesg (1, "Exception %s" % value)
@@ -114,6 +119,11 @@
           "following error:\n\t%s") % value
 
 
+  def commit (self):
+    if not self.noTransactions:
+      DBSIG2.Connection.commit (self)
+
+
   # Return a list of necessary login fields (e.g., user/pass).
   # Each list item is another list of ["field label", isPassword?]
   def getLoginFields(self):





reply via email to

[Prev in Thread] Current Thread [Next in Thread]