com.bixuebihui.db.Dialect Maven / Gradle / Ivy
package com.bixuebihui.db;
/**
* @author xwx
*/
public class Dialect {
/** Constant UNKNOWN=0
*/
public static final int UNKNOWN = 0;
/** Constant ORACLE=1
*/
public static final int ORACLE = 1;
/** Constant DERBY=2
*/
public static final int DERBY = 2;
/** Constant MYSQL=3
*/
public static final int MYSQL = 3;
/** Constant SQLSERVER=4
*/
public static final int SQLSERVER = 4;
/** Constant SQLSERVER_2005_AND_UP=7
*/
public static final int SQLSERVER_2005_AND_UP = 7;
public static final int SQLSERVER_2010_AND_UP = 9;
/** Constant POSTGRESQL=5
// POSTGRESQL NATIVE DRIVER*/
public static final int POSTGRESQL = 5;
/** Constant ACCESS=6
*/
public static final int ACCESS = 6;
/** Constant H2=8
*/
public static final int H2 = 8;
/**
* detectDbType.
*
* @param driverName a {@link java.lang.String} object.
* @return a int.
*/
public static int detectDbType(String driverName) {
int res = UNKNOWN;
String name = driverName.toUpperCase();
if (name.contains("ORACLE")) {
res = ORACLE;
} else if (name.contains("DERBY")) {
res = DERBY;
} else if (name.contains("MYSQL")) {
res = MYSQL;
} else if (name.contains("SQLSERVER")) {
// sqlserver 2000
res = SQLSERVER;
//} else if (name.contains("SQL SERVER 201") || name.contains("SQL SERVER 202")) {
} else if (name.contains("SQL SERVER")) {
res = SQLSERVER_2010_AND_UP; //2010 ~ 2029
// sql server 2005
// res = SQLSERVER_2005_AND_UP;
} else if (name.contains("POSTGRESQL")) {
res = POSTGRESQL;
} else if (name.contains("H2")) {
res = H2;
} else if (name.contains("ACCESS")) {
res = ACCESS;
}
return res;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy