Skip to content

Commit

Permalink
在 DefaultSqlInterceptor中插入全局表一致性sql拦截器
Browse files Browse the repository at this point in the history
  • Loading branch information
digdeep126 committed May 29, 2016
1 parent 20f95b2 commit e949481
Showing 1 changed file with 6 additions and 0 deletions.
@@ -1,6 +1,7 @@
package io.mycat.server.interceptor.impl;

import io.mycat.MycatServer;
import io.mycat.config.model.SystemConfig;
import io.mycat.server.interceptor.SQLInterceptor;

public class DefaultSqlInterceptor implements SQLInterceptor {
Expand Down Expand Up @@ -49,6 +50,11 @@ public String interceptSQL(String sql, int sqlType) {
if("fdbparser".equals(MycatServer.getInstance().getConfig().getSystem().getDefaultSqlParser()))
sql = processEscape(sql);

// 全局表一致性 sql 改写拦截
SystemConfig system = MycatServer.getInstance().getConfig().getSystem();
if(system != null && system.getUseGlobleTableCheck() == 1) // 全局表一致性检测是否开启
sql = GlobalTableUtil.interceptSQL(sql, sqlType);

// other interceptors put in here ....

return sql;
Expand Down

0 comments on commit e949481

Please sign in to comment.