import net.sf.minuteProject.configuration.bean.strategy.datamodel.PrimaryKeyPolicyPatternEnum;
public class DatabaseUtils {
public static String providePrimaryKeyLookUpString (Table table) {
Database database = table.getDatabase();
if (database.getType().equals("DB2")){
return "SELECT NEXTVAL FOR "+provideSequence(table)+" AS ID FROM SYSIBM.SYSDUMMY1";
} else if (database.getType().equals("ORACLE")){
return "SELECT "+provideSequence(table)+".NEXTVAL AS ID FROM DUAL";
} else if (database.getType().equals("MYSQL")){
return "SELECT LAST_INSERT_ID() AS value";
}
else if (database.getType().equals("HSQLDB")){
return "SELECT NEXT VALUE FOR "+provideSequence(table)+" AS ID FROM DUAL";
} else
return "ERROR_ON_LOOK_UP for PK";
}