git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@884 f203690c-595d-4dc9-a70b-905162fa7fd2tags/jackcess-2.0.6
<action dev="jahlborn" type="fix" system="SourceForge2" issue="109"> | <action dev="jahlborn" type="fix" system="SourceForge2" issue="109"> | ||||
IndexCursor can early exit when searching based on indexed values. | IndexCursor can early exit when searching based on indexed values. | ||||
</action> | </action> | ||||
<action dev="jahlborn" type="fix" system="SourceForge2" issue="110"> | |||||
Fix regression where empty memo values are returned as null. | |||||
</action> | |||||
</release> | </release> | ||||
<release version="2.0.5" date="2014-09-17"> | <release version="2.0.5" date="2014-09-17"> | ||||
<action dev="jahlborn" type="add"> | <action dev="jahlborn" type="add"> |
throws IOException | throws IOException | ||||
{ | { | ||||
byte[] binData = readLongValue(lvalDefinition); | byte[] binData = readLongValue(lvalDefinition); | ||||
if((binData == null) || (binData.length == 0)) { | |||||
if(binData == null) { | |||||
return null; | return null; | ||||
} | } | ||||
if(binData.length == 0) { | |||||
return ""; | |||||
} | |||||
return decodeTextValue(binData); | return decodeTextValue(binData); | ||||
} | } | ||||
table.addRow(testStr, testStr, null); | table.addRow(testStr, testStr, null); | ||||
table.addRow(testStr, longMemo, oleValue); | table.addRow(testStr, longMemo, oleValue); | ||||
table.addRow("", "", new byte[0]); | |||||
table.addRow(null, null, null); | |||||
table.reset(); | table.reset(); | ||||
assertEquals(longMemo, row.get("B")); | assertEquals(longMemo, row.get("B")); | ||||
assertTrue(Arrays.equals(oleValue, row.getBytes("C"))); | assertTrue(Arrays.equals(oleValue, row.getBytes("C"))); | ||||
row = table.getNextRow(); | |||||
assertEquals("", row.get("A")); | |||||
assertEquals("", row.get("B")); | |||||
assertTrue(Arrays.equals(new byte[0], row.getBytes("C"))); | |||||
row = table.getNextRow(); | |||||
assertNull(row.get("A")); | |||||
assertNull(row.get("B")); | |||||
assertNull(row.getBytes("C")); | |||||
db.close(); | db.close(); | ||||
} | } | ||||
} | } | ||||
for(Map<String, Object> row : cursor) { | for(Map<String, Object> row : cursor) { | ||||
foundTable.add(row); | foundTable.add(row); | ||||
} | } | ||||
assertEquals(expectedTable, foundTable); | |||||
assertEquals(expectedTable.size(), foundTable.size()); | |||||
for(int i = 0; i < expectedTable.size(); ++i) { | |||||
assertEquals(expectedTable.get(i), foundTable.get(i)); | |||||
} | |||||
} | } | ||||
public static RowImpl createExpectedRow(Object... rowElements) { | public static RowImpl createExpectedRow(Object... rowElements) { |
t.addRow(Column.AUTO_NUMBER, "foo", "1_foo", longStr, true, 2, bd1); | t.addRow(Column.AUTO_NUMBER, "foo", "1_foo", longStr, true, 2, bd1); | ||||
t.addRow(Column.AUTO_NUMBER, "bar", "2_bar", longStr, false, -37, bd2); | t.addRow(Column.AUTO_NUMBER, "bar", "2_bar", longStr, false, -37, bd2); | ||||
t.addRow(Column.AUTO_NUMBER, "", "", "", false, 0, BigDecimal.ZERO); | |||||
t.addRow(Column.AUTO_NUMBER, null, null, null, null, null, null); | |||||
List<? extends Map<String, Object>> expectedRows = | List<? extends Map<String, Object>> expectedRows = | ||||
createExpectedTable( | createExpectedTable( | ||||
"calc_memo", longStr, | "calc_memo", longStr, | ||||
"calc_bool", false, | "calc_bool", false, | ||||
"calc_long", -37, | "calc_long", -37, | ||||
"calc_numeric", bd2)); | |||||
"calc_numeric", bd2), | |||||
createExpectedRow( | |||||
"id", 3, | |||||
"data", "", | |||||
"calc_text", "", | |||||
"calc_memo", "", | |||||
"calc_bool", false, | |||||
"calc_long", 0, | |||||
"calc_numeric", BigDecimal.ZERO), | |||||
createExpectedRow( | |||||
"id", 4, | |||||
"data", null, | |||||
"calc_text", null, | |||||
"calc_memo", null, | |||||
"calc_bool", null, | |||||
"calc_long", null, | |||||
"calc_numeric", null)); | |||||
assertTable(expectedRows, t); | assertTable(expectedRows, t); | ||||