Author: jolee
Date: 2012-08-21 13:49:10 -0400 (Tue, 21 Aug 2012)
New Revision: 4355
Modified:
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java
branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseSQLConversionVisitor.java
Log:
TEIID-2157 adding sybase limit for older releases
Modified:
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java
===================================================================
---
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java 2012-08-21
17:29:30 UTC (rev 4354)
+++
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java 2012-08-21
17:49:10 UTC (rev 4355)
@@ -52,7 +52,8 @@
@Translator(name="sybase", description="A translator for Sybase
Database")
public class SybaseExecutionFactory extends BaseSybaseExecutionFactory {
-
+
+ public static final String TWELVE_5_3 = "12.5.3"; //$NON-NLS-1$
public static final String TWELVE_5 = "12.5"; //$NON-NLS-1$
public static final String FIFTEEN_0_2 = "15.0.2"; //$NON-NLS-1$
public static final String FIFTEEN_5 = "15.5"; //$NON-NLS-1$
@@ -363,7 +364,7 @@
@Override
public boolean supportsRowLimit() {
- return getDatabaseVersion().compareTo(FIFTEEN_0_2) >= 0;
+ return (getDatabaseVersion().startsWith("12") &&
getDatabaseVersion().compareTo(TWELVE_5_3) >= 0) ||
getDatabaseVersion().compareTo(FIFTEEN_0_2) >=0; //$NON-NLS-1$
}
}
Modified:
branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseSQLConversionVisitor.java
===================================================================
---
branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseSQLConversionVisitor.java 2012-08-21
17:29:30 UTC (rev 4354)
+++
branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseSQLConversionVisitor.java 2012-08-21
17:49:10 UTC (rev 4355)
@@ -35,6 +35,7 @@
/**
*/
+@SuppressWarnings("nls")
public class TestSybaseSQLConversionVisitor {
private static SybaseExecutionFactory trans = new SybaseExecutionFactory();
@@ -256,4 +257,16 @@
"SELECT {fn timestampadd(sql_tsi_second, 1, SmallA.TimestampValue)},
dateadd(millisecond, 1000/1000000, SmallA.TimestampValue), datediff(millisecond,
SmallA.TimestampValue,SmallA.TimestampValue)*1000000 FROM SmallA"); //$NON-NLS-1$
}
+ @Test public void testLimitSupport() {
+ SybaseExecutionFactory sybaseExecutionFactory = new SybaseExecutionFactory();
+ sybaseExecutionFactory.setDatabaseVersion("12.5.4");
+ assertTrue(sybaseExecutionFactory.supportsRowLimit());
+ sybaseExecutionFactory.setDatabaseVersion("12.5.2");
+ assertFalse(sybaseExecutionFactory.supportsRowLimit());
+ sybaseExecutionFactory.setDatabaseVersion("15");
+ assertFalse(sybaseExecutionFactory.supportsRowLimit());
+ sybaseExecutionFactory.setDatabaseVersion("15.1");
+ assertTrue(sybaseExecutionFactory.supportsRowLimit());
+ }
+
}
Show replies by date