db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r492884 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/sql/SqlUpdateStatement.java
Date Fri, 05 Jan 2007 03:11:14 GMT
Author: arminw
Date: Thu Jan  4 19:11:13 2007
New Revision: 492884

URL: http://svn.apache.org/viewvc?view=rev&rev=492884
Log:
minor changes, add comment

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/sql/SqlUpdateStatement.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/sql/SqlUpdateStatement.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/sql/SqlUpdateStatement.java?view=diff&rev=492884&r1=492883&r2=492884
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/sql/SqlUpdateStatement.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/sql/SqlUpdateStatement.java
Thu Jan  4 19:11:13 2007
@@ -23,11 +23,15 @@
 /**
  * Model an UPDATE Statement
  *
- * @author <a href="mailto:jbraeuchi@hotmail.com">Jakob Braeuchi</a>
  * @version $Id$
  */
 public class SqlUpdateStatement extends SqlPkStatement
 {
+//    /*
+//    todo: This workaround solve update problem when only specific fields must be updated
+//    */
+//    private FieldDescriptor[] fieldsToUpdate;
+
     /**
      * Constructor for SqlUpdateStatement.
      */
@@ -36,14 +40,22 @@
         super(aPlatform, aLogger, aCld);
     }
 
+//    public SqlUpdateStatement(Platform aPlatform, Logger aLogger, ClassDescriptor aCld,
FieldDescriptor[] fieldsToUpdate)
+//    {
+//        super(aPlatform, aLogger, aCld);
+//        this.fieldsToUpdate = fieldsToUpdate;
+//        // don't hold references to metadata classes,
+//        // thus we have to make a workaround
+//        getStatement();
+//        this.fieldsToUpdate = null;
+//    }
+
     /**
      * generates a SET-phrase for a prepared update statement.
      * @param buf the StringBuffer
      */
-    private void appendSetClause(ClassDescriptor cld, StringBuffer buf)
+    private void appendSetClause(FieldDescriptor[] fields, StringBuffer buf)
     {
-        FieldDescriptor[] fields = cld.getNonPkRwFields();
-
         if(fields.length == 0)
         {
             return;
@@ -71,7 +83,17 @@
 
         stmt.append("UPDATE ");
         appendTable(cld, stmt);
-        appendSetClause(cld, stmt);
+
+//        if(fieldsToUpdate == null)
+//        {
+//            appendSetClause(cld.getNonPkRwFields(), stmt);
+//        }
+//        else
+//        {
+//            appendSetClause(fieldsToUpdate, stmt);
+//        }
+        appendSetClause(cld.getNonPkRwFields(), stmt);
+
         appendWhereClause(cld, true, stmt); //use Locking
 
         return stmt.toString();



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


Mime
View raw message