details:   /erp/devel/pi/rev/438617827527
changeset: 8765:438617827527
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Wed Oct 27 21:23:12 2010 +0200
summary:   Fixes issue 15050: OBQuery: whereclause with alias with a comma 
direct after the alias fails
Fixes issue 15056: OBQuery: whereclause with alias with a comma direct after 
the alias fails

diffstat:

 src-test/org/openbravo/test/dal/IssuesTest.java |  14 ++++++++++++++
 src/org/openbravo/dal/service/OBQuery.java      |   3 +++
 2 files changed, 17 insertions(+), 0 deletions(-)

diffs (43 lines):

diff -r 6592d59a0205 -r 438617827527 
src-test/org/openbravo/test/dal/IssuesTest.java
--- a/src-test/org/openbravo/test/dal/IssuesTest.java   Wed Oct 27 17:54:27 
2010 +0200
+++ b/src-test/org/openbravo/test/dal/IssuesTest.java   Wed Oct 27 21:23:12 
2010 +0200
@@ -114,6 +114,9 @@
  * https://issues.openbravo.com/view.php?id=14276: Need feature to disable 
maintaining audit info
  * via dal for one request/dal-session
  * 
+ * https://issues.openbravo.com/view.php?id=15050: OBQuery: whereclause with 
alias with a comma
+ * direct after the alias fails
+ * 
  * @author mtaal
  * @author iperdomo
  */
@@ -530,4 +533,15 @@
       assertFalse(table.getUpdated().getTime() == oldUpdated.getTime());
     }
   }
+
+  /**
+   * https://issues.openbravo.com/view.php?id=15050: OBQuery: whereclause with 
alias with a comma
+   * direct after the alias fails
+   */
+  public void test15050() throws Exception {
+    setSystemAdministratorContext();
+    final String whereClause = " as t, ADColumn as c where c.table = t and 
c.keyColumn=true";
+    final OBQuery<Table> tables = OBDal.getInstance().createQuery(Table.class, 
whereClause);
+    assertTrue(tables.list().size() > 0);
+  }
 }
\ No newline at end of file
diff -r 6592d59a0205 -r 438617827527 src/org/openbravo/dal/service/OBQuery.java
--- a/src/org/openbravo/dal/service/OBQuery.java        Wed Oct 27 17:54:27 
2010 +0200
+++ b/src/org/openbravo/dal/service/OBQuery.java        Wed Oct 27 21:23:12 
2010 +0200
@@ -240,6 +240,9 @@
       } else {
         alias = strippedWhereClause.substring(0, index);
       }
+      if (alias.endsWith(",")) {
+        alias = alias.substring(0, alias.length() - 1);
+      }
       prefix = alias + ".";
     }
 

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to