Interface IQuery
An interface representing a runnable query over a data source
Inherited Members
Namespace: Couchbase.Lite.Query
Assembly: Couchbase.Lite.dll
Syntax
public interface IQuery : IDisposable
Properties
| Improve this Doc View SourceParameters
Gets or sets the parameter collection for this query so that parameters may be added for substitution into the query API (via Parameter(String))
Declaration
Parameters Parameters { get; set; }
Property Value
Type | Description |
---|---|
Parameters |
Remarks
The returned collection is a copy, and must be reset onto the query instance. Doing so will trigger a re-run and update any listeners.
Methods
| Improve this Doc View SourceAddChangeListener(EventHandler<QueryChangedEventArgs>)
Adds a change listener to track when this query instance has a change in its results. Adding the first change listener will begin the live semantics.
Declaration
ListenerToken AddChangeListener(EventHandler<QueryChangedEventArgs> handler)
Parameters
Type | Name | Description |
---|---|---|
System.EventHandler<QueryChangedEventArgs> | handler | The handler to call when the query result set changes |
Returns
Type | Description |
---|---|
ListenerToken | A token that can be used to remove the listener later |
AddChangeListener(TaskScheduler, EventHandler<QueryChangedEventArgs>)
Adds a change listener to track when this query instance has a change in its results. Adding the first change listener will begin the live semantics.
Declaration
ListenerToken AddChangeListener(TaskScheduler scheduler, EventHandler<QueryChangedEventArgs> handler)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.Tasks.TaskScheduler | scheduler | The scheduler to use when firing events |
System.EventHandler<QueryChangedEventArgs> | handler | The handler to call when the query result set changes |
Returns
Type | Description |
---|---|
ListenerToken | A token that can be used to remove the listener later |
Execute()
Runs the query
Declaration
IResultSet Execute()
Returns
Type | Description |
---|---|
IResultSet | The results of running the query |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown if this query has no database to operate on, or if it is missing SELECT or FROM statements (unusual) |
Explain()
Gets an explanation of what the query will do
Declaration
string Explain()
Returns
Type | Description |
---|---|
System.String | The explanation of the query |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | Thrown if this method is called after disposal |
RemoveChangeListener(ListenerToken)
Removes a changes listener based on the token that was received from AddChangeListener(TaskScheduler, EventHandler<QueryChangedEventArgs>)
Declaration
void RemoveChangeListener(ListenerToken token)
Parameters
Type | Name | Description |
---|---|---|
ListenerToken | token | The received token from adding the change listener |