METAMODEL-1123: Fixed. METAMODEL-1124: Fixed.
authorJuslwk <i.am.kasper.sorensen@gmail.com>
Thu, 13 Oct 2016 19:45:25 +0000 (12:45 -0700)
committerKasper Sørensen <i.am.kasper.sorensen@gmail.com>
Thu, 13 Oct 2016 19:45:25 +0000 (12:45 -0700)
Fixes #132

CHANGES.md
jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/SQLServerQueryRewriter.java
jdbc/src/test/java/org/apache/metamodel/dialects/SQLServerQueryRewriterTest.java
salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceTable.java

index bef1902..236602e 100644 (file)
@@ -8,6 +8,8 @@
  * [METAMODEL-1113] - Fixed support for ColumnNamingStrategy in CSV connector.
  * [METAMODEL-1114] - Added support for ColumnNamingStrategy in EBCDIC connector.
  * [METAMODEL-1119] - Worked around Hive JDBC driver issues, avoiding non-compliant metadata calls.
+ * [METAMODEL-1123] - Fixed the treatment of a Salesforce.com 'currency' value as a number, not a string.
+ * [METAMODEL-1124] - Fixed the date formatting of date values in MS SQL server.
 
 ### Apache MetaModel 4.5.4
 
index f261d40..88bed85 100644 (file)
@@ -112,7 +112,7 @@ public class SQLServerQueryRewriter extends DefaultQueryRewriter {
 
                 final Date date = (Date) operand;
 
-                final DateFormat format = DateUtils.createDateFormat("yyyy-MM-dd HH:mm:ss");
+                final DateFormat format = DateUtils.createDateFormat("yyyyMMdd HH:mm:ss");
                 final String dateTimeValue = "CAST('" + format.format(date) + "' AS DATETIME)";
 
                 sb.append(dateTimeValue);
index 9b588ab..7d75dc1 100644 (file)
@@ -87,7 +87,7 @@ public class SQLServerQueryRewriterTest extends TestCase {
                         .toDate("2014-06-28 14:06:00")));
 
         assertEquals(
-                "SELECT MY_SCHEMA.\"foo\".\"bar\", timestamp FROM MY_SCHEMA.\"foo\" WHERE timestamp < CAST('2014-06-28 14:06:00' AS DATETIME)",
+                "SELECT MY_SCHEMA.\"foo\".\"bar\", timestamp FROM MY_SCHEMA.\"foo\" WHERE timestamp < CAST('20140628 14:06:00' AS DATETIME)",
                 qr.rewriteQuery(q));
     }
 
index 2df17cc..0c1c113 100644 (file)
@@ -105,6 +105,7 @@ final class SalesforceTable extends AbstractTable {
         case _int:
             return ColumnType.INTEGER;
         case _double:
+        case currency:
             return ColumnType.DOUBLE;
         case date:
             return ColumnType.DATE;
@@ -120,7 +121,6 @@ final class SalesforceTable extends AbstractTable {
         case textarea:
         case encryptedstring:
         case base64:
-        case currency:
         case id:
         case picklist:
             return ColumnType.VARCHAR;