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 Project: SpringBootLearn   Author: LiHaodong888   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
Source Project: microservices-platform   Author: zlt2000   File: TenantAutoConfigure.java    License: 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 Project: pre   Author: LiHaodong888   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   Author: diennea   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
Source Project: sqlhelper   Author: fangjinuo   File: NullExpressionConverter.java    License: 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 Project: sqlhelper   Author: fangjinuo   File: NullExpressionConverter.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public NullExpression fromJSqlParserExpression(NullValue expression) {
    return null;
}
 
Example #7
Source Project: sqlhelper   Author: fangjinuo   File: NullExpressionConverter.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public Class<NullValue> getJSqlParserExpressionClass() {
    return NullValue.class;
}
 
Example #8
Source Project: DataPermissionHelper   Author: holyliao   File: ExpressionVisitorImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void visit(NullValue nullValue) {
}
 
Example #9
Source Project: spanner-jdbc   Author: olavloite   File: AbstractSpannerExpressionVisitorAdapter.java    License: MIT License 4 votes vote down vote up
@Override
public void visit(NullValue value) {
  setValue(null, null);
}
 
Example #10
Source Project: spanner-jdbc   Author: olavloite   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   Author: Quetzal-RDF   File: CTEToNestedQueryConverter.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void visit(NullValue nullValue) {
	clear();
	defaultTopLevelProcessing(nullValue);
}