Browse Source

Applied Mitchell Friedman's patch for support of additional JDBC data types.

Added CREDITS.txt.


git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@18 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/rel_1_1
Tim McCune 19 years ago
parent
commit
468b7748b3

+ 3
- 0
CREDITS.txt View File

@@ -0,0 +1,3 @@
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

+ 8
- 5
src/java/com/healthmarketscience/jackcess/Column.java View File

@@ -404,18 +404,21 @@ public class Column implements Comparable<Column> {
}
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);

+ 8
- 0
src/java/com/healthmarketscience/jackcess/DataType.java View File

@@ -62,6 +62,14 @@ public enum DataType {
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>();

+ 14
- 6
src/java/com/healthmarketscience/jackcess/Database.java View File

@@ -546,16 +546,24 @@ public class Database {
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;
}

+ 14
- 0
xdocs/faq.fml View File

@@ -110,6 +110,20 @@
</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>

Loading…
Cancel
Save