Daniel Rall wrote:
> 
> Jerome Verleyen <[EMAIL PROTECTED]> writes:
> 
> > Hi all,
> >
> > For Turbine 2.1 (or 2.2b1??;)
> >
> > I'm just finding that the BasePeer class file don't implement the good
> > stuf for the method delete(criteria). That's because of Postgresql, taht
> > need to have a transaction when deleting rows whith binary object. And
> > for example, it's impossible to delete a user in the database.
> >
> > I'm got the ultimate source of turbine code today ( jakarta-turbine-2),
> > and o correct this whith the patch following..
> >
> > And sorry to not have discover this before..
> 
> Thanks Jerome!  Could you send a unidiff?
> 
> cvs diff -u [path to file]
> 

I should not gave the good file ?

I'm making "diff -u" another time, and give it to you..

Jerome
-- 
 GG: les Teletubbies, � la base, c'est d�j� du lavage de cerveau, alors, 
 si en plus on rajoute Microsoft...
 CS: ...d'abord �a lave, ensuite �a ringe et apr�s �a te laisse tout
sec.
 +CS in Guide du Macounet pervers : Microsoft lave plus blanc que blanc+
--- 
/usr/local/Jakarta/jakarta-turbine-2/src/java/org/apache/turbine/om/peer/BasePeer.java 
     Wed Aug 22 19:19:33 2001
+++ /tmp/BasePeer.java  Thu Aug 23 11:26:19 2001
@@ -470,15 +470,35 @@
         throws Exception
     {
         DBConnection dbCon = null;
+
+        // Transaction stuff added for postgres.
+        boolean doTransaction = (TurbineDB.getDB(criteria.getDbName()).
+            objectDataNeedsTrans() &&
+            criteria.containsObjectColumn(criteria.getDbName()));
+
         try
         {
             // Get a connection to the db.
-            dbCon = TurbineDB.getConnection( criteria.getDbName() );
+            if (doTransaction)
+            {
+                dbCon = beginTransaction(criteria.getDbName());
+            }
+            else
+            {
+                dbCon = TurbineDB.getConnection( criteria.getDbName() );
+            }
             doDelete(criteria, dbCon);
         }
         finally
         {
-            TurbineDB.releaseConnection(dbCon);
+            if (doTransaction)
+            {
+                commitTransaction(dbCon);
+            }
+            else
+            {
+                TurbineDB.releaseConnection(dbCon);
+            }
         }
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to