--- /dev/null
+Tim McCune - Original author and project founder
+Rob DiMarco - Added ability to import delimited text into new tables
+Mitchell J. Friedman - Added support for additional JDBC data types
}
ByteBuffer buffer = ByteBuffer.allocate(size);
buffer.order(order);
+ if (obj instanceof Boolean) {
+ obj = ((Boolean) obj) ? 1 : 0;
+ }
if (_type == DataType.BOOLEAN) {
//Do nothing
} else if (_type == DataType.BYTE) {
- buffer.put(((Byte) obj).byteValue());
+ buffer.put(((Number) obj).byteValue());
} else if (_type == DataType.INT) {
- buffer.putShort(((Short) obj).shortValue());
+ buffer.putShort(((Number) obj).shortValue());
} else if (_type == DataType.LONG) {
- buffer.putInt(((Integer) obj).intValue());
+ buffer.putInt(((Number) obj).intValue());
} else if (_type == DataType.DOUBLE) {
- buffer.putDouble(((Double) obj).doubleValue());
+ buffer.putDouble(((Number) obj).doubleValue());
} else if (_type == DataType.FLOAT) {
- buffer.putFloat(((Float) obj).floatValue());
+ buffer.putFloat(((Number) obj).floatValue());
} else if (_type == DataType.SHORT_DATE_TIME) {
Calendar cal = Calendar.getInstance();
cal.setTime((Date) obj);
SQL_TYPES.put(type._sqlType, type);
}
}
+ SQL_TYPES.put(Types.BIT, BYTE);
+ SQL_TYPES.put(Types.BLOB, OLE);
+ SQL_TYPES.put(Types.BIGINT, LONG);
+ SQL_TYPES.put(Types.CHAR, TEXT);
+ SQL_TYPES.put(Types.DATE, SHORT_DATE_TIME);
+ SQL_TYPES.put(Types.REAL, DOUBLE);
+ SQL_TYPES.put(Types.TIME, SHORT_DATE_TIME);
+ SQL_TYPES.put(Types.VARBINARY, BINARY);
}
private static Map<Byte, DataType> DATA_TYPES = new HashMap<Byte, DataType>();
int textCount = 0;
int totalSize = 0;
for (int i = 1; i <= md.getColumnCount(); i++) {
- switch (md.getColumnType(i)) {
- case Types.INTEGER:
- case Types.FLOAT:
+ DataType accessColumnType = DataType.fromSQLType(md.getColumnType(i));
+ switch (accessColumnType) {
+ case BYTE:
+ case INT:
+ case LONG:
+ case MONEY:
+ case FLOAT:
+ case NUMERIC:
totalSize += 4;
break;
- case Types.DOUBLE:
- case Types.DATE:
+ case DOUBLE:
+ case SHORT_DATE_TIME:
totalSize += 8;
break;
- case Types.VARCHAR:
+ case BINARY:
+ case TEXT:
+ case OLE:
+ case MEMO:
textCount++;
break;
}
</answer>
</faq>
+ <faq id="dependencies">
+ <question>Why do I get a NoClassDefFoundError?</question>
+ <answer>
+ <p>
+ Probably because you're missing a jar that Jackcess depends on from your
+ classpath. Take a loook at the <a href="http://jackcess.sourceforge.net/dependencies.html">dependencies list</a>. The first 3 are required for both building and running
+ and can be found either at the <a href="http://jakarta.apache.org/commons/">
+ Jakarta Commons</a> or the <a href="http://www.ibiblio.org/maven">Ibiblio
+ Maven Repository</a>. The other 3 are only required for building, in which
+ case, Maven will find them for you.
+ </p>
+ </answer>
+ </faq>
+
<faq id="hms">
<question>Who is Health Market Science?</question>
<answer>