package com.engine.salary.util.db;

import com.engine.salary.exception.SalaryRunTimeException;

public enum DBType implements DBOperateAdapter {
    MYSQL("mysql") {
        @Override
        public String like(String some) {
            return "like '%" + some + "%'";
        }
    },
    SQLSERVER("sqlserver") {
        @Override
        public String like(String some) {
            return "like '%" + some + "%'";
        }
    },
    ORACLE("oracle") {
        @Override
        public String like(String some) {
            return "like '%" + some + "%'";
        }
    };

    private String dbtype;

    DBType(String dbtype) {
        this.dbtype = dbtype;
    }

    public static DBType get(String dbtype) {
        for (DBType t : DBType.values()) {
            if (t.dbtype.equalsIgnoreCase(dbtype)) {
                return t;
            }
        }
        throw new SalaryRunTimeException("不支持的数据库类型");
    }


}
