svn commit: r492884 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/sql/SqlUpdateStatement.java

[email protected]
Newsgroups gmane.comp.jakarta.ojb.devel
Message-ID <[email protected]>
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:[email protected]">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();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.