package foundation.persist.adapter;
|
|
import foundation.server.config.DBaseType;
|
|
public class IdAdapter implements IDBAdapter {
|
@Override
|
public String toSqlString(DBaseType type) {
|
return null;
|
}
|
|
@Override
|
public String getFunciton(DBaseType dbaseType, String functionName) {
|
if ("guid".equalsIgnoreCase(functionName)) {
|
return getGuid(dbaseType);
|
}
|
return null;
|
}
|
|
private String getGuid(DBaseType dbaseType) {
|
if (dbaseType.isOracle()) {
|
return "rawtohex(sys_guid())";
|
}
|
else if (dbaseType.isMySQL()) {
|
return "md5(UUID_SHORT())";
|
}
|
else if (dbaseType.isSQLServer()) {
|
return "NEWID()";
|
}
|
|
return "rawtohex(sys_guid())";
|
}
|
|
}
|