当前位置: 首页>>代码示例>>Java>>正文


Java LongValue类代码示例

本文整理汇总了Java中net.sf.jsqlparser.expression.LongValue的典型用法代码示例。如果您正苦于以下问题:Java LongValue类的具体用法?Java LongValue怎么用?Java LongValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LongValue类属于net.sf.jsqlparser.expression包,在下文中一共展示了LongValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
@Override
public void visit(SignedExpression value)
{
	Expression underlyingValue = value.getExpression();
	if (underlyingValue instanceof DoubleValue)
	{
		DoubleValue doubleValue = (DoubleValue) underlyingValue;
		doubleValue.setValue(value.getSign() == '-' ? -doubleValue.getValue() : doubleValue.getValue());
		visit(doubleValue);
	}
	else if (underlyingValue instanceof LongValue)
	{
		LongValue longValue = (LongValue) underlyingValue;
		longValue.setValue(value.getSign() == '-' ? -longValue.getValue() : longValue.getValue());
		visit(longValue);
	}
	else
	{
		super.visit(value);
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:22,代码来源:AbstractSpannerExpressionVisitorAdapter.java

示例2: countSelectItem

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
/**
 * 获取jsqlparser中count的SelectItem
 *
 * @return
 */
private static List<SelectItem> countSelectItem() {
    if (CollectionUtils.isNotEmpty(countSelectItem)) {
        return countSelectItem;
    }
    Function function = new Function();
    function.setName("COUNT");
    List<Expression> expressions = new ArrayList<>();
    LongValue longValue = new LongValue(1);
    ExpressionList expressionList = new ExpressionList();
    expressions.add(longValue);
    expressionList.setExpressions(expressions);
    function.setParameters(expressionList);
    countSelectItem = new ArrayList<>();
    SelectExpressionItem selectExpressionItem = new SelectExpressionItem(function);
    countSelectItem.add(selectExpressionItem);
    return countSelectItem;
}
 
开发者ID:Caratacus,项目名称:mybatis-plus-mini,代码行数:23,代码来源:JsqlParserUtils.java

示例3: setUp

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    tenantSqlParser = new TenantSqlParser();
    tenantSqlParser.setTenantHandler(new TenantHandler() {
        @Override
        public Expression getTenantId() {
            return new LongValue(1000L);
        }

        @Override
        public String getTenantIdColumn() {
            return "tenant_id";
        }

        @Override
        public boolean doTableFilter(String tableName) {
            return "user".equals(tableName);
        }
    });
}
 
开发者ID:baomidou,项目名称:mybatis-plus,代码行数:21,代码来源:TenantSqlTest.java

示例4: parseExpression

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
private ru.cjdb.sql.expressions.Expression parseExpression(Expression expr, String... tableNames) {
    if (expr instanceof LongValue) {
        return new ValueExpression(((LongValue) expr).getStringValue());
    }
    if (expr instanceof StringValue) {
        return new ValueExpression(((StringValue) expr).getValue());
    }
    if (expr instanceof Column) {
        String columnName = ((Column) expr).getColumnName();
        ru.cjdb.scheme.dto.Column column = asList(tableNames).stream()
                .flatMap(name -> metainfoService.getTable(name).getColumns().stream())
                .filter(col -> col.getName().equals(columnName))
                .findAny()
                .orElseThrow(() -> new SqlParseException("Column " + columnName + " not found!"));
        return new ColumnValueExpr(columnName, column.getType());
    }
    return null;
}
 
开发者ID:SerCeMan,项目名称:cjdb,代码行数:19,代码来源:QueryParserImpl.java

示例5: parseToValue

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
private static Expression parseToValue(Object arg) {
    if (arg instanceof Long || arg instanceof Integer) {
        return new LongValue(arg.toString());
    } else if (arg instanceof Double || arg instanceof Float) {
        return new DoubleValue(arg.toString());
    }

    return new StringValue(arg.toString());
}
 
开发者ID:kkmike999,项目名称:YuiHatano,代码行数:10,代码来源:KbSqlParser.java

示例6: isConstant

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
static boolean isConstant(Expression exp) {
    return exp instanceof StringValue
        || exp instanceof LongValue
        || exp instanceof NullValue
        || exp instanceof TimestampValue
        || exp instanceof JdbcParameter;
}
 
开发者ID:diennea,项目名称:herddb,代码行数:8,代码来源:SQLRecordPredicate.java

示例7: resolveValue

import net.sf.jsqlparser.expression.LongValue; //导入依赖的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());
    }
}
 
开发者ID:diennea,项目名称:herddb,代码行数:40,代码来源:SQLPlanner.java

示例8: countSelectItem

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
/**
 * <p>
 * 获取jsqlparser中count的SelectItem
 * </p>
 */
private static List<SelectItem> countSelectItem() {
    Function function = new Function();
    function.setName("COUNT");
    List<Expression> expressions = new ArrayList<>();
    LongValue longValue = new LongValue(1);
    ExpressionList expressionList = new ExpressionList();
    expressions.add(longValue);
    expressionList.setExpressions(expressions);
    function.setParameters(expressionList);
    List<SelectItem> selectItems = new ArrayList<>();
    SelectExpressionItem selectExpressionItem = new SelectExpressionItem(function);
    selectItems.add(selectExpressionItem);
    return selectItems;
}
 
开发者ID:baomidou,项目名称:mybatis-plus,代码行数:20,代码来源:JsqlParserCountOptimize.java

示例9: visit

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
@Override
public void visit(LongValue longValue) {
    this.getBuffer().append("?");
    long value = longValue.getValue();
    if(context.isNegative()) {
        value = -value;
    }
    values.add(value);
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:10,代码来源:PreparedExpressionConverter.java

示例10: countSelectItem

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
/**
 * 获取jsqlparser中count的SelectItem
 *
 * @return
 */
private static List<SelectItem> countSelectItem() {
    if (CollectionUtils.isNotEmpty(countSelectItem)) {
        return countSelectItem;
    }
    Function function = new Function();
    function.setName("COUNT");
    List<Expression> expressions = new ArrayList<Expression>();
    LongValue longValue = new LongValue(0);
    ExpressionList expressionList = new ExpressionList();
    expressions.add(longValue);
    expressionList.setExpressions(expressions);
    function.setParameters(expressionList);
    countSelectItem = new ArrayList<SelectItem>();
    SelectExpressionItem selectExpressionItem = new SelectExpressionItem(function);
    countSelectItem.add(selectExpressionItem);
    return countSelectItem;
}
 
开发者ID:baomidou,项目名称:hibernate-plus,代码行数:23,代码来源:SqlUtils.java

示例11: testReplaceSyntax1

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
public void testReplaceSyntax1() throws JSQLParserException {
	String statement = "REPLACE mytable SET col1='as', col2=?, col3=565";
	Replace replace = (Replace) parserManager.parse(new StringReader(statement));
	assertEquals("mytable", replace.getTable().getName());
	assertEquals(3, replace.getColumns().size());
	assertEquals("col1", ((Column) replace.getColumns().get(0)).getColumnName());
	assertEquals("col2", ((Column) replace.getColumns().get(1)).getColumnName());
	assertEquals("col3", ((Column) replace.getColumns().get(2)).getColumnName());
	assertEquals("as", ((StringValue)replace.getExpressions().get(0)).getValue());
	assertTrue(replace.getExpressions().get(1) instanceof JdbcParameter);
	assertEquals(565, ((LongValue)replace.getExpressions().get(2)).getValue());
	assertEquals(statement, ""+replace);

}
 
开发者ID:UBOdin,项目名称:jsqlparser,代码行数:15,代码来源:ReplaceTest.java

示例12: testReplaceSyntax2

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
public void testReplaceSyntax2() throws JSQLParserException {
	String statement = "REPLACE mytable (col1, col2, col3) VALUES ('as', ?, 565)";
	Replace replace = (Replace) parserManager.parse(new StringReader(statement));
	assertEquals("mytable", replace.getTable().getName());
	assertEquals(3, replace.getColumns().size());
	assertEquals("col1", ((Column) replace.getColumns().get(0)).getColumnName());
	assertEquals("col2", ((Column) replace.getColumns().get(1)).getColumnName());
	assertEquals("col3", ((Column) replace.getColumns().get(2)).getColumnName());
	assertEquals("as", ((StringValue) ((ExpressionList)replace.getItemsList()).getExpressions().get(0)).getValue());
	assertTrue(((ExpressionList)replace.getItemsList()).getExpressions().get(1) instanceof JdbcParameter);
	assertEquals(565, ((LongValue) ((ExpressionList)replace.getItemsList()).getExpressions().get(2)).getValue());
	assertEquals(statement, ""+replace);
}
 
开发者ID:UBOdin,项目名称:jsqlparser,代码行数:14,代码来源:ReplaceTest.java

示例13: testUpdate

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
public void testUpdate() throws JSQLParserException {
	String statement = "UPDATE mytable set col1='as', col2=?, col3=565 Where o >= 3";
	Update update = (Update) parserManager.parse(new StringReader(statement));
	assertEquals("mytable", update.getTable().getName());
	assertEquals(3, update.getColumns().size());
	assertEquals("col1", ((Column) update.getColumns().get(0)).getColumnName());
	assertEquals("col2", ((Column) update.getColumns().get(1)).getColumnName());
	assertEquals("col3", ((Column) update.getColumns().get(2)).getColumnName());
	assertEquals("as", ((StringValue) update.getExpressions().get(0)).getValue());
	assertTrue(update.getExpressions().get(1) instanceof JdbcParameter);
	assertEquals(565, ((LongValue) update.getExpressions().get(2)).getValue());

	assertTrue(update.getWhere() instanceof GreaterThanEquals);
}
 
开发者ID:UBOdin,项目名称:jsqlparser,代码行数:15,代码来源:UpdateTest.java

示例14: testReplaceSyntax1

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
@Test
public void testReplaceSyntax1() throws JSQLParserException {
    String statement = "REPLACE mytable SET col1='as', col2=?, col3=565";
    Replace replace = (Replace) parserManager.parse(new StringReader(statement));
    assertEquals("mytable", replace.getTable().getName());
    assertEquals(3, replace.getColumns().size());
    assertEquals("col1", ((Column) replace.getColumns().get(0)).getColumnName());
    assertEquals("col2", ((Column) replace.getColumns().get(1)).getColumnName());
    assertEquals("col3", ((Column) replace.getColumns().get(2)).getColumnName());
    assertEquals("as", ((StringValue) replace.getExpressions().get(0)).getValue());
    assertTrue(replace.getExpressions().get(1) instanceof JdbcParameter);
    assertEquals(565, ((LongValue) replace.getExpressions().get(2)).getValue());
    assertEquals(statement, "" + replace);

}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:16,代码来源:ReplaceTest.java

示例15: testReplaceSyntax2

import net.sf.jsqlparser.expression.LongValue; //导入依赖的package包/类
@Test
public void testReplaceSyntax2() throws JSQLParserException {
    String statement = "REPLACE mytable (col1, col2, col3) VALUES ('as', ?, 565)";
    Replace replace = (Replace) parserManager.parse(new StringReader(statement));
    assertEquals("mytable", replace.getTable().getName());
    assertEquals(3, replace.getColumns().size());
    assertEquals("col1", ((Column) replace.getColumns().get(0)).getColumnName());
    assertEquals("col2", ((Column) replace.getColumns().get(1)).getColumnName());
    assertEquals("col3", ((Column) replace.getColumns().get(2)).getColumnName());
    assertEquals("as", ((StringValue) ((ExpressionList) replace.getItemsList()).getExpressions().get(0)).getValue());
    assertTrue(((ExpressionList) replace.getItemsList()).getExpressions().get(1) instanceof JdbcParameter);
    assertEquals(565, ((LongValue) ((ExpressionList) replace.getItemsList()).getExpressions().get(2)).getValue());
    assertEquals(statement, "" + replace);
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:15,代码来源:ReplaceTest.java


注:本文中的net.sf.jsqlparser.expression.LongValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。