Module Name: src Committed By: abhinav Date: Sun Jul 3 17:07:39 UTC 2016
Modified Files: src/external/public-domain/sqlite/man: Makefile Added Files: src/external/public-domain/sqlite/man: SQLITE_CHANGESET_DATA.3 SQLITE_CHANGESET_OMIT.3 SQLITE_INDEX_SCAN_UNIQUE.3 SQLITE_SCANSTAT_NLOOP.3 sqlite3_changeset_iter.3 sqlite3_db_cacheflush.3 sqlite3_preupdate_hook.3 sqlite3_result_subtype.3 sqlite3_session.3 sqlite3_snapshot.3 sqlite3_snapshot_cmp.3 sqlite3_snapshot_free.3 sqlite3_snapshot_get.3 sqlite3_snapshot_open.3 sqlite3_stmt_scanstatus.3 sqlite3_stmt_scanstatus_reset.3 sqlite3_strlike.3 sqlite3_system_errno.3 sqlite3_value_dup.3 sqlite3_value_subtype.3 sqlite3changegroup_new.3 sqlite3changeset_apply.3 sqlite3changeset_apply_strm.3 sqlite3changeset_concat.3 sqlite3changeset_conflict.3 sqlite3changeset_finalize.3 sqlite3changeset_fk_conflicts.3 sqlite3changeset_invert.3 sqlite3changeset_new.3 sqlite3changeset_next.3 sqlite3changeset_old.3 sqlite3changeset_op.3 sqlite3changeset_pk.3 sqlite3changeset_start.3 sqlite3session_attach.3 sqlite3session_changeset.3 sqlite3session_create.3 sqlite3session_delete.3 sqlite3session_diff.3 sqlite3session_enable.3 sqlite3session_indirect.3 sqlite3session_isempty.3 sqlite3session_patchset.3 sqlite3session_table_filter.3 Log Message: Add newly generated man pages To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/public-domain/sqlite/man/Makefile cvs rdiff -u -r0 -r1.1 \ src/external/public-domain/sqlite/man/SQLITE_CHANGESET_DATA.3 \ src/external/public-domain/sqlite/man/SQLITE_CHANGESET_OMIT.3 \ src/external/public-domain/sqlite/man/SQLITE_INDEX_SCAN_UNIQUE.3 \ src/external/public-domain/sqlite/man/SQLITE_SCANSTAT_NLOOP.3 \ src/external/public-domain/sqlite/man/sqlite3_changeset_iter.3 \ src/external/public-domain/sqlite/man/sqlite3_db_cacheflush.3 \ src/external/public-domain/sqlite/man/sqlite3_preupdate_hook.3 \ src/external/public-domain/sqlite/man/sqlite3_result_subtype.3 \ src/external/public-domain/sqlite/man/sqlite3_session.3 \ src/external/public-domain/sqlite/man/sqlite3_snapshot.3 \ src/external/public-domain/sqlite/man/sqlite3_snapshot_cmp.3 \ src/external/public-domain/sqlite/man/sqlite3_snapshot_free.3 \ src/external/public-domain/sqlite/man/sqlite3_snapshot_get.3 \ src/external/public-domain/sqlite/man/sqlite3_snapshot_open.3 \ src/external/public-domain/sqlite/man/sqlite3_stmt_scanstatus.3 \ src/external/public-domain/sqlite/man/sqlite3_stmt_scanstatus_reset.3 \ src/external/public-domain/sqlite/man/sqlite3_strlike.3 \ src/external/public-domain/sqlite/man/sqlite3_system_errno.3 \ src/external/public-domain/sqlite/man/sqlite3_value_dup.3 \ src/external/public-domain/sqlite/man/sqlite3_value_subtype.3 \ src/external/public-domain/sqlite/man/sqlite3changegroup_new.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_apply.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_apply_strm.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_concat.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_conflict.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_finalize.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_fk_conflicts.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_invert.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_new.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_next.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_old.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_op.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_pk.3 \ src/external/public-domain/sqlite/man/sqlite3changeset_start.3 \ src/external/public-domain/sqlite/man/sqlite3session_attach.3 \ src/external/public-domain/sqlite/man/sqlite3session_changeset.3 \ src/external/public-domain/sqlite/man/sqlite3session_create.3 \ src/external/public-domain/sqlite/man/sqlite3session_delete.3 \ src/external/public-domain/sqlite/man/sqlite3session_diff.3 \ src/external/public-domain/sqlite/man/sqlite3session_enable.3 \ src/external/public-domain/sqlite/man/sqlite3session_indirect.3 \ src/external/public-domain/sqlite/man/sqlite3session_isempty.3 \ src/external/public-domain/sqlite/man/sqlite3session_patchset.3 \ src/external/public-domain/sqlite/man/sqlite3session_table_filter.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/public-domain/sqlite/man/Makefile diff -u src/external/public-domain/sqlite/man/Makefile:1.1 src/external/public-domain/sqlite/man/Makefile:1.2 --- src/external/public-domain/sqlite/man/Makefile:1.1 Wed Mar 30 21:31:44 2016 +++ src/external/public-domain/sqlite/man/Makefile Sun Jul 3 17:07:38 2016 @@ -1,9 +1,11 @@ -# $NetBSD: Makefile,v 1.1 2016/03/30 21:31:44 christos Exp $ +# $NetBSD: Makefile,v 1.2 2016/07/03 17:07:38 abhinav Exp $ .include <bsd.init.mk> MAN += \ SQLITE_ACCESS_EXISTS.3 \ +SQLITE_CHANGESET_DATA.3 \ +SQLITE_CHANGESET_OMIT.3 \ SQLITE_CHECKPOINT_PASSIVE.3 \ SQLITE_CONFIG_SINGLETHREAD.3 \ SQLITE_CREATE_INDEX.3 \ @@ -13,6 +15,7 @@ SQLITE_DENY.3 \ SQLITE_DETERMINISTIC.3 \ SQLITE_FCNTL_LOCKSTATE.3 \ SQLITE_INDEX_CONSTRAINT_EQ.3 \ +SQLITE_INDEX_SCAN_UNIQUE.3 \ SQLITE_INTEGER.3 \ SQLITE_IOCAP_ATOMIC.3 \ SQLITE_IOERR_READ.3 \ @@ -22,6 +25,7 @@ SQLITE_MUTEX_FAST.3 \ SQLITE_OK.3 \ SQLITE_OPEN_READONLY.3 \ SQLITE_ROLLBACK.3 \ +SQLITE_SCANSTAT_NLOOP.3 \ SQLITE_SHM_NLOCK.3 \ SQLITE_SHM_UNLOCK.3 \ SQLITE_STATUS_MEMORY_USED.3 \ @@ -52,6 +56,7 @@ sqlite3_busy_handler.3 \ sqlite3_busy_timeout.3 \ sqlite3_cancel_auto_extension.3 \ sqlite3_changes.3 \ +sqlite3_changeset_iter.3 \ sqlite3_clear_bindings.3 \ sqlite3_close.3 \ sqlite3_collation_needed.3 \ @@ -71,6 +76,7 @@ sqlite3_create_function.3 \ sqlite3_create_module.3 \ sqlite3_data_count.3 \ sqlite3_data_directory.3 \ +sqlite3_db_cacheflush.3 \ sqlite3_db_config.3 \ sqlite3_db_filename.3 \ sqlite3_db_handle.3 \ @@ -115,14 +121,22 @@ sqlite3_pcache.3 \ sqlite3_pcache_methods2.3 \ sqlite3_pcache_page.3 \ sqlite3_prepare.3 \ +sqlite3_preupdate_hook.3 \ sqlite3_progress_handler.3 \ sqlite3_randomness.3 \ sqlite3_release_memory.3 \ sqlite3_reset.3 \ sqlite3_reset_auto_extension.3 \ sqlite3_result_blob.3 \ +sqlite3_result_subtype.3 \ +sqlite3_session.3 \ sqlite3_set_authorizer.3 \ sqlite3_sleep.3 \ +sqlite3_snapshot.3 \ +sqlite3_snapshot_cmp.3 \ +sqlite3_snapshot_free.3 \ +sqlite3_snapshot_get.3 \ +sqlite3_snapshot_open.3 \ sqlite3_soft_heap_limit.3 \ sqlite3_soft_heap_limit64.3 \ sqlite3_sql.3 \ @@ -131,9 +145,13 @@ sqlite3_step.3 \ sqlite3_stmt.3 \ sqlite3_stmt_busy.3 \ sqlite3_stmt_readonly.3 \ +sqlite3_stmt_scanstatus.3 \ +sqlite3_stmt_scanstatus_reset.3 \ sqlite3_stmt_status.3 \ sqlite3_strglob.3 \ sqlite3_stricmp.3 \ +sqlite3_strlike.3 \ +sqlite3_system_errno.3 \ sqlite3_table_column_metadata.3 \ sqlite3_temp_directory.3 \ sqlite3_test_control.3 \ @@ -146,6 +164,8 @@ sqlite3_uri_parameter.3 \ sqlite3_user_data.3 \ sqlite3_value.3 \ sqlite3_value_blob.3 \ +sqlite3_value_dup.3 \ +sqlite3_value_subtype.3 \ sqlite3_version.3 \ sqlite3_vfs.3 \ sqlite3_vfs_find.3 \ @@ -157,6 +177,30 @@ sqlite3_wal_autocheckpoint.3 \ sqlite3_wal_checkpoint.3 \ sqlite3_wal_checkpoint_v2.3 \ sqlite3_wal_hook.3 \ +sqlite3changegroup_new.3 \ +sqlite3changeset_apply.3 \ +sqlite3changeset_apply_strm.3 \ +sqlite3changeset_concat.3 \ +sqlite3changeset_conflict.3 \ +sqlite3changeset_finalize.3 \ +sqlite3changeset_fk_conflicts.3 \ +sqlite3changeset_invert.3 \ +sqlite3changeset_new.3 \ +sqlite3changeset_next.3 \ +sqlite3changeset_old.3 \ +sqlite3changeset_op.3 \ +sqlite3changeset_pk.3 \ +sqlite3changeset_start.3 \ +sqlite3session_attach.3 \ +sqlite3session_changeset.3 \ +sqlite3session_create.3 \ +sqlite3session_delete.3 \ +sqlite3session_diff.3 \ +sqlite3session_enable.3 \ +sqlite3session_indirect.3 \ +sqlite3session_isempty.3 \ +sqlite3session_patchset.3 \ +sqlite3session_table_filter.3 \ sqlite_int64.3 .include <bsd.man.mk> Added files: Index: src/external/public-domain/sqlite/man/SQLITE_CHANGESET_DATA.3 diff -u /dev/null src/external/public-domain/sqlite/man/SQLITE_CHANGESET_DATA.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/SQLITE_CHANGESET_DATA.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,59 @@ +.Dd $Mdocdate$ +.Dt SQLITE_CHANGESET_DATA 3 +.Os +.Sh NAME +.Nm SQLITE_CHANGESET_DATA , +.Nm SQLITE_CHANGESET_NOTFOUND , +.Nm SQLITE_CHANGESET_CONFLICT , +.Nm SQLITE_CHANGESET_CONSTRAINT , +.Nm SQLITE_CHANGESET_FOREIGN_KEY +.Nd Constants Passed To The Conflict Handler +.Sh SYNOPSIS +.Fd #define SQLITE_CHANGESET_DATA +.Fd #define SQLITE_CHANGESET_NOTFOUND +.Fd #define SQLITE_CHANGESET_CONFLICT +.Fd #define SQLITE_CHANGESET_CONSTRAINT +.Fd #define SQLITE_CHANGESET_FOREIGN_KEY +.Sh DESCRIPTION +Values that may be passed as the second argument to a conflict-handler. +.Bl -tag -width Ds +.It SQLITE_CHANGESET_DATAThe 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 expected "before" values. +.Pp +The conflicting row, in this case, is the database row with the matching +primary key. +.It SQLITE_CHANGESET_NOTFOUNDThe 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. +.Pp +There is no conflicting row in this case. +The results of invoking the sqlite3changeset_conflict() API are undefined. +.It SQLITE_CHANGESET_CONFLICTCHANGESET_CONFLICT is passed as the second +argument to the conflict handler while processing an INSERT change +if the operation would result in duplicate primary key values. +.Pp +The conflicting row in this case is the database row with the matching +primary key. +.It SQLITE_CHANGESET_FOREIGN_KEYIf foreign key handling is enabled, and +applying a changeset leaves the 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 foreign key constraint violation, are committed. +Or, if it returns CHANGESET_ABORT, the changeset is rolled back. +.Pp +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(). +.It SQLITE_CHANGESET_CONSTRAINTIf 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. +.Pp +There is no conflicting row in this case. +The results of invoking the sqlite3changeset_conflict() API are undefined. +.El +.Pp Index: src/external/public-domain/sqlite/man/SQLITE_CHANGESET_OMIT.3 diff -u /dev/null src/external/public-domain/sqlite/man/SQLITE_CHANGESET_OMIT.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/SQLITE_CHANGESET_OMIT.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,39 @@ +.Dd $Mdocdate$ +.Dt SQLITE_CHANGESET_OMIT 3 +.Os +.Sh NAME +.Nm SQLITE_CHANGESET_OMIT , +.Nm SQLITE_CHANGESET_REPLACE , +.Nm SQLITE_CHANGESET_ABORT +.Nd Constants Returned By The Conflict Handler +.Sh SYNOPSIS +.Fd #define SQLITE_CHANGESET_OMIT +.Fd #define SQLITE_CHANGESET_REPLACE +.Fd #define SQLITE_CHANGESET_ABORT +.Sh DESCRIPTION +A conflict handler callback must return one of the following three +values. +.Bl -tag -width Ds +.It SQLITE_CHANGESET_OMITIf a conflict handler returns this value no special +action is taken. +The change that caused the conflict is not applied. +The session module continues to the next change in the changeset. +.It SQLITE_CHANGESET_REPLACEThis 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 call to sqlite3changeset_apply() returns SQLITE_MISUSE. +.Pp +If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +handler, then the conflicting row is either updated or deleted, depending +on the type of change. +.Pp +If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +handler, then the conflicting row is removed from the database and +a second attempt to apply the change is made. +If this second attempt fails, the original row is restored to the database +before continuing. +.It SQLITE_CHANGESET_ABORTIf this value is returned, any changes applied +so far are rolled back and the call to sqlite3changeset_apply() returns +SQLITE_ABORT. +.El +.Pp Index: src/external/public-domain/sqlite/man/SQLITE_INDEX_SCAN_UNIQUE.3 diff -u /dev/null src/external/public-domain/sqlite/man/SQLITE_INDEX_SCAN_UNIQUE.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/SQLITE_INDEX_SCAN_UNIQUE.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,9 @@ +.Dd $Mdocdate$ +.Dt SQLITE_INDEX_SCAN_UNIQUE 3 +.Os +.Sh NAME +.Nm SQLITE_INDEX_SCAN_UNIQUE +.Nd Virtual Table Scan Flags +.Sh SYNOPSIS +.Fd #define SQLITE_INDEX_SCAN_UNIQUE +.Sh DESCRIPTION Index: src/external/public-domain/sqlite/man/SQLITE_SCANSTAT_NLOOP.3 diff -u /dev/null src/external/public-domain/sqlite/man/SQLITE_SCANSTAT_NLOOP.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/SQLITE_SCANSTAT_NLOOP.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,62 @@ +.Dd $Mdocdate$ +.Dt SQLITE_SCANSTAT_NLOOP 3 +.Os +.Sh NAME +.Nm SQLITE_SCANSTAT_NLOOP , +.Nm SQLITE_SCANSTAT_NVISIT , +.Nm SQLITE_SCANSTAT_EST , +.Nm SQLITE_SCANSTAT_NAME , +.Nm SQLITE_SCANSTAT_EXPLAIN , +.Nm SQLITE_SCANSTAT_SELECTID +.Nd Prepared Statement Scan Status Opcodes +.Sh SYNOPSIS +.Fd #define SQLITE_SCANSTAT_NLOOP +.Fd #define SQLITE_SCANSTAT_NVISIT +.Fd #define SQLITE_SCANSTAT_EST +.Fd #define SQLITE_SCANSTAT_NAME +.Fd #define SQLITE_SCANSTAT_EXPLAIN +.Fd #define SQLITE_SCANSTAT_SELECTID +.Sh DESCRIPTION +The following constants can be used for the T parameter to the sqlite3_stmt_scanstatus(S,X,T,V) +interface. +Each constant designates a different metric for sqlite3_stmt_scanstatus() +to return. +.Pp +When the value returned to V is a string, space to hold that string +is managed by the prepared statement S and will be automatically freed +when S is finalized. +.Bl -tag -width Ds +.It SQLITE_SCANSTAT_NLOOP +The sqlite3_int64 variable pointed to by the T parameter +will be set to the total number of times that the X-th loop has run. +.It SQLITE_SCANSTAT_NVISIT +The sqlite3_int64 variable pointed to by the T parameter +will be set to the total number of rows examined by all iterations +of the X-th loop. +.It SQLITE_SCANSTAT_EST +The "double" variable pointed to by the T parameter will be set to +the query planner's estimate for the average number of rows output +from each iteration of the X-th loop. +If the query planner's estimates was accurate, then this value will +approximate the quotient NVISIT/NLOOP and the product of this value +for all prior loops with the same SELECTID will be the NLOOP value +for the current loop. +.It SQLITE_SCANSTAT_NAME +The "const char *" variable pointed to by the T parameter will be set +to a zero-terminated UTF-8 string containing the name of the index +or table used for the X-th loop. +.It SQLITE_SCANSTAT_EXPLAIN +The "const char *" variable pointed to by the T parameter will be set +to a zero-terminated UTF-8 string containing the EXPLAIN QUERY PLAN +description for the X-th loop. +.It SQLITE_SCANSTAT_SELECT +The "int" variable pointed to by the T parameter will be set to the +"select-id" for the X-th loop. +The select-id identifies which query or subquery the loop is part of. +The main query has a select-id of zero. +The select-id is the same value as is output in the first column of +an EXPLAIN QUERY PLAN query. +.El +.Pp +.Sh SEE ALSO +.Xr sqlite_int64 3 Index: src/external/public-domain/sqlite/man/sqlite3_changeset_iter.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_changeset_iter.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_changeset_iter.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,9 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_CHANGESET_ITER 3 +.Os +.Sh NAME +.Nm sqlite3_changeset_iter +.Nd Changeset Iterator Handle +.Sh SYNOPSIS +.Vt typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; +.Sh DESCRIPTION Index: src/external/public-domain/sqlite/man/sqlite3_db_cacheflush.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_db_cacheflush.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_db_cacheflush.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,46 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_DB_CACHEFLUSH 3 +.Os +.Sh NAME +.Nm sqlite3_db_cacheflush +.Nd Flush caches to disk mid-transaction +.Sh SYNOPSIS +.Ft int SQLITE_STDCALL +.Fo sqlite3_db_cacheflush +.Fa "sqlite3*" +.Fc +.Sh DESCRIPTION +If a write-transaction is open on database connection +D when the sqlite3_db_cacheflush(D) interface +invoked, any dirty pages in the pager-cache that are not currently +in use are written out to disk. +A dirty page may be in use if a database cursor created by an active +SQL statement is reading from it, or if it is page 1 of a database +file (page 1 is always "in use"). +The sqlite3_db_cacheflush(D) interface flushes +caches for all schemas - "main", "temp", and any attached databases. +.Pp +If this function needs to obtain extra database locks before dirty +pages can be flushed to disk, it does so. +If those locks cannot be obtained immediately and there is a busy-handler +callback configured, it is invoked in the usual manner. +If the required lock still cannot be obtained, then the database is +skipped and an attempt made to flush any dirty pages belonging to the +next (if any) database. +If any databases are skipped because locks cannot be obtained, but +no other error occurs, this function returns SQLITE_BUSY. +.Pp +If any other error occurs while flushing dirty pages to disk (for example +an IO error or out-of-memory condition), then processing is abandoned +and an SQLite error code is returned to the caller immediately. +.Pp +Otherwise, if no error occurs, sqlite3_db_cacheflush() +returns SQLITE_OK. +.Pp +This function does not set the database handle error code or message +returned by the sqlite3_errcode() and sqlite3_errmsg() +functions. +.Sh SEE ALSO +.Xr sqlite3 3 , +.Xr sqlite3_db_cacheflush 3 , +.Xr sqlite3_errcode 3 Index: src/external/public-domain/sqlite/man/sqlite3_preupdate_hook.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_preupdate_hook.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_preupdate_hook.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,127 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_PREUPDATE_HOOK 3 +.Os +.Sh NAME +.Nm sqlite3_preupdate_hook , +.Nm sqlite3_preupdate_old , +.Nm sqlite3_preupdate_count , +.Nm sqlite3_preupdate_depth , +.Nm sqlite3_preupdate_new +.Nd The pre-update hook. +.Sh SYNOPSIS +.Ft void *SQLITE_STDCALL +.Fo sqlite3_preupdate_hook +.Fa "sqlite3 *db" +.Fa "void(*xPreUpdate)( void *pCtx, sqlite3 *db, int op, char const *zDb, char const *zName, sqlite3_int64 iKey1, sqlite3_int64 iKey2 )" +.Fa "void* " +.Fc +.Ft int SQLITE_STDCALL +.Fo sqlite3_preupdate_old +.Fa "sqlite3 *" +.Fa "int" +.Fa "sqlite3_value **" +.Fc +.Ft int SQLITE_STDCALL +.Fo sqlite3_preupdate_count +.Fa "sqlite3 *" +.Fc +.Ft int SQLITE_STDCALL +.Fo sqlite3_preupdate_depth +.Fa "sqlite3 *" +.Fc +.Ft int SQLITE_STDCALL +.Fo sqlite3_preupdate_new +.Fa "sqlite3 *" +.Fa "int" +.Fa "sqlite3_value **" +.Fc +.Sh DESCRIPTION +These interfaces are only available if SQLite is compiled using the +SQLITE_ENABLE_PREUPDATE_HOOK compile-time +option. +.Pp +The sqlite3_preupdate_hook() interface registers +a callback function that is invoked prior to each INSERT, UPDATE, +and DELETE operation on a rowid table. +At most one preupdate hook may be registered at a time on a single +database connection; each call to sqlite3_preupdate_hook() +overrides the previous setting. +The preupdate hook is disabled by invoking sqlite3_preupdate_hook() +with a NULL pointer as the second parameter. +The third parameter to sqlite3_preupdate_hook() +is passed through as the first parameter to callbacks. +.Pp +The preupdate hook only fires for changes to rowid tables; +the preupdate hook is not invoked for changes to virtual tables +or WITHOUT ROWID tables. +.Pp +The second parameter to the preupdate callback is a pointer to the +database connection that registered the preupdate +hook. +The third parameter to the preupdate callback is one of the constants +SQLITE_INSERT, SQLITE_DELETE, or SQLITE_UPDATE +to indentify the kind of update operation that is about to occur. +The fourth parameter to the preupdate callback is the name of the database +within the database connection that is being modified. +This will be "main" for the main database or "temp" for TEMP tables +or the name given after the AS keyword in the ATTACH statement +for attached databases. +The fifth parameter to the preupdate callback is the name of the table +that is being modified. +The sixth parameter to the preupdate callback is the initial rowid +of the row being changes for SQLITE_UPDATE and SQLITE_DELETE changes +and is undefined for SQLITE_INSERT changes. +The seventh parameter to the preupdate callback is the final rowid +of the row being changed for SQLITE_UPDATE and SQLITE_INSERT changes +and is undefined for SQLITE_DELETE changes. +.Pp +The sqlite3_preupdate_old(), sqlite3_preupdate_new(), +sqlite3_preupdate_count(), and sqlite3_preupdate_depth() +interfaces provide additional information about a preupdate event. +These routines may only be called from within a preupdate callback. +Invoking any of these routines from outside of a preupdate callback +or with a database connection pointer that is different +from the one supplied to the preupdate callback results in undefined +and probably undesirable behavior. +.Pp +The sqlite3_preupdate_count(D) interface +returns the number of columns in the row that is being inserted, updated, +or deleted. +.Pp +The sqlite3_preupdate_old(D,N,P) interface +writes into P a pointer to a protected sqlite3_value +that contains the value of the Nth column of the table row before it +is updated. +The N parameter must be between 0 and one less than the number of columns +or the behavior will be undefined. +This must only be used within SQLITE_UPDATE and SQLITE_DELETE preupdate +callbacks; if it is used by an SQLITE_INSERT callback then the behavior +is undefined. +The sqlite3_value that P points to will be destroyed when +the preupdate callback returns. +.Pp +The sqlite3_preupdate_new(D,N,P) interface +writes into P a pointer to a protected sqlite3_value +that contains the value of the Nth column of the table row after it +is updated. +The N parameter must be between 0 and one less than the number of columns +or the behavior will be undefined. +This must only be used within SQLITE_INSERT and SQLITE_UPDATE preupdate +callbacks; if it is used by an SQLITE_DELETE callback then the behavior +is undefined. +The sqlite3_value that P points to will be destroyed when +the preupdate callback returns. +.Pp +The sqlite3_preupdate_depth(D) interface +returns 0 if the preupdate callback was invoked as a result of a direct +insert, update, or delete operation; or 1 for inserts, updates, or +deletes invoked by top-level triggers; or 2 for changes resulting from +triggers called by top-level triggers; and so forth. +.Pp +.Sh SEE ALSO +.Xr sqlite3 3 , +.Xr sqlite3_value 3 , +.Xr sqlite3_preupdate_hook 3 , +.Xr sqlite3_update_hook 3 , +.Xr sqlite3_value 3 , +.Xr SQLITE_CREATE_INDEX 3 Index: src/external/public-domain/sqlite/man/sqlite3_result_subtype.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_result_subtype.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_result_subtype.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,23 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_RESULT_SUBTYPE 3 +.Os +.Sh NAME +.Nm sqlite3_result_subtype +.Nd Setting The Subtype Of An SQL Function +.Sh SYNOPSIS +.Ft void SQLITE_STDCALL +.Fo sqlite3_result_subtype +.Fa "sqlite3_context*" +.Fa "unsigned int" +.Fc +.Sh DESCRIPTION +The sqlite3_result_subtype(C,T) function causes the subtype of the +result from the application-defined SQL function +with sqlite3_context C to be the value T. +Only the lower 8 bits of the subtype T are preserved in current versions +of SQLite; higher order bits are discarded. +The number of subtype bytes preserved by SQLite might increase in future +releases of SQLite. +.Sh SEE ALSO +.Xr sqlite3_create_function 3 , +.Xr sqlite3_context 3 Index: src/external/public-domain/sqlite/man/sqlite3_session.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_session.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_session.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,9 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_SESSION 3 +.Os +.Sh NAME +.Nm sqlite3_session +.Nd Session Object Handle +.Sh SYNOPSIS +.Vt typedef struct sqlite3_session sqlite3_session; +.Sh DESCRIPTION Index: src/external/public-domain/sqlite/man/sqlite3_snapshot.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_snapshot.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_snapshot.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,35 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_SNAPSHOT 3 +.Os +.Sh NAME +.Nm sqlite3_snapshot +.Nd Database Snapshot +.Sh SYNOPSIS +.Vt typedef struct sqlite3_snapshot sqlite3_snapshot; +.Sh DESCRIPTION +An instance of the snapshot object records the state of a WAL mode +database for some specific point in history. +.Pp +In WAL mode, multiple database connections +that are open on the same database file can each be reading a different +historical version of the database file. +When a database connection begins a read transaction, +that connection sees an unchanging copy of the database as it existed +for the point in time when the transaction first started. +Subsequent changes to the database from other connections are not seen +by the reader until a new read transaction is started. +.Pp +The sqlite3_snapshot object records state information about an historical +version of the database file so that it is possible to later open a +new read transaction that sees that historical version of the database +rather than the most recent version. +.Pp +The constructor for this object is sqlite3_snapshot_get(). +The sqlite3_snapshot_open() method causes a +fresh read transaction to refer to an historical snapshot (if possible). +The destructor for sqlite3_snapshot objects is sqlite3_snapshot_free(). +.Sh SEE ALSO +.Xr sqlite3 3 , +.Xr sqlite3_snapshot_free 3 , +.Xr sqlite3_snapshot_get 3 , +.Xr sqlite3_snapshot_open 3 Index: src/external/public-domain/sqlite/man/sqlite3_snapshot_cmp.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_snapshot_cmp.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_snapshot_cmp.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,30 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_SNAPSHOT_CMP 3 +.Os +.Sh NAME +.Nm sqlite3_snapshot_cmp +.Nd Compare the ages of two snapshot handles. +.Sh SYNOPSIS +.Ft int SQLITE_STDCALL +.Fo sqlite3_snapshot_cmp +.Fa "sqlite3_snapshot *p1" +.Fa "sqlite3_snapshot *p2 " +.Fc +.Sh DESCRIPTION +The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages +of two valid snapshot handles. +.Pp +If the two snapshot handles are not associated with the same database +file, the result of the comparison is undefined. +.Pp +Additionally, the result of the comparison is only valid if both of +the snapshot handles were obtained by calling sqlite3_snapshot_get() +since the last time the wal file was deleted. +The wal file is deleted when the database is changed back to rollback +mode or when the number of database clients drops to zero. +If either snapshot handle was obtained before the wal file was last +deleted, the value returned by this function is undefined. +.Pp +Otherwise, this API returns a negative value if P1 refers to an older +snapshot than P2, zero if the two handles refer to the same database +snapshot, and a positive value if P1 is a newer snapshot than P2. Index: src/external/public-domain/sqlite/man/sqlite3_snapshot_free.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_snapshot_free.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_snapshot_free.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,22 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_SNAPSHOT_FREE 3 +.Os +.Sh NAME +.Nm sqlite3_snapshot_free +.Nd Destroy a snapshot +.Sh SYNOPSIS +.Ft void SQLITE_STDCALL +.Fo sqlite3_snapshot_free +.Fa "sqlite3_snapshot*" +.Fc +.Sh DESCRIPTION +The sqlite3_snapshot_free(P) interface destroys +sqlite3_snapshot P. +The application must eventually free every sqlite3_snapshot +object using this routine to avoid a memory leak. +.Pp +The sqlite3_snapshot_free() interface is only +available when the SQLITE_ENABLE_SNAPSHOT compile-time option is used. +.Sh SEE ALSO +.Xr sqlite3_snapshot 3 , +.Xr sqlite3_snapshot_free 3 Index: src/external/public-domain/sqlite/man/sqlite3_snapshot_get.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_snapshot_get.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_snapshot_get.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,36 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_SNAPSHOT_GET 3 +.Os +.Sh NAME +.Nm sqlite3_snapshot_get +.Nd Record A Database Snapshot +.Sh SYNOPSIS +.Ft int SQLITE_STDCALL +.Fo sqlite3_snapshot_get +.Fa "sqlite3 *db" +.Fa "const char *zSchema" +.Fa "sqlite3_snapshot **ppSnapshot " +.Fc +.Sh DESCRIPTION +The sqlite3_snapshot_get(D,S,P) interface +attempts to make a new sqlite3_snapshot object that +records the current state of schema S in database connection D. +On success, the sqlite3_snapshot_get(D,S,P) +interface writes a pointer to the newly created sqlite3_snapshot +object into *P and returns SQLITE_OK. +If schema S of database connection D is not a WAL mode +database that is in a read transaction, then sqlite3_snapshot_get(D,S,P) +leaves the *P value unchanged and returns an appropriate error code. +.Pp +The sqlite3_snapshot object returned from a successful +call to sqlite3_snapshot_get() must be freed +using sqlite3_snapshot_free() to avoid a memory +leak. +.Pp +The sqlite3_snapshot_get() interface is only +available when the SQLITE_ENABLE_SNAPSHOT compile-time option is used. +.Sh SEE ALSO +.Xr sqlite3 3 , +.Xr sqlite3_snapshot 3 , +.Xr sqlite3_snapshot_free 3 , +.Xr sqlite3_snapshot_get 3 Index: src/external/public-domain/sqlite/man/sqlite3_snapshot_open.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_snapshot_open.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_snapshot_open.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,46 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_SNAPSHOT_OPEN 3 +.Os +.Sh NAME +.Nm sqlite3_snapshot_open +.Nd Start a read transaction on an historical snapshot +.Sh SYNOPSIS +.Ft int SQLITE_STDCALL +.Fo sqlite3_snapshot_open +.Fa "sqlite3 *db" +.Fa "const char *zSchema" +.Fa "sqlite3_snapshot *pSnapshot " +.Fc +.Sh DESCRIPTION +The sqlite3_snapshot_open(D,S,P) interface +starts a read transaction for schema S of database connection +D such that the read transaction refers to historical snapshot +P, rather than the most recent change to the database. +The sqlite3_snapshot_open() interface returns +SQLITE_OK on success or an appropriate error code if it fails. +.Pp +In order to succeed, a call to sqlite3_snapshot_open(D,S,P) +must be the first operation following the BEGIN that takes the +schema S out of autocommit mode. +In other words, schema S must not currently be in a transaction for +sqlite3_snapshot_open(D,S,P) to work, but +the database connection D must be out of autocommit mode. +A snapshot will fail to open if it has been overwritten by +a checkpoint. +A call to sqlite3_snapshot_open(D,S,P) +will fail if the database connection D does not know that the database +file for schema S is in WAL mode. +A database connection might not know that the database file is in WAL mode +if there has been no prior I/O on that database connection, or if the +database entered WAL mode after the most recent I/O on the +database connection. +(Hint: Run "PRAGMA application_id" against a newly +opened database connection in order to make it ready to use snapshots.) +.Pp +The sqlite3_snapshot_open() interface is only +available when the SQLITE_ENABLE_SNAPSHOT compile-time option is used. +.Sh SEE ALSO +.Xr sqlite3_get_autocommit 3 , +.Xr sqlite3 3 , +.Xr sqlite3_snapshot 3 , +.Xr sqlite3_snapshot_open 3 Index: src/external/public-domain/sqlite/man/sqlite3_stmt_scanstatus.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_stmt_scanstatus.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_stmt_scanstatus.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,46 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_STMT_SCANSTATUS 3 +.Os +.Sh NAME +.Nm sqlite3_stmt_scanstatus +.Nd Prepared Statement Scan Status +.Sh SYNOPSIS +.Ft int SQLITE_STDCALL +.Fo sqlite3_stmt_scanstatus +.Fa "sqlite3_stmt *pStmt" +.Fa "int idx" +.Fa "int iScanStatusOp" +.Fa "void *pOut " +.Fc +.Sh DESCRIPTION +This interface returns information about the predicted and measured +performance for pStmt. +Advanced applications can use this interface to compare the predicted +and the measured performance and issue warnings and/or rerun ANALYZE +if discrepancies are found. +.Pp +Since this interface is expected to be rarely used, it is only available +if SQLite is compiled using the SQLITE_ENABLE_STMT_SCANSTATUS +compile-time option. +.Pp +The "iScanStatusOp" parameter determines which status information to +return. +The "iScanStatusOp" must be one of the scanstatus options +or the behavior of this interface is undefined. +The requested measurement is written into a variable pointed to by +the "pOut" parameter. +Parameter "idx" identifies the specific loop to retrieve statistics +for. +Loops are numbered starting from zero. +If idx is out of range - less than zero or greater than or equal to +the total number of loops used to implement the statement - a non-zero +value is returned and the variable that pOut points to is unchanged. +.Pp +Statistics might not be available for all loops in all statements. +In cases where there exist loops with no available statistics, this +function behaves as if the loop did not exist - it returns non-zero +and leave the variable that pOut points to unchanged. +.Pp +.Sh SEE ALSO +.Xr SQLITE_SCANSTAT_NLOOP 3 , +.Xr sqlite3_stmt_scanstatus_reset 3 Index: src/external/public-domain/sqlite/man/sqlite3_stmt_scanstatus_reset.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_stmt_scanstatus_reset.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_stmt_scanstatus_reset.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,19 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_STMT_SCANSTATUS_RESET 3 +.Os +.Sh NAME +.Nm sqlite3_stmt_scanstatus_reset +.Nd Zero Scan-Status Counters +.Sh SYNOPSIS +.Ft void SQLITE_STDCALL +.Fo sqlite3_stmt_scanstatus_reset +.Fa "sqlite3_stmt*" +.Fc +.Sh DESCRIPTION +Zero all sqlite3_stmt_scanstatus() related +event counters. +.Pp +This API is only available if the library is built with pre-processor +symbol SQLITE_ENABLE_STMT_SCANSTATUS defined. +.Sh SEE ALSO +.Xr sqlite3_stmt_scanstatus 3 Index: src/external/public-domain/sqlite/man/sqlite3_strlike.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_strlike.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_strlike.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,24 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_STRLIKE 3 +.Os +.Sh NAME +.Nm sqlite3_strlike +.Nd String LIKE Matching +.Sh SYNOPSIS +.Ft int SQLITE_STDCALL +.Fo sqlite3_strlike +.Fa "const char *zGlob" +.Fa "const char *zStr" +.Fa "unsigned int cEsc" +.Fc +.Sh DESCRIPTION +The sqlite3_strlike(P,X,E) function matches Unicode +characters, though only ASCII characters are case folded. +.Pp +Note that this routine returns zero on a match and non-zero if the +strings do not match, the same as sqlite3_stricmp() +and sqlite3_strnicmp(). +.Pp +.Sh SEE ALSO +.Xr sqlite3_strglob 3 , +.Xr sqlite3_stricmp 3 Index: src/external/public-domain/sqlite/man/sqlite3_system_errno.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_system_errno.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_system_errno.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,22 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_SYSTEM_ERRNO 3 +.Os +.Sh NAME +.Nm sqlite3_system_errno +.Nd Low-level system error code +.Sh SYNOPSIS +.Ft int SQLITE_STDCALL +.Fo sqlite3_system_errno +.Fa "sqlite3*" +.Fc +.Sh DESCRIPTION +Attempt to return the underlying operating system error code or error +number that caused the most recent I/O error or failure to open a file. +The return value is OS-dependent. +For example, on unix systems, after sqlite3_open_v2() +returns SQLITE_CANTOPEN, this interface could be called +to get back the underlying "errno" that caused the problem, such as +ENOSPC, EAUTH, EISDIR, and so forth. +.Sh SEE ALSO +.Xr sqlite3_open 3 , +.Xr SQLITE_OK 3 Index: src/external/public-domain/sqlite/man/sqlite3_value_dup.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_value_dup.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_value_dup.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,30 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_VALUE_DUP 3 +.Os +.Sh NAME +.Nm sqlite3_value_dup , +.Nm sqlite3_value_free +.Nd Copy And Free SQL Values +.Sh SYNOPSIS +.Ft sqlite3_value *SQLITE_STDCALL +.Fo sqlite3_value_dup +.Fa "const sqlite3_value*" +.Fc +.Ft void SQLITE_STDCALL +.Fo sqlite3_value_free +.Fa "sqlite3_value*" +.Fc +.Sh DESCRIPTION +The sqlite3_value_dup(V) interface makes a copy of the sqlite3_value +object D and returns a pointer to that copy. +The sqlite3_value returned is a protected sqlite3_value +object even if the input is not. +The sqlite3_value_dup(V) interface returns NULL if V is NULL or if +a memory allocation fails. +.Pp +The sqlite3_value_free(V) interface frees an sqlite3_value +object previously obtained from sqlite3_value_dup(). +If V is a NULL pointer then sqlite3_value_free(V) is a harmless no-op. +.Sh SEE ALSO +.Xr sqlite3_value 3 , +.Xr sqlite3_value_dup 3 Index: src/external/public-domain/sqlite/man/sqlite3_value_subtype.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3_value_subtype.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3_value_subtype.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,25 @@ +.Dd $Mdocdate$ +.Dt SQLITE3_VALUE_SUBTYPE 3 +.Os +.Sh NAME +.Nm sqlite3_value_subtype +.Nd Finding The Subtype Of SQL Values +.Sh SYNOPSIS +.Ft unsigned int SQLITE_STDCALL +.Fo sqlite3_value_subtype +.Fa "sqlite3_value*" +.Fc +.Sh DESCRIPTION +The sqlite3_value_subtype(V) function returns the subtype for an application-defined SQL function +argument V. +The subtype information can be used to pass a limited amount of context +from one SQL function to another. +Use the sqlite3_result_subtype() routine to +set the subtype for the return value of an SQL function. +.Pp +SQLite makes no use of subtype itself. +It merely passes the subtype from the result of one application-defined SQL function +into the input of another. +.Sh SEE ALSO +.Xr sqlite3_create_function 3 , +.Xr sqlite3_result_subtype 3 Index: src/external/public-domain/sqlite/man/sqlite3changegroup_new.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changegroup_new.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changegroup_new.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,45 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGEGROUP_NEW 3 +.Os +.Sh NAME +.Nm sqlite3changegroup_new +.Nd Combine two or more changesets into a single changeset. +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changegroup_new +.Fa "sqlite3_changegroup **pp" +.Fc +.Sh DESCRIPTION +An sqlite3_changegroup object is used to combine two or more changesets +(or patchsets) into a single changeset (or patchset). +A single changegroup object may combine changesets or patchsets, but +not both. +The output is always in the same format as the input. +.Pp +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 sqlite3changegroup_delete(). +If an error occurs, an SQLite error code (i.e. +SQLITE_NOMEM) is returned and *pp is set to NULL. +.Pp +The usual usage pattern for an sqlite3_changegroup object is as follows: +.Bl -bullet +.It +It is created using a call to sqlite3changegroup_new(). +.It +Zero or more changesets (or patchsets) are added to the object by calling +sqlite3changegroup_add(). +.It +The result of combining all input changesets together is obtained by +the application via a call to sqlite3changegroup_output(). +.It +The object is deleted using a call to sqlite3changegroup_delete(). +.El +.Pp +Any number of calls to add() and output() may be made between the calls +to new() and delete(), and in any order. +.Pp +As well as the regular sqlite3changegroup_add() and sqlite3changegroup_output() +functions, also available are the streaming versions sqlite3changegroup_add_strm() +and sqlite3changegroup_output_strm(). Index: src/external/public-domain/sqlite/man/sqlite3changeset_apply.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_apply.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_apply.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,156 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_APPLY 3 +.Os +.Sh NAME +.Nm sqlite3changeset_apply +.Nd Apply A Changeset To A Database +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_apply +.Fa "sqlite3 *db" +.Fa "int nChangeset" +.Fa "void *pChangeset" +.Fa "int(*xFilter)( void *pCtx, const char *zTab )" +.Fa "int(*xConflict)( void *pCtx, int eConflict, sqlite3_changeset_iter *p )" +.Fa "void *pCtx " +.Fc +.Sh DESCRIPTION +Apply a changeset to a database. +This function attempts to update the "main" database attached to handle +db with the changes found in the changeset passed via the second and +third arguments. +.Pp +The fourth argument (xFilter) passed to this function is the "filter +callback". +If it is not NULL, then for each table affected by at least one change +in the changeset, the filter callback is invoked with the table name +as the second argument, and a copy of the context pointer passed as +the sixth argument to this function as the first. +If the "filter callback" returns zero, then no attempt is made to apply +any changes to the table. +Otherwise, if the return value is non-zero or the xFilter argument +to this function is NULL, all changes related to the table are attempted. +.Pp +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: +.Bl -bullet +.It +The table has the same name as the name recorded in the changeset, +and +.It +The table has the same number of columns as recorded in the changeset, +and +.It +The table has primary key columns in the same position as recorded +in the changeset. +.El +.Pp +If there is no compatible table, it is not an error, but none of the +changes associated with the table are applied. +A warning message is issued via the sqlite3_log() mechanism with the +error code SQLITE_SCHEMA. +At most one such warning is issued for each table in the changeset. +.Pp +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. +.Pp +Unlike the xFilter argument, xConflict may not be passed NULL. +The results of passing anything other than a valid function pointer +as the xConflict argument are undefined. +.Pp +Each time the conflict handler function is invoked, it must return +one 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 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 available return values +for details. +.Bl -tag -width Ds +.It DELETE ChangesFor each DELETE change, this 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. +.Pp +If a row with matching primary key values is found, but one or more +of the non-primary key fields contains a value different from the original +row value stored in the changeset, the conflict-handler function is +invoked with SQLITE_CHANGESET_DATA as the second +argument. +.Pp +If no row with matching primary key values is found in the database, +the conflict-handler function is invoked with SQLITE_CHANGESET_NOTFOUND +passed as the second argument. +.Pp +If the DELETE operation is attempted, but SQLite returns SQLITE_CONSTRAINT +(which can only happen if a foreign key constraint is violated), the +conflict-handler function is invoked with SQLITE_CHANGESET_CONSTRAINT +passed as the second argument. +This includes the case where the DELETE operation is attempted because +an earlier call to the conflict handler function returned SQLITE_CHANGESET_REPLACE. +.It INSERT ChangesFor each INSERT change, an attempt is made to insert +the new row into the database. +.Pp +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 SQLITE_CHANGESET_CONFLICT. +.Pp +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 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 SQLITE_CHANGESET_REPLACE. +.It UPDATE ChangesFor each UPDATE change, this 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 updated within +the target database. +.Pp +If a row with matching primary key values is found, but one or more +of the non-primary key fields contains a value different from an original +row value stored in the changeset, the conflict-handler function is +invoked with SQLITE_CHANGESET_DATA as the second +argument. +Since UPDATE changes only contain values for non-primary key fields +that are to be modified, only those fields need to match the original +values to avoid the SQLITE_CHANGESET_DATA conflict-handler callback. +.Pp +If no row with matching primary key values is found in the database, +the conflict-handler function is invoked with SQLITE_CHANGESET_NOTFOUND +passed as the second argument. +.Pp +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 +an earlier call to the conflict handler function returned SQLITE_CHANGESET_REPLACE. +.El +.Pp +It is safe to execute SQL statements, including those that write to +the table that the callback related to, from within the xConflict callback. +This can be used to further customize the applications conflict resolution +strategy. +.Pp +All changes made by this function 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 SQLite error code returned. +.Sh SEE ALSO +.Xr SQLITE_CHANGESET_OMIT 3 , +.Xr SQLITE_CHANGESET_DATA 3 , +.Xr SQLITE_CHANGESET_OMIT 3 Index: src/external/public-domain/sqlite/man/sqlite3changeset_apply_strm.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_apply_strm.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_apply_strm.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,163 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_APPLY_STRM 3 +.Os +.Sh NAME +.Nm sqlite3changeset_apply_strm , +.Nm sqlite3changeset_concat_strm , +.Nm sqlite3changeset_invert_strm , +.Nm sqlite3changeset_start_strm , +.Nm sqlite3session_changeset_strm , +.Nm sqlite3session_patchset_strm , +.Nm sqlite3changegroup_add_strm , +.Nm sqlite3changegroup_output_strm +.Nd Streaming Versions of API functions. +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_apply_strm +.Fa "sqlite3 *db" +.Fa "int (*xInput)(void *pIn, void *pData, int *pnData)" +.Fa "void *pIn" +.Fa "int(*xFilter)( void *pCtx, const char *zTab )" +.Fa "int(*xConflict)( void *pCtx, int eConflict, sqlite3_changeset_iter *p )" +.Fa "void *pCtx " +.Fc +.Ft int +.Fo sqlite3changeset_concat_strm +.Fa "int (*xInputA)(void *pIn, void *pData, int *pnData)" +.Fa "void *pInA" +.Fa "int (*xInputB)(void *pIn, void *pData, int *pnData)" +.Fa "void *pInB" +.Fa "int (*xOutput)(void *pOut, const void *pData, int nData)" +.Fa "void *pOut " +.Fc +.Ft int +.Fo sqlite3changeset_invert_strm +.Fa "int (*xInput)(void *pIn, void *pData, int *pnData)" +.Fa "void *pIn" +.Fa "int (*xOutput)(void *pOut, const void *pData, int nData)" +.Fa "void *pOut " +.Fc +.Ft int +.Fo sqlite3changeset_start_strm +.Fa "sqlite3_changeset_iter **pp" +.Fa "int (*xInput)(void *pIn, void *pData, int *pnData)" +.Fa "void *pIn " +.Fc +.Ft int +.Fo sqlite3session_changeset_strm +.Fa "sqlite3_session *pSession" +.Fa "int (*xOutput)(void *pOut, const void *pData, int nData)" +.Fa "void *pOut " +.Fc +.Ft int +.Fo sqlite3session_patchset_strm +.Fa "sqlite3_session *pSession" +.Fa "int (*xOutput)(void *pOut, const void *pData, int nData)" +.Fa "void *pOut " +.Fc +.Ft int +.Fo sqlite3changegroup_add_strm +.Fa "sqlite3_changegroup*" +.Fa "int (*xInput)(void *pIn, void *pData, int *pnData)" +.Fa "void *pIn " +.Fc +.Ft int +.Fo sqlite3changegroup_output_strm +.Fa "sqlite3_changegroup*" +.Fa "int (*xOutput)(void *pOut, const void *pData, int nData)" +.Fa "void *pOut " +.Fc +.Sh DESCRIPTION +The six streaming API xxx_strm() functions serve similar purposes to +the corresponding non-streaming API functions: +.Pp +<table border=1 style="margin-left:8ex;margin-right:8ex"> <tr><th>Streaming +function<th>Non-streaming equivalent</th> <tr><td>sqlite3changeset_apply_str<td>sqlite3changeset_apply +<tr><td>sqlite3changeset_concat_str<td>sqlite3changeset_concat +<tr><td>sqlite3changeset_invert_str<td>sqlite3changeset_invert +<tr><td>sqlite3changeset_start_str<td>sqlite3changeset_start +<tr><td>sqlite3session_changeset_str<td>sqlite3session_changeset +<tr><td>sqlite3session_patchset_str<td>sqlite3session_patchset +</table> +.Pp +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 low-memory environment is required +to handle very large changesets, the large contiguous memory allocations +required can become onerous. +.Pp +In order to avoid this problem, instead of a single large buffer, input +is passed to a streaming API functions by way of a callback function +that the sessions module invokes to incrementally request input data +as it is required. +In all cases, a pair of API function parameters such as +.Bd -literal + int nChangeset, void *pChangeset, +.Ed +.Pp +Is replaced by: +.Bd -literal + int (*xInput)(void *pIn, void *pData, int *pnData), void +*pIn, +.Ed +.Pp +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 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. +.Pp +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 immediately +fail with the same error code as returned by xInput. +.Pp +Similarly, streaming API functions that return changesets (or patchsets) +return them in chunks by way of a callback function instead of via +a pointer to a single large buffer. +In this case, a pair of parameters such as: +.Bd -literal + int *pnChangeset, void **ppChangeset, +.Ed +.Pp +Is replaced by: +.Bd -literal + int (*xOutput)(void *pOut, const void *pData, int nData), +void *pOut +.Ed +.Pp +The xOutput callback is invoked zero or more times to return data to +the application. +The first parameter passed to each call is a copy of the pOut pointer +supplied by the application. +The second parameter, pData, points to a buffer nData bytes in size +containing the chunk of output data being returned. +If the xOutput callback successfully processes the supplied data, it +should return SQLITE_OK to indicate success. +Otherwise, it should return some other SQLite error code. +In this case processing is immediately abandoned and the streaming +API function returns a copy of the xOutput error code to the application. +.Pp +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. +.Sh SEE ALSO +.Xr sqlite3changeset_apply 3 , +.Xr sqlite3changeset_concat 3 , +.Xr sqlite3changeset_invert 3 , +.Xr sqlite3changeset_start 3 , +.Xr sqlite3session_changeset 3 , +.Xr sqlite3session_patchset 3 Index: src/external/public-domain/sqlite/man/sqlite3changeset_concat.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_concat.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_concat.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,33 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_CONCAT 3 +.Os +.Sh NAME +.Nm sqlite3changeset_concat +.Nd Concatenate Two Changeset Objects +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_concat +.Fa "int nA" +.Fa "void *pA" +.Fa "int nB" +.Fa "void *pB" +.Fa "int *pnOut" +.Fa "void **ppOut " +.Fc +.Sh DESCRIPTION +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. +.Pp +This function combines the two input changesets using an sqlite3_changegroup +object. +Calling it produces similar results as the following code fragment: +.Pp +sqlite3_changegroup *pGrp; rc = sqlite3_changegroup_new(&pGrp); if( +rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA); if( rc==SQLITE_OK +) rc = sqlite3changegroup_add(pGrp, nB, pB); if( rc==SQLITE_OK ){ rc += sqlite3changegroup_output(pGrp, pnOut, ppOut); }else{ *ppOut = 0; +*pnOut = 0; } +.Pp +Refer to the sqlite3_changegroup documentation below for details. Index: src/external/public-domain/sqlite/man/sqlite3changeset_conflict.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_conflict.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_conflict.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,37 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_CONFLICT 3 +.Os +.Sh NAME +.Nm sqlite3changeset_conflict +.Nd Obtain Conflicting Row Values From A Changeset Iterator +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_conflict +.Fa "sqlite3_changeset_iter *pIter" +.Fa "int iVal" +.Fa "sqlite3_value **ppValue " +.Fc +.Sh DESCRIPTION +This function should only be used with iterator objects passed to a +conflict-handler callback by sqlite3changeset_apply() +with either SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. +If this function is called on any other iterator, SQLITE_MISUSE +is returned and *ppValue is set to NULL. +.Pp +Argument iVal must be greater than or equal to 0, and less than the +number of columns in the table affected by the current change. +Otherwise, SQLITE_RANGE is returned and *ppValue is set +to NULL. +.Pp +If successful, this function sets *ppValue to point to a protected +sqlite3_value object containing the iVal'th value from the "conflicting +row" associated with the current conflict-handler callback and returns +SQLITE_OK. +.Pp +If some other error occurs (e.g. +an OOM condition), an SQLite error code is returned and *ppValue is +set to NULL. +.Sh SEE ALSO +.Xr sqlite3changeset_apply 3 , +.Xr SQLITE_CHANGESET_DATA 3 , +.Xr SQLITE_OK 3 Index: src/external/public-domain/sqlite/man/sqlite3changeset_finalize.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_finalize.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_finalize.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,39 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_FINALIZE 3 +.Os +.Sh NAME +.Nm sqlite3changeset_finalize +.Nd Finalize A Changeset Iterator +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_finalize +.Fa "sqlite3_changeset_iter *pIter" +.Fc +.Sh DESCRIPTION +This function is used to finalize an iterator allocated with sqlite3changeset_start(). +.Pp +This function should only be called on iterators created using the +sqlite3changeset_start() function. +If an application calls this function with an iterator passed to a +conflict-handler by sqlite3changeset_apply(), +SQLITE_MISUSE is immediately returned and the call has +no effect. +.Pp +If an error was encountered within a call to an sqlite3changeset_xxx() +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): +.Pp +sqlite3changeset_start(); while( SQLITE_ROW==sqlite3changeset_next() +){ // Do something with change. +} rc = sqlite3changeset_finalize(); if( rc!=SQLITE_OK ){ // An error +has occurred } +.Sh SEE ALSO +.Xr sqlite3changeset_apply 3 , +.Xr sqlite3changeset_new 3 , +.Xr sqlite3changeset_next 3 , +.Xr sqlite3changeset_start 3 , +.Xr SQLITE_OK 3 Index: src/external/public-domain/sqlite/man/sqlite3changeset_fk_conflicts.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_fk_conflicts.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_fk_conflicts.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,19 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_FK_CONFLICTS 3 +.Os +.Sh NAME +.Nm sqlite3changeset_fk_conflicts +.Nd Determine The Number Of Foreign Key Constraint Violations +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_fk_conflicts +.Fa "sqlite3_changeset_iter *pIter" +.Fa "int *pnOut " +.Fc +.Sh DESCRIPTION +This function may only be called with an iterator passed to an SQLITE_CHANGESET_FOREIGN_KEY +conflict handler callback. +In this case it sets the output variable to the total number of known +foreign key violations in the destination database and returns SQLITE_OK. +.Pp +In all other cases this function returns SQLITE_MISUSE. Index: src/external/public-domain/sqlite/man/sqlite3changeset_invert.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_invert.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_invert.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,45 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_INVERT 3 +.Os +.Sh NAME +.Nm sqlite3changeset_invert +.Nd Invert A Changeset +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_invert +.Fa "int nIn" +.Fa "const void *pIn" +.Fa "int *pnOut" +.Fa "void **ppOut " +.Fc +.Sh DESCRIPTION +This function is used to "invert" a changeset object. +Applying an inverted changeset to a database reverses the effects of +applying the uninverted changeset. +Specifically: +.Bl -bullet +.It +Each DELETE change is changed to an INSERT, and +.It +Each INSERT change is changed to a DELETE, and +.It +For each UPDATE change, the old.* and new.* values are exchanged. +.El +.Pp +This function does not change the order in which changes appear within +the changeset. +It merely reverses the sense of each individual change. +.Pp +If successful, a pointer to a buffer containing the inverted changeset +is stored in *ppOut, the size of the same buffer is stored in *pnOut, +and SQLITE_OK is returned. +If an error occurs, both *pnOut and *ppOut are zeroed and an SQLite +error code returned. +.Pp +It is the responsibility of the caller to eventually call sqlite3_free() +on the *ppOut pointer to free the buffer allocation following a successful +call to this function. +.Pp +WARNING/TODO: This function currently assumes that the input is a valid +changeset. +If it is not, the results are undefined. Index: src/external/public-domain/sqlite/man/sqlite3changeset_new.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_new.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_new.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,48 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_NEW 3 +.Os +.Sh NAME +.Nm sqlite3changeset_new +.Nd Obtain new.* Values From A Changeset Iterator +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_new +.Fa "sqlite3_changeset_iter *pIter" +.Fa "int iVal" +.Fa "sqlite3_value **ppValue " +.Fc +.Sh DESCRIPTION +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. +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. +.Pp +Argument iVal must be greater than or equal to 0, and less than the +number of columns in the table affected by the current change. +Otherwise, SQLITE_RANGE is returned and *ppValue is set +to NULL. +.Pp +If successful, this function sets *ppValue to point to a protected +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 triggers. +.Pp +If some other error occurs (e.g. +an OOM condition), an SQLite error code is returned and *ppValue is +set to NULL. +.Sh SEE ALSO +.Xr sqlite3changeset_apply 3 , +.Xr sqlite3changeset_next 3 , +.Xr sqlite3changeset_start 3 , +.Xr SQLITE_CREATE_INDEX 3 , +.Xr SQLITE_OK 3 , +.Xr SQLITE_CREATE_INDEX 3 Index: src/external/public-domain/sqlite/man/sqlite3changeset_next.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_next.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_next.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,34 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_NEXT 3 +.Os +.Sh NAME +.Nm sqlite3changeset_next +.Nd Advance A Changeset Iterator +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_next +.Fa "sqlite3_changeset_iter *pIter" +.Fc +.Sh DESCRIPTION +This function may only be used with iterators created by function sqlite3changeset_start(). +If it is called on an iterator passed to a conflict-handler callback +by sqlite3changeset_apply(), SQLITE_MISUSE +is returned and the call has no effect. +.Pp +Immediately after an iterator is created by sqlite3changeset_start(), +it does not point to any change in the changeset. +Assuming the changeset is not empty, the first call to this function +advances the iterator to 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. +Otherwise, if all changes in the changeset have already been visited, +SQLITE_DONE is returned. +.Pp +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. +.Sh SEE ALSO +.Xr sqlite3changeset_apply 3 , +.Xr sqlite3changeset_start 3 Index: src/external/public-domain/sqlite/man/sqlite3changeset_old.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_old.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_old.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,46 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_OLD 3 +.Os +.Sh NAME +.Nm sqlite3changeset_old +.Nd Obtain old.* Values From A Changeset Iterator +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_old +.Fa "sqlite3_changeset_iter *pIter" +.Fa "int iVal" +.Fa "sqlite3_value **ppValue " +.Fc +.Sh DESCRIPTION +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. +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. +.Pp +Argument iVal must be greater than or equal to 0, and less than the +number of columns in the table affected by the current change. +Otherwise, SQLITE_RANGE is returned and *ppValue is set +to NULL. +.Pp +If successful, this function sets *ppValue to point to a protected +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 is similar to +the "old.*" columns available to update or delete triggers. +.Pp +If some other error occurs (e.g. +an OOM condition), an SQLite error code is returned and *ppValue is +set to NULL. +.Sh SEE ALSO +.Xr sqlite3changeset_apply 3 , +.Xr sqlite3changeset_next 3 , +.Xr sqlite3changeset_start 3 , +.Xr SQLITE_CREATE_INDEX 3 , +.Xr SQLITE_OK 3 , +.Xr SQLITE_CREATE_INDEX 3 Index: src/external/public-domain/sqlite/man/sqlite3changeset_op.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_op.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_op.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,49 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_OP 3 +.Os +.Sh NAME +.Nm sqlite3changeset_op +.Nd Obtain The Current Operation From A Changeset Iterator +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_op +.Fa "sqlite3_changeset_iter *pIter" +.Fa "const char **pzTab" +.Fa "int *pnCol" +.Fa "int *pOp" +.Fa "int *pbIndirect " +.Fc +.Sh DESCRIPTION +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. +If this is not the case, this function returns SQLITE_MISUSE. +.Pp +If argument pzTab is not NULL, then *pzTab is set to point to a nul-terminated +utf-8 encoded string containing the name of the table affected by the +current change. +The buffer remains valid until either sqlite3changeset_next() is called +on the iterator or until the conflict-handler function returns. +If pnCol is not NULL, then *pnCol is set to the number of columns in +the table affected by the change. +If pbIncorrect is not NULL, then *pbIndirect is set to true (1) if +the change is an indirect change, or false (0) otherwise. +See the documentation for sqlite3session_indirect() +for a description of direct and indirect changes. +Finally, if pOp is not NULL, then *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. +.Pp +If no error occurs, SQLITE_OK is returned. +If an error does occur, an SQLite error code is returned. +The values of the output variables may not be trusted in this case. +.Sh SEE ALSO +.Xr sqlite3changeset_apply 3 , +.Xr sqlite3changeset_next 3 , +.Xr sqlite3changeset_start 3 , +.Xr sqlite3session_indirect 3 , +.Xr SQLITE_CREATE_INDEX 3 , +.Xr SQLITE_OK 3 , +.Xr SQLITE_CREATE_INDEX 3 Index: src/external/public-domain/sqlite/man/sqlite3changeset_pk.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_pk.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_pk.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,37 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_PK 3 +.Os +.Sh NAME +.Nm sqlite3changeset_pk +.Nd Obtain The Primary Key Definition Of A Table +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_pk +.Fa "sqlite3_changeset_iter *pIter" +.Fa "unsigned char **pabPK" +.Fa "int *pnCol " +.Fc +.Sh DESCRIPTION +For each modified table, a changeset includes the following: +.Bl -bullet +.It +The number of columns in the table, and +.It +Which of those columns make up the tables PRIMARY KEY. +.El +.Pp +This function is used to find which columns comprise the PRIMARY KEY +of the table modified by the change that iterator pIter currently points +to. +If successful, *pabPK is set to point to an array of nCol entries, +where nCol is the number of columns in the table. +Elements of *pabPK are set to 0x01 if the corresponding column is part +of the tables primary key, or 0x00 if it is not. +.Pp +If argumet pnCol is not NULL, then *pnCol is set to the number of columns +in the table. +.Pp +If this function is called when the iterator does not point to a valid +entry, SQLITE_MISUSE is returned and the output variables zeroed. +Otherwise, SQLITE_OK is returned and the output variables populated +as described above. Index: src/external/public-domain/sqlite/man/sqlite3changeset_start.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3changeset_start.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3changeset_start.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,57 @@ +.Dd $Mdocdate$ +.Dt SQLITE3CHANGESET_START 3 +.Os +.Sh NAME +.Nm sqlite3changeset_start +.Nd Create An Iterator To Traverse A Changeset +.Sh SYNOPSIS +.Ft int +.Fo sqlite3changeset_start +.Fa "sqlite3_changeset_iter **pp" +.Fa "int nChangeset" +.Fa "void *pChangeset " +.Fc +.Sh DESCRIPTION +Create an iterator used to iterate through the contents of a changeset. +If successful, *pp is set to point to the iterator handle and SQLITE_OK +is returned. +Otherwise, if an error occurs, *pp is set to zero and an SQLite error +code is returned. +.Pp +The following functions can be used to advance and query a changeset +iterator created by this function: +.Bl -bullet +.It +sqlite3changeset_next() +.It +sqlite3changeset_op() +.It +sqlite3changeset_new() +.It +sqlite3changeset_old() +.El +.Pp +It is the responsibility of the caller to eventually destroy the iterator +by passing it to sqlite3changeset_finalize(). +The buffer containing the changeset (pChangeset) must remain valid +until after the iterator is destroyed. +.Pp +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 visted 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. +.Sh SEE ALSO +.Xr sqlite3changeset_concat 3 , +.Xr sqlite3changeset_finalize 3 , +.Xr sqlite3changeset_invert 3 , +.Xr sqlite3changeset_new 3 , +.Xr sqlite3changeset_next 3 , +.Xr sqlite3changeset_old 3 , +.Xr sqlite3changeset_op 3 , +.Xr sqlite3session_changeset 3 Index: src/external/public-domain/sqlite/man/sqlite3session_attach.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3session_attach.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3session_attach.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,45 @@ +.Dd $Mdocdate$ +.Dt SQLITE3SESSION_ATTACH 3 +.Os +.Sh NAME +.Nm sqlite3session_attach +.Nd Attach A Table To A Session Object +.Sh SYNOPSIS +.Ft int +.Fo sqlite3session_attach +.Fa "sqlite3_session *pSession" +.Fa "const char *zTab " +.Fc +.Sh DESCRIPTION +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 documentation for sqlite3session_changeset() +for further details. +.Pp +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 the new tables +are also recorded. +.Pp +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 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. +.Pp +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. +.Pp +Changes are not recorded for individual rows that have NULL values +stored in one or more of their PRIMARY KEY columns. +.Pp +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. +.Sh SEE ALSO +.Xr sqlite3session_changeset 3 Index: src/external/public-domain/sqlite/man/sqlite3session_changeset.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3session_changeset.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3session_changeset.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,132 @@ +.Dd $Mdocdate$ +.Dt SQLITE3SESSION_CHANGESET 3 +.Os +.Sh NAME +.Nm sqlite3session_changeset +.Nd Generate A Changeset From A Session Object +.Sh SYNOPSIS +.Ft int +.Fo sqlite3session_changeset +.Fa "sqlite3_session *pSession" +.Fa "int *pnChangeset" +.Fa "void **ppChangeset " +.Fc +.Sh DESCRIPTION +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. +.Pp +A changeset consists of zero or more INSERT, UPDATE and/or DELETE changes, +each representing a change to a single row of an attached table. +An INSERT change contains the values of each field of a new database +row. +A DELETE contains the original values of each field of a deleted database +row. +An UPDATE change contains the original values of each field of an updated +database row along with the updated values for each updated non-primary-key +column. +It is not possible for an UPDATE change to represent a change that +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. +.Pp +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 PRIMARY KEY +columns is updated so that all PRIMARY KEY columns are non-NULL, only +an INSERT is appears in the changeset. +Similarly, if an existing row with non-NULL PRIMARY KEY values is updated +so that one or more of its PRIMARY KEY columns are set to NULL, the +resulting changeset contains a DELETE change only. +.Pp +The contents of a changeset may be traversed using an iterator created +using the sqlite3changeset_start() API. +A changeset may be applied to a database with a compatible schema using +the sqlite3changeset_apply() API. +.Pp +Within a changeset generated by this function, all changes related +to a single table are grouped together. +In other words, when iterating through a changeset or when applying +a changeset to a database, all changes related to a single table are +processed before moving on to the next table. +Tables are sorted in the same order in which they were attached (or +auto-attached) to the sqlite3_session object. +The order in which the changes related to a single table are stored +is undefined. +.Pp +Following a successful call to this function, it is the responsibility +of the caller to eventually free the buffer that *ppChangeset points +to using sqlite3_free(). +.Ss Changeset Generation +Once a table has been attached to a session object, the session object +records the primary key values of all new rows inserted into the table. +It also records the original primary key and other column values of +any deleted or updated rows. +For each unique primary key value, data is only recorded once - the +first time a row with said primary key is inserted, updated or deleted +in the lifetime of the session. +.Pp +There is one exception to the previous paragraph: when a row is inserted, +updated or deleted, if one or more of its primary key columns contain +a NULL value, no record of the change is made. +.Pp +The session object therefore accumulates two types of records - those +that consist of primary key values only (created when the user inserts +a new record) and those that consist of the primary key values and +the original values of other table columns (created when the users +deletes or updates a record). +.Pp +When this function is called, the requested changeset is created using +both the accumulated records and the current contents of the database +file. +Specifically: +.Bl -bullet +.It +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 is added to the changeset. +.It +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 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. +.El +.Pp +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 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. +.Pp +When a session object is disabled (see the sqlite3session_enable() +API), 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 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 +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. +.Sh SEE ALSO +.Xr sqlite3_malloc 3 , +.Xr sqlite3changeset_apply 3 , +.Xr sqlite3changeset_start 3 , +.Xr sqlite3session_enable 3 Index: src/external/public-domain/sqlite/man/sqlite3session_create.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3session_create.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3session_create.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,47 @@ +.Dd $Mdocdate$ +.Dt SQLITE3SESSION_CREATE 3 +.Os +.Sh NAME +.Nm sqlite3session_create +.Nd Create A New Session Object +.Sh SYNOPSIS +.Ft int +.Fo sqlite3session_create +.Fa "sqlite3 *db" +.Fa "const char *zDb" +.Fa "sqlite3_session **ppSession " +.Fc +.Sh DESCRIPTION +Create a new session object attached to database handle db. +If successful, a pointer to the new object is written to *ppSession +and SQLITE_OK is returned. +If an error occurs, *ppSession is set to NULL and an SQLite error code +(e.g. +SQLITE_NOMEM) is returned. +.Pp +It is possible to create multiple session objects attached to a single +database handle. +.Pp +Session objects created using this function should be deleted using +the sqlite3session_delete() function before +the database handle that they are attached to is itself closed. +If the database handle is closed before the session object is deleted, +then the results of calling any session module function, including +sqlite3session_delete() on the session object +are undefined. +.Pp +Because the session module uses the sqlite3_preupdate_hook() +API, it 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 either of these things are undefined. +.Pp +The session object will be used to create changesets for tables in +database zDb, where zDb is either "main", or "temp", or the name of +an attached database. +It is not an error if database zDb is not attached to the database +when the session object is created. +.Sh SEE ALSO +.Xr sqlite3_preupdate_hook 3 , +.Xr sqlite3session_delete 3 Index: src/external/public-domain/sqlite/man/sqlite3session_delete.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3session_delete.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3session_delete.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,22 @@ +.Dd $Mdocdate$ +.Dt SQLITE3SESSION_DELETE 3 +.Os +.Sh NAME +.Nm sqlite3session_delete +.Nd Delete A Session Object +.Sh SYNOPSIS +.Ft void +.Fo sqlite3session_delete +.Fa "sqlite3_session *pSession" +.Fc +.Sh DESCRIPTION +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. +.Pp +Session objects must be deleted before the database handle to which +they are attached is closed. +Refer to the documentation for sqlite3session_create() +for details. +.Sh SEE ALSO +.Xr sqlite3session_create 3 Index: src/external/public-domain/sqlite/man/sqlite3session_diff.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3session_diff.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3session_diff.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,73 @@ +.Dd $Mdocdate$ +.Dt SQLITE3SESSION_DIFF 3 +.Os +.Sh NAME +.Nm sqlite3session_diff +.Nd Load The Difference Between Tables Into A Session +.Sh SYNOPSIS +.Ft int +.Fo sqlite3session_diff +.Fa "sqlite3_session *pSession" +.Fa "const char *zFromDb" +.Fa "const char *zTbl" +.Fa "char **pzErrMsg " +.Fc +.Sh DESCRIPTION +If it is not already attached to the session object passed as the first +argument, this function attaches table zTbl in the same manner as the +sqlite3session_attach() function. +If zTbl does not exist, or if it does not have a primary key, this +function is a no-op (but does not return an error). +.Pp +Argument zFromDb must be the name of a database ("main", "temp" etc.) +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: +.Bl -bullet +.It +Has the same name, +.It +Has the same set of columns declared in the same order, and +.It +Has the same PRIMARY KEY definition. +.El +.Pp +If the tables are not compatible, SQLITE_SCHEMA is returned. +If the tables are compatible but do not have any PRIMARY KEY columns, +it is not an error but no changes are added to the session object. +As with other session APIs, tables without PRIMARY KEYs are simply +ignored. +.Pp +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 +object (call this the "to-table"). +Specifically: +.Bl -bullet +.It +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. +.It +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. +.It +For each row (primary key) that exists in both tables, but features +different in each, an UPDATE record is added to the session. +.El +.Pp +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 identical. +.Pp +It an error if database zFrom does not exist or does not contain the +required compatible table. +.Pp +If the operation 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 message. +It is the responsibility of the caller to free this buffer using sqlite3_free(). +.Sh SEE ALSO +.Xr sqlite3session_attach 3 , +.Xr sqlite3session_changeset 3 Index: src/external/public-domain/sqlite/man/sqlite3session_enable.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3session_enable.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3session_enable.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,30 @@ +.Dd $Mdocdate$ +.Dt SQLITE3SESSION_ENABLE 3 +.Os +.Sh NAME +.Nm sqlite3session_enable +.Nd Enable Or Disable A Session Object +.Sh SYNOPSIS +.Ft int +.Fo sqlite3session_enable +.Fa "sqlite3_session *pSession" +.Fa "int bEnable" +.Fc +.Sh DESCRIPTION +Enable or disable the recording of changes by a session object. +When enabled, a session object records changes made to the database. +When disabled - it does not. +A newly created session object is enabled. +Refer to the documentation for sqlite3session_changeset() +for further details regarding how enabling and disabling a session +object affects the eventual changesets. +.Pp +Passing zero to this function disables the session. +Passing a value 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. +.Pp +The return value indicates the final state of the session object: 0 +if the session is disabled, or 1 if it is enabled. +.Sh SEE ALSO +.Xr sqlite3session_changeset 3 Index: src/external/public-domain/sqlite/man/sqlite3session_indirect.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3session_indirect.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3session_indirect.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,40 @@ +.Dd $Mdocdate$ +.Dt SQLITE3SESSION_INDIRECT 3 +.Os +.Sh NAME +.Nm sqlite3session_indirect +.Nd Set Or Clear the Indirect Change Flag +.Sh SYNOPSIS +.Ft int +.Fo sqlite3session_indirect +.Fa "sqlite3_session *pSession" +.Fa "int bIndirect" +.Fc +.Sh DESCRIPTION +Each change recorded by a session object is marked as either direct +or indirect. +A change is marked as indirect if either: +.Bl -bullet +.It +The session object "indirect" flag is set when the change is made, +or +.It +The change is made by an SQL trigger or foreign key action instead +of directly as a result of a users SQL statement. +.El +.Pp +If a single row is affected by more than one operation within a session, +then the change is considered indirect if all operations meet the criteria +for an indirect change above, or direct otherwise. +.Pp +This function is used to set, clear or query the session object indirect +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 +indirect flag for the specified session object. +.Pp +The return value indicates the final state of the indirect flag: 0 +if it is clear, or 1 if it is set. Index: src/external/public-domain/sqlite/man/sqlite3session_isempty.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3session_isempty.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3session_isempty.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,26 @@ +.Dd $Mdocdate$ +.Dt SQLITE3SESSION_ISEMPTY 3 +.Os +.Sh NAME +.Nm sqlite3session_isempty +.Nd Test if a changeset has recorded any changes. +.Sh SYNOPSIS +.Ft int +.Fo sqlite3session_isempty +.Fa "sqlite3_session *pSession" +.Fc +.Sh DESCRIPTION +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. +.Pp +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 are restored. +However, if this function returns non-zero, then it is guaranteed that +a call to sqlite3session_changeset() will return a changeset containing +zero changes. +.Sh SEE ALSO +.Xr sqlite3session_changeset 3 Index: src/external/public-domain/sqlite/man/sqlite3session_patchset.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3session_patchset.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3session_patchset.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,39 @@ +.Dd $Mdocdate$ +.Dt SQLITE3SESSION_PATCHSET 3 +.Os +.Sh NAME +.Nm sqlite3session_patchset +.Nd Generate A Patchset From A Session Object +.Sh SYNOPSIS +.Ft int +.Fo sqlite3session_patchset +.Fa "sqlite3_session *pSession" +.Fa "int *pnPatchset" +.Fa "void **ppPatchset " +.Fc +.Sh DESCRIPTION +The differences between a patchset and a changeset are that: +.Bl -bullet +.It +DELETE records consist of the primary key fields only. +The original values of other fields are omitted. +.It +The original values of any modified fields are omitted from UPDATE +records. +.El +.Pp +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. +.Pp +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. +.Pp +Changes within a patchset are ordered in the same way as for changesets +generated by the sqlite3session_changeset() function (i.e. +all changes for a single table are grouped together, tables appear +in the order in which they were attached to the session object). Index: src/external/public-domain/sqlite/man/sqlite3session_table_filter.3 diff -u /dev/null src/external/public-domain/sqlite/man/sqlite3session_table_filter.3:1.1 --- /dev/null Sun Jul 3 17:07:39 2016 +++ src/external/public-domain/sqlite/man/sqlite3session_table_filter.3 Sun Jul 3 17:07:38 2016 @@ -0,0 +1,20 @@ +.Dd $Mdocdate$ +.Dt SQLITE3SESSION_TABLE_FILTER 3 +.Os +.Sh NAME +.Nm sqlite3session_table_filter +.Nd Set a table filter on a Session Object. +.Sh SYNOPSIS +.Ft void +.Fo sqlite3session_table_filter +.Fa "sqlite3_session *pSession" +.Fa "int(*xFilter)( void *pCtx, const char *zTab )" +.Fa "void *pCtx " +.Fc +.Sh DESCRIPTION +The second argument (xFilter) is the "filter callback". +For changes to rows in tables that are not attached to the Session +oject, the filter is called to determine whether changes to the table's +rows should be tracked or not. +If xFilter returns 0, changes is not tracked. +Note that once a table is attached, xFilter will not be called again.