Java源码示例:net.sf.jsqlparser.expression.TimestampValue

示例1
static boolean isConstant(Expression exp) {
    return exp instanceof StringValue
            || exp instanceof LongValue
            || exp instanceof NullValue
            || exp instanceof TimestampValue
            || exp instanceof JdbcParameter;
}
 
示例2
@Override
public void visit(TimestampValue timestampValue) {
}
 
示例3
@Override
public void visit(TimestampValue value) {
  setValue(value.getValue(), Types.TIMESTAMP);
}
 
示例4
@Override
public void visit(TimestampValue value) {
  visitExpression(col, value);
}
 
示例5
private static Object resolveValue(Expression expression, boolean allowColumn) throws StatementExecutionException {
    if (expression instanceof JdbcParameter) {
        throw new StatementExecutionException("jdbcparameter expression not usable in this query");
    } else if (allowColumn && expression instanceof net.sf.jsqlparser.schema.Column) {
        // this is only for supporting back ticks in DDL
        return fixMySqlBackTicks(((net.sf.jsqlparser.schema.Column) expression).getColumnName());
    } else if (expression instanceof StringValue) {
        return ((StringValue) expression).getValue();
    } else if (expression instanceof LongValue) {
        return ((LongValue) expression).getValue();
    } else if (expression instanceof TimestampValue) {
        return ((TimestampValue) expression).getValue();
    } else if (expression instanceof SignedExpression) {
        SignedExpression se = (SignedExpression) expression;
        switch (se.getSign()) {
            case '+': {
                return resolveValue(se.getExpression(), allowColumn);
            }
            case '-': {
                Object value = resolveValue(se.getExpression(), allowColumn);
                if (value == null) {
                    return null;
                }
                if (value instanceof Integer) {
                    return -1L * ((Integer) value);
                } else if (value instanceof Long) {
                    return -1L * ((Long) value);
                } else {
                    throw new StatementExecutionException(
                            "unsupported value type " + expression.getClass() + " with sign " + se.getSign() + " on value " + value + " of type " + value.
                            getClass());
                }
            }
            default:
                throw new StatementExecutionException(
                        "unsupported value type " + expression.getClass() + " with sign " + se.getSign());
        }

    } else {
        throw new StatementExecutionException("unsupported value type " + expression.getClass());
    }
}
 
示例6
@Override
public void visit(TimestampValue timestampValue) {
	clear();
	defaultTopLevelProcessing(timestampValue);
}