return num.intValue();
}
- public long getLong(int index) throws TypeMismatchException
+ public Long getLong(int index) throws TypeMismatchException
{
checkType(index, Column.Type.INTEGER);
+ if (null == m_values[index]) {
+ return null;
+ }
+
Number num = (Number)m_values[index];
return num.longValue();
}
public java.util.Date getDate(int index) throws TypeMismatchException
{
- checkType(index, Column.Type.INTEGER);
- long milliseconds = (Long)m_values[index];
- java.util.Date date = new java.util.Date(milliseconds);
- return date;
+ checkType(index, Column.Type.TIMESTAMPTZ);
+ return (java.util.Date)m_values[index];
}
protected void checkType(int index, Column.Type type) throws TypeMismatchException {
Column column = m_columns[index];
- if (column.getType().equals(type)) {
+ Column.Type columnType = column.getType();
+
+ if (columnType.equals(Column.Type.TIMESTAMPTZ)) {
+ // Special case: TIMESTAMPTZ is stored as an INTEGER
+ if ( Column.Type.TIMESTAMPTZ.equals(type)
+ || Column.Type.INTEGER.equals(type) )
+ {
+ return;
+ }
+ }
+
+ if (columnType.equals(type)) {
return;
}