[#800] Add support for Sybase Adaptive Server Enterprise - fixed many integration tests

This commit is contained in:
Lukas Eder 2011-09-06 17:34:47 +00:00
parent d746075fc9
commit 65bb1d29e9
15 changed files with 46 additions and 14 deletions

View File

@ -696,6 +696,7 @@ public abstract class jOOQAbstractTest<
// Schema mapping is supported in many RDBMS. But maintaining several
// databases is non-trivial in some of them.
switch (getDialect()) {
case ADAPTIVESERVER:
case DB2:
case DERBY:
case H2:
@ -1735,6 +1736,7 @@ public abstract class jOOQAbstractTest<
assertEquals(2, result2.size());
switch (getDialect()) {
case ADAPTIVESERVER:
case DB2:
case DERBY:
case HSQLDB:
@ -4903,7 +4905,7 @@ public abstract class jOOQAbstractTest<
q.addSelect(position);
// https://issues.apache.org/jira/browse/DERBY-5005
q.addOrderBy(create().field("AUTHOR"));
q.addOrderBy(create().field(VLibrary_AUTHOR().getName()));
q.execute();
Record r1 = q.getResult().get(1); // George Orwell
@ -5911,6 +5913,7 @@ public abstract class jOOQAbstractTest<
@Test
public void testWindowFunctions() throws Exception {
switch (getDialect()) {
case ADAPTIVESERVER:
case DERBY:
case H2:
case HSQLDB:
@ -7129,6 +7132,7 @@ public abstract class jOOQAbstractTest<
// Update duplicate records
// ------------------------
switch (getDialect()) {
case ADAPTIVESERVER:
case DERBY:
case H2:
case INGRES:

View File

@ -63,6 +63,7 @@ class Atan2 extends AbstractFunction<BigDecimal> {
@Override
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.getDialect()) {
case ADAPTIVESERVER:
case SQLSERVER:
return new Function<BigDecimal>("atn2", SQLDataType.NUMERIC, arg1, arg2);

View File

@ -64,7 +64,8 @@ class Ceil<T> extends AbstractFunction<T> {
case SQLITE:
return argument.add(0.5).round();
case H2: // No break
case ADAPTIVESERVER:
case H2:
case SQLSERVER:
return new Function<T>("ceiling", getDataType(), argument);

View File

@ -61,6 +61,7 @@ class Cosh extends AbstractFunction<BigDecimal> {
@Override
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.getDialect()) {
case ADAPTIVESERVER:
case HSQLDB:
case INGRES:
case MYSQL:

View File

@ -129,6 +129,7 @@ class Extract extends AbstractFunction<Integer> {
throw new SQLDialectNotSupportedException("DatePart not supported: " + datePart);
}
case ADAPTIVESERVER:
case SQLSERVER:
case SYBASE:
switch (datePart) {

View File

@ -1629,6 +1629,7 @@ public class Factory implements Configuration {
return select(field).fetchOne(field);
}
case ADAPTIVESERVER:
case SQLSERVER:
case SYBASE: {
Field<BigInteger> field = field("@@identity", BigInteger.class);
@ -2487,6 +2488,9 @@ public class Factory implements Configuration {
*/
public final Field<Timestamp> currentTimestamp() {
switch (getDialect()) {
case ADAPTIVESERVER:
return new Function<Timestamp>("current_bigdatetime", SQLDataType.TIMESTAMP);
case ORACLE:
return new Function<Timestamp>("sysdate", SQLDataType.TIMESTAMP);
@ -2512,6 +2516,9 @@ public class Factory implements Configuration {
*/
public final Field<String> currentUser() {
switch (getDialect()) {
case ADAPTIVESERVER:
return field("user", SQLDataType.VARCHAR);
case ORACLE:
return new Function<String>("user", SQLDataType.VARCHAR);

View File

@ -63,8 +63,12 @@ class Greatest<T> extends AbstractFunction<T> {
}
switch (configuration.getDialect()) {
case DERBY: // No break
case SQLSERVER: // No break
// This implementation has O(2^n) complexity. Better implementations
// are very welcome
case ADAPTIVESERVER:
case DERBY:
case SQLSERVER:
case SYBASE: {
Field<T> first = (Field<T>) getArguments()[0];
Field<T> other = (Field<T>) getArguments()[1];

View File

@ -320,6 +320,7 @@ class InsertQueryImpl<R extends TableRecord<R>> extends AbstractStoreQuery<R> im
// Some dialects can only return AUTO_INCREMENT values
// Other values have to be fetched in a second step
case ADAPTIVESERVER:
case DERBY:
case H2:
case INGRES:
@ -382,6 +383,7 @@ class InsertQueryImpl<R extends TableRecord<R>> extends AbstractStoreQuery<R> im
// Some dialects can only retrieve "identity" (AUTO_INCREMENT) values
// Additional values have to be fetched explicitly
case ADAPTIVESERVER:
case DERBY:
case H2:
case INGRES:

View File

@ -63,8 +63,12 @@ class Least<T> extends AbstractFunction<T> {
}
switch (configuration.getDialect()) {
case DERBY: // No break
case SQLSERVER: // No break
// This implementation has O(2^n) complexity. Better implementations
// are very welcome
case ADAPTIVESERVER:
case DERBY:
case SQLSERVER:
case SYBASE: {
Field<T> first = (Field<T>) getArguments()[0];
Field<T> other = (Field<T>) getArguments()[1];

View File

@ -68,6 +68,7 @@ class Ln extends AbstractFunction<BigDecimal> {
final Field<BigDecimal> getFunction0(Configuration configuration) {
if (base == null) {
switch (configuration.getDialect()) {
case ADAPTIVESERVER:
case H2:
case SQLSERVER:
return new Function<BigDecimal>("log", SQLDataType.NUMERIC, argument);
@ -80,12 +81,13 @@ class Ln extends AbstractFunction<BigDecimal> {
Field<Integer> baseField = create(configuration).literal(base);
switch (configuration.getDialect()) {
case DB2: // No break
case DERBY: // No break
case H2: // No break
case HSQLDB: // No break
case INGRES: // No break
case SQLSERVER: // No break
case ADAPTIVESERVER:
case DB2:
case DERBY:
case H2:
case HSQLDB:
case INGRES:
case SQLSERVER:
case SYBASE:
return argument.ln().div(baseField.ln());

View File

@ -76,6 +76,7 @@ class Position extends AbstractFunction<Integer> {
case ORACLE:
return new Function<Integer>("instr", SQLDataType.INTEGER, in, search);
case ADAPTIVESERVER:
case SQLSERVER:
return new Function<Integer>("charindex", SQLDataType.INTEGER, search, in);

View File

@ -89,8 +89,9 @@ class Round<T> extends AbstractFunction<T> {
}
// These dialects have a mandatory decimals argument
case INGRES: // No break
case SQLSERVER: // No break
case ADAPTIVESERVER:
case INGRES:
case SQLSERVER:
case SYBASE: {
return new Function<T>("round", getDataType(), argument, val(decimals));
}

View File

@ -61,6 +61,7 @@ class Sinh extends AbstractFunction<BigDecimal> {
@Override
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.getDialect()) {
case ADAPTIVESERVER:
case HSQLDB:
case INGRES:
case MYSQL:

View File

@ -105,6 +105,7 @@ class SortFieldImpl<T> extends AbstractNamedTypeProviderQueryPart<T> implements
case DB2:
// These dialects don't support this syntax at all
case ADAPTIVESERVER:
case INGRES:
case MYSQL:
case SQLITE:

View File

@ -61,6 +61,7 @@ class Tanh extends AbstractFunction<BigDecimal> {
@Override
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.getDialect()) {
case ADAPTIVESERVER:
case HSQLDB:
case INGRES:
case MYSQL: