svn commit: r981620 - in /ofbiz/trunk/framework/sql/src/org/ofbiz/sql: Joined.java KeyMap.java Relation.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r981620 - in /ofbiz/trunk/framework/sql/src/org/ofbiz/sql: Joined.java KeyMap.java Relation.java

doogie-3
Author: doogie
Date: Mon Aug  2 17:42:17 2010
New Revision: 981620

URL: http://svn.apache.org/viewvc?rev=981620&view=rev
Log:
OPTIMIZE: KeyMap no longer extends Atom, so no longer has any appendTo variants.

Modified:
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Joined.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/KeyMap.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Relation.java

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Joined.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Joined.java?rev=981620&r1=981619&r2=981620&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Joined.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Joined.java Mon Aug  2 17:42:17 2010
@@ -76,8 +76,10 @@ public final class Joined extends Atom i
         tableName.appendTo(sb);
         sb.append(" ON ");
         for (int i = 0; i < keyMaps.size(); i++) {
+            KeyMap keyMap = keyMaps.get(i);
             if (i != 0) sb.append(" AND ");
-            keyMaps.get(i).appendTo(leftAlias, tableName.getAlias(), sb);
+            sb.append(' ').append(leftAlias).append('.').append(keyMap.getLeftFieldName());
+            sb.append(" = ").append(tableName.getAlias()).append('.').append(keyMap.getRightFieldName());
         }
         if (joined != null) {
             joined.appendTo(tableName.getAlias(), sb);

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/KeyMap.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/KeyMap.java?rev=981620&r1=981619&r2=981620&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/KeyMap.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/KeyMap.java Mon Aug  2 17:42:17 2010
@@ -18,7 +18,7 @@
  */
 package org.ofbiz.sql;
 
-public final class KeyMap extends Atom {
+public final class KeyMap {
     private final String leftFieldName;
     private final String rightFieldName;
 
@@ -43,15 +43,4 @@ public final class KeyMap extends Atom {
             return false;
         }
     }
-
-    public StringBuilder appendTo(StringBuilder sb) {
-        return appendTo("left", "right", sb);
-    }
-
-    public StringBuilder appendTo(String leftAlias, String rightAlias, StringBuilder sb) {
-        sb.append(leftAlias).append('.').append(leftFieldName);
-        sb.append(" = ");
-        sb.append(rightAlias).append('.').append(rightFieldName);
-        return sb;
-    }
 }

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Relation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Relation.java?rev=981620&r1=981619&r2=981620&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Relation.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Relation.java Mon Aug  2 17:42:17 2010
@@ -76,9 +76,10 @@ public final class Relation extends Atom
         sb.append(' ').append(entityName);
         sb.append(" ON");
         for (int i = 0; i < keyMaps.size(); i++) {
+            KeyMap keyMap = keyMaps.get(i);
             if (i != 0) sb.append(" AND ");
-            sb.append(' ');
-            keyMaps.get(i).appendTo("cur", "other", sb);
+            sb.append(" cur.").append(keyMap.getLeftFieldName());
+            sb.append(" = other.").append(keyMap.getRightFieldName());
         }
         return sb;
     }