
package com.lideeyunji.tool.framework.sql.template;

import com.lideeyunji.tool.framework.sql.build.buildmodel.SQLInterpretContext;
import com.lideeyunji.tool.framework.sql.chain.SQLParserChainClient;
import com.lideeyunji.tool.framework.sql.entity.SqlInfoEntity;

/**
 * 数据库模板
 */
public abstract class AbstractDbTemplate {
    
    //初始化数据库类型
    protected abstract void initDbColunmTypes(SqlInfoEntity sqlInfoEntity);

    //格式化sql上下文
    protected abstract void formatSQLInterpretContext(SQLInterpretContext context);

    //TODO 不一样的类型在之类处理
    public final void operation(SqlInfoEntity sqlInfoEntity){
        //初始化数据库特有类型
        initDbColunmTypes(sqlInfoEntity);
        //处理上下文
        formatSQLInterpretContext(sqlInfoEntity.getContext());
        //处理sql/ddl
        SQLParserChainClient.sqlParser(sqlInfoEntity);
    }
}
