Skip to content

Commit

Permalink
TEIID-3501 fixing format
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Jul 22, 2015
1 parent 26aae12 commit 23d1b49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -248,17 +248,17 @@ public List<String> getSupportedFunctions() {

@Override
public String translateLiteralDate(Date dateValue) {
return "DATE " + formatDateValue(dateValue); //$NON-NLS-1$
return "DATE '" + formatDateValue(dateValue) + '\''; //$NON-NLS-1$
}

@Override
public String translateLiteralTime(Time timeValue) {
return "TIME " + formatDateValue(timeValue); //$NON-NLS-1$
return "TIME '" + formatDateValue(timeValue) + '\''; //$NON-NLS-1$
}

@Override
public String translateLiteralTimestamp(Timestamp timestampValue) {
return "TIMESTAMP " + formatDateValue(timestampValue); //$NON-NLS-1$
return "TIMESTAMP '" + formatDateValue(timestampValue) + '\''; //$NON-NLS-1$
}

// Teradata also supports MINUS & ALL set operators
Expand Down
Expand Up @@ -75,7 +75,7 @@ public String helpGetString(Expression expr) throws Exception {
}

@Test public void testTimestampToTime() throws Exception {
helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(111, 4, 5, 9, 16, 34, 220000000), Timestamp.class), "time", "cast(TIMESTAMP 2011-05-05 09:16:34.22 AS TIME)");
helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(111, 4, 5, 9, 16, 34, 220000000), Timestamp.class), "time", "cast(TIMESTAMP '2011-05-05 09:16:34.22' AS TIME)");
}

@Test public void testIntegerToString() throws Exception {
Expand Down Expand Up @@ -183,7 +183,7 @@ public String helpGetString(Expression expr) throws Exception {

@Test public void testDateTimeLiterals() throws Exception {
String input = "SELECT {t '12:00:00'}, {d '2015-01-01'}, {ts '2015-01-01 12:00:00.1'}";
String out = "SELECT TIME 12:00:00, DATE 2015-01-01, TIMESTAMP 2015-01-01 12:00:00.1";
String out = "SELECT TIME '12:00:00', DATE '2015-01-01', TIMESTAMP '2015-01-01 12:00:00.1'";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, null, input, out, TRANSLATOR);
}

Expand Down

0 comments on commit 23d1b49

Please sign in to comment.