mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-25 06:42:27 +00:00
Revert whitespace fixes to third_party (#501)
This commit is contained in:
parent
d4000bb8f7
commit
9de3d8f1e6
365 changed files with 39190 additions and 39211 deletions
386
third_party/sqlite3/sqlite3session.inc
vendored
386
third_party/sqlite3/sqlite3session.inc
vendored
|
@ -51,7 +51,7 @@ typedef struct sqlite3_changeset_iter sqlite3_changeset_iter;
|
|||
** is not possible for an application to register a pre-update hook on a
|
||||
** database handle that has one or more session objects attached. Nor is
|
||||
** it possible to create a session object attached to a database handle for
|
||||
** which a pre-update hook is already defined. The results of attempting
|
||||
** which a pre-update hook is already defined. The results of attempting
|
||||
** either of these things are undefined.
|
||||
**
|
||||
** The session object will be used to create changesets for tables in
|
||||
|
@ -69,13 +69,13 @@ int sqlite3session_create(
|
|||
** CAPI3REF: Delete A Session Object
|
||||
** DESTRUCTOR: sqlite3_session
|
||||
**
|
||||
** Delete a session object previously allocated using
|
||||
** Delete a session object previously allocated using
|
||||
** [sqlite3session_create()]. Once a session object has been deleted, the
|
||||
** results of attempting to use pSession with any other session module
|
||||
** function are undefined.
|
||||
**
|
||||
** Session objects must be deleted before the database handle to which they
|
||||
** are attached is closed. Refer to the documentation for
|
||||
** are attached is closed. Refer to the documentation for
|
||||
** [sqlite3session_create()] for details.
|
||||
*/
|
||||
void sqlite3session_delete(sqlite3_session *pSession);
|
||||
|
@ -93,10 +93,10 @@ void sqlite3session_delete(sqlite3_session *pSession);
|
|||
** the eventual changesets.
|
||||
**
|
||||
** Passing zero to this function disables the session. Passing a value
|
||||
** greater than zero enables it. Passing a value less than zero is a
|
||||
** greater than zero enables it. Passing a value less than zero is a
|
||||
** no-op, and may be used to query the current state of the session.
|
||||
**
|
||||
** The return value indicates the final state of the session object: 0 if
|
||||
** The return value indicates the final state of the session object: 0 if
|
||||
** the session is disabled, or 1 if it is enabled.
|
||||
*/
|
||||
int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
|
||||
|
@ -111,7 +111,7 @@ int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
|
|||
** <ul>
|
||||
** <li> The session object "indirect" flag is set when the change is
|
||||
** made, or
|
||||
** <li> The change is made by an SQL trigger or foreign key action
|
||||
** <li> The change is made by an SQL trigger or foreign key action
|
||||
** instead of directly as a result of a users SQL statement.
|
||||
** </ul>
|
||||
**
|
||||
|
@ -123,10 +123,10 @@ int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
|
|||
** flag. If the second argument passed to this function is zero, then the
|
||||
** indirect flag is cleared. If it is greater than zero, the indirect flag
|
||||
** is set. Passing a value less than zero does not modify the current value
|
||||
** of the indirect flag, and may be used to query the current state of the
|
||||
** of the indirect flag, and may be used to query the current state of the
|
||||
** indirect flag for the specified session object.
|
||||
**
|
||||
** The return value indicates the final state of the indirect flag: 0 if
|
||||
** The return value indicates the final state of the indirect flag: 0 if
|
||||
** it is clear, or 1 if it is set.
|
||||
*/
|
||||
int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
|
||||
|
@ -136,20 +136,20 @@ int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
|
|||
** METHOD: sqlite3_session
|
||||
**
|
||||
** If argument zTab is not NULL, then it is the name of a table to attach
|
||||
** to the session object passed as the first argument. All subsequent changes
|
||||
** made to the table while the session object is enabled will be recorded. See
|
||||
** to the session object passed as the first argument. All subsequent changes
|
||||
** made to the table while the session object is enabled will be recorded. See
|
||||
** documentation for [sqlite3session_changeset()] for further details.
|
||||
**
|
||||
** Or, if argument zTab is NULL, then changes are recorded for all tables
|
||||
** in the database. If additional tables are added to the database (by
|
||||
** executing "CREATE TABLE" statements) after this call is made, changes for
|
||||
** in the database. If additional tables are added to the database (by
|
||||
** executing "CREATE TABLE" statements) after this call is made, changes for
|
||||
** the new tables are also recorded.
|
||||
**
|
||||
** Changes can only be recorded for tables that have a PRIMARY KEY explicitly
|
||||
** defined as part of their CREATE TABLE statement. It does not matter if the
|
||||
** defined as part of their CREATE TABLE statement. It does not matter if the
|
||||
** PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) or not. The PRIMARY
|
||||
** KEY may consist of a single column, or may be a composite key.
|
||||
**
|
||||
**
|
||||
** It is not an error if the named table does not exist in the database. Nor
|
||||
** is it an error if the named table does not have a PRIMARY KEY. However,
|
||||
** no changes will be recorded in either of these scenarios.
|
||||
|
@ -157,29 +157,29 @@ int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
|
|||
** Changes are not recorded for individual rows that have NULL values stored
|
||||
** in one or more of their PRIMARY KEY columns.
|
||||
**
|
||||
** SQLITE_OK is returned if the call completes without error. Or, if an error
|
||||
** SQLITE_OK is returned if the call completes without error. Or, if an error
|
||||
** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
|
||||
**
|
||||
** <h3>Special sqlite_stat1 Handling</h3>
|
||||
**
|
||||
** As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to
|
||||
** As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to
|
||||
** some of the rules above. In SQLite, the schema of sqlite_stat1 is:
|
||||
** <pre>
|
||||
** CREATE TABLE sqlite_stat1(tbl,idx,stat)
|
||||
** CREATE TABLE sqlite_stat1(tbl,idx,stat)
|
||||
** </pre>
|
||||
**
|
||||
** Even though sqlite_stat1 does not have a PRIMARY KEY, changes are
|
||||
** recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes
|
||||
** Even though sqlite_stat1 does not have a PRIMARY KEY, changes are
|
||||
** recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes
|
||||
** are recorded for rows for which (idx IS NULL) is true. However, for such
|
||||
** rows a zero-length blob (SQL value X'') is stored in the changeset or
|
||||
** patchset instead of a NULL value. This allows such changesets to be
|
||||
** manipulated by legacy implementations of sqlite3changeset_invert(),
|
||||
** concat() and similar.
|
||||
**
|
||||
** The sqlite3changeset_apply() function automatically converts the
|
||||
** The sqlite3changeset_apply() function automatically converts the
|
||||
** zero-length blob back to a NULL value when updating the sqlite_stat1
|
||||
** table. However, if the application calls sqlite3changeset_new(),
|
||||
** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset
|
||||
** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset
|
||||
** iterator directly (including on a changeset iterator passed to a
|
||||
** conflict-handler callback) then the X'' value is returned. The application
|
||||
** must translate X'' to NULL itself if required.
|
||||
|
@ -198,10 +198,10 @@ int sqlite3session_attach(
|
|||
** CAPI3REF: Set a table filter on a Session Object.
|
||||
** METHOD: sqlite3_session
|
||||
**
|
||||
** The second argument (xFilter) is the "filter callback". For changes to rows
|
||||
** The second argument (xFilter) is the "filter callback". For changes to rows
|
||||
** in tables that are not attached to the Session object, the filter is called
|
||||
** to determine whether changes to the table's rows should be tracked or not.
|
||||
** If xFilter returns 0, changes are not tracked. Note that once a table is
|
||||
** to determine whether changes to the table's rows should be tracked or not.
|
||||
** If xFilter returns 0, changes are not tracked. Note that once a table is
|
||||
** attached, xFilter will not be called again.
|
||||
*/
|
||||
void sqlite3session_table_filter(
|
||||
|
@ -217,9 +217,9 @@ void sqlite3session_table_filter(
|
|||
** CAPI3REF: Generate A Changeset From A Session Object
|
||||
** METHOD: sqlite3_session
|
||||
**
|
||||
** Obtain a changeset containing changes to the tables attached to the
|
||||
** session object passed as the first argument. If successful,
|
||||
** set *ppChangeset to point to a buffer containing the changeset
|
||||
** Obtain a changeset containing changes to the tables attached to the
|
||||
** session object passed as the first argument. If successful,
|
||||
** set *ppChangeset to point to a buffer containing the changeset
|
||||
** and *pnChangeset to the size of the changeset in bytes before returning
|
||||
** SQLITE_OK. If an error occurs, set both *ppChangeset and *pnChangeset to
|
||||
** zero and return an SQLite error code.
|
||||
|
@ -234,7 +234,7 @@ void sqlite3session_table_filter(
|
|||
** modifies the values of primary key columns. If such a change is made, it
|
||||
** is represented in a changeset as a DELETE followed by an INSERT.
|
||||
**
|
||||
** Changes are not recorded for rows that have NULL values stored in one or
|
||||
** Changes are not recorded for rows that have NULL values stored in one or
|
||||
** more of their PRIMARY KEY columns. If such a row is inserted or deleted,
|
||||
** no corresponding change is present in the changesets returned by this
|
||||
** function. If an existing row with one or more NULL values stored in
|
||||
|
@ -287,14 +287,14 @@ void sqlite3session_table_filter(
|
|||
** <ul>
|
||||
** <li> For each record generated by an insert, the database is queried
|
||||
** for a row with a matching primary key. If one is found, an INSERT
|
||||
** change is added to the changeset. If no such row is found, no change
|
||||
** change is added to the changeset. If no such row is found, no change
|
||||
** is added to the changeset.
|
||||
**
|
||||
** <li> For each record generated by an update or delete, the database is
|
||||
** <li> For each record generated by an update or delete, the database is
|
||||
** queried for a row with a matching primary key. If such a row is
|
||||
** found and one or more of the non-primary key fields have been
|
||||
** modified from their original values, an UPDATE change is added to
|
||||
** the changeset. Or, if no such row is found in the table, a DELETE
|
||||
** modified from their original values, an UPDATE change is added to
|
||||
** the changeset. Or, if no such row is found in the table, a DELETE
|
||||
** change is added to the changeset. If there is a row with a matching
|
||||
** primary key in the database, but all fields contain their original
|
||||
** values, no change is added to the changeset.
|
||||
|
@ -302,7 +302,7 @@ void sqlite3session_table_filter(
|
|||
**
|
||||
** This means, amongst other things, that if a row is inserted and then later
|
||||
** deleted while a session object is active, neither the insert nor the delete
|
||||
** will be present in the changeset. Or if a row is deleted and then later a
|
||||
** will be present in the changeset. Or if a row is deleted and then later a
|
||||
** row with the same primary key values inserted while a session object is
|
||||
** active, the resulting changeset will contain an UPDATE change instead of
|
||||
** a DELETE and an INSERT.
|
||||
|
@ -311,10 +311,10 @@ void sqlite3session_table_filter(
|
|||
** it does not accumulate records when rows are inserted, updated or deleted.
|
||||
** This may appear to have some counter-intuitive effects if a single row
|
||||
** is written to more than once during a session. For example, if a row
|
||||
** is inserted while a session object is enabled, then later deleted while
|
||||
** is inserted while a session object is enabled, then later deleted while
|
||||
** the same session object is disabled, no INSERT record will appear in the
|
||||
** changeset, even though the delete took place while the session was disabled.
|
||||
** Or, if one field of a row is updated while a session is disabled, and
|
||||
** Or, if one field of a row is updated while a session is disabled, and
|
||||
** another field of the same row is updated while the session is enabled, the
|
||||
** resulting changeset will contain an UPDATE change that updates both fields.
|
||||
*/
|
||||
|
@ -335,7 +335,7 @@ int sqlite3session_changeset(
|
|||
** an error).
|
||||
**
|
||||
** Argument zFromDb must be the name of a database ("main", "temp" etc.)
|
||||
** attached to the same database handle as the session object that contains
|
||||
** attached to the same database handle as the session object that contains
|
||||
** a table compatible with the table attached to the session by this function.
|
||||
** A table is considered compatible if it:
|
||||
**
|
||||
|
@ -351,25 +351,25 @@ int sqlite3session_changeset(
|
|||
** APIs, tables without PRIMARY KEYs are simply ignored.
|
||||
**
|
||||
** This function adds a set of changes to the session object that could be
|
||||
** used to update the table in database zFrom (call this the "from-table")
|
||||
** so that its content is the same as the table attached to the session
|
||||
** used to update the table in database zFrom (call this the "from-table")
|
||||
** so that its content is the same as the table attached to the session
|
||||
** object (call this the "to-table"). Specifically:
|
||||
**
|
||||
** <ul>
|
||||
** <li> For each row (primary key) that exists in the to-table but not in
|
||||
** <li> For each row (primary key) that exists in the to-table but not in
|
||||
** the from-table, an INSERT record is added to the session object.
|
||||
**
|
||||
** <li> For each row (primary key) that exists in the to-table but not in
|
||||
** <li> For each row (primary key) that exists in the to-table but not in
|
||||
** the from-table, a DELETE record is added to the session object.
|
||||
**
|
||||
** <li> For each row (primary key) that exists in both tables, but features
|
||||
** <li> For each row (primary key) that exists in both tables, but features
|
||||
** different non-PK values in each, an UPDATE record is added to the
|
||||
** session.
|
||||
** session.
|
||||
** </ul>
|
||||
**
|
||||
** To clarify, if this function is called and then a changeset constructed
|
||||
** using [sqlite3session_changeset()], then after applying that changeset to
|
||||
** database zFrom the contents of the two compatible tables would be
|
||||
** using [sqlite3session_changeset()], then after applying that changeset to
|
||||
** database zFrom the contents of the two compatible tables would be
|
||||
** identical.
|
||||
**
|
||||
** It an error if database zFrom does not exist or does not contain the
|
||||
|
@ -377,7 +377,7 @@ int sqlite3session_changeset(
|
|||
**
|
||||
** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
|
||||
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
|
||||
** may be set to point to a buffer containing an English language error
|
||||
** may be set to point to a buffer containing an English language error
|
||||
** message. It is the responsibility of the caller to free this buffer using
|
||||
** sqlite3_free().
|
||||
*/
|
||||
|
@ -396,19 +396,19 @@ int sqlite3session_diff(
|
|||
** The differences between a patchset and a changeset are that:
|
||||
**
|
||||
** <ul>
|
||||
** <li> DELETE records consist of the primary key fields only. The
|
||||
** <li> DELETE records consist of the primary key fields only. The
|
||||
** original values of other fields are omitted.
|
||||
** <li> The original values of any modified fields are omitted from
|
||||
** <li> The original values of any modified fields are omitted from
|
||||
** UPDATE records.
|
||||
** </ul>
|
||||
**
|
||||
** A patchset blob may be used with up to date versions of all
|
||||
** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(),
|
||||
** A patchset blob may be used with up to date versions of all
|
||||
** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(),
|
||||
** which returns SQLITE_CORRUPT if it is passed a patchset. Similarly,
|
||||
** attempting to use a patchset blob with old versions of the
|
||||
** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error.
|
||||
** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error.
|
||||
**
|
||||
** Because the non-primary key "old.*" fields are omitted, no
|
||||
** Because the non-primary key "old.*" fields are omitted, no
|
||||
** SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset
|
||||
** is passed to the sqlite3changeset_apply() API. Other conflict types work
|
||||
** in the same way as for changesets.
|
||||
|
@ -427,16 +427,16 @@ int sqlite3session_patchset(
|
|||
/*
|
||||
** CAPI3REF: Test if a changeset has recorded any changes.
|
||||
**
|
||||
** Return non-zero if no changes to attached tables have been recorded by
|
||||
** the session object passed as the first argument. Otherwise, if one or
|
||||
** Return non-zero if no changes to attached tables have been recorded by
|
||||
** the session object passed as the first argument. Otherwise, if one or
|
||||
** more changes have been recorded, return zero.
|
||||
**
|
||||
** Even if this function returns zero, it is possible that calling
|
||||
** [sqlite3session_changeset()] on the session handle may still return a
|
||||
** changeset that contains no changes. This can happen when a row in
|
||||
** an attached table is modified and then later on the original values
|
||||
** changeset that contains no changes. This can happen when a row in
|
||||
** an attached table is modified and then later on the original values
|
||||
** are restored. However, if this function returns non-zero, then it is
|
||||
** guaranteed that a call to sqlite3session_changeset() will return a
|
||||
** guaranteed that a call to sqlite3session_changeset() will return a
|
||||
** changeset containing zero changes.
|
||||
*/
|
||||
int sqlite3session_isempty(sqlite3_session *pSession);
|
||||
|
@ -444,13 +444,13 @@ int sqlite3session_isempty(sqlite3_session *pSession);
|
|||
/*
|
||||
** CAPI3REF: Query for the amount of heap memory used by a session object.
|
||||
**
|
||||
** This API returns the total amount of heap memory in bytes currently
|
||||
** This API returns the total amount of heap memory in bytes currently
|
||||
** used by the session object passed as the only argument.
|
||||
*/
|
||||
sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Create An Iterator To Traverse A Changeset
|
||||
** CAPI3REF: Create An Iterator To Traverse A Changeset
|
||||
** CONSTRUCTOR: sqlite3_changeset_iter
|
||||
**
|
||||
** Create an iterator used to iterate through the contents of a changeset.
|
||||
|
@ -458,7 +458,7 @@ sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
|
|||
** is returned. Otherwise, if an error occurs, *pp is set to zero and an
|
||||
** SQLite error code is returned.
|
||||
**
|
||||
** The following functions can be used to advance and query a changeset
|
||||
** The following functions can be used to advance and query a changeset
|
||||
** iterator created by this function:
|
||||
**
|
||||
** <ul>
|
||||
|
@ -475,12 +475,12 @@ sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
|
|||
**
|
||||
** Assuming the changeset blob was created by one of the
|
||||
** [sqlite3session_changeset()], [sqlite3changeset_concat()] or
|
||||
** [sqlite3changeset_invert()] functions, all changes within the changeset
|
||||
** that apply to a single table are grouped together. This means that when
|
||||
** an application iterates through a changeset using an iterator created by
|
||||
** this function, all changes that relate to a single table are visited
|
||||
** consecutively. There is no chance that the iterator will visit a change
|
||||
** the applies to table X, then one for table Y, and then later on visit
|
||||
** [sqlite3changeset_invert()] functions, all changes within the changeset
|
||||
** that apply to a single table are grouped together. This means that when
|
||||
** an application iterates through a changeset using an iterator created by
|
||||
** this function, all changes that relate to a single table are visited
|
||||
** consecutively. There is no chance that the iterator will visit a change
|
||||
** the applies to table X, then one for table Y, and then later on visit
|
||||
** another change for table X.
|
||||
**
|
||||
** The behavior of sqlite3changeset_start_v2() and its streaming equivalent
|
||||
|
@ -531,12 +531,12 @@ int sqlite3changeset_start_v2(
|
|||
** point to the first change in the changeset. Each subsequent call advances
|
||||
** the iterator to point to the next change in the changeset (if any). If
|
||||
** no error occurs and the iterator points to a valid change after a call
|
||||
** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned.
|
||||
** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned.
|
||||
** Otherwise, if all changes in the changeset have already been visited,
|
||||
** SQLITE_DONE is returned.
|
||||
**
|
||||
** If an error occurs, an SQLite error code is returned. Possible error
|
||||
** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
|
||||
** If an error occurs, an SQLite error code is returned. Possible error
|
||||
** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
|
||||
** SQLITE_NOMEM.
|
||||
*/
|
||||
int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
|
||||
|
@ -552,7 +552,7 @@ int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
|
|||
** is not the case, this function returns [SQLITE_MISUSE].
|
||||
**
|
||||
** Arguments pOp, pnCol and pzTab may not be NULL. Upon return, three
|
||||
** outputs are set through these pointers:
|
||||
** outputs are set through these pointers:
|
||||
**
|
||||
** *pOp is set to one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
|
||||
** depending on the type of change that the iterator currently points to;
|
||||
|
@ -620,7 +620,7 @@ int sqlite3changeset_pk(
|
|||
** The pIter argument passed to this function may either be an iterator
|
||||
** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
|
||||
** created by [sqlite3changeset_start()]. In the latter case, the most recent
|
||||
** call to [sqlite3changeset_next()] must have returned SQLITE_ROW.
|
||||
** call to [sqlite3changeset_next()] must have returned SQLITE_ROW.
|
||||
** Furthermore, it may only be called if the type of change that the iterator
|
||||
** currently points to is either [SQLITE_DELETE] or [SQLITE_UPDATE]. Otherwise,
|
||||
** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.
|
||||
|
@ -630,9 +630,9 @@ int sqlite3changeset_pk(
|
|||
** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
|
||||
**
|
||||
** If successful, this function sets *ppValue to point to a protected
|
||||
** sqlite3_value object containing the iVal'th value from the vector of
|
||||
** sqlite3_value object containing the iVal'th value from the vector of
|
||||
** original row values stored as part of the UPDATE or DELETE change and
|
||||
** returns SQLITE_OK. The name of the function comes from the fact that this
|
||||
** returns SQLITE_OK. The name of the function comes from the fact that this
|
||||
** is similar to the "old.*" columns available to update or delete triggers.
|
||||
**
|
||||
** If some other error occurs (e.g. an OOM condition), an SQLite error code
|
||||
|
@ -651,7 +651,7 @@ int sqlite3changeset_old(
|
|||
** The pIter argument passed to this function may either be an iterator
|
||||
** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
|
||||
** created by [sqlite3changeset_start()]. In the latter case, the most recent
|
||||
** call to [sqlite3changeset_next()] must have returned SQLITE_ROW.
|
||||
** call to [sqlite3changeset_next()] must have returned SQLITE_ROW.
|
||||
** Furthermore, it may only be called if the type of change that the iterator
|
||||
** currently points to is either [SQLITE_UPDATE] or [SQLITE_INSERT]. Otherwise,
|
||||
** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.
|
||||
|
@ -661,12 +661,12 @@ int sqlite3changeset_old(
|
|||
** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
|
||||
**
|
||||
** If successful, this function sets *ppValue to point to a protected
|
||||
** sqlite3_value object containing the iVal'th value from the vector of
|
||||
** sqlite3_value object containing the iVal'th value from the vector of
|
||||
** new row values stored as part of the UPDATE or INSERT change and
|
||||
** returns SQLITE_OK. If the change is an UPDATE and does not include
|
||||
** a new value for the requested column, *ppValue is set to NULL and
|
||||
** SQLITE_OK returned. The name of the function comes from the fact that
|
||||
** this is similar to the "new.*" columns available to update or delete
|
||||
** a new value for the requested column, *ppValue is set to NULL and
|
||||
** SQLITE_OK returned. The name of the function comes from the fact that
|
||||
** this is similar to the "new.*" columns available to update or delete
|
||||
** triggers.
|
||||
**
|
||||
** If some other error occurs (e.g. an OOM condition), an SQLite error code
|
||||
|
@ -693,7 +693,7 @@ int sqlite3changeset_new(
|
|||
** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
|
||||
**
|
||||
** If successful, this function sets *ppValue to point to a protected
|
||||
** sqlite3_value object containing the iVal'th value from the
|
||||
** sqlite3_value object containing the iVal'th value from the
|
||||
** "conflicting row" associated with the current conflict-handler callback
|
||||
** and returns SQLITE_OK.
|
||||
**
|
||||
|
@ -737,7 +737,7 @@ int sqlite3changeset_fk_conflicts(
|
|||
** call has no effect.
|
||||
**
|
||||
** If an error was encountered within a call to an sqlite3changeset_xxx()
|
||||
** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an
|
||||
** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an
|
||||
** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding
|
||||
** to that error is returned by this function. Otherwise, SQLITE_OK is
|
||||
** returned. This is to allow the following pattern (pseudo-code):
|
||||
|
@ -749,7 +749,7 @@ int sqlite3changeset_fk_conflicts(
|
|||
** }
|
||||
** rc = sqlite3changeset_finalize();
|
||||
** if( rc!=SQLITE_OK ){
|
||||
** // An error has occurred
|
||||
** // An error has occurred
|
||||
** }
|
||||
** </pre>
|
||||
*/
|
||||
|
@ -777,7 +777,7 @@ int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
|
|||
** zeroed and an SQLite error code returned.
|
||||
**
|
||||
** It is the responsibility of the caller to eventually call sqlite3_free()
|
||||
** on the *ppOut pointer to free the buffer allocation following a successful
|
||||
** on the *ppOut pointer to free the buffer allocation following a successful
|
||||
** call to this function.
|
||||
**
|
||||
** WARNING/TODO: This function currently assumes that the input is a valid
|
||||
|
@ -791,11 +791,11 @@ int sqlite3changeset_invert(
|
|||
/*
|
||||
** CAPI3REF: Concatenate Two Changeset Objects
|
||||
**
|
||||
** This function is used to concatenate two changesets, A and B, into a
|
||||
** This function is used to concatenate two changesets, A and B, into a
|
||||
** single changeset. The result is a changeset equivalent to applying
|
||||
** changeset A followed by changeset B.
|
||||
** changeset A followed by changeset B.
|
||||
**
|
||||
** This function combines the two input changesets using an
|
||||
** This function combines the two input changesets using an
|
||||
** sqlite3_changegroup object. Calling it produces similar results as the
|
||||
** following code fragment:
|
||||
**
|
||||
|
@ -827,7 +827,7 @@ int sqlite3changeset_concat(
|
|||
/*
|
||||
** CAPI3REF: Changegroup Handle
|
||||
**
|
||||
** A changegroup is an object used to combine two or more
|
||||
** A changegroup is an object used to combine two or more
|
||||
** [changesets] or [patchsets]
|
||||
*/
|
||||
typedef struct sqlite3_changegroup sqlite3_changegroup;
|
||||
|
@ -843,7 +843,7 @@ typedef struct sqlite3_changegroup sqlite3_changegroup;
|
|||
**
|
||||
** If successful, this function returns SQLITE_OK and populates (*pp) with
|
||||
** a pointer to a new sqlite3_changegroup object before returning. The caller
|
||||
** should eventually free the returned object using a call to
|
||||
** should eventually free the returned object using a call to
|
||||
** sqlite3changegroup_delete(). If an error occurs, an SQLite error code
|
||||
** (i.e. SQLITE_NOMEM) is returned and *pp is set to NULL.
|
||||
**
|
||||
|
@ -855,7 +855,7 @@ typedef struct sqlite3_changegroup sqlite3_changegroup;
|
|||
** <li> Zero or more changesets (or patchsets) are added to the object
|
||||
** by calling sqlite3changegroup_add().
|
||||
**
|
||||
** <li> The result of combining all input changesets together is obtained
|
||||
** <li> The result of combining all input changesets together is obtained
|
||||
** by the application via a call to sqlite3changegroup_output().
|
||||
**
|
||||
** <li> The object is deleted using a call to sqlite3changegroup_delete().
|
||||
|
@ -864,7 +864,7 @@ typedef struct sqlite3_changegroup sqlite3_changegroup;
|
|||
** Any number of calls to add() and output() may be made between the calls to
|
||||
** new() and delete(), and in any order.
|
||||
**
|
||||
** As well as the regular sqlite3changegroup_add() and
|
||||
** As well as the regular sqlite3changegroup_add() and
|
||||
** sqlite3changegroup_output() functions, also available are the streaming
|
||||
** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm().
|
||||
*/
|
||||
|
@ -875,7 +875,7 @@ int sqlite3changegroup_new(sqlite3_changegroup **pp);
|
|||
** METHOD: sqlite3_changegroup
|
||||
**
|
||||
** Add all changes within the changeset (or patchset) in buffer pData (size
|
||||
** nData bytes) to the changegroup.
|
||||
** nData bytes) to the changegroup.
|
||||
**
|
||||
** If the buffer contains a patchset, then all prior calls to this function
|
||||
** on the same changegroup object must also have specified patchsets. Or, if
|
||||
|
@ -902,7 +902,7 @@ int sqlite3changegroup_new(sqlite3_changegroup **pp);
|
|||
** changeset was recorded immediately after the changesets already
|
||||
** added to the changegroup.
|
||||
** <tr><td>INSERT <td>UPDATE <td>
|
||||
** The INSERT change remains in the changegroup. The values in the
|
||||
** The INSERT change remains in the changegroup. The values in the
|
||||
** INSERT change are modified as if the row was inserted by the
|
||||
** existing change and then updated according to the new change.
|
||||
** <tr><td>INSERT <td>DELETE <td>
|
||||
|
@ -913,17 +913,17 @@ int sqlite3changegroup_new(sqlite3_changegroup **pp);
|
|||
** changeset was recorded immediately after the changesets already
|
||||
** added to the changegroup.
|
||||
** <tr><td>UPDATE <td>UPDATE <td>
|
||||
** The existing UPDATE remains within the changegroup. It is amended
|
||||
** so that the accompanying values are as if the row was updated once
|
||||
** The existing UPDATE remains within the changegroup. It is amended
|
||||
** so that the accompanying values are as if the row was updated once
|
||||
** by the existing change and then again by the new change.
|
||||
** <tr><td>UPDATE <td>DELETE <td>
|
||||
** The existing UPDATE is replaced by the new DELETE within the
|
||||
** changegroup.
|
||||
** <tr><td>DELETE <td>INSERT <td>
|
||||
** If one or more of the column values in the row inserted by the
|
||||
** new change differ from those in the row deleted by the existing
|
||||
** new change differ from those in the row deleted by the existing
|
||||
** change, the existing DELETE is replaced by an UPDATE within the
|
||||
** changegroup. Otherwise, if the inserted row is exactly the same
|
||||
** changegroup. Otherwise, if the inserted row is exactly the same
|
||||
** as the deleted row, the existing DELETE is simply discarded.
|
||||
** <tr><td>DELETE <td>UPDATE <td>
|
||||
** The new change is ignored. This case does not occur if the new
|
||||
|
@ -968,7 +968,7 @@ int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
|
|||
**
|
||||
** If an error occurs, an SQLite error code is returned and the output
|
||||
** variables (*pnData) and (*ppData) are set to 0. Otherwise, SQLITE_OK
|
||||
** is returned and the output variables are set to the size of and a
|
||||
** is returned and the output variables are set to the size of and a
|
||||
** pointer to the output buffer, respectively. In this case it is the
|
||||
** responsibility of the caller to eventually free the buffer using a
|
||||
** call to sqlite3_free().
|
||||
|
@ -990,7 +990,7 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|||
**
|
||||
** Apply a changeset or patchset to a database. These functions attempt to
|
||||
** update the "main" database attached to handle db with the changes found in
|
||||
** the changeset passed via the second and third arguments.
|
||||
** the changeset passed via the second and third arguments.
|
||||
**
|
||||
** The fourth argument (xFilter) passed to these functions is the "filter
|
||||
** callback". If it is not NULL, then for each table affected by at least one
|
||||
|
@ -1001,16 +1001,16 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|||
** Otherwise, if the return value is non-zero or the xFilter argument to
|
||||
** is NULL, all changes related to the table are attempted.
|
||||
**
|
||||
** For each table that is not excluded by the filter callback, this function
|
||||
** tests that the target database contains a compatible table. A table is
|
||||
** For each table that is not excluded by the filter callback, this function
|
||||
** tests that the target database contains a compatible table. A table is
|
||||
** considered compatible if all of the following are true:
|
||||
**
|
||||
** <ul>
|
||||
** <li> The table has the same name as the name recorded in the
|
||||
** <li> The table has the same name as the name recorded in the
|
||||
** changeset, and
|
||||
** <li> The table has at least as many columns as recorded in the
|
||||
** <li> The table has at least as many columns as recorded in the
|
||||
** changeset, and
|
||||
** <li> The table has primary key columns in the same position as
|
||||
** <li> The table has primary key columns in the same position as
|
||||
** recorded in the changeset.
|
||||
** </ul>
|
||||
**
|
||||
|
@ -1019,11 +1019,11 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|||
** via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most
|
||||
** one such warning is issued for each table in the changeset.
|
||||
**
|
||||
** For each change for which there is a compatible table, an attempt is made
|
||||
** to modify the table contents according to the UPDATE, INSERT or DELETE
|
||||
** change. If a change cannot be applied cleanly, the conflict handler
|
||||
** function passed as the fifth argument to sqlite3changeset_apply() may be
|
||||
** invoked. A description of exactly when the conflict handler is invoked for
|
||||
** For each change for which there is a compatible table, an attempt is made
|
||||
** to modify the table contents according to the UPDATE, INSERT or DELETE
|
||||
** change. If a change cannot be applied cleanly, the conflict handler
|
||||
** function passed as the fifth argument to sqlite3changeset_apply() may be
|
||||
** invoked. A description of exactly when the conflict handler is invoked for
|
||||
** each type of change is below.
|
||||
**
|
||||
** Unlike the xFilter argument, xConflict may not be passed NULL. The results
|
||||
|
@ -1031,23 +1031,23 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|||
** argument are undefined.
|
||||
**
|
||||
** Each time the conflict handler function is invoked, it must return one
|
||||
** of [SQLITE_CHANGESET_OMIT], [SQLITE_CHANGESET_ABORT] or
|
||||
** of [SQLITE_CHANGESET_OMIT], [SQLITE_CHANGESET_ABORT] or
|
||||
** [SQLITE_CHANGESET_REPLACE]. SQLITE_CHANGESET_REPLACE may only be returned
|
||||
** if the second argument passed to the conflict handler is either
|
||||
** SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler
|
||||
** returns an illegal value, any changes already made are rolled back and
|
||||
** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different
|
||||
** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different
|
||||
** actions are taken by sqlite3changeset_apply() depending on the value
|
||||
** returned by each invocation of the conflict-handler function. Refer to
|
||||
** the documentation for the three
|
||||
** the documentation for the three
|
||||
** [SQLITE_CHANGESET_OMIT|available return values] for details.
|
||||
**
|
||||
** <dl>
|
||||
** <dt>DELETE Changes<dd>
|
||||
** For each DELETE change, the function checks if the target database
|
||||
** contains a row with the same primary key value (or values) as the
|
||||
** original row values stored in the changeset. If it does, and the values
|
||||
** stored in all non-primary key columns also match the values stored in
|
||||
** For each DELETE change, the function checks if the target database
|
||||
** contains a row with the same primary key value (or values) as the
|
||||
** original row values stored in the changeset. If it does, and the values
|
||||
** stored in all non-primary key columns also match the values stored in
|
||||
** the changeset the row is deleted from the target database.
|
||||
**
|
||||
** If a row with matching primary key values is found, but one or more of
|
||||
|
@ -1076,22 +1076,22 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|||
** database table, the trailing fields are populated with their default
|
||||
** values.
|
||||
**
|
||||
** If the attempt to insert the row fails because the database already
|
||||
** If the attempt to insert the row fails because the database already
|
||||
** contains a row with the same primary key values, the conflict handler
|
||||
** function is invoked with the second argument set to
|
||||
** function is invoked with the second argument set to
|
||||
** [SQLITE_CHANGESET_CONFLICT].
|
||||
**
|
||||
** If the attempt to insert the row fails because of some other constraint
|
||||
** violation (e.g. NOT NULL or UNIQUE), the conflict handler function is
|
||||
** violation (e.g. NOT NULL or UNIQUE), the conflict handler function is
|
||||
** invoked with the second argument set to [SQLITE_CHANGESET_CONSTRAINT].
|
||||
** This includes the case where the INSERT operation is re-attempted because
|
||||
** an earlier call to the conflict handler function returned
|
||||
** This includes the case where the INSERT operation is re-attempted because
|
||||
** an earlier call to the conflict handler function returned
|
||||
** [SQLITE_CHANGESET_REPLACE].
|
||||
**
|
||||
** <dt>UPDATE Changes<dd>
|
||||
** For each UPDATE change, the function checks if the target database
|
||||
** contains a row with the same primary key value (or values) as the
|
||||
** original row values stored in the changeset. If it does, and the values
|
||||
** For each UPDATE change, the function checks if the target database
|
||||
** contains a row with the same primary key value (or values) as the
|
||||
** original row values stored in the changeset. If it does, and the values
|
||||
** stored in all modified non-primary key columns also match the values
|
||||
** stored in the changeset the row is updated within the target database.
|
||||
**
|
||||
|
@ -1107,12 +1107,12 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|||
** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]
|
||||
** passed as the second argument.
|
||||
**
|
||||
** If the UPDATE operation is attempted, but SQLite returns
|
||||
** SQLITE_CONSTRAINT, the conflict-handler function is invoked with
|
||||
** If the UPDATE operation is attempted, but SQLite returns
|
||||
** SQLITE_CONSTRAINT, the conflict-handler function is invoked with
|
||||
** [SQLITE_CHANGESET_CONSTRAINT] passed as the second argument.
|
||||
** This includes the case where the UPDATE operation is attempted after
|
||||
** This includes the case where the UPDATE operation is attempted after
|
||||
** an earlier call to the conflict handler function returned
|
||||
** [SQLITE_CHANGESET_REPLACE].
|
||||
** [SQLITE_CHANGESET_REPLACE].
|
||||
** </dl>
|
||||
**
|
||||
** It is safe to execute SQL statements, including those that write to the
|
||||
|
@ -1123,12 +1123,12 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|||
** All changes made by these functions are enclosed in a savepoint transaction.
|
||||
** If any other error (aside from a constraint failure when attempting to
|
||||
** write to the target database) occurs, then the savepoint transaction is
|
||||
** rolled back, restoring the target database to its original state, and an
|
||||
** rolled back, restoring the target database to its original state, and an
|
||||
** SQLite error code returned.
|
||||
**
|
||||
** If the output parameters (ppRebase) and (pnRebase) are non-NULL and
|
||||
** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2()
|
||||
** may set (*ppRebase) to point to a "rebase" that may be used with the
|
||||
** may set (*ppRebase) to point to a "rebase" that may be used with the
|
||||
** sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase)
|
||||
** is set to the size of the buffer in bytes. It is the responsibility of the
|
||||
** caller to eventually free any such buffer using sqlite3_free(). The buffer
|
||||
|
@ -1189,7 +1189,7 @@ int sqlite3changeset_apply_v2(
|
|||
** SAVEPOINT is committed if the changeset or patchset is successfully
|
||||
** applied, or rolled back if an error occurs. Specifying this flag
|
||||
** causes the sessions module to omit this savepoint. In this case, if the
|
||||
** caller has an open transaction or savepoint when apply_v2() is called,
|
||||
** caller has an open transaction or savepoint when apply_v2() is called,
|
||||
** it may revert the partially applied changeset by rolling it back.
|
||||
**
|
||||
** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
|
||||
|
@ -1200,7 +1200,7 @@ int sqlite3changeset_apply_v2(
|
|||
#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
|
||||
#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
|
||||
|
||||
/*
|
||||
/*
|
||||
** CAPI3REF: Constants Passed To The Conflict Handler
|
||||
**
|
||||
** Values that may be passed as the second argument to a conflict-handler.
|
||||
|
@ -1209,32 +1209,32 @@ int sqlite3changeset_apply_v2(
|
|||
** <dt>SQLITE_CHANGESET_DATA<dd>
|
||||
** The conflict handler is invoked with CHANGESET_DATA as the second argument
|
||||
** when processing a DELETE or UPDATE change if a row with the required
|
||||
** PRIMARY KEY fields is present in the database, but one or more other
|
||||
** (non primary-key) fields modified by the update do not contain the
|
||||
** PRIMARY KEY fields is present in the database, but one or more other
|
||||
** (non primary-key) fields modified by the update do not contain the
|
||||
** expected "before" values.
|
||||
**
|
||||
**
|
||||
** The conflicting row, in this case, is the database row with the matching
|
||||
** primary key.
|
||||
**
|
||||
**
|
||||
** <dt>SQLITE_CHANGESET_NOTFOUND<dd>
|
||||
** The conflict handler is invoked with CHANGESET_NOTFOUND as the second
|
||||
** argument when processing a DELETE or UPDATE change if a row with the
|
||||
** required PRIMARY KEY fields is not present in the database.
|
||||
**
|
||||
**
|
||||
** There is no conflicting row in this case. The results of invoking the
|
||||
** sqlite3changeset_conflict() API are undefined.
|
||||
**
|
||||
**
|
||||
** <dt>SQLITE_CHANGESET_CONFLICT<dd>
|
||||
** CHANGESET_CONFLICT is passed as the second argument to the conflict
|
||||
** handler while processing an INSERT change if the operation would result
|
||||
** handler while processing an INSERT change if the operation would result
|
||||
** in duplicate primary key values.
|
||||
**
|
||||
**
|
||||
** The conflicting row in this case is the database row with the matching
|
||||
** primary key.
|
||||
**
|
||||
** <dt>SQLITE_CHANGESET_FOREIGN_KEY<dd>
|
||||
** If foreign key handling is enabled, and applying a changeset leaves the
|
||||
** database in a state containing foreign key violations, the conflict
|
||||
** database in a state containing foreign key violations, the conflict
|
||||
** handler is invoked with CHANGESET_FOREIGN_KEY as the second argument
|
||||
** exactly once before the changeset is committed. If the conflict handler
|
||||
** returns CHANGESET_OMIT, the changes, including those that caused the
|
||||
|
@ -1244,12 +1244,12 @@ int sqlite3changeset_apply_v2(
|
|||
** No current or conflicting row information is provided. The only function
|
||||
** it is possible to call on the supplied sqlite3_changeset_iter handle
|
||||
** is sqlite3changeset_fk_conflicts().
|
||||
**
|
||||
**
|
||||
** <dt>SQLITE_CHANGESET_CONSTRAINT<dd>
|
||||
** If any other constraint violation occurs while applying a change (i.e.
|
||||
** a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is
|
||||
** If any other constraint violation occurs while applying a change (i.e.
|
||||
** a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is
|
||||
** invoked with CHANGESET_CONSTRAINT as the second argument.
|
||||
**
|
||||
**
|
||||
** There is no conflicting row in this case. The results of invoking the
|
||||
** sqlite3changeset_conflict() API are undefined.
|
||||
**
|
||||
|
@ -1261,7 +1261,7 @@ int sqlite3changeset_apply_v2(
|
|||
#define SQLITE_CHANGESET_CONSTRAINT 4
|
||||
#define SQLITE_CHANGESET_FOREIGN_KEY 5
|
||||
|
||||
/*
|
||||
/*
|
||||
** CAPI3REF: Constants Returned By The Conflict Handler
|
||||
**
|
||||
** A conflict handler callback must return one of the following three values.
|
||||
|
@ -1269,13 +1269,13 @@ int sqlite3changeset_apply_v2(
|
|||
** <dl>
|
||||
** <dt>SQLITE_CHANGESET_OMIT<dd>
|
||||
** If a conflict handler returns this value no special action is taken. The
|
||||
** change that caused the conflict is not applied. The session module
|
||||
** change that caused the conflict is not applied. The session module
|
||||
** continues to the next change in the changeset.
|
||||
**
|
||||
** <dt>SQLITE_CHANGESET_REPLACE<dd>
|
||||
** This value may only be returned if the second argument to the conflict
|
||||
** handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this
|
||||
** is not the case, any changes applied so far are rolled back and the
|
||||
** is not the case, any changes applied so far are rolled back and the
|
||||
** call to sqlite3changeset_apply() returns SQLITE_MISUSE.
|
||||
**
|
||||
** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict
|
||||
|
@ -1288,7 +1288,7 @@ int sqlite3changeset_apply_v2(
|
|||
** the original row is restored to the database before continuing.
|
||||
**
|
||||
** <dt>SQLITE_CHANGESET_ABORT<dd>
|
||||
** If this value is returned, any changes applied so far are rolled back
|
||||
** If this value is returned, any changes applied so far are rolled back
|
||||
** and the call to sqlite3changeset_apply() returns SQLITE_ABORT.
|
||||
** </dl>
|
||||
*/
|
||||
|
@ -1296,20 +1296,20 @@ int sqlite3changeset_apply_v2(
|
|||
#define SQLITE_CHANGESET_REPLACE 1
|
||||
#define SQLITE_CHANGESET_ABORT 2
|
||||
|
||||
/*
|
||||
/*
|
||||
** CAPI3REF: Rebasing changesets
|
||||
** EXPERIMENTAL
|
||||
**
|
||||
** Suppose there is a site hosting a database in state S0. And that
|
||||
** modifications are made that move that database to state S1 and a
|
||||
** changeset recorded (the "local" changeset). Then, a changeset based
|
||||
** on S0 is received from another site (the "remote" changeset) and
|
||||
** applied to the database. The database is then in state
|
||||
** on S0 is received from another site (the "remote" changeset) and
|
||||
** applied to the database. The database is then in state
|
||||
** (S1+"remote"), where the exact state depends on any conflict
|
||||
** resolution decisions (OMIT or REPLACE) made while applying "remote".
|
||||
** Rebasing a changeset is to update it to take those conflict
|
||||
** Rebasing a changeset is to update it to take those conflict
|
||||
** resolution decisions into account, so that the same conflicts
|
||||
** do not have to be resolved elsewhere in the network.
|
||||
** do not have to be resolved elsewhere in the network.
|
||||
**
|
||||
** For example, if both the local and remote changesets contain an
|
||||
** INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)":
|
||||
|
@ -1328,7 +1328,7 @@ int sqlite3changeset_apply_v2(
|
|||
**
|
||||
** <dl>
|
||||
** <dt>Local INSERT<dd>
|
||||
** This may only conflict with a remote INSERT. If the conflict
|
||||
** This may only conflict with a remote INSERT. If the conflict
|
||||
** resolution was OMIT, then add an UPDATE change to the rebased
|
||||
** changeset. Or, if the conflict resolution was REPLACE, add
|
||||
** nothing to the rebased changeset.
|
||||
|
@ -1352,12 +1352,12 @@ int sqlite3changeset_apply_v2(
|
|||
** the old.* values are rebased using the new.* values in the remote
|
||||
** change. Or, if the resolution is REPLACE, then the change is copied
|
||||
** into the rebased changeset with updates to columns also updated by
|
||||
** the conflicting remote UPDATE removed. If this means no columns would
|
||||
** the conflicting remote UPDATE removed. If this means no columns would
|
||||
** be updated, the change is omitted.
|
||||
** </dl>
|
||||
**
|
||||
** A local change may be rebased against multiple remote changes
|
||||
** simultaneously. If a single key is modified by multiple remote
|
||||
** A local change may be rebased against multiple remote changes
|
||||
** simultaneously. If a single key is modified by multiple remote
|
||||
** changesets, they are combined as follows before the local changeset
|
||||
** is rebased:
|
||||
**
|
||||
|
@ -1370,10 +1370,10 @@ int sqlite3changeset_apply_v2(
|
|||
** of the OMIT resolutions.
|
||||
** </ul>
|
||||
**
|
||||
** Note that conflict resolutions from multiple remote changesets are
|
||||
** combined on a per-field basis, not per-row. This means that in the
|
||||
** case of multiple remote UPDATE operations, some fields of a single
|
||||
** local change may be rebased for REPLACE while others are rebased for
|
||||
** Note that conflict resolutions from multiple remote changesets are
|
||||
** combined on a per-field basis, not per-row. This means that in the
|
||||
** case of multiple remote UPDATE operations, some fields of a single
|
||||
** local change may be rebased for REPLACE while others are rebased for
|
||||
** OMIT.
|
||||
**
|
||||
** In order to rebase a local changeset, the remote changeset must first
|
||||
|
@ -1381,7 +1381,7 @@ int sqlite3changeset_apply_v2(
|
|||
** the buffer of rebase information captured. Then:
|
||||
**
|
||||
** <ol>
|
||||
** <li> An sqlite3_rebaser object is created by calling
|
||||
** <li> An sqlite3_rebaser object is created by calling
|
||||
** sqlite3rebaser_create().
|
||||
** <li> The new object is configured with the rebase buffer obtained from
|
||||
** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure().
|
||||
|
@ -1402,8 +1402,8 @@ typedef struct sqlite3_rebaser sqlite3_rebaser;
|
|||
**
|
||||
** Allocate a new changeset rebaser object. If successful, set (*ppNew) to
|
||||
** point to the new object and return SQLITE_OK. Otherwise, if an error
|
||||
** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew)
|
||||
** to NULL.
|
||||
** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew)
|
||||
** to NULL.
|
||||
*/
|
||||
int sqlite3rebaser_create(sqlite3_rebaser **ppNew);
|
||||
|
||||
|
@ -1417,9 +1417,9 @@ int sqlite3rebaser_create(sqlite3_rebaser **ppNew);
|
|||
** sqlite3changeset_apply_v2().
|
||||
*/
|
||||
int sqlite3rebaser_configure(
|
||||
sqlite3_rebaser*,
|
||||
sqlite3_rebaser*,
|
||||
int nRebase, const void *pRebase
|
||||
);
|
||||
);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Rebase a changeset
|
||||
|
@ -1429,7 +1429,7 @@ int sqlite3rebaser_configure(
|
|||
** in size. This function allocates and populates a buffer with a copy
|
||||
** of the changeset rebased according to the configuration of the
|
||||
** rebaser object passed as the first argument. If successful, (*ppOut)
|
||||
** is set to point to the new buffer containing the rebased changeset and
|
||||
** is set to point to the new buffer containing the rebased changeset and
|
||||
** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the
|
||||
** responsibility of the caller to eventually free the new buffer using
|
||||
** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut)
|
||||
|
@ -1437,8 +1437,8 @@ int sqlite3rebaser_configure(
|
|||
*/
|
||||
int sqlite3rebaser_rebase(
|
||||
sqlite3_rebaser*,
|
||||
int nIn, const void *pIn,
|
||||
int *pnOut, void **ppOut
|
||||
int nIn, const void *pIn,
|
||||
int *pnOut, void **ppOut
|
||||
);
|
||||
|
||||
/*
|
||||
|
@ -1449,30 +1449,30 @@ int sqlite3rebaser_rebase(
|
|||
** should be one call to this function for each successful invocation
|
||||
** of sqlite3rebaser_create().
|
||||
*/
|
||||
void sqlite3rebaser_delete(sqlite3_rebaser *p);
|
||||
void sqlite3rebaser_delete(sqlite3_rebaser *p);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Streaming Versions of API functions.
|
||||
**
|
||||
** The six streaming API xxx_strm() functions serve similar purposes to the
|
||||
** The six streaming API xxx_strm() functions serve similar purposes to the
|
||||
** corresponding non-streaming API functions:
|
||||
**
|
||||
** <table border=1 style="margin-left:8ex;margin-right:8ex">
|
||||
** <tr><th>Streaming function<th>Non-streaming equivalent</th>
|
||||
** <tr><td>sqlite3changeset_apply_strm<td>[sqlite3changeset_apply]
|
||||
** <tr><td>sqlite3changeset_apply_strm_v2<td>[sqlite3changeset_apply_v2]
|
||||
** <tr><td>sqlite3changeset_concat_strm<td>[sqlite3changeset_concat]
|
||||
** <tr><td>sqlite3changeset_invert_strm<td>[sqlite3changeset_invert]
|
||||
** <tr><td>sqlite3changeset_start_strm<td>[sqlite3changeset_start]
|
||||
** <tr><td>sqlite3session_changeset_strm<td>[sqlite3session_changeset]
|
||||
** <tr><td>sqlite3session_patchset_strm<td>[sqlite3session_patchset]
|
||||
** <tr><td>sqlite3changeset_apply_strm<td>[sqlite3changeset_apply]
|
||||
** <tr><td>sqlite3changeset_apply_strm_v2<td>[sqlite3changeset_apply_v2]
|
||||
** <tr><td>sqlite3changeset_concat_strm<td>[sqlite3changeset_concat]
|
||||
** <tr><td>sqlite3changeset_invert_strm<td>[sqlite3changeset_invert]
|
||||
** <tr><td>sqlite3changeset_start_strm<td>[sqlite3changeset_start]
|
||||
** <tr><td>sqlite3session_changeset_strm<td>[sqlite3session_changeset]
|
||||
** <tr><td>sqlite3session_patchset_strm<td>[sqlite3session_patchset]
|
||||
** </table>
|
||||
**
|
||||
** Non-streaming functions that accept changesets (or patchsets) as input
|
||||
** require that the entire changeset be stored in a single buffer in memory.
|
||||
** Similarly, those that return a changeset or patchset do so by returning
|
||||
** a pointer to a single large buffer allocated using sqlite3_malloc().
|
||||
** Normally this is convenient. However, if an application running in a
|
||||
** require that the entire changeset be stored in a single buffer in memory.
|
||||
** Similarly, those that return a changeset or patchset do so by returning
|
||||
** a pointer to a single large buffer allocated using sqlite3_malloc().
|
||||
** Normally this is convenient. However, if an application running in a
|
||||
** low-memory environment is required to handle very large changesets, the
|
||||
** large contiguous memory allocations required can become onerous.
|
||||
**
|
||||
|
@ -1494,12 +1494,12 @@ void sqlite3rebaser_delete(sqlite3_rebaser *p);
|
|||
** </pre>
|
||||
**
|
||||
** Each time the xInput callback is invoked by the sessions module, the first
|
||||
** argument passed is a copy of the supplied pIn context pointer. The second
|
||||
** argument, pData, points to a buffer (*pnData) bytes in size. Assuming no
|
||||
** error occurs the xInput method should copy up to (*pnData) bytes of data
|
||||
** into the buffer and set (*pnData) to the actual number of bytes copied
|
||||
** before returning SQLITE_OK. If the input is completely exhausted, (*pnData)
|
||||
** should be set to zero to indicate this. Or, if an error occurs, an SQLite
|
||||
** argument passed is a copy of the supplied pIn context pointer. The second
|
||||
** argument, pData, points to a buffer (*pnData) bytes in size. Assuming no
|
||||
** error occurs the xInput method should copy up to (*pnData) bytes of data
|
||||
** into the buffer and set (*pnData) to the actual number of bytes copied
|
||||
** before returning SQLITE_OK. If the input is completely exhausted, (*pnData)
|
||||
** should be set to zero to indicate this. Or, if an error occurs, an SQLite
|
||||
** error code should be returned. In all cases, if an xInput callback returns
|
||||
** an error, all processing is abandoned and the streaming API function
|
||||
** returns a copy of the error code to the caller.
|
||||
|
@ -1507,7 +1507,7 @@ void sqlite3rebaser_delete(sqlite3_rebaser *p);
|
|||
** In the case of sqlite3changeset_start_strm(), the xInput callback may be
|
||||
** invoked by the sessions module at any point during the lifetime of the
|
||||
** iterator. If such an xInput callback returns an error, the iterator enters
|
||||
** an error state, whereby all subsequent calls to iterator functions
|
||||
** an error state, whereby all subsequent calls to iterator functions
|
||||
** immediately fail with the same error code as returned by xInput.
|
||||
**
|
||||
** Similarly, streaming API functions that return changesets (or patchsets)
|
||||
|
@ -1537,7 +1537,7 @@ void sqlite3rebaser_delete(sqlite3_rebaser *p);
|
|||
** is immediately abandoned and the streaming API function returns a copy
|
||||
** of the xOutput error code to the application.
|
||||
**
|
||||
** The sessions module never invokes an xOutput callback with the third
|
||||
** The sessions module never invokes an xOutput callback with the third
|
||||
** parameter set to a value less than or equal to zero. Other than this,
|
||||
** no guarantees are made as to the size of the chunks of data returned.
|
||||
*/
|
||||
|
@ -1608,12 +1608,12 @@ int sqlite3session_patchset_strm(
|
|||
int (*xOutput)(void *pOut, const void *pData, int nData),
|
||||
void *pOut
|
||||
);
|
||||
int sqlite3changegroup_add_strm(sqlite3_changegroup*,
|
||||
int sqlite3changegroup_add_strm(sqlite3_changegroup*,
|
||||
int (*xInput)(void *pIn, void *pData, int *pnData),
|
||||
void *pIn
|
||||
);
|
||||
int sqlite3changegroup_output_strm(sqlite3_changegroup*,
|
||||
int (*xOutput)(void *pOut, const void *pData, int nData),
|
||||
int (*xOutput)(void *pOut, const void *pData, int nData),
|
||||
void *pOut
|
||||
);
|
||||
int sqlite3rebaser_rebase_strm(
|
||||
|
@ -1628,16 +1628,16 @@ int sqlite3rebaser_rebase_strm(
|
|||
** CAPI3REF: Configure global parameters
|
||||
**
|
||||
** The sqlite3session_config() interface is used to make global configuration
|
||||
** changes to the sessions module in order to tune it to the specific needs
|
||||
** changes to the sessions module in order to tune it to the specific needs
|
||||
** of the application.
|
||||
**
|
||||
** The sqlite3session_config() interface is not threadsafe. If it is invoked
|
||||
** while any other thread is inside any other sessions method then the
|
||||
** results are undefined. Furthermore, if it is invoked after any sessions
|
||||
** related objects have been created, the results are also undefined.
|
||||
** related objects have been created, the results are also undefined.
|
||||
**
|
||||
** The first argument to the sqlite3session_config() function must be one
|
||||
** of the SQLITE_SESSION_CONFIG_XXX constants defined below. The
|
||||
** of the SQLITE_SESSION_CONFIG_XXX constants defined below. The
|
||||
** interpretation of the (void*) value passed as the second parameter and
|
||||
** the effect of calling this function depends on the value of the first
|
||||
** parameter.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue