本文整理汇总了Java中net.sf.jsqlparser.expression.TimestampValue类的典型用法代码示例。如果您正苦于以下问题:Java TimestampValue类的具体用法?Java TimestampValue怎么用?Java TimestampValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TimestampValue类属于net.sf.jsqlparser.expression包,在下文中一共展示了TimestampValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isConstant
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
static boolean isConstant(Expression exp) {
return exp instanceof StringValue
|| exp instanceof LongValue
|| exp instanceof NullValue
|| exp instanceof TimestampValue
|| exp instanceof JdbcParameter;
}
示例2: resolveValue
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
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 ((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());
}
}
示例3: testTimestamp
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
@Test
public void testTimestamp() throws JSQLParserException {
String statement = "SELECT * FROM tab1 WHERE a > {ts '2004-04-30 04:05:34.56'}";
PlainSelect plainSelect = (PlainSelect) ((Select) parserManager.parse(new StringReader(statement))).getSelectBody();
assertEquals("2004-04-30 04:05:34.56", ((TimestampValue) ((GreaterThan) plainSelect.getWhere()).getRightExpression()).getValue().toString());
assertEquals(statement, "" + plainSelect);
}
示例4: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
@Override
public void visit(TimestampValue value)
{
setValue(value.getValue());
}
示例5: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
@Override
public void visit(TimestampValue value)
{
visitExpression(col, value);
}
示例6: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
@Override
public void visit(TimestampValue timestampValue) {
buffer.append("{ts '").append(timestampValue.getValue().toString()).append("'}");
}
示例7: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
@Override
public void visit(TimestampValue timestampValue) {
}
示例8: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
@Override
public void visit(TimestampValue timestampValue) {
// TODO Auto-generated method stub
}
示例9: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
@Override
public void visit(TimestampValue timestampValue) {
this.getBuffer().append("?");
values.add(timestampValue.getValue());
}
示例10: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
@Override
public void visit(TimestampValue arg0) {
log.debug("sql Timestamp value expression = " + arg0.toString());
value = arg0.getValue();
}
示例11: testTimestamp
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
public void testTimestamp() throws JSQLParserException {
String statement = "SELECT * FROM tab1 WHERE a > {ts '2004-04-30 04:05:34.56'}";
PlainSelect plainSelect = (PlainSelect) ((Select) parserManager.parse(new StringReader(statement))).getSelectBody();
assertEquals("2004-04-30 04:05:34.56", ((TimestampValue)((GreaterThan) plainSelect.getWhere()).getRightExpression()).getValue().toString());
assertEquals(statement, ""+plainSelect);
}
示例12: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
public void visit(TimestampValue timestampValue) {
}
示例13: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
@Override
public void visit(TimestampValue arg0) {
isSimple = false;
}
示例14: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
public void visit(TimestampValue timestampValue) {
buffer.append(timestampValue.getComment() != null ? timestampValue.getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("{ts '").append(timestampValue.getValue().toString()).append("'}");
}
示例15: visit
import net.sf.jsqlparser.expression.TimestampValue; //导入依赖的package包/类
@Override
public void visit(TimestampValue timestampValue)
{
Timestamp value = timestampValue.getValue();
mExpression = sSqlFactory.createDateTimeValueExpression(value);
}