You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jm...@apache.org on 2002/02/04 19:01:54 UTC

cvs commit: jakarta-turbine-torque/src/templates/om Peer.vm

jmcnally    02/02/04 10:01:54

  Modified:    src/templates/om Peer.vm
  Log:
  patch to buildCriteria, so that it accounts for the name given in the schema.
  - by Dave Everson
  
  Also moved the code that checks and assigns the db name in the doXXX methods,
  so that it is invoked during transactions.
  
  Revision  Changes    Path
  1.14      +29 -29    jakarta-turbine-torque/src/templates/om/Peer.vm
  
  Index: Peer.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/Peer.vm,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Peer.vm	27 Dec 2001 18:28:59 -0000	1.13
  +++ Peer.vm	4 Feb 2002 18:01:54 -0000	1.14
  @@ -234,15 +234,15 @@
            #end
        #end
   
  +        // Set the correct dbName if it has not been overridden
  +        // criteria.getDbName will return the same object if not set to 
  +        // another value so == check is okay and faster
  +        if ( criteria.getDbName() == Torque.getDefaultDB() )
  +        {
  +            criteria.setDbName(DATABASE_NAME);
  +        }
           if ( dbCon == null )
           {
  -            // Set the correct dbName if it has not been overridden
  -            // criteria.getDbName will return the same object if not set to 
  -            // another value so == check is okay and faster
  -            if ( criteria.getDbName() == Torque.getDefaultDB() )
  -            {
  -                criteria.setDbName(DATABASE_NAME);
  -            }
               return BasePeer.doInsert( criteria );
           }
           else
  @@ -402,17 +402,17 @@
            #end
        #end
   
  +        // Set the correct dbName if it has not been overridden
  +        // criteria.getDbName will return the same object if not set to 
  +        // another value so == check is okay and faster
  +        if ( criteria.getDbName() == Torque.getDefaultDB() )
  +        {
  +            criteria.setDbName(DATABASE_NAME);
  +        }
           // BasePeer returns a Vector of Value (Village) arrays.  The array
           // order follows the order columns were placed in the Select clause.
           if ( dbCon == null)
           {
  -            // Set the correct dbName if it has not been overridden
  -            // criteria.getDbName will return the same object if not set to 
  -            // another value so == check is okay and faster
  -            if ( criteria.getDbName() == Torque.getDefaultDB() )
  -            {
  -                criteria.setDbName(DATABASE_NAME);
  -            }
               return BasePeer.doSelect(criteria);
           }
           else
  @@ -571,15 +571,15 @@
            #end
        #end
   
  +        // Set the correct dbName if it has not been overridden
  +        // criteria.getDbName will return the same object if not set to 
  +        // another value so == check is okay and faster
  +        if ( criteria.getDbName() == Torque.getDefaultDB() )
  +        {
  +            criteria.setDbName(DATABASE_NAME);
  +        }
           if ( dbCon == null )
           {
  -            // Set the correct dbName if it has not been overridden
  -            // criteria.getDbName will return the same object if not set to 
  -            // another value so == check is okay and faster
  -            if ( criteria.getDbName() == Torque.getDefaultDB() )
  -            {
  -                criteria.setDbName(DATABASE_NAME);
  -            }
               BasePeer.doUpdate( selectCriteria, criteria );
           }
           else
  @@ -648,15 +648,15 @@
            #end
        #end
   
  +        // Set the correct dbName if it has not been overridden
  +        // criteria.getDbName will return the same object if not set to 
  +        // another value so == check is okay and faster
  +        if ( criteria.getDbName() == Torque.getDefaultDB() )
  +        {
  +            criteria.setDbName(DATABASE_NAME);
  +        }
           if ( dbCon == null )
           {
  -            // Set the correct dbName if it has not been overridden
  -            // criteria.getDbName will return the same object if not set to 
  -            // another value so == check is okay and faster
  -            if ( criteria.getDbName() == Torque.getDefaultDB() )
  -            {
  -                criteria.setDbName(DATABASE_NAME);
  -            }
               BasePeer.doDelete ( criteria );
           }
           else
  @@ -746,7 +746,7 @@
       /** Build a Criteria object from the data object for this peer */
       public static Criteria buildCriteria( $table.JavaName obj )
       {
  -        Criteria criteria = new Criteria();
  +        Criteria criteria = new Criteria(DATABASE_NAME);
           #foreach ($col in $table.Columns)
               #set ( $cfc=$col.JavaName )
               #set ( $cup=$col.Name.toUpperCase() )
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>