sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1729283 - /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java
Date Mon, 08 Feb 2016 22:24:35 GMT
Author: desruisseaux
Date: Mon Feb  8 22:24:34 2016
New Revision: 1729283

URL: http://svn.apache.org/viewvc?rev=1729283&view=rev
Log:
Need to remove "ABS" in "ABS(DEPRECATED)" if the "DEPRECATED" column is of SQL type BOOLEAN.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java?rev=1729283&r1=1729282&r2=1729283&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java
[UTF-8] Mon Feb  8 22:24:34 2016
@@ -413,14 +413,19 @@ public class SQLTranslator implements Fu
          */
         if (useBoolean) {
             int w = ansi.indexOf("WHERE");
-            w += 5;
             if (w >= 0) {
+                w += 5;
                 for (final String field : BOOLEAN_FIELDS) {
                     int p = ansi.indexOf(field, w);
                     if (p >= 0) {
                         p += field.length();
-                        if (!replaceIfEquals(ansi, p, "=0", "=FALSE")) {
-                            replaceIfEquals(ansi, p, "<>0", "=TRUE");
+                        if (!replaceIfEquals(ansi, p, "=0", "=FALSE") &&
+                            !replaceIfEquals(ansi, p, "<>0", "=TRUE"))
+                        {
+                            // Remove "ABS" in "ABS(DEPRECATED)" or "ABS(CO.DEPRECATED)".
+                            if ((p = ansi.lastIndexOf("(", p)) > w) {
+                                replaceIfEquals(ansi, p-3, "ABS", "");
+                            }
                         }
                     }
                 }



Mime
View raw message