if (idx == 0 && rs.getInt(0) == 1219)
System.err.println(rs.getDate(6));
int jdbcColumnType = rs.getMetaData().getColumnType(idx);
Calendar c = Calendar.getInstance();
IListWriter lw = null;
InputStream isr = null;
int isrRes = -1;
switch(jdbcColumnType) {
case Types.ARRAY:
throw new UnsupportedOperation("JDBC Array types are currently not supported", null);
case Types.BIGINT:
if (rs.getBigDecimal(idx) != null)
res = vf.integer(rs.getBigDecimal(idx).toString());
else
res = vf.integer(0);
break;
case Types.BINARY:
isr = rs.getBinaryStream(idx);
lw = vf.listWriter(TypeFactory.getInstance().integerType());
if (isr != null) {
isrRes = isr.read();
while (isrRes != -1) {
lw.append(vf.integer(isrRes));
isrRes = isr.read();
}
}
res = lw.done();
break;
case Types.BIT:
res = vf.bool(rs.getBoolean(idx));
break;
case Types.BLOB:
lw = vf.listWriter(TypeFactory.getInstance().integerType());
if (rs.getBlob(idx) != null) {
isr = rs.getBlob(idx).getBinaryStream();
if (isr != null) {
isrRes = isr.read();
while (isrRes != -1) {
lw.append(vf.integer(isrRes));
isrRes = isr.read();
}
}
}
res = lw.done();
break;
case Types.BOOLEAN:
res = vf.bool(rs.getBoolean(idx));
break;
case Types.CHAR:
if (rs.getString(idx) != null)
res = vf.string(rs.getString(idx));
else
res = vf.string("");
break;
case Types.CLOB:
lw = vf.listWriter(TypeFactory.getInstance().integerType());
if (rs.getClob(idx) != null) {
isr = rs.getClob(idx).getAsciiStream();
if (isr != null) {
isrRes = isr.read();
while (isrRes != -1) {
lw.append(vf.integer(isrRes));
isrRes = isr.read();
}
}
}
res = lw.done();
break;
case Types.DATALINK:
throw new UnsupportedOperation("JDBC Datalink types are currently not supported", null);
case Types.DATE:
if (rs.getDate(idx) != null) {
c = Calendar.getInstance();
c.setTimeInMillis(rs.getDate(idx).getTime());
// c.setTime(rs.getDate(idx));
}
res = vf.date(c.get(Calendar.YEAR), c.get(Calendar.MONTH)+1, c.get(Calendar.DAY_OF_MONTH));
break;
case Types.DECIMAL:
if (rs.getBigDecimal(idx) != null)
res = vf.real(rs.getBigDecimal(idx).toString());
else
res = vf.real(0.0);
break;
case Types.DISTINCT:
throw new UnsupportedOperation("JDBC Distinct types are currently not supported", null);
case Types.DOUBLE:
res = vf.real(rs.getDouble(idx));
break;
case Types.FLOAT:
res = vf.real(rs.getFloat(idx));
break;
case Types.INTEGER:
res = vf.integer(rs.getInt(idx));
break;
case Types.JAVA_OBJECT:
throw new UnsupportedOperation("JDBC JavaObject types are currently not supported", null);
case Types.LONGNVARCHAR:
if (rs.getString(idx) != null)
res = vf.string(rs.getString(idx));
else
res = vf.string("");
break;
case Types.LONGVARBINARY:
lw = vf.listWriter(TypeFactory.getInstance().integerType());
isr = rs.getBinaryStream(idx);
if (isr != null) {
isrRes = isr.read();
while (isrRes != -1) {
lw.append(vf.integer(isrRes));
isrRes = isr.read();
}
}
res = lw.done();
break;
case Types.LONGVARCHAR:
if (rs.getString(idx) != null)
res = vf.string(rs.getString(idx));
else
res = vf.string("");
break;
case Types.NCHAR:
if (rs.getString(idx) != null)
res = vf.string(rs.getString(idx));
else
res = vf.string("");
break;
case Types.NCLOB:
lw = vf.listWriter(TypeFactory.getInstance().integerType());
if (rs.getNClob(idx) != null) {
isr = rs.getNClob(idx).getAsciiStream();
if (isr != null) {
isrRes = isr.read();
while (isrRes != -1) {
lw.append(vf.integer(isrRes));
isrRes = isr.read();
}
}
}
res = lw.done();
break;
case Types.NULL:
throw new UnsupportedOperation("JDBC Null types are currently not supported", null);
case Types.NUMERIC:
if (rs.getBigDecimal(idx) != null) {
res = vf.real(rs.getBigDecimal(idx).toString());
} else {
res = vf.real(0);
}
break;
case Types.NVARCHAR:
if (rs.getString(idx) != null)
res = vf.string(rs.getString(idx));
else
res = vf.string("");
break;
case Types.OTHER:
throw new UnsupportedOperation("JDBC Other types are currently not supported", null);
case Types.REAL:
res = vf.real(rs.getDouble(idx));
break;
case Types.REF:
throw new UnsupportedOperation("JDBC Ref types are currently not supported", null);
case Types.ROWID:
throw new UnsupportedOperation("JDBC RowID types are currently not supported", null);
case Types.SMALLINT:
res = vf.integer(rs.getInt(idx));
break;
case Types.SQLXML:
throw new UnsupportedOperation("JDBC SQLXML types are currently not supported", null);
case Types.STRUCT:
throw new UnsupportedOperation("JDBC Struct types are currently not supported", null);
case Types.TIME:
if (rs.getTime(idx) != null) {
c = Calendar.getInstance();
c.setTimeInMillis(rs.getDate(idx).getTime());
}
res = vf.time(c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND), c.get(Calendar.MILLISECOND));
break;
case Types.TIMESTAMP:
if (rs.getTimestamp(idx) != null) {
c = Calendar.getInstance();
c.setTimeInMillis(rs.getDate(idx).getTime());
}
res = vf.datetime(c.get(Calendar.YEAR), c.get(Calendar.MONTH)+1, c.get(Calendar.DAY_OF_MONTH), c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND), c.get(Calendar.MILLISECOND));
break;
case Types.TINYINT:
res = vf.integer(rs.getInt(idx));
break;
case Types.VARBINARY:
lw = vf.listWriter(TypeFactory.getInstance().integerType());
isr = rs.getBinaryStream(idx);
if (isr != null) {
isrRes = isr.read();
while (isrRes != -1) {
lw.append(vf.integer(isrRes));
isrRes = isr.read();
}
}
res = lw.done();
break;
case Types.VARCHAR:
if (rs.getString(idx) != null)
res = vf.string(rs.getString(idx));
else