net.sf.jsqlparser.expression.NullValue Java Examples

The following examples show how to use net.sf.jsqlparser.expression.NullValue. 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 File: MyTenantHandler.java    From SpringBootLearn with 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
Source File: TenantAutoConfigure.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
@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 File: PreTenantHandler.java    From pre with 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 File: SQLRecordPredicate.java    From herddb with 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
Source File: NullExpressionConverter.java    From sqlhelper with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public NullValue toJSqlParserExpression(NullExpression expression) {
    return new NullValue();
}
 
Example #6
Source File: NullExpressionConverter.java    From sqlhelper with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public NullExpression fromJSqlParserExpression(NullValue expression) {
    return null;
}
 
Example #7
Source File: NullExpressionConverter.java    From sqlhelper with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public Class<NullValue> getJSqlParserExpressionClass() {
    return NullValue.class;
}
 
Example #8
Source File: ExpressionVisitorImpl.java    From DataPermissionHelper with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(NullValue nullValue) {
}
 
Example #9
Source File: AbstractSpannerExpressionVisitorAdapter.java    From spanner-jdbc with MIT License 4 votes vote down vote up
@Override
public void visit(NullValue value) {
  setValue(null, null);
}
 
Example #10
Source File: DMLWhereClauseVisitorAdapter.java    From spanner-jdbc with MIT License 4 votes vote down vote up
@Override
public void visit(NullValue value) {
  invalid = true;
  super.visit(value);
}
 
Example #11
Source File: CTEToNestedQueryConverter.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void visit(NullValue nullValue) {
	clear();
	defaultTopLevelProcessing(nullValue);
}