[jOOQ/jOOQ#8029] Support timestamp precision in Informix casts
This commit is contained in:
parent
4b68d9cd17
commit
bc98ddb7f7
@ -39,6 +39,7 @@ package org.jooq.impl;
|
||||
|
||||
import static org.jooq.Nullability.NOT_NULL;
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
// ...
|
||||
import static org.jooq.impl.DSL.unquotedName;
|
||||
import static org.jooq.impl.SQLDataType.BLOB;
|
||||
import static org.jooq.impl.SQLDataType.CLOB;
|
||||
@ -447,6 +448,12 @@ abstract class AbstractDataType<T> extends AbstractNamed implements DataType<T>
|
||||
// precision support in DDL.
|
||||
if (isTimestamp() && NO_SUPPORT_TIMESTAMP_PRECISION.contains(dialect))
|
||||
return castTypePrefix0() + castTypeSuffix0();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else if (scaleDefined() && scale() > 0)
|
||||
return castTypePrefix0() + "(" + precision() + ", " + scale() + ")" + castTypeSuffix0();
|
||||
else
|
||||
|
||||
@ -97,6 +97,10 @@ final class Cast<T> extends AbstractField<T> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case DERBY:
|
||||
ctx.visit(new CastDerby());
|
||||
break;
|
||||
@ -258,6 +262,33 @@ final class Cast<T> extends AbstractField<T> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -103,8 +103,10 @@ import static org.jooq.impl.Keywords.K_TRUE;
|
||||
import static org.jooq.impl.Keywords.K_YEAR_TO_DAY;
|
||||
import static org.jooq.impl.Keywords.K_YEAR_TO_FRACTION;
|
||||
import static org.jooq.impl.SQLDataType.BLOB;
|
||||
import static org.jooq.impl.SQLDataType.CHAR;
|
||||
import static org.jooq.impl.SQLDataType.DATE;
|
||||
import static org.jooq.impl.SQLDataType.DOUBLE;
|
||||
import static org.jooq.impl.SQLDataType.LONGVARCHAR;
|
||||
import static org.jooq.impl.SQLDataType.OTHER;
|
||||
import static org.jooq.impl.SQLDataType.ROWID;
|
||||
import static org.jooq.impl.SQLDataType.TIME;
|
||||
@ -709,7 +711,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
// [#1727] VARCHAR types should be cast to their actual lengths in some
|
||||
// dialects
|
||||
else if (FIREBIRD == family && (sqlDataType == SQLDataType.VARCHAR || sqlDataType == SQLDataType.CHAR))
|
||||
else if (FIREBIRD == family && (sqlDataType == VARCHAR || sqlDataType == CHAR))
|
||||
if (dataType.lengthDefined())
|
||||
sqlCast(ctx, converted, dataType, dataType.length(), null, null);
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user