You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Jerome Verleyen <je...@ibt.unam.mx> on 2001/06/27 20:36:34 UTC

BasePeer to Postgresql.

Hi,
With the aid of John Macnally, i'v just tried out this patch to correct
BasePeer.java, that it could go whith Postgresql.

Just the method doDelete(criteria) that bug in the initial version
because of the fact that it could be access Objectdata in the database.
I'm just reuse the code in the doInsert(criteria) ;))


Whith this patch, i can now remove a user.

PS: That go well with Village package as is. There is nothing to change,
at this time..

Thank's a lot John.

Jerome Verleyen

-- 
 [...] C'est aussi mon avis. Il reigne par ici une frenesie autour du
GMP
 tout a fait inquietante... (Et la je suis encore bon pour le GMP,
 surtout que je fais 3 lignes, comme par hasard) ;o)
 -+- ED in Guide du Macounet Pervers : Hasard (?) frénétique -+-

Re: BasePeer to Postgresql.

Posted by Jerome Verleyen <je...@ibt.unam.mx>.
John McNally wrote:
> 
> Julia Stobbes submitted the patch that I mentioned to Jerome.  It is
> already in the HEAD.  It should probably be ported to the 2.1 branch,
> whenever a bugfix release is in.  This does not fix the bigger problem
> of tables with blobs that are not working when the criteria does not
> contain the blob column.
> 
> A couple solutions to this would be to
> 1.  run all postgresql command in transactions (removing the
> criteria.containsObjectColumn() checks in BasePeer.
> 
> 2.  Have Peers (in particular TurbineUserPeer) for tables that include
> blobs, set a flag in the Criteria then the containsObjectColumn() method
> can return true without actually checking if the criteria actually is
> referencing the column.
> 
> I think 2 should work pretty well.  But I will let those who actually
> are using Postgresql implement the solution.
> 
> john mcnally
> 
Well, i will contact with Julia to see how we can make this change!
Thank's.
Jerome Verleyen
-- 
 Le principe de fufe, ce n'est pas de faire évoluer fr.*, mais bien
 d'occuper les fufeurs pour qu'ils ne répandent pas le chaos ailleurs.
 C'est un zoo. 
 -+- TP in: Guide du Cabaliste Usenet - La cage de la Cabale -+-

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: BasePeer to Postgresql.

Posted by John McNally <jm...@collab.net>.
Julia Stobbes submitted the patch that I mentioned to Jerome.  It is
already in the HEAD.  It should probably be ported to the 2.1 branch,
whenever a bugfix release is in.  This does not fix the bigger problem
of tables with blobs that are not working when the criteria does not
contain the blob column.  

A couple solutions to this would be to 
1.  run all postgresql command in transactions (removing the
criteria.containsObjectColumn() checks in BasePeer.

2.  Have Peers (in particular TurbineUserPeer) for tables that include
blobs, set a flag in the Criteria then the containsObjectColumn() method
can return true without actually checking if the criteria actually is
referencing the column.

I think 2 should work pretty well.  But I will let those who actually
are using Postgresql implement the solution.

john mcnally

Jerome Verleyen wrote:
> 
> Hi,
> With the aid of John Macnally, i'v just tried out this patch to correct
> BasePeer.java, that it could go whith Postgresql.
> 
> Just the method doDelete(criteria) that bug in the initial version
> because of the fact that it could be access Objectdata in the database.
> I'm just reuse the code in the doInsert(criteria) ;))
> 
> Whith this patch, i can now remove a user.
> 
> PS: That go well with Village package as is. There is nothing to change,
> at this time..
> 
> Thank's a lot John.
> 
> Jerome Verleyen
> 
> --
>  [...] C'est aussi mon avis. Il reigne par ici une frenesie autour du
> GMP
>  tout a fait inquietante... (Et la je suis encore bon pour le GMP,
>  surtout que je fais 3 lignes, comme par hasard) ;o)
>  -+- ED in Guide du Macounet Pervers : Hasard (?) frénétique -+-
> 
>   ------------------------------------------------------------------------
> --- BasePeer.java-ORI   Wed Jun 27 13:20:30 2001
> +++ BasePeer.java-NEW   Wed Jun 27 13:32:03 2001
> @@ -458,18 +458,40 @@
>       */
>      public static void doDelete(Criteria criteria)
>          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);
> +            }
>          }
> +        return id;
> +
>      }
> 
>      /**
>

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org