You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by "Göschl,Siegfried" <Si...@drei.com> on 2003/12/05 17:17:01 UTC

Oracle, Torque and PreparedStatements - Potential Patch of Peer.vm

Hi folks,

we recently had a discussion about Torque and problems with Oracle - it seems to have problems with ad-hoc SQL statements filling up an internal buffer. There is BasePeer.doPSSelect() which returns a List of Village Records.

The following patch could return "proper" TORQUE objects. Have a look at it since it is a quick hack and I already had a cup of mulled wine ... ;-) ... and will have a second one before I do more patches ... :-O

Cheers,

Siegfried Goeschl

===============================================================

PEER.VM

  ## ------------------------------------------------------------
  ## Patch by Siegfried Goeschl
  ## ------------------------------------------------------------

    /**
     * Do a Prepared Statement select according to the given criteria
     *
     * @param criteria
     * @return Result as Torque generated objects and NOT Village Records
     * @throws TorqueException Any exceptions caught during processing will be
     *         rethrown wrapped into a TorqueException.
     */
    public static List doPSSelectEx(Criteria criteria) throws TorqueException
    {
     	List v = null;
     	List temp = null;
     	
    	// add the columns to the criteria
    	$basePrefix${table.JavaName}Peer.addSelectColumns( criteria );
    	// invoke the BasePeer to get the list of Village Records
    	temp = $basePrefix${table.JavaName}Peer.doPSSelect( criteria );
    	// convert the VillageRecords into Torque objects
	v = $basePrefix${table.JavaName}Peer.populateObjects( temp );
	return v;
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Oracle, Torque and PreparedStatements - Potential Patch of Peer.vm

Posted by Martin Poeschl <mp...@marmot.at>.
please create patches using diff -u

thanx

martin

Göschl,Siegfried wrote:

>Hi folks,
>
>we recently had a discussion about Torque and problems with Oracle - it seems to have problems with ad-hoc SQL statements filling up an internal buffer. There is BasePeer.doPSSelect() which returns a List of Village Records.
>
>The following patch could return "proper" TORQUE objects. Have a look at it since it is a quick hack and I already had a cup of mulled wine ... ;-) ... and will have a second one before I do more patches ... :-O
>
>Cheers,
>
>Siegfried Goeschl
>
>===============================================================
>
>PEER.VM
>
>  ## ------------------------------------------------------------
>  ## Patch by Siegfried Goeschl
>  ## ------------------------------------------------------------
>
>    /**
>     * Do a Prepared Statement select according to the given criteria
>     *
>     * @param criteria
>     * @return Result as Torque generated objects and NOT Village Records
>     * @throws TorqueException Any exceptions caught during processing will be
>     *         rethrown wrapped into a TorqueException.
>     */
>    public static List doPSSelectEx(Criteria criteria) throws TorqueException
>    {
>     	List v = null;
>     	List temp = null;
>     	
>    	// add the columns to the criteria
>    	$basePrefix${table.JavaName}Peer.addSelectColumns( criteria );
>    	// invoke the BasePeer to get the list of Village Records
>    	temp = $basePrefix${table.JavaName}Peer.doPSSelect( criteria );
>    	// convert the VillageRecords into Torque objects
>	v = $basePrefix${table.JavaName}Peer.populateObjects( temp );
>	return v;
>    }
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Oracle, Torque and PreparedStatements - Potential Patch of Peer.vm

Posted by Ramesh Sabeti <rs...@reazon.com>.
Siegfried,

Out of curiosity, how do you use your patch? 
 
There are two separate issues that need a solution.

1.  doSelect():  This is what you tried to solve in your patch.  An
easier solution is to replace all calls to doSelect with doPSSelect in
Base*Peer.java :)  A patch is not really needed for this case :(

2.  doUpdate():  this method issues a non-parameterized SELECT first,
and that one is buried deep in the API.  I'm still looking for a
solution for that.  Want to give that a try?

Cheers to all the patch-makers,

Ramesh.

> -----Original Message-----
> From: Göschl,Siegfried [mailto:Siegfried.Goeschl@drei.com]
> Sent: Friday, December 05, 2003 8:17 AM
> To: torque-user@db.apache.org
> Subject: Oracle, Torque and PreparedStatements - Potential Patch of
> Peer.vm
> 
> Hi folks,
> 
> we recently had a discussion about Torque and problems with Oracle -
it
> seems to have problems with ad-hoc SQL statements filling up an
internal
> buffer. There is BasePeer.doPSSelect() which returns a List of Village
> Records.
> 
> The following patch could return "proper" TORQUE objects. Have a look
at
> it since it is a quick hack and I already had a cup of mulled wine ...
;-)
> ... and will have a second one before I do more patches ... :-O
> 
> Cheers,
> 
> Siegfried Goeschl
> 
> ===============================================================
> 
> PEER.VM
> 
>   ## ------------------------------------------------------------
>   ## Patch by Siegfried Goeschl
>   ## ------------------------------------------------------------
> 
>     /**
>      * Do a Prepared Statement select according to the given criteria
>      *
>      * @param criteria
>      * @return Result as Torque generated objects and NOT Village
Records
>      * @throws TorqueException Any exceptions caught during processing
> will be
>      *         rethrown wrapped into a TorqueException.
>      */
>     public static List doPSSelectEx(Criteria criteria) throws
> TorqueException
>     {
>      	List v = null;
>      	List temp = null;
> 
>     	// add the columns to the criteria
>     	$basePrefix${table.JavaName}Peer.addSelectColumns( criteria );
>     	// invoke the BasePeer to get the list of Village Records
>     	temp = $basePrefix${table.JavaName}Peer.doPSSelect( criteria );
>     	// convert the VillageRecords into Torque objects
> 	v = $basePrefix${table.JavaName}Peer.populateObjects( temp );
> 	return v;
>     }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org