Java Code Examples for net.sf.jsqlparser.expression.NullValue

The following examples show how to use net.sf.jsqlparser.expression.NullValue. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: SpringBootLearn   Source File: MyTenantHandler.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 租户Id
 *
 * @return
 */
@Override
public Expression getTenantId() {
    // 从当前系统上下文中取出当前请求的服务商ID,通过解析器注入到SQL中。
    Long tenantId = apiContext.getCurrentTenantId();
    log.debug("当前租户为{}", tenantId);
    if (tenantId == null) {
        return new NullValue();
    }
    return new LongValue(tenantId);
}
 
Example 2
@Bean
public TenantHandler tenantHandler() {
    return new TenantHandler() {
        /**
         * 获取租户id
         */
        @Override
        public Expression getTenantId(boolean where) {
            String tenant = TenantContextHolder.getTenant();
            if (tenant != null) {
                return new StringValue(TenantContextHolder.getTenant());
            }
            return new NullValue();
        }

        /**
         * 获取租户列名
         */
        @Override
        public String getTenantIdColumn() {
            return "tenant_id";
        }

        /**
         * 过滤不需要根据租户隔离的表
         * @param tableName 表名
         */
        @Override
        public boolean doTableFilter(String tableName) {
            return tenantProperties.getIgnoreTables().stream().anyMatch(
                    (e) -> e.equalsIgnoreCase(tableName)
            );
        }
    };
}
 
Example 3
Source Project: pre   Source File: PreTenantHandler.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * 租户Id
 *
 * @return
 */
@Override
public Expression getTenantId(boolean where) {
    Long tenantId = PreTenantContextHolder.getCurrentTenantId();
    log.debug("当前租户为{}", tenantId);
    if (tenantId == null) {
        return new NullValue();
    }
    return new LongValue(tenantId);
}
 
Example 4
Source Project: herddb   Source File: SQLRecordPredicate.java    License: Apache License 2.0 5 votes vote down vote up
static boolean isConstant(Expression exp) {
    return exp instanceof StringValue
            || exp instanceof LongValue
            || exp instanceof NullValue
            || exp instanceof TimestampValue
            || exp instanceof JdbcParameter;
}
 
Example 5
@Override
public NullValue toJSqlParserExpression(NullExpression expression) {
    return new NullValue();
}
 
Example 6
@Override
public NullExpression fromJSqlParserExpression(NullValue expression) {
    return null;
}
 
Example 7
@Override
public Class<NullValue> getJSqlParserExpressionClass() {
    return NullValue.class;
}
 
Example 8
@Override
public void visit(NullValue nullValue) {
}
 
Example 9
@Override
public void visit(NullValue value) {
  setValue(null, null);
}
 
Example 10
Source Project: spanner-jdbc   Source File: DMLWhereClauseVisitorAdapter.java    License: MIT License 4 votes vote down vote up
@Override
public void visit(NullValue value) {
  invalid = true;
  super.visit(value);
}
 
Example 11
Source Project: quetzal   Source File: CTEToNestedQueryConverter.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void visit(NullValue nullValue) {
	clear();
	defaultTopLevelProcessing(nullValue);
}