You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Julia Stobbe <st...@projust.de> on 2001/06/08 19:24:12 UTC
Postgresql and BasePeer
hi,
there was a little oversight when adding transaction support for postgresql.
doDelete was overlooked, so it returns the cryptic FastPath Call Error -
postgres can deal with LOBs only in transactions..
i do not know whether BasePeer.deleteAll (String table, String column, int
value)
should be "fixed" - could only work with the default database. if it makes
sense, i
will send a patch
the diff below was generated with -w, i hope, you can use it the way it is
(got totally useless diffs without it - is there a lot of whitespaces in
the sources?)
Julia
Index: ./peer/BasePeer.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/om/peer/BasePeer.java,v
retrieving revision 1.63
diff -w -u -r1.63 BasePeer.java
--- ./peer/BasePeer.java 2001/05/23 15:12:05 1.63
+++ ./peer/BasePeer.java 2001/06/08 16:48:54
@@ -459,6 +459,26 @@
public static void doDelete(Criteria criteria)
throws Exception
{
+ // Transaction stuff added for postgres.
+ if (TurbineDB.getDB(criteria.getDbName())
+ .objectDataNeedsTrans() &&
+ criteria.containsObjectColumn(criteria.getDbName()))
+ {
+ DBConnection dbCon = beginTransaction(criteria.getDbName());
+ try
+ {
+ doDelete(criteria, dbCon);
+ commitTransaction(dbCon);
+ }
+ catch (Exception e)
+ {
+ // make sure to return connection
+ rollBackTransaction(dbCon);
+ throw e;
+ }
+ }
+ else
+ {
DBConnection dbCon = null;
try
{
@@ -471,6 +491,7 @@
TurbineDB.releaseConnection(dbCon);
}
}
+ }
/**
* Method to perform deletes based on values and keys in a
@@ -2191,3 +2212,4 @@
}
}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: Postgresql and BasePeer
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Hi Julia. I merged your patch into CVS HEAD by hand. If you would
test out deleteAll() and see if it needs adjustment as well, it would
be appreciated.
Daniel
Julia Stobbe <st...@projust.de> writes:
> hi,
> there was a little oversight when adding transaction support for postgresql.
>
> doDelete was overlooked, so it returns the cryptic FastPath Call Error -
> postgres can deal with LOBs only in transactions..
>
> i do not know whether BasePeer.deleteAll (String table, String column,
> int value)
>
> should be "fixed" - could only work with the default database. if it
> makes sense, i
>
> will send a patch
>
> the diff below was generated with -w, i hope, you can use it the way it is
> (got totally useless diffs without it - is there a lot of whitespaces
> in the sources?)
>
>
> Julia
>
> Index: ./peer/BasePeer.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/om/peer/BasePeer.java,v
>
> retrieving revision 1.63
> diff -w -u -r1.63 BasePeer.java
> --- ./peer/BasePeer.java 2001/05/23 15:12:05 1.63
> +++ ./peer/BasePeer.java 2001/06/08 16:48:54
> @@ -459,6 +459,26 @@
> public static void doDelete(Criteria criteria)
> throws Exception
> {
> + // Transaction stuff added for postgres.
> + if (TurbineDB.getDB(criteria.getDbName())
> + .objectDataNeedsTrans() &&
> + criteria.containsObjectColumn(criteria.getDbName()))
> + {
> + DBConnection dbCon = beginTransaction(criteria.getDbName());
> + try
> + {
> + doDelete(criteria, dbCon);
> + commitTransaction(dbCon);
> + }
> + catch (Exception e)
> + {
> + // make sure to return connection
> + rollBackTransaction(dbCon);
> + throw e;
> + }
> + }
> + else
> + {
> DBConnection dbCon = null;
> try
> {
> @@ -471,6 +491,7 @@
> TurbineDB.releaseConnection(dbCon);
> }
> }
> + }
>
> /**
> * Method to perform deletes based on values and keys in a
> @@ -2191,3 +2212,4 @@
> }
>
> }
> +
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org