LiteCore
Couchbase Lite cross-platform core implementation
Loading...
Searching...
No Matches
c4Query.h
Go to the documentation of this file.
1//
2// c4Query.h
3//
4// Copyright 2016-Present Couchbase, Inc.
5//
6// Use of this software is governed by the Business Source License included
7// in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
8// in that file, in accordance with the Business Source License, use of this
9// software will be governed by the Apache License, Version 2.0, included in
10// the file licenses/APL2.txt.
11//
12
13#pragma once
14#include "c4QueryTypes.h"
15
18
24
25
38 C4String expression, int* C4NULLABLE outErrorPos,
39 C4Error* C4NULLABLE error) C4API;
40
46
47
51
60
61
63
64
73
74
85 C4Error* C4NULLABLE outError) C4API;
86
95 C4Error* C4NULLABLE outError) C4API;
96
101
109
118 C4Error* C4NULLABLE outError) C4API;
119
124 return c4queryenum_seek(e, -1, outError);
125}
126
131 C4Error* C4NULLABLE outError) C4API;
132
136
#define NODISCARD
Definition CompilerSupport.h:59
#define CBL_CORE_API
Definition c4Compat.h:134
#define C4NULLABLE
Definition c4Compat.h:38
#define C4API
Definition c4Compat.h:114
#define C4_ASSUME_NONNULL_BEGIN
Definition c4Compat.h:36
#define C4API_END_DECLS
Definition c4Compat.h:116
#define C4API_BEGIN_DECLS
Definition c4Compat.h:115
#define C4_ASSUME_NONNULL_END
Definition c4Compat.h:37
struct C4Query C4Query
Opaque handle to a compiled query.
Definition c4Base.h:160
struct C4Database C4Database
Opaque handle to an opened database.
Definition c4Base.h:136
CBL_CORE_API FLString c4query_columnTitle(C4Query *, unsigned column)
Returns a suggested title for a column, which may be: An alias specified in an 'AS' modifier in the c...
C4QueryLanguage
Definition c4QueryTypes.h:26
NODISCARD CBL_CORE_API C4Query * c4query_new2(C4Database *database, C4QueryLanguage language, C4String expression, int *outErrorPos, C4Error *error)
Compiles a query from an expression given as JSON.
NODISCARD CBL_CORE_API C4QueryEnumerator * c4query_run(C4Query *query, C4String encodedParameters, C4Error *outError)
Runs a compiled query.
NODISCARD CBL_CORE_API bool c4queryenum_seek(C4QueryEnumerator *e, int64_t rowIndex, C4Error *outError)
Jumps to a specific row.
NODISCARD CBL_CORE_API bool c4queryenum_next(C4QueryEnumerator *e, C4Error *outError)
Advances a query enumerator to the next row, populating its fields.
CBL_CORE_API void c4query_setParameters(C4Query *query, C4String encodedParameters)
Sets the parameter values to use when running the query, if no parameters are given to c4query_run.
CBL_CORE_API C4StringResult c4query_fullTextMatched(C4Query *query, const C4FullTextMatch *term, C4Error *outError)
Given a C4FullTextMatch from the enumerator, returns the entire text of the property that was matched...
static NODISCARD bool c4queryenum_restart(C4QueryEnumerator *e, C4Error *outError)
Restarts the enumeration, as though it had just been created: the next call to c4queryenum_next will ...
Definition c4Query.h:123
NODISCARD CBL_CORE_API int64_t c4queryenum_getRowCount(C4QueryEnumerator *e, C4Error *outError)
Returns the total number of rows in the query, if known.
NODISCARD CBL_CORE_API C4QueryEnumerator * c4queryenum_refresh(C4QueryEnumerator *e, C4Error *outError)
Checks whether the query results have changed since this enumerator was created; if so,...
CBL_CORE_API void c4queryenum_close(C4QueryEnumerator *)
Closes an enumerator without freeing it.
CBL_CORE_API C4StringResult c4query_explain(C4Query *)
Returns a string describing the implementation of the compiled query.
CBL_CORE_API unsigned c4query_columnCount(C4Query *)
Returns the number of columns (the values specified in the WHAT clause) in each row.
An error value.
Definition c4Error.h:133
Info about a match of a full-text query term.
Definition c4QueryTypes.h:40
A query result enumerator.
Definition c4QueryTypes.h:54
A simple reference to a block of memory.
Definition FLSlice.h:45
A heap-allocated block of memory returned from an API call.
Definition FLSlice.h:63