Java Code Examples for com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser#parseStatement()

The following examples show how to use com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser#parseStatement() . 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: OrVisitorTest.java    From baymax with Apache License 2.0 6 votes vote down vote up
private List<List<TableStat.Condition>> test(String sql){
    MySqlStatementParser parser = new MySqlStatementParser(sql);

    SQLStatement statemen = parser.parseStatement();

    List<Object> parameters = new ArrayList<Object>();

    parameters.add(10);

    OrVisitor visitor = new OrVisitor();
    OrVisitor.OrEntity orEntity = new OrVisitor.OrEntity(visitor, statemen);
    List<List<TableStat.Condition>> conditions = orEntity.getOrConditions();
    System.out.println();
    System.out.println(sql);
    System.out.println(conditions);
    System.out.println();
    return conditions;
}
 
Example 2
Source File: RouterUtil.java    From Mycat2 with GNU General Public License v3.0 6 votes vote down vote up
private  static String changeCreateTable(SchemaConfig schema,String tableName,String sql) {
	if (schema.getTables().containsKey(tableName)) {
		MySqlStatementParser parser = new MySqlStatementParser(sql);
		SQLStatement insertStatement = parser.parseStatement();
		if (insertStatement instanceof MySqlCreateTableStatement) {
			TableConfig tableConfig = schema.getTables().get(tableName);
			AbstractPartitionAlgorithm algorithm = tableConfig.getRule().getRuleAlgorithm();
			if (algorithm instanceof SlotFunction) {
				SQLColumnDefinition column = new SQLColumnDefinition();
				column.setDataType(new SQLCharacterDataType("int"));
				column.setName(new SQLIdentifierExpr("_slot"));
				column.setComment(new SQLCharExpr("自动迁移算法slot,禁止修改"));
				((SQLCreateTableStatement) insertStatement).getTableElementList().add(column);
				return insertStatement.toString();

			}
		}

	}
	return sql;
}
 
Example 3
Source File: SqlToCountSqlRewrite.java    From Zebra with Apache License 2.0 5 votes vote down vote up
public String rewrite(String sql, List<ParamContext> countParams) {
	MySqlStatementParser parser = new MySqlStatementParser(sql);
	SQLStatement stmt = parser.parseStatement();
	RewriteSqlToCountSqlVisitor visitor = new RewriteSqlToCountSqlVisitor(countParams);
	stmt.accept(visitor);

	return stmt.toString();
}
 
Example 4
Source File: AutoCompensateHandler.java    From txle with Apache License 2.0 5 votes vote down vote up
@Override
public void prepareCompensationAfterExecuting(PreparedStatement delegate, String executeSql, Map<String, Object> standbyParams) throws SQLException {
    String globalTxId = CurrentThreadOmegaContext.getGlobalTxIdFromCurThread();
    if (globalTxId == null || globalTxId.length() == 0) {
        return;
    }
    String localTxId = CurrentThreadOmegaContext.getLocalTxIdFromCurThread();
    if (localTxId == null || localTxId.length() == 0) {
        return;
    }

    // To parse SQL by SQLParser tools from Druid.
    MySqlStatementParser parser = new MySqlStatementParser(executeSql);
    SQLStatement sqlStatement = parser.parseStatement();
    if (sqlStatement instanceof MySqlSelectIntoStatement) {
        return;
    }

    if (standbyParams == null) {
        standbyParams = new HashMap<>(8);
    }

    String server = CurrentThreadOmegaContext.getServiceNameFromCurThread();

    // To set a relationship between localTxId and datSourceInfo, in order to determine to use the relative dataSource for localTxId when it need be compensated.
    DatabaseMetaData databaseMetaData = delegate.getConnection().getMetaData();
    String dburl = databaseMetaData.getURL(), dbusername = databaseMetaData.getUserName(), dbdrivername = databaseMetaData.getDriverName();
    DataSourceMappingCache.putLocalTxIdAndDataSourceInfo(localTxId, dburl, dbusername, dbdrivername);
    // To construct kafka message.
    standbyParams.put("dbdrivername", dbdrivername);
    standbyParams.put("dburl", dburl);
    standbyParams.put("dbusername", dbusername);

    if (sqlStatement instanceof MySqlInsertStatement) {
        AutoCompensateInsertHandler.newInstance().prepareCompensationAfterInserting(delegate, sqlStatement, executeSql, globalTxId, localTxId, server, standbyParams);
    } else if (sqlStatement instanceof MySqlUpdateStatement) {
        AutoCompensateUpdateHandler.newInstance().prepareCompensationAfterUpdating(delegate, sqlStatement, executeSql, globalTxId, localTxId, server, standbyParams);
    }
}
 
Example 5
Source File: SqlParser.java    From es_data_export with Apache License 2.0 5 votes vote down vote up
public static boolean isInsertSql(String sql){
	MySqlStatementParser parser = new MySqlStatementParser(sql);
	SQLStatement statement = parser.parseStatement();
	if(statement instanceof SQLInsertStatement){
		SQLInsertStatement insert =(SQLInsertStatement) statement; 
		tableName = insert.getTableName().toString();
		return true;
	}else if(statement instanceof SQLUpdateStatement){
		SQLUpdateStatement update =(SQLUpdateStatement) statement; 
		tableName = update.getTableName().toString();
		return true;
	}
	return false;
}
 
Example 6
Source File: ShareJoin.java    From Mycat2 with GNU General Public License v3.0 5 votes vote down vote up
public void route(SystemConfig sysConfig, SchemaConfig schema,int sqlType, String realSQL, String charset, ServerConnection sc,	LayerCachePool cachePool) {
	int rs = ServerParse.parse(realSQL);
	this.sqltype = rs & 0xff;
	this.sysConfig=sysConfig; 
	this.schema=schema;
	this.charset=charset; 
	this.sc=sc;	
	this.cachePool=cachePool;		
	try {
	 //  RouteStrategy routes=RouteStrategyFactory.getRouteStrategy();	
	  // rrs =RouteStrategyFactory.getRouteStrategy().route(sysConfig, schema, sqlType2, realSQL,charset, sc, cachePool);		   
		MySqlStatementParser parser = new MySqlStatementParser(realSQL);			
		SQLStatement statement = parser.parseStatement();
		if(statement instanceof SQLSelectStatement) {
		   SQLSelectStatement st=(SQLSelectStatement)statement;
		   SQLSelectQuery sqlSelectQuery =st.getSelect().getQuery();
			if(sqlSelectQuery instanceof MySqlSelectQueryBlock) {
				MySqlSelectQueryBlock mysqlSelectQuery = (MySqlSelectQueryBlock)sqlSelectQuery;
				joinParser=new JoinParser(mysqlSelectQuery,realSQL);
				joinParser.parser();
			}	
		}
	   /*	
	   if (routes instanceof DruidMysqlRouteStrategy) {
		   SQLSelectStatement st=((DruidMysqlRouteStrategy) routes).getSQLStatement();
		   SQLSelectQuery sqlSelectQuery =st.getSelect().getQuery();
			if(sqlSelectQuery instanceof MySqlSelectQueryBlock) {
				MySqlSelectQueryBlock mysqlSelectQuery = (MySqlSelectQueryBlock)st.getSelect().getQuery();
				joinParser=new JoinParser(mysqlSelectQuery,realSQL);
				joinParser.parser();
			}
	   }
	   */
	} catch (Exception e) {
	
	}
}
 
Example 7
Source File: QueryConditionAnalyzer.java    From Mycat2 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 解析 SQL 获取指定表及条件列的值
 * 
 * @param sql
 * @param tableName
 * @param colnumName
 * @return
 */
public List<Object> parseConditionValues(String sql, String tableName, String colnumName)  {
	
	List<Object> values = null;
	
	if ( sql != null && tableName != null && columnName != null ) {
	
		values = new ArrayList<Object>();
		
		MySqlStatementParser parser = new MySqlStatementParser(sql);
		SQLStatement stmt = parser.parseStatement();
		
		MySqlSchemaStatVisitor visitor = new MySqlSchemaStatVisitor();
		stmt.accept(visitor);
		
		String currentTable = visitor.getCurrentTable();
		if ( tableName.equalsIgnoreCase( currentTable ) ) {
			
			List<Condition> conditions = visitor.getConditions();
			for(Condition condition: conditions) {
				
				String ccN = condition.getColumn().getName();
				ccN = fixName(ccN);
				
				if ( colnumName.equalsIgnoreCase( ccN ) ) {					
					List<Object> ccVL = condition.getValues();
					values.addAll( ccVL );
				}
			}
		}				
	}
	return values;
}
 
Example 8
Source File: DruidMysqlCreateTableTest.java    From Mycat2 with GNU General Public License v3.0 5 votes vote down vote up
private boolean isInsertHasSlot(String sql)
{
    MySqlStatementParser parser = new MySqlStatementParser(sql);
    MySqlInsertStatement insertStatement= (MySqlInsertStatement)parser.parseStatement();
 List<SQLExpr> cc= insertStatement.getColumns();
    for (SQLExpr sqlExpr : cc) {
        SQLIdentifierExpr c= (SQLIdentifierExpr) sqlExpr;
        if("_slot".equalsIgnoreCase(c.getName())   &&cc.size()==insertStatement.getValues().getValues().size())    return true;
    }
    return false;
}
 
Example 9
Source File: DruidMysqlRouteStrategyTest.java    From dble with GNU General Public License v2.0 5 votes vote down vote up
public void testModifySQLLimit() throws Exception {
    final SchemaConfig schema = schemaMap.get("TESTDB");

    String sql = null;
    RouteResultset rrs = null;
    //SQL span multi datanode 
    sql = "select * from orders limit 2,3";
    rrs = routeStrategy.route(schema, ServerParse.SELECT, sql, null, cachePool);
    Assert.assertEquals(true, rrs.isSqlRouteCacheAble());
    Map<String, RouteResultsetNode> nodeMap = getNodeMap(rrs, 2);
    NodeNameAsserter nameAsserter = new NodeNameAsserter("dn2",
            "dn1");
    nameAsserter.assertRouteNodeNames(nodeMap.keySet());
    Assert.assertEquals(3, rrs.getLimitSize());


    MySqlStatementParser parser = new MySqlStatementParser("SELECT * FROM orders LIMIT 0,5");
    SQLStatement statement = parser.parseStatement();

    Assert.assertEquals(statement.toString(), rrs.getNodes()[0].getStatement());

    //SQL  not span multi datanode
    sql = "select * from customer where id=10000 limit 2,3";
    rrs = routeStrategy.route(schema, ServerParse.SELECT, sql, null, cachePool);
    Assert.assertEquals(true, rrs.isSqlRouteCacheAble());
    nodeMap = getNodeMap(rrs, 1);
    nameAsserter = new NodeNameAsserter("dn1");
    nameAsserter.assertRouteNodeNames(nodeMap.keySet());
    Assert.assertEquals(3, rrs.getLimitSize());
    Assert.assertEquals("select * from customer where id=10000 limit 2,3", rrs.getNodes()[0].getStatement());


}
 
Example 10
Source File: DruidMysqlRouteStrategyTest.java    From Mycat2 with GNU General Public License v3.0 5 votes vote down vote up
public void testModifySQLLimit() throws Exception {
    final SchemaConfig schema = schemaMap.get("TESTDB");

    String sql = null;
    RouteResultset rrs = null;
    //SQL span multi datanode 
    sql = "select * from orders limit 2,3";
    rrs = routeStrategy.route(new SystemConfig(), schema, ServerParse.SELECT, sql, null, null, cachePool);
    Assert.assertEquals(true, rrs.isCacheAble());
    Map<String, RouteResultsetNode> nodeMap = getNodeMap(rrs, 2);
    NodeNameAsserter nameAsserter = new NodeNameAsserter("dn2",
            "dn1");
    nameAsserter.assertRouteNodeNames(nodeMap.keySet());
    Assert.assertEquals(3, rrs.getLimitSize());


    MySqlStatementParser parser = new MySqlStatementParser("SELECT * FROM orders LIMIT 0,5");
    SQLStatement statement = parser.parseStatement();

    Assert.assertEquals(statement.toString(), rrs.getNodes()[0].getStatement());

    //SQL  not span multi datanode
    sql = "select * from customer where id=10000 limit 2,3";
    rrs = routeStrategy.route(new SystemConfig(), schema, ServerParse.SELECT, sql, null, null, cachePool);
    Assert.assertEquals(true, rrs.isCacheAble());
    nodeMap = getNodeMap(rrs, 1);
    nameAsserter = new NodeNameAsserter("dn1");
    nameAsserter.assertRouteNodeNames(nodeMap.keySet());
    Assert.assertEquals(3, rrs.getLimitSize());
    Assert.assertEquals("select * from customer where id=10000 limit 2,3", rrs.getNodes()[0].getStatement());


}
 
Example 11
Source File: QueryConditionAnalyzer.java    From dble with GNU General Public License v2.0 5 votes vote down vote up
/**
 * parseConditionValues
 *
 * @param sql
 * @param table
 * @param column
 * @return
 */
public List<Object> parseConditionValues(String sql, String table, String column) {

    List<Object> values = null;

    if (sql != null && table != null && QueryConditionAnalyzer.this.columnName != null) {

        values = new ArrayList<>();

        MySqlStatementParser parser = new MySqlStatementParser(sql);
        SQLStatement stmt = parser.parseStatement();

        ServerSchemaStatVisitor visitor = new ServerSchemaStatVisitor();
        stmt.accept(visitor);

        String currentTable = visitor.getCurrentTable();
        if (table.equalsIgnoreCase(currentTable)) {

            List<Condition> conditions = visitor.getConditions();
            for (Condition condition : conditions) {

                String ccN = condition.getColumn().getName();
                ccN = fixName(ccN);

                if (column.equalsIgnoreCase(ccN)) {
                    List<Object> ccVL = condition.getValues();
                    values.addAll(ccVL);
                }
            }
        }
    }
    return values;
}
 
Example 12
Source File: DruidMysqlCreateTableTest.java    From dble with GNU General Public License v2.0 5 votes vote down vote up
private boolean isInsertHasSlot(String sql) {
    MySqlStatementParser parser = new MySqlStatementParser(sql);
    MySqlInsertStatement insertStatement = (MySqlInsertStatement) parser.parseStatement();
    List<SQLExpr> cc = insertStatement.getColumns();
    for (SQLExpr sqlExpr : cc) {
        SQLIdentifierExpr c = (SQLIdentifierExpr) sqlExpr;
        if ("_slot".equalsIgnoreCase(c.getName()) && cc.size() == insertStatement.getValues().getValues().size())
            return true;
    }
    return false;
}
 
Example 13
Source File: DruidMysqlCreateTableTest.java    From Mycat2 with GNU General Public License v3.0 4 votes vote down vote up
public boolean parseSql(String sql) {
    MySqlStatementParser parser = new MySqlStatementParser(sql);
    SQLStatement statement = parser.parseStatement();
    return hasColumn(statement);
}
 
Example 14
Source File: DruidMysqlRouteStrategyTest.java    From dble with GNU General Public License v2.0 4 votes vote down vote up
private String formatSql(String sql) {
    MySqlStatementParser parser = new MySqlStatementParser(sql);
    SQLStatement stmt = parser.parseStatement();
    return stmt.toString();
}
 
Example 15
Source File: DruidMysqlCreateTableTest.java    From dble with GNU General Public License v2.0 4 votes vote down vote up
public boolean parseSql(String sql) {
    MySqlStatementParser parser = new MySqlStatementParser(sql);
    SQLStatement statement = parser.parseStatement();
    return hasColumn(statement);
}
 
Example 16
Source File: DruidMysqlRouteStrategyTest.java    From Mycat2 with GNU General Public License v3.0 4 votes vote down vote up
private String formatSql(String sql) {
    MySqlStatementParser parser = new MySqlStatementParser(sql);
    SQLStatement stmt = parser.parseStatement();
    return stmt.toString();
}
 
Example 17
Source File: AutoCompensateService.java    From txle with Apache License 2.0 4 votes vote down vote up
private boolean checkDataConsistency(String compensateSql, String globalTxId, String localTxId) throws NoSuchAlgorithmException, IOException {
    MySqlStatementParser parser = new MySqlStatementParser(compensateSql);
    SQLStatement sqlStatement = parser.parseStatement();
    if (sqlStatement instanceof MySqlUpdateStatement ||  sqlStatement instanceof MySqlInsertStatement) {
        MySqlUpdateStatement deleteStatement = (MySqlUpdateStatement) sqlStatement;
        String tableName = deleteStatement.getTableName().toString().toLowerCase();
        String schema = TxleConstants.APP_NAME;
        String txleBackupTableName = "backup_new_" + tableName;
        int backupDataCount = autoCompensateDao.executeQueryCount("SELECT count(*) FROM " + schema + "." + txleBackupTableName + " T WHERE T.globalTxId = ? AND T.localTxId = ? FOR UPDATE", globalTxId, localTxId);
        if (backupDataCount > 0) {
            String pkName = this.parsePrimaryKeyColumnName(tableName);
            int currentDataCount = autoCompensateDao.executeQueryCount("SELECT count(*) FROM " + tableName + " T WHERE T.id IN (SELECT T1.id FROM " + schema + "." + txleBackupTableName + " T1 WHERE T1.globalTxId = ? AND T1.localTxId = ?)", globalTxId, localTxId);
            // in case of updating many times for some same data, to delete the previous changes, so it only has one backup for any data.
            if (backupDataCount == currentDataCount) {
                List<Map<String, Object>> columnList = autoCompensateDao.executeQuery(
                        "SELECT GROUP_CONCAT(COLUMN_NAME) COLUMN_NAMES FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '" + schema + "' AND TABLE_NAME = '" + txleBackupTableName + "' AND COLUMN_NAME NOT IN ('globalTxId', 'localTxId')");
                if (columnList != null && !columnList.isEmpty()) {
                    StringBuilder columnNames = new StringBuilder();
                    String[] columnArr = columnList.get(0).get("COLUMN_NAMES").toString().split(",");
                    for (String column : columnArr) {
                        if (columnNames.length() == 0) {
                            columnNames.append("T." + column);
                        } else {
                            columnNames.append(",T." + column);
                        }
                    }
                    String backupDataSql = "SELECT " + columnNames + " FROM " + schema + "." + txleBackupTableName + " T WHERE T.globalTxId = '" + globalTxId + "' AND T.localTxId = '" + localTxId + "'";
                    String currentDataSql = "SELECT " + columnNames + " FROM " + tableName + " T, " + schema + "." + txleBackupTableName + " T1 WHERE T." + pkName + " = T1." + pkName + " AND T1.globalTxId = '" + globalTxId + "' AND T1.localTxId = '" + localTxId + "'";

                    String backupDataMD5 = getMD5Digest(backupDataSql, backupDataCount);
                    String currentDataMD5 = getMD5Digest(currentDataSql, currentDataCount);
                    if (backupDataMD5.equals(currentDataMD5)) {
                        return true;
                    }
                }
            }
        }
        throw new RuntimeException("That's not consistent between backup data and current data.");
    }
    return true;
}
 
Example 18
Source File: GlobalTableUtilTest.java    From Mycat2 with GNU General Public License v3.0 4 votes vote down vote up
public String parseSql(String sql) {
	MySqlStatementParser parser = new MySqlStatementParser(sql);
	SQLStatement statement = parser.parseStatement();
	return GlobalTableUtil.addColumnIfCreate(sql, statement);
}
 
Example 19
Source File: BatchInsertSequence.java    From Mycat2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void route(SystemConfig sysConfig, SchemaConfig schema, int sqlType,
		String realSQL, String charset, ServerConnection sc,
		LayerCachePool cachePool) {
	int rs = ServerParse.parse(realSQL);
	this.sqltype = rs & 0xff;
	this.sysConfig=sysConfig; 
	this.schema=schema;
	this.charset=charset; 
	this.sc=sc;	
	this.cachePool=cachePool;	
	
	try {
		MySqlStatementParser parser = new MySqlStatementParser(realSQL);	 
		SQLStatement statement = parser.parseStatement();
		MySqlInsertStatement insert = (MySqlInsertStatement)statement;
		if(insert.getValuesList()!=null){
			String tableName = StringUtil.getTableName(realSQL).toUpperCase();
			TableConfig tableConfig = schema.getTables().get(tableName);
			String primaryKey = tableConfig.getPrimaryKey();//获得表的主键字段
			
			SQLIdentifierExpr sqlIdentifierExpr = new SQLIdentifierExpr();
			sqlIdentifierExpr.setName(primaryKey);
			insert.getColumns().add(sqlIdentifierExpr);
			
			if(sequenceHandler == null){
				int seqHandlerType = MycatServer.getInstance().getConfig().getSystem().getSequenceHandlerType();
				switch(seqHandlerType){
					case SystemConfig.SEQUENCEHANDLER_MYSQLDB:
						sequenceHandler = IncrSequenceMySQLHandler.getInstance();
						break;
					case SystemConfig.SEQUENCEHANDLER_LOCALFILE:
						sequenceHandler = IncrSequencePropHandler.getInstance();
						break;
					case SystemConfig.SEQUENCEHANDLER_LOCAL_TIME:
						sequenceHandler = IncrSequenceTimeHandler.getInstance();
						break;
					case SystemConfig.SEQUENCEHANDLER_ZK_DISTRIBUTED:
						sequenceHandler = DistributedSequenceHandler.getInstance(MycatServer.getInstance().getConfig().getSystem());
						break;
					case SystemConfig.SEQUENCEHANDLER_ZK_GLOBAL_INCREMENT:
						sequenceHandler = IncrSequenceZKHandler.getInstance();
						break;
					default:
						throw new java.lang.IllegalArgumentException("Invalid sequnce handler type "+seqHandlerType);
				}
			}
			
			for(ValuesClause vc : insert.getValuesList()){
				SQLIntegerExpr sqlIntegerExpr = new SQLIntegerExpr();
				long value = sequenceHandler.nextId(tableName.toUpperCase());
				sqlIntegerExpr.setNumber(value);//插入生成的sequence值
				vc.addValue(sqlIntegerExpr);
			}
			
			String insertSql = insert.toString();
			this.executeSql = insertSql;
		}
		
	} catch (Exception e) {
		LOGGER.error("BatchInsertSequence.route(......)",e);
	}
}
 
Example 20
Source File: AutoCompensateHandler.java    From txle with Apache License 2.0 4 votes vote down vote up
@Override
public void prepareCompensationBeforeExecuting(PreparedStatement delegate, String executeSql, Map<String, Object> standbyParams) throws SQLException {
    String globalTxId = CurrentThreadOmegaContext.getGlobalTxIdFromCurThread();
    if (globalTxId == null || globalTxId.length() == 0) {
        return;
    }
    String localTxId = CurrentThreadOmegaContext.getLocalTxIdFromCurThread();
    if (localTxId == null || localTxId.length() == 0) {
        return;
    }

    // To parse SQL by SQLParser tools from Druid.
    MySqlStatementParser parser = new MySqlStatementParser(executeSql);
    SQLStatement sqlStatement = parser.parseStatement();
    if (sqlStatement instanceof MySqlSelectIntoStatement) {
        return;
    }

    if (standbyParams == null) {
        standbyParams = new HashMap<>(8);
    }

    String server = CurrentThreadOmegaContext.getServiceNameFromCurThread();

    // To set a relationship between localTxId and datSourceInfo, in order to determine to use the relative dataSource for localTxId when it need be compensated.
    DatabaseMetaData databaseMetaData = delegate.getConnection().getMetaData();
    String dburl = databaseMetaData.getURL(), dbusername = databaseMetaData.getUserName(), dbdrivername = databaseMetaData.getDriverName();
    DataSourceMappingCache.putLocalTxIdAndDataSourceInfo(localTxId, dburl, dbusername, dbdrivername);
    // To construct kafka message.
    standbyParams.put("dbdrivername", dbdrivername);
    standbyParams.put("dburl", dburl);
    standbyParams.put("dbusername", dbusername);

    if (sqlStatement instanceof MySqlInsertStatement) {
        return;
    } else if (sqlStatement instanceof MySqlUpdateStatement) {
        AutoCompensateUpdateHandler.newInstance().prepareCompensationBeforeUpdating(delegate, sqlStatement, executeSql, globalTxId, localTxId, server, standbyParams);
    } else if (sqlStatement instanceof MySqlDeleteStatement) {
        AutoCompensateDeleteHandler.newInstance().prepareCompensationBeforeDeleting(delegate, sqlStatement, executeSql, globalTxId, localTxId, server, standbyParams);
    } else {
        standbyParams.clear();
        // Default is closed, means that just does record, if it's open, then program will throw an exception about current special SQL, just for auto-compensation.
        boolean checkSpecialSql = TxleStaticConfig.getBooleanConfig("txle.transaction.auto-compensation.check-special-sql", false);
        if (checkSpecialSql) {
            throw new SQLException(TxleConstants.logErrorPrefixWithTime() + "Do not support sql [" + executeSql + "] to auto-compensation.");
        } else {
            LOG.debug(TxleConstants.logDebugPrefixWithTime() + "Do not support sql [{}] to auto-compensation, but it has been executed due to the switch 'checkSpecialSql' is closed.", executeSql);
        }
    }
}