details:   /erp/devel/dbsm-main/rev/169c154df272
changeset: 281:169c154df272
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Fri Mar 05 15:43:38 2010 +0100
summary:   Fixed issue 12314. onCreateDefaults will now be executed without 
linking to temporary table, to speed the execution in cases in which the tables 
have a big number of rows.

details:   /erp/devel/dbsm-main/rev/ef9bb5546b88
changeset: 282:ef9bb5546b88
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Tue Mar 09 19:04:32 2010 +0100
summary:   Fixed issue 12621.
Now useless data changes (which change something from X to X, that is, they 
don't change anything at all) will no longer be generated when exporting a 
configuration script.

diffstat:

 src/org/apache/ddlutils/alteration/DataComparator.java |  24 +++++++++---------
 src/org/apache/ddlutils/platform/SqlBuilder.java       |  11 +------
 2 files changed, 14 insertions(+), 21 deletions(-)

diffs (55 lines):

diff -r 6806615911a0 -r ef9bb5546b88 
src/org/apache/ddlutils/alteration/DataComparator.java
--- a/src/org/apache/ddlutils/alteration/DataComparator.java    Wed Mar 03 
11:54:19 2010 +0100
+++ b/src/org/apache/ddlutils/alteration/DataComparator.java    Tue Mar 09 
19:04:32 2010 +0100
@@ -185,18 +185,18 @@
       if (table.includesColumn(nonprimaryKeys[i].getName())) {
         Object v1 = db1.get(nonprimaryKeys[i].getName());
         Object v2 = db2.get(nonprimaryKeys[i].getName());
-        if ((v1 == null && v2 != null) || (v1 != null && v2 == null)
-            || (v1 != null && v2 != null && !v1.equals(v2))) {
-          String val1;
-          if (v1 == null)
-            val1 = null;
-          else
-            val1 = v1.toString();
-          String val2;
-          if (v2 == null)
-            val2 = null;
-          else
-            val2 = v2.toString();
+        String val1;
+        if (v1 == null)
+          val1 = null;
+        else
+          val1 = v1.toString();
+        String val2;
+        if (v2 == null)
+          val2 = null;
+        else
+          val2 = v2.toString();
+        if ((val1 == null && val2 != null) || (val1 != null && val2 == null)
+            || (val1 != null && val2 != null && !val1.equals(val2))) {
           dataChanges.add(new ColumnDataChange(dynaClass.getTable(), 
nonprimaryKeys[i].getColumn(),
               val1, val2, pkVal));
           // System.out.println("Column change:
diff -r 6806615911a0 -r ef9bb5546b88 
src/org/apache/ddlutils/platform/SqlBuilder.java
--- a/src/org/apache/ddlutils/platform/SqlBuilder.java  Wed Mar 03 11:54:19 
2010 +0100
+++ b/src/org/apache/ddlutils/platform/SqlBuilder.java  Tue Mar 09 19:04:32 
2010 +0100
@@ -865,15 +865,8 @@
     }
     String oncreatedefault = col.getOnCreateDefault();
     if (oncreatedefault != null && !oncreatedefault.equals("")) {
-      if (recreated) {
-        print("UPDATE " + table.getName() + " SET " + col.getName() + "=(" + 
oncreatedefault
-            + ") WHERE EXISTS (SELECT 1 FROM " + tempTable.getName() + " WHERE 
" + pk + ") AND "
-            + col.getName() + " IS NULL");
-      } else {
-        print("UPDATE " + table.getName() + " SET " + col.getName() + "=(" + 
oncreatedefault + ")");
-        if (onlyForNullRows)
-          print(" WHERE " + col.getName() + " IS NULL");
-      }
+      print("UPDATE " + table.getName() + " SET " + col.getName() + "=(" + 
oncreatedefault
+          + ") WHERE " + col.getName() + " IS NULL");
       println();
       printEndOfStatement();
     }

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to