summaryrefslogtreecommitdiffstats
path: root/src/java/com
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2006-09-23 18:21:19 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2006-09-23 18:21:19 +0000
commit78c26cb7fe9a4e20b7e6dfca3e375a3c0c927134 (patch)
treef9f6f51adfea8c6e7719fa998857213f4aaee838 /src/java/com
parent7808136ebc973a428fd488a0a18f259eea0e378f (diff)
downloadjackcess-78c26cb7fe9a4e20b7e6dfca3e375a3c0c927134.tar.gz
jackcess-78c26cb7fe9a4e20b7e6dfca3e375a3c0c927134.zip
create method for interpreting boolean values
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@119 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/java/com')
-rw-r--r--src/java/com/healthmarketscience/jackcess/Column.java9
-rw-r--r--src/java/com/healthmarketscience/jackcess/Table.java8
2 files changed, 11 insertions, 6 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Column.java b/src/java/com/healthmarketscience/jackcess/Column.java
index 3fb63db..5237c2b 100644
--- a/src/java/com/healthmarketscience/jackcess/Column.java
+++ b/src/java/com/healthmarketscience/jackcess/Column.java
@@ -1006,6 +1006,13 @@ public class Column implements Comparable<Column> {
return value.toString();
}
}
+
+ /**
+ * Interpret a boolean value (null == false)
+ */
+ public static boolean toBooleanValue(Object obj) {
+ return ((obj != null) && ((Boolean)obj).booleanValue());
+ }
/**
* Swaps the bytes of the given numeric in place.
@@ -1033,5 +1040,5 @@ public class Column implements Comparable<Column> {
}
return obj;
}
-
+
}
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java
index 25008d8..ba65ab7 100644
--- a/src/java/com/healthmarketscience/jackcess/Table.java
+++ b/src/java/com/healthmarketscience/jackcess/Table.java
@@ -793,11 +793,9 @@ public class Table
buffer.put(col.write(row.get(index), 0));
}
if (col.getType() == DataType.BOOLEAN) {
- if (row.get(index) != null) {
- if (!((Boolean) row.get(index)).booleanValue()) {
- //Booleans are stored in the null mask
- nullMask.markNull(index);
- }
+ if(!Column.toBooleanValue(row.get(index))) {
+ //Booleans are stored in the null mask
+ nullMask.markNull(index);
}
} else if (row.get(index) == null) {
nullMask.markNull(index);