[#800] Add support for Sybase Adaptive Server Enterprise - rename "adaptiveserver" into "ase"
This commit is contained in:
parent
99064a0c32
commit
0c07598323
@ -37,7 +37,7 @@
|
||||
package org.jooq;
|
||||
|
||||
import org.jooq.impl.Factory;
|
||||
import org.jooq.util.adaptiveserver.AdaptiveServerFactory;
|
||||
import org.jooq.util.ase.ASEFactory;
|
||||
import org.jooq.util.db2.DB2Factory;
|
||||
import org.jooq.util.derby.DerbyFactory;
|
||||
import org.jooq.util.h2.H2Factory;
|
||||
@ -68,7 +68,7 @@ public enum SQLDialect {
|
||||
/**
|
||||
* The Sybase Adaptive Server SQL dialect
|
||||
*/
|
||||
ADAPTIVESERVER("AdaptiveServer", AdaptiveServerFactory.class),
|
||||
ASE("ASE", ASEFactory.class),
|
||||
|
||||
/**
|
||||
* The IBM DB2 SQL dialect
|
||||
|
||||
@ -193,7 +193,7 @@ implements
|
||||
break;
|
||||
}
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER:
|
||||
case SYBASE: {
|
||||
|
||||
@ -413,7 +413,7 @@ implements
|
||||
|
||||
// SQL Server is a bit different from the other dialects
|
||||
switch (context.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER: // No break
|
||||
case SYBASE: {
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ class Atan2 extends AbstractFunction<BigDecimal> {
|
||||
@Override
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER:
|
||||
return new Function<BigDecimal>("atn2", SQLDataType.NUMERIC, arg1, arg2);
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ class BitLength extends AbstractFunction<Integer> {
|
||||
@Override
|
||||
final Field<Integer> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
return new Function<Integer>("8 * datalength", SQLDataType.INTEGER, argument);
|
||||
|
||||
case DB2: // No break
|
||||
|
||||
@ -64,7 +64,7 @@ class Ceil<T> extends AbstractFunction<T> {
|
||||
case SQLITE:
|
||||
return argument.add(0.5).round();
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case H2:
|
||||
case SQLSERVER:
|
||||
return new Function<T>("ceiling", getDataType(), argument);
|
||||
|
||||
@ -61,7 +61,7 @@ class Cosh extends AbstractFunction<BigDecimal> {
|
||||
@Override
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case HSQLDB:
|
||||
case INGRES:
|
||||
case MYSQL:
|
||||
|
||||
@ -133,7 +133,7 @@ class DefaultRenderContext extends AbstractContext<RenderContext> implements Ren
|
||||
sql(literal);
|
||||
break;
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER:
|
||||
case SYBASE:
|
||||
sql("[").sql(literal).sql("]");
|
||||
|
||||
@ -107,7 +107,7 @@ class DescribeQuery<R extends Record> extends AbstractQuery {
|
||||
context.sql("select ");
|
||||
|
||||
// TODO [#21] Refactor this and correctly implement Limit for Sybase
|
||||
if (context.getDialect() == SQLDialect.ADAPTIVESERVER ||
|
||||
if (context.getDialect() == SQLDialect.ASE ||
|
||||
context.getDialect() == SQLDialect.SYBASE ||
|
||||
context.getDialect() == SQLDialect.SQLSERVER) {
|
||||
context.inline(true)
|
||||
@ -120,7 +120,7 @@ class DescribeQuery<R extends Record> extends AbstractQuery {
|
||||
context.sql(" ");
|
||||
|
||||
// nothing to do here, top clause added at start of statement
|
||||
if (context.getDialect() == SQLDialect.ADAPTIVESERVER ||
|
||||
if (context.getDialect() == SQLDialect.ASE ||
|
||||
context.getDialect() == SQLDialect.SYBASE ||
|
||||
context.getDialect() == SQLDialect.SQLSERVER) {
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ class Dual extends AbstractTable<Record> {
|
||||
context.sql("INFORMATION_SCHEMA.SYSTEM_USERS");
|
||||
break;
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case INGRES:
|
||||
case POSTGRES:
|
||||
case SQLITE:
|
||||
|
||||
@ -57,7 +57,7 @@ class Euler extends AbstractFunction<BigDecimal> {
|
||||
@Override
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case DB2:
|
||||
case DERBY:
|
||||
case H2:
|
||||
|
||||
@ -129,7 +129,7 @@ class Extract extends AbstractFunction<Integer> {
|
||||
throw new SQLDialectNotSupportedException("DatePart not supported: " + datePart);
|
||||
}
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER:
|
||||
case SYBASE:
|
||||
switch (datePart) {
|
||||
|
||||
@ -1629,7 +1629,7 @@ public class Factory implements Configuration {
|
||||
return select(field).fetchOne(field);
|
||||
}
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER:
|
||||
case SYBASE: {
|
||||
Field<BigInteger> field = field("@@identity", BigInteger.class);
|
||||
@ -2488,7 +2488,7 @@ public class Factory implements Configuration {
|
||||
*/
|
||||
public final Field<Timestamp> currentTimestamp() {
|
||||
switch (getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
return new Function<Timestamp>("current_bigdatetime", SQLDataType.TIMESTAMP);
|
||||
|
||||
case ORACLE:
|
||||
@ -2516,7 +2516,7 @@ public class Factory implements Configuration {
|
||||
*/
|
||||
public final Field<String> currentUser() {
|
||||
switch (getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
return field("user", SQLDataType.VARCHAR);
|
||||
|
||||
case ORACLE:
|
||||
|
||||
@ -87,7 +87,7 @@ class FieldMapsForInsert extends AbstractQueryPart {
|
||||
switch (context.getDialect()) {
|
||||
|
||||
// Some dialects don't support multi-record inserts
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case INGRES:
|
||||
case ORACLE:
|
||||
case SQLITE:
|
||||
|
||||
@ -72,7 +72,7 @@ import org.jooq.Result;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.SQLDialectNotSupportedException;
|
||||
import org.jooq.UDTRecord;
|
||||
import org.jooq.util.adaptiveserver.AdaptiveServerDataType;
|
||||
import org.jooq.util.ase.ASEDataType;
|
||||
import org.jooq.util.db2.DB2DataType;
|
||||
import org.jooq.util.derby.DerbyDataType;
|
||||
import org.jooq.util.h2.H2DataType;
|
||||
@ -813,8 +813,8 @@ public final class FieldTypeHelper {
|
||||
|
||||
public static <T> DataType<T> getDataType(SQLDialect dialect, Class<? extends T> type) {
|
||||
switch (dialect) {
|
||||
case ADAPTIVESERVER:
|
||||
return AdaptiveServerDataType.getDataType(type);
|
||||
case ASE:
|
||||
return ASEDataType.getDataType(type);
|
||||
case DB2:
|
||||
return DB2DataType.getDataType(type);
|
||||
case DERBY:
|
||||
|
||||
@ -66,7 +66,7 @@ class Greatest<T> extends AbstractFunction<T> {
|
||||
// This implementation has O(2^n) complexity. Better implementations
|
||||
// are very welcome
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case DERBY:
|
||||
case SQLSERVER:
|
||||
case SYBASE: {
|
||||
|
||||
@ -320,7 +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 ASE:
|
||||
case DERBY:
|
||||
case H2:
|
||||
case INGRES:
|
||||
@ -383,7 +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 ASE:
|
||||
case DERBY:
|
||||
case H2:
|
||||
case INGRES:
|
||||
|
||||
@ -66,7 +66,7 @@ class Least<T> extends AbstractFunction<T> {
|
||||
// This implementation has O(2^n) complexity. Better implementations
|
||||
// are very welcome
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case DERBY:
|
||||
case SQLSERVER:
|
||||
case SYBASE: {
|
||||
|
||||
@ -148,7 +148,7 @@ class Limit extends AbstractQueryPart {
|
||||
break;
|
||||
}
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER:
|
||||
case SYBASE: {
|
||||
if (getOffset() != 0) {
|
||||
@ -201,7 +201,7 @@ class Limit extends AbstractQueryPart {
|
||||
|
||||
// These dialects don't allow bind variables in their TOP clauses
|
||||
// -----------------------------------------------------------------
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case DB2:
|
||||
case SQLSERVER:
|
||||
case SYBASE: {
|
||||
|
||||
@ -68,7 +68,7 @@ class Ln extends AbstractFunction<BigDecimal> {
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
if (base == null) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case H2:
|
||||
case SQLSERVER:
|
||||
return new Function<BigDecimal>("log", SQLDataType.NUMERIC, argument);
|
||||
@ -81,7 +81,7 @@ class Ln extends AbstractFunction<BigDecimal> {
|
||||
Field<Integer> baseField = create(configuration).literal(base);
|
||||
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case DB2:
|
||||
case DERBY:
|
||||
case H2:
|
||||
|
||||
@ -64,7 +64,7 @@ class Lpad extends AbstractFunction<String> {
|
||||
@Override
|
||||
final Field<String> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER:
|
||||
case SYBASE: {
|
||||
if (character == null) {
|
||||
|
||||
@ -63,7 +63,7 @@ class Mod<T> extends AbstractFunction<T> {
|
||||
@Override
|
||||
final Field<T> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLITE:
|
||||
case SQLSERVER:
|
||||
return new Expression<T>(MODULO, arg1, arg2);
|
||||
|
||||
@ -76,7 +76,7 @@ class Position extends AbstractFunction<Integer> {
|
||||
case ORACLE:
|
||||
return new Function<Integer>("instr", SQLDataType.INTEGER, in, search);
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER:
|
||||
return new Function<Integer>("charindex", SQLDataType.INTEGER, search, in);
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ class Repeat extends AbstractFunction<String> {
|
||||
case ORACLE:
|
||||
return string.rpad(string.length().mul(count), (Field<String>) string);
|
||||
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER:
|
||||
return new Function<String>("replicate", SQLDataType.VARCHAR, string, count);
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ class Replace extends AbstractFunction<String> {
|
||||
@Override
|
||||
final Field<String> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER: {
|
||||
case ASE: {
|
||||
if (getArguments().length == 2) {
|
||||
return new Function<String>("str_replace", SQLDataType.VARCHAR,
|
||||
getArguments()[0], getArguments()[1], val(""));
|
||||
|
||||
@ -89,7 +89,7 @@ class Round<T> extends AbstractFunction<T> {
|
||||
}
|
||||
|
||||
// These dialects have a mandatory decimals argument
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case INGRES:
|
||||
case SQLSERVER:
|
||||
case SYBASE: {
|
||||
|
||||
@ -64,7 +64,7 @@ class Rpad extends AbstractFunction<String> {
|
||||
@Override
|
||||
final Field<String> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER:
|
||||
case SYBASE: {
|
||||
if (character == null) {
|
||||
|
||||
@ -45,7 +45,7 @@ import java.sql.Types;
|
||||
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Result;
|
||||
import org.jooq.util.adaptiveserver.AdaptiveServerDataType;
|
||||
import org.jooq.util.ase.ASEDataType;
|
||||
import org.jooq.util.db2.DB2DataType;
|
||||
import org.jooq.util.derby.DerbyDataType;
|
||||
import org.jooq.util.h2.H2DataType;
|
||||
@ -267,7 +267,7 @@ public final class SQLDataType<T> extends AbstractDataType<T> {
|
||||
// Load all dialect-specific data types
|
||||
|
||||
try {
|
||||
Class.forName(AdaptiveServerDataType.class.getName());
|
||||
Class.forName(ASEDataType.class.getName());
|
||||
Class.forName(DB2DataType.class.getName());
|
||||
Class.forName(DerbyDataType.class.getName());
|
||||
Class.forName(H2DataType.class.getName());
|
||||
|
||||
@ -61,7 +61,7 @@ class Sinh extends AbstractFunction<BigDecimal> {
|
||||
@Override
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case HSQLDB:
|
||||
case INGRES:
|
||||
case MYSQL:
|
||||
|
||||
@ -105,7 +105,7 @@ class SortFieldImpl<T> extends AbstractNamedTypeProviderQueryPart<T> implements
|
||||
case DB2:
|
||||
|
||||
// These dialects don't support this syntax at all
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case INGRES:
|
||||
case MYSQL:
|
||||
case SQLITE:
|
||||
|
||||
@ -58,7 +58,7 @@ class Substring extends AbstractFunction<String> {
|
||||
|
||||
switch (configuration.getDialect()) {
|
||||
// Sybase ASE and SQL Server requires 3 arguments
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case SQLSERVER: {
|
||||
if (getArguments().length == 2) {
|
||||
return new Function<String>(functionName, SQLDataType.VARCHAR, getArguments()[0],
|
||||
|
||||
@ -61,7 +61,7 @@ class Tanh extends AbstractFunction<BigDecimal> {
|
||||
@Override
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case HSQLDB:
|
||||
case INGRES:
|
||||
case MYSQL:
|
||||
|
||||
@ -59,7 +59,7 @@ class Trim extends AbstractFunction<String> {
|
||||
@Override
|
||||
final Field<String> getFunction0(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ADAPTIVESERVER:
|
||||
case ASE:
|
||||
case INGRES:
|
||||
case SQLSERVER:
|
||||
return argument.rtrim().ltrim();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user