1

How to search rows with corresponding date in newEntryIterable

Example :

Table table = db.getTable("Facture");                                                                        
IndexCursor cursor = CursorBuilder.createCursor(table.getIndex("DateIndex"));                             
for(Row row : cursor.newEntryIterable("01/03/2014")) {
   ...
}

No rows are returned, but there are rows with date = 01/03/2014 in my database.

4

1 回答 1

1

解决方案是使用java.util.Date而不是 string "Date"

Table table = db.getTable("Facture");
IndexCursor cursor = CursorBuilder.createCursor(table.getIndex("DateIndex"));
Date search_date = Date('2014/03/01');
for(Row row : cursor.newEntryIterable(search_date)) { ... }
于 2014-09-16T21:12:44.897 回答