use of com.alibaba.druid.sql.ast.expr.SQLCastExpr in project dble by actiontech.
the class ItemDecimalTypecast method toExpression.
@Override
public SQLExpr toExpression() {
SQLCastExpr cast = new SQLCastExpr();
cast.setExpr(args.get(0).toExpression());
SQLDataTypeImpl dataType = new SQLDataTypeImpl("DECIMAL");
if (precision >= 0) {
dataType.addArgument(new SQLIntegerExpr(precision));
}
if (dec > 0) {
dataType.addArgument(new SQLIntegerExpr(dec));
}
cast.setDataType(dataType);
return cast;
}
use of com.alibaba.druid.sql.ast.expr.SQLCastExpr in project dble by actiontech.
the class ItemFuncBinary method toExpression.
@Override
public SQLExpr toExpression() {
SQLCastExpr cast = new SQLCastExpr();
cast.setExpr(args.get(0).toExpression());
SQLDataTypeImpl dataType = new SQLDataTypeImpl("BINARY");
if (castLength >= 0) {
dataType.addArgument(new SQLIntegerExpr(castLength));
}
cast.setDataType(dataType);
return cast;
}
use of com.alibaba.druid.sql.ast.expr.SQLCastExpr in project dble by actiontech.
the class ItemNCharTypecast method toExpression.
@Override
public SQLExpr toExpression() {
SQLCastExpr cast = new SQLCastExpr();
cast.setExpr(args.get(0).toExpression());
SQLDataTypeImpl dataType = new SQLDataTypeImpl("NCAHR");
if (castLength >= 0) {
dataType.addArgument(new SQLIntegerExpr(castLength));
}
cast.setDataType(dataType);
return cast;
}
use of com.alibaba.druid.sql.ast.expr.SQLCastExpr in project dble by actiontech.
the class ItemTimeTypecast method toExpression.
@Override
public SQLExpr toExpression() {
SQLCastExpr cast = new SQLCastExpr();
cast.setExpr(args.get(0).toExpression());
SQLDataTypeImpl dataType = new SQLDataTypeImpl("TIME");
if (decimals != NOT_FIXED_DEC) {
dataType.addArgument(new SQLIntegerExpr(decimals));
}
cast.setDataType(dataType);
return cast;
}
use of com.alibaba.druid.sql.ast.expr.SQLCastExpr in project dble by actiontech.
the class ItemCharTypecast method toExpression.
@Override
public SQLExpr toExpression() {
SQLCastExpr cast = new SQLCastExpr();
cast.setExpr(args.get(0).toExpression());
SQLCharacterDataType dataType = new SQLCharacterDataType(SQLCharacterDataType.CHAR_TYPE_CHAR);
cast.setDataType(dataType);
if (castLength >= 0) {
dataType.addArgument(new SQLIntegerExpr(castLength));
}
if (charSetName != null) {
dataType.setName(charSetName);
}
cast.setDataType(dataType);
return cast;
}
Aggregations