我的 DAL 中有一个方法可以使用 CQL 查询选择对象。我正在尝试按如下方式传递时间间隔:
//FilterStartTime, FilterEndTime are of type DateTime, stored in config
// converting DateTime to unix timestamp
var start = (FilterStartTime - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds;
var end = (FilterEndTime - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds;
// UploadedOn is of type timestamp
var selectQuery2 = "SELECT * FROM MyColumnFamily WHERE DocumentKey=" + key
+ " AND UploadedOn>=" + start
+ " AND UploadedOn<=" + end;
//"SELECT * FROM MyColumnFamily WHERE DocumentKey=000001 AND UploadedOn>=1341093600 AND UploadedOn<=1343599200"
数据库包含指定范围内的记录。上面的查询虽然返回 0 个元素。CQL 的使用不是必需的,所以我可能已经使用过 API,但是没有 Fetch 方法了(http://stackoverflow.com/questions/5325035/fluentcassandra-range-selection-problem),我仍然想知道我的查询有什么问题。