提交 d2ab6942 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Add and use DataType.isDateTimeType()

上级 a9d72ecf
......@@ -837,17 +837,6 @@ public class MetaTable extends Table {
Column c = cols[j];
DataType dataType = c.getDataType();
String precision = Integer.toString(c.getPrecisionAsInt());
boolean isDateTime;
switch (dataType.type) {
case Value.TIME:
case Value.DATE:
case Value.TIMESTAMP:
case Value.TIMESTAMP_TZ:
isDateTime = true;
break;
default:
isDateTime = false;
}
Sequence sequence = c.getSequence();
add(rows,
// TABLE_CATALOG
......@@ -877,7 +866,7 @@ public class MetaTable extends Table {
// NUMERIC_SCALE
Integer.toString(c.getScale()),
// DATETIME_PRECISION
isDateTime ? Integer.toString(c.getScale()) : null,
DataType.isDateTimeType(dataType.type) ? Integer.toString(c.getScale()) : null,
// CHARACTER_SET_NAME
CHARACTER_SET_NAME,
// COLLATION_NAME
......
......@@ -1225,6 +1225,25 @@ public class DataType {
return result;
}
/**
* Check if the given value type is a date-time type (TIME, DATE, TIMESTAMP,
* TIMESTAMP_TZ).
*
* @param type the value type
* @return true if the value type is a date-time type
*/
public static boolean isDateTimeType(int type) {
switch (type) {
case Value.TIME:
case Value.DATE:
case Value.TIMESTAMP:
case Value.TIMESTAMP_TZ:
return true;
default:
return false;
}
}
/**
* Check if the given value type is a large object (BLOB or CLOB).
*
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论