1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
.Dd January 24, 2024
.Dt SQLITE3_VTAB_RHS_VALUE 3
.Os
.Sh NAME
.Nm sqlite3_vtab_rhs_value
.Nd constraint values in xBestIndex()
.Sh SYNOPSIS
.In sqlite3.h
.Ft int
.Fo sqlite3_vtab_rhs_value
.Fa "sqlite3_index_info*"
.Fa "int"
.Fa "sqlite3_value **ppVal"
.Fc
.Sh DESCRIPTION
This API may only be used from within the xBestIndex method
of a virtual table implementation.
The result of calling this interface from outside of an xBestIndex
method are undefined and probably harmful.
.Pp
When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within
the xBestIndex method of a virtual table implementation,
with P being a copy of the sqlite3_index_info object
pointer passed into xBestIndex and J being a 0-based index into P->aConstraint[],
then this routine attempts to set *V to the value of the right-hand
operand of that constraint if the right-hand operand is known.
If the right-hand operand is not known, then *V is set to a NULL pointer.
The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if and
only if *V is set to a value.
The sqlite3_vtab_rhs_value(P,J,V) inteface returns SQLITE_NOTFOUND
if the right-hand side of the J-th constraint is not available.
The sqlite3_vtab_rhs_value() interface can return an result code other
than SQLITE_OK or SQLITE_NOTFOUND if something goes wrong.
.Pp
The sqlite3_vtab_rhs_value() interface is usually only successful if
the right-hand operand of a constraint is a literal value in the original
SQL statement.
If the right-hand operand is an expression or a reference to some other
column or a host parameter, then sqlite3_vtab_rhs_value()
will probably return SQLITE_NOTFOUND.
.Pp
Some constraints, such as SQLITE_INDEX_CONSTRAINT_ISNULL
and SQLITE_INDEX_CONSTRAINT_ISNOTNULL,
have no right-hand operand.
For such constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.
.Pp
The sqlite3_value object returned in *V is a protected
sqlite3_value and remains valid for the duration of the xBestIndex
method call.
When xBestIndex returns, the sqlite3_value object returned by sqlite3_vtab_rhs_value()
is automatically deallocated.
.Pp
The "_rhs_" in the name of this routine is an abbreviation for "Right-Hand
Side".
.Sh IMPLEMENTATION NOTES
These declarations were extracted from the
interface documentation at line 10083.
.Bd -literal
SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **ppVal);
.Ed
.Sh SEE ALSO
.Xr sqlite3_bind_blob 3 ,
.Xr sqlite3_index_info 3 ,
.Xr sqlite3_value 3 ,
.Xr SQLITE_INDEX_CONSTRAINT_EQ 3 ,
.Xr SQLITE_OK 3
|