me.icymint.libra.jdbc.dialect.Dialects Maven / Gradle / Ivy
package me.icymint.libra.jdbc.dialect;
import me.icymint.libra.jdbc.JdbcAccessException;
/**
* libra-jdbc包支持的数据源汇总。
*
* @author Daniel Yu
* @since 2013-3-14
*
*/
public enum Dialects {
MySql(new MySqlDialect()), SqlServer(new SqlServerDialect()), Db2Nt(
new Db2NtDialect());
public static Dialect fetch(String productName) {
for (Dialects ds : Dialects.values()) {
if (ds.getDialect().getDatabaseProductName().equals(productName)) {
return ds.getDialect();
}
}
throw new JdbcAccessException("无法识别数据源" + productName);
}
private Dialect d;
private Dialects(Dialect d) {
this.d = d;
}
public Dialect getDialect() {
return d;
}
}