SQLBrite how to pass parameter to createQuery

104 views Asked by At

I am using sqlbrite for my chatting app. I need to observe a database, but the range is not fixed.

Observable<Query> messages = db.createQuery("messages", "SELECT * FROM users WHERE timestamp > ? ");

I need to pass in an argument newestMessage.sentTime, but newestMessage keeps updating as soon as a new message comes. So I cant just pass in the current newestMessage as argument.

1

There are 1 answers

0
CL. On BEST ANSWER

The results of a single query execution never change and represent a snapshot. To get more messages, you have to re-execute the query, i.e., call createQuery again.