Documentation Source Text

Check-in [92b3735966]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Clarification and typo fixes in the sqlite3_value_nochange() description within the xUpdate documentation.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 92b37359667e3ea4aefae5253e6f612442f6dc34bb91c3f4195c9c8bcd8fd5e1
User & Date: drh 2018-01-13 00:03:50.336
Context
2018-01-13
14:33
Update the file-format documentation on serial-types 10 and 11. They are no longer "reserved for expansion" but have shifted to "reserved for internal use". (check-in: 9b212044e0 user: drh tags: trunk)
00:03
Clarification and typo fixes in the sqlite3_value_nochange() description within the xUpdate documentation. (check-in: 92b3735966 user: drh tags: trunk)
2018-01-12
23:52
Update documentation for the sqlite3_value_nochange() interface. (check-in: 8d811e938b user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/vtab.in.
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194

1195
1196
1197
1198
1199
1200
1201
1202
1203

<p>If the xUpdate method violates some constraint of the virtual table
(including, but not limited to, attempting to store a value of the wrong 
datatype, attempting to store a value that is too
large or too small, or attempting to change a read-only value) then the
xUpdate must fail with an appropriate [error code].

<p>If the xUpdate method is performaing an UPDATE, then
[sqlite3_value_nochange(X)] can be used to discover which columns
of the virtual table were actually modified by the UPDATE
statement.  The [sqlite3_value_nochange(X)] interface returns
true for columns that do not change.
On every UPDATE, SQLite will first invoke
[xColumn] separately for each unchanging column in the table to 
obtain the value for that column.  The [xColumn] method can
check to see if the column is unchanged by invoking
[sqlite3_vtab_nochange()].  If [xColumn] sees that the column
is not being modified, it can return without setting a result
using one of the [sqlite3_result_int|sqlite3_result_xxxxx()]
interfaces.  In that case [sqlite3_value_nochange()] will be
true within the xUpdate method.  However, if [xColumn]
invokes one or more [sqlite3_result_int|sqlite3_result_xxxxx()]

interfaces, then the [sqlite3_value_nochange()] for that
column will be false within xUpdate.

<p>There might be one or more [sqlite3_vtab_cursor] objects open and in use 
on the virtual table instance and perhaps even on the row of the virtual
table when the xUpdate method is invoked.  The implementation of
xUpdate must be prepared for attempts to delete or modify rows of the table
out from other existing cursors.  If the virtual table cannot accommodate
such changes, the xUpdate method must return an [error code].







|







|
|
|
|
|
|
|
>
|
|







1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204

<p>If the xUpdate method violates some constraint of the virtual table
(including, but not limited to, attempting to store a value of the wrong 
datatype, attempting to store a value that is too
large or too small, or attempting to change a read-only value) then the
xUpdate must fail with an appropriate [error code].

<p>If the xUpdate method is performing an UPDATE, then
[sqlite3_value_nochange(X)] can be used to discover which columns
of the virtual table were actually modified by the UPDATE
statement.  The [sqlite3_value_nochange(X)] interface returns
true for columns that do not change.
On every UPDATE, SQLite will first invoke
[xColumn] separately for each unchanging column in the table to 
obtain the value for that column.  The [xColumn] method can
check to see if the column is unchanged at the SQL level
by invoking [sqlite3_vtab_nochange()].  If [xColumn] sees that
the column is not being modified, it should return without setting 
a result using one of the [sqlite3_result_int|sqlite3_result_xxxxx()]
interfaces.  Only in that case [sqlite3_value_nochange()] will be
true within the xUpdate method.  If [xColumn] does
invoke one or more [sqlite3_result_int|sqlite3_result_xxxxx()]
interfaces, then SQLite understands that as a change in the value
of the column and the [sqlite3_value_nochange()] call for that
column within xUpdate will return false.

<p>There might be one or more [sqlite3_vtab_cursor] objects open and in use 
on the virtual table instance and perhaps even on the row of the virtual
table when the xUpdate method is invoked.  The implementation of
xUpdate must be prepared for attempts to delete or modify rows of the table
out from other existing cursors.  If the virtual table cannot accommodate
such changes, the xUpdate method must return an [error code].