Use switch for consistency

This commit is contained in:
gavinking 2020-01-30 15:23:17 +01:00 committed by Steve Ebersole
parent eb71ec395d
commit a63d23f724
1 changed files with 16 additions and 6 deletions

View File

@ -22,16 +22,26 @@ public class InformixIdentityColumnSupport extends IdentityColumnSupportImpl {
@Override @Override
public String getIdentitySelectString(String table, String column, int type) public String getIdentitySelectString(String table, String column, int type)
throws MappingException { throws MappingException {
return type == Types.BIGINT switch (type) {
? "select dbinfo('serial8') from informix.systables where tabid=1" case Types.BIGINT:
: "select dbinfo('sqlca.sqlerrd1') from informix.systables where tabid=1"; return "select dbinfo('serial8') from informix.systables where tabid=1";
case Types.INTEGER:
return "select dbinfo('sqlca.sqlerrd1') from informix.systables where tabid=1";
default:
throw new MappingException("illegal identity column type");
}
} }
@Override @Override
public String getIdentityColumnString(int type) throws MappingException { public String getIdentityColumnString(int type) throws MappingException {
return type == Types.BIGINT ? switch (type) {
"serial8 not null" : case Types.BIGINT:
"serial not null"; return "serial8 not null";
case Types.INTEGER:
return "serial not null";
default:
throw new MappingException("illegal identity column type");
}
} }
@Override @Override