|
21 | 21 | import java.util.Date;
|
22 | 22 | import java.util.List;
|
23 | 23 |
|
| 24 | +import de.greenrobot.dao.internal.SqlUtils; |
24 | 25 | import de.greenrobot.dao.query.Query;
|
25 | 26 | import de.greenrobot.dao.query.QueryBuilder;
|
| 27 | +import de.greenrobot.dao.query.WhereCondition; |
26 | 28 | import de.greenrobot.daotest.TestEntity;
|
27 |
| -import de.greenrobot.daotest.TestEntityDao; |
28 | 29 | import de.greenrobot.daotest.TestEntityDao.Properties;
|
29 | 30 | import de.greenrobot.daotest.entity.TestEntityTestBase;
|
30 | 31 |
|
@@ -172,20 +173,23 @@ public void testEqBoolean() {
|
172 | 173 | }
|
173 | 174 |
|
174 | 175 | // TODO fix byte arrays? Android is doing String args everywhere
|
175 |
| - public void _testEqByteArray() { |
| 176 | + public void testEqByteArray() { |
176 | 177 | ArrayList<TestEntity> inserted = insert(3);
|
177 | 178 | TestEntity testEntity = inserted.get(1);
|
178 | 179 |
|
179 | 180 | byte[] byteArray = {96, 77, 37, -21};
|
180 | 181 | testEntity.setSimpleByteArray(byteArray);
|
181 | 182 | dao.update(testEntity);
|
182 | 183 |
|
183 |
| - Query<TestEntity> queryBoolean = dao.queryBuilder().where(Properties.SimpleByteArray.eq(byteArray)).build(); |
184 |
| - TestEntity testEntity2 = queryBoolean.uniqueOrThrow(); |
| 184 | + // Unsupported: Query<TestEntity> query = dao.queryBuilder().where(Properties.SimpleByteArray.eq(byteArray)).build(); |
| 185 | + String conditionString = Properties.SimpleByteArray.columnName + '=' + SqlUtils.escapeBlobArgument(byteArray); |
| 186 | + WhereCondition condition = new WhereCondition.StringCondition(conditionString); |
| 187 | + Query<TestEntity> query = dao.queryBuilder().where(condition).build(); |
| 188 | + TestEntity testEntity2 = query.uniqueOrThrow(); |
185 | 189 | assertEquals(testEntity.getId(), testEntity2.getId());
|
186 | 190 |
|
187 |
| - queryBoolean.setParameter(0, new byte[]{96, 77, 37, -21, 99}); |
188 |
| - assertNull(queryBoolean.unique()); |
| 191 | + // Unsupported: query.setParameter(0, new byte[]{96, 77, 37, -21, 99}); |
| 192 | + // Unsupported: assertNull(query.unique()); |
189 | 193 | }
|
190 | 194 |
|
191 | 195 | public void testIsNullIsNotNull() {
|
|
0 commit comments