Subject | OT: why is there no getInteger method in jdbc |
---|---|
Author | bumperbox |
Post date | 2006-11-24T09:03:42Z |
this is a bit off topic, but i ask here because i am using jaybird
and everyone here seems very knowledgeable
i use null values in integer columns in my database
if i use rs.getInt(columnName) it returns int, which can not be null
if i use rs.getString(columnName) it returns String, which can be null
Why is there no rs.getInteger(columnName) ??
to make my life simple i would like to extend resultset
Integer getInteger(String columnName) {
int x = getInt(columnName);
if (wasNull()) {
return null;
} else {
return new Integer(x);
}
}
there must be a good reason why this is missing from jdbc ?
is it a good idea to do this, or is there a better way ?
thanks in advance
alex
and everyone here seems very knowledgeable
i use null values in integer columns in my database
if i use rs.getInt(columnName) it returns int, which can not be null
if i use rs.getString(columnName) it returns String, which can be null
Why is there no rs.getInteger(columnName) ??
to make my life simple i would like to extend resultset
Integer getInteger(String columnName) {
int x = getInt(columnName);
if (wasNull()) {
return null;
} else {
return new Integer(x);
}
}
there must be a good reason why this is missing from jdbc ?
is it a good idea to do this, or is there a better way ?
thanks in advance
alex