external/public-domain/sqlite - Import SQLite 3.17.0

Syncs with NetBSD-8
This commit is contained in:
Sevan Janiyan 2018-11-18 02:11:42 +00:00
parent ca0ddd72d0
commit 16ab5af568
224 changed files with 100712 additions and 24892 deletions

View File

@ -1,5 +1,5 @@
# $NetBSD: Makefile,v 1.1 2011/10/13 21:40:27 joerg Exp $
# $NetBSD: Makefile,v 1.2 2016/03/30 21:31:44 christos Exp $
SUBDIR+= lib .WAIT bin
SUBDIR+= lib .WAIT bin man
.include <bsd.subdir.mk>

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.5 2012/06/01 20:28:02 wiz Exp $
# $NetBSD: Makefile.inc,v 1.7 2016/10/13 18:11:19 martin Exp $
WARNS= 2
@ -14,12 +14,14 @@ CPPFLAGS+= \
-DHAVE_STDINT_H=1 \
-DHAVE_STRERROR_R=1 \
-DHAVE_USLEEP=1 \
-DHAVE_SYS_ENDIAN_H=1 \
-DSQLITE_ENABLE_COLUMN_METADATA \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_ENABLE_LOAD_EXTENSION \
-DSQLITE_ENABLE_UNLOCK_NOTIFY \
-DSQLITE_HAVE_ISNAN
-DSQLITE_HAVE_ISNAN \
-DSQLITE_MAX_WORKER_THREADS=0
.if defined(__MINIX)
CPPFLAGS+= \
@ -27,4 +29,5 @@ CPPFLAGS+= \
-DSQLITE_OMIT_WAL
.endif # defined(__MINIX)
CWARNFLAGS+= -Wno-shadow -Wno-unused

2
external/public-domain/sqlite/README vendored Normal file
View File

@ -0,0 +1,2 @@
# $NetBSD: README,v 1.1 2016/03/30 21:31:44 christos Exp $
To regenerate the man pages, build and run sqlite2mdoc < /usr/include/sqlite3.h

View File

@ -1,4 +1,4 @@
.\" $NetBSD: sqlite3.1,v 1.5 2012/12/21 19:26:39 njoly Exp $
.\" $NetBSD: sqlite3.1,v 1.1 2017/03/11 16:29:51 christos Exp $
.Dd December 16, 2012
.Dt SQLITE3 1
.Os

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -15,12 +15,10 @@
** as extensions by SQLite should #include this file instead of
** sqlite3.h.
*/
#ifndef _SQLITE3EXT_H_
#define _SQLITE3EXT_H_
#ifndef SQLITE3EXT_H
#define SQLITE3EXT_H
#include "sqlite3.h"
typedef struct sqlite3_api_routines sqlite3_api_routines;
/*
** The following structure holds pointers to all of the SQLite API
** routines.
@ -28,7 +26,7 @@ typedef struct sqlite3_api_routines sqlite3_api_routines;
** WARNING: In order to maintain backwards compatibility, add new
** interfaces to the end of this structure only. If you insert new
** interfaces in the middle of this structure, then older different
** versions of SQLite will not be able to load each others' shared
** versions of SQLite will not be able to load each other's shared
** libraries!
*/
struct sqlite3_api_routines {
@ -250,11 +248,55 @@ struct sqlite3_api_routines {
const char *(*uri_parameter)(const char*,const char*);
char *(*vsnprintf)(int,char*,const char*,va_list);
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
/* Version 3.8.7 and later */
int (*auto_extension)(void(*)(void));
int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
void(*)(void*));
int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
void(*)(void*),unsigned char);
int (*cancel_auto_extension)(void(*)(void));
int (*load_extension)(sqlite3*,const char*,const char*,char**);
void *(*malloc64)(sqlite3_uint64);
sqlite3_uint64 (*msize)(void*);
void *(*realloc64)(void*,sqlite3_uint64);
void (*reset_auto_extension)(void);
void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
void(*)(void*));
void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
void(*)(void*), unsigned char);
int (*strglob)(const char*,const char*);
/* Version 3.8.11 and later */
sqlite3_value *(*value_dup)(const sqlite3_value*);
void (*value_free)(sqlite3_value*);
int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64);
int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64);
/* Version 3.9.0 and later */
unsigned int (*value_subtype)(sqlite3_value*);
void (*result_subtype)(sqlite3_context*,unsigned int);
/* Version 3.10.0 and later */
int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int);
int (*strlike)(const char*,const char*,unsigned int);
int (*db_cacheflush)(sqlite3*);
/* Version 3.12.0 and later */
int (*system_errno)(sqlite3*);
/* Version 3.14.0 and later */
int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
char *(*expanded_sql)(sqlite3_stmt*);
};
/*
** This is the function signature used for all extension entry points. It
** is also defined in the file "loadext.c".
*/
typedef int (*sqlite3_loadext_entry)(
sqlite3 *db, /* Handle to the database. */
char **pzErrMsg, /* Used to set error string on failure. */
const sqlite3_api_routines *pThunk /* Extension API function pointers. */
);
/*
** The following macros redefine the API routines so that they are
** redirected throught the global sqlite3_api structure.
** redirected through the global sqlite3_api structure.
**
** This header file is also used by the loadext.c source file
** (part of the main SQLite library - not an extension) so that
@ -263,7 +305,7 @@ struct sqlite3_api_routines {
** the API. So the redefinition macros are only valid if the
** SQLITE_CORE macros is undefined.
*/
#ifndef SQLITE_CORE
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
#define sqlite3_aggregate_context sqlite3_api->aggregate_context
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_aggregate_count sqlite3_api->aggregate_count
@ -390,6 +432,7 @@ struct sqlite3_api_routines {
#define sqlite3_value_text16le sqlite3_api->value_text16le
#define sqlite3_value_type sqlite3_api->value_type
#define sqlite3_vmprintf sqlite3_api->vmprintf
#define sqlite3_vsnprintf sqlite3_api->vsnprintf
#define sqlite3_overload_function sqlite3_api->overload_function
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
@ -467,9 +510,39 @@ struct sqlite3_api_routines {
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
#define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
#endif /* SQLITE_CORE */
/* Version 3.8.7 and later */
#define sqlite3_auto_extension sqlite3_api->auto_extension
#define sqlite3_bind_blob64 sqlite3_api->bind_blob64
#define sqlite3_bind_text64 sqlite3_api->bind_text64
#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension
#define sqlite3_load_extension sqlite3_api->load_extension
#define sqlite3_malloc64 sqlite3_api->malloc64
#define sqlite3_msize sqlite3_api->msize
#define sqlite3_realloc64 sqlite3_api->realloc64
#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension
#define sqlite3_result_blob64 sqlite3_api->result_blob64
#define sqlite3_result_text64 sqlite3_api->result_text64
#define sqlite3_strglob sqlite3_api->strglob
/* Version 3.8.11 and later */
#define sqlite3_value_dup sqlite3_api->value_dup
#define sqlite3_value_free sqlite3_api->value_free
#define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64
#define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64
/* Version 3.9.0 and later */
#define sqlite3_value_subtype sqlite3_api->value_subtype
#define sqlite3_result_subtype sqlite3_api->result_subtype
/* Version 3.10.0 and later */
#define sqlite3_status64 sqlite3_api->status64
#define sqlite3_strlike sqlite3_api->strlike
#define sqlite3_db_cacheflush sqlite3_api->db_cacheflush
/* Version 3.12.0 and later */
#define sqlite3_system_errno sqlite3_api->system_errno
/* Version 3.14.0 and later */
#define sqlite3_trace_v2 sqlite3_api->trace_v2
#define sqlite3_expanded_sql sqlite3_api->expanded_sql
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#ifndef SQLITE_CORE
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
/* This case when the file really is being compiled as a loadable
** extension */
# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0;
@ -484,4 +557,4 @@ struct sqlite3_api_routines {
# define SQLITE_EXTENSION_INIT3 /*no-op*/
#endif
#endif /* _SQLITE3EXT_H_ */
#endif /* SQLITE3EXT_H */

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.6 2014/03/07 18:37:48 christos Exp $
# $NetBSD: Makefile,v 1.8 2016/10/04 14:25:02 christos Exp $
LIB= sqlite3
INCS= sqlite3.h sqlite3ext.h
@ -16,15 +16,18 @@ FILESDIR_sqlite3.pc= /usr/lib/pkgconfig
CLEANFILES+=sqlite3.pc
.include <bsd.lib.mk>
.include <bsd.own.mk>
.if defined(__MINIX)
.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \
!empty(DBG:M-g) || !empty(CFLAGS:M-g)
#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og
CWARNFLAGS.gcc+= -Wno-maybe-uninitialized
.if ${MACHINE_CPU} == "m68k"
CWARNFLAGS+= -Wa,--warn
.endif
.endif # defined(__MINIX)
.if ${MACHINE_ARCH} == "powerpc64"
# call to `' lacks nop, can't restore toc; recompile with -fPIC
COPTS.sqlite3.c += -O0
.endif
.include <bsd.lib.mk>
all: sqlite3.pc
dependall: all

View File

@ -1,4 +1,4 @@
# $NetBSD: shlib_version,v 1.3 2014/02/16 18:16:35 christos Exp $
# $NetBSD: shlib_version,v 1.4 2017/03/11 16:29:52 christos Exp $
#
major=1
minor=2
minor=3

View File

@ -0,0 +1,215 @@
# $NetBSD: Makefile,v 1.3 2017/03/11 16:29:52 christos 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 \
SQLITE_DBCONFIG_LOOKASIDE.3 \
SQLITE_DBCONFIG_MAINDBNAME.3 \
SQLITE_DBSTATUS_LOOKASIDE_USED.3 \
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 \
SQLITE_LIMIT_LENGTH.3 \
SQLITE_LOCK_NONE.3 \
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 \
SQLITE_STMTSTATUS_FULLSCAN_STEP.3 \
SQLITE_SYNC_NORMAL.3 \
SQLITE_TESTCTRL_FIRST.3 \
SQLITE_TRACE_STMT.3 \
SQLITE_UTF8.3 \
SQLITE_VERSION.3 \
SQLITE_VTAB_CONSTRAINT_SUPPORT.3 \
sqlite3.3 \
sqlite3_aggregate_context.3 \
sqlite3_aggregate_count.3 \
sqlite3_api_routines.3 \
sqlite3_auto_extension.3 \
sqlite3_backup.3 \
sqlite3_backup_init.3 \
sqlite3_bind_blob.3 \
sqlite3_bind_parameter_count.3 \
sqlite3_bind_parameter_index.3 \
sqlite3_bind_parameter_name.3 \
sqlite3_blob.3 \
sqlite3_blob_bytes.3 \
sqlite3_blob_close.3 \
sqlite3_blob_open.3 \
sqlite3_blob_read.3 \
sqlite3_blob_reopen.3 \
sqlite3_blob_write.3 \
sqlite3_busy_handler.3 \
sqlite3_busy_timeout.3 \
sqlite3_cancel_auto_extension.3 \
sqlite3_changegroup.3 \
sqlite3_changes.3 \
sqlite3_changeset_iter.3 \
sqlite3_clear_bindings.3 \
sqlite3_close.3 \
sqlite3_collation_needed.3 \
sqlite3_column_blob.3 \
sqlite3_column_count.3 \
sqlite3_column_database_name.3 \
sqlite3_column_decltype.3 \
sqlite3_column_name.3 \
sqlite3_commit_hook.3 \
sqlite3_compileoption_used.3 \
sqlite3_complete.3 \
sqlite3_config.3 \
sqlite3_context.3 \
sqlite3_context_db_handle.3 \
sqlite3_create_collation.3 \
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 \
sqlite3_db_mutex.3 \
sqlite3_db_readonly.3 \
sqlite3_db_release_memory.3 \
sqlite3_db_status.3 \
sqlite3_declare_vtab.3 \
sqlite3_destructor_type.3 \
sqlite3_enable_load_extension.3 \
sqlite3_enable_shared_cache.3 \
sqlite3_errcode.3 \
sqlite3_exec.3 \
sqlite3_extended_result_codes.3 \
sqlite3_file.3 \
sqlite3_file_control.3 \
sqlite3_finalize.3 \
sqlite3_get_autocommit.3 \
sqlite3_get_auxdata.3 \
sqlite3_get_table.3 \
sqlite3_index_info.3 \
sqlite3_initialize.3 \
sqlite3_interrupt.3 \
sqlite3_io_methods.3 \
sqlite3_last_insert_rowid.3 \
sqlite3_limit.3 \
sqlite3_load_extension.3 \
sqlite3_log.3 \
sqlite3_malloc.3 \
sqlite3_mem_methods.3 \
sqlite3_memory_used.3 \
sqlite3_module.3 \
sqlite3_mprintf.3 \
sqlite3_mutex.3 \
sqlite3_mutex_alloc.3 \
sqlite3_mutex_held.3 \
sqlite3_mutex_methods.3 \
sqlite3_next_stmt.3 \
sqlite3_open.3 \
sqlite3_overload_function.3 \
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_snapshot_recover.3 \
sqlite3_soft_heap_limit.3 \
sqlite3_soft_heap_limit64.3 \
sqlite3_sql.3 \
sqlite3_status.3 \
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 \
sqlite3_threadsafe.3 \
sqlite3_total_changes.3 \
sqlite3_trace.3 \
sqlite3_trace_v2.3 \
sqlite3_unlock_notify.3 \
sqlite3_update_hook.3 \
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 \
sqlite3_vtab.3 \
sqlite3_vtab_config.3 \
sqlite3_vtab_cursor.3 \
sqlite3_vtab_on_conflict.3 \
sqlite3_wal_autocheckpoint.3 \
sqlite3_wal_checkpoint.3 \
sqlite3_wal_checkpoint_v2.3 \
sqlite3_wal_hook.3 \
sqlite3changegroup_add.3 \
sqlite3changegroup_delete.3 \
sqlite3changegroup_new.3 \
sqlite3changegroup_output.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>

View File

@ -0,0 +1,31 @@
.Dd March 11, 2017
.Dt SQLITE_ACCESS_EXISTS 3
.Os
.Sh NAME
.Nm SQLITE_ACCESS_EXISTS ,
.Nm SQLITE_ACCESS_READWRITE ,
.Nm SQLITE_ACCESS_READ
.Nd Flags for the xAccess VFS method
.Sh SYNOPSIS
.Fd #define SQLITE_ACCESS_EXISTS
.Fd #define SQLITE_ACCESS_READWRITE
.Fd #define SQLITE_ACCESS_READ
.Sh DESCRIPTION
These integer constants can be used as the third parameter to the xAccess
method of an sqlite3_vfs object.
They determine what kind of permissions the xAccess method is looking
for.
With SQLITE_ACCESS_EXISTS, the xAccess method simply checks whether
the file exists.
With SQLITE_ACCESS_READWRITE, the xAccess method checks whether the
named directory is both readable and writable (in other words, if files
can be added, removed, and renamed within the directory).
The SQLITE_ACCESS_READWRITE constant is currently used only by the
temp_store_directory pragma, though this
could change in a future release of SQLite.
With SQLITE_ACCESS_READ, the xAccess method checks whether the file
is readable.
The SQLITE_ACCESS_READ constant is currently unused, though it might
be used in a future release of SQLite.
.Sh SEE ALSO
.Xr sqlite3_vfs 3

View File

@ -0,0 +1,59 @@
.Dd March 11, 2017
.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

View File

@ -0,0 +1,39 @@
.Dd March 11, 2017
.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

View File

@ -0,0 +1,22 @@
.Dd March 11, 2017
.Dt SQLITE_CHECKPOINT_PASSIVE 3
.Os
.Sh NAME
.Nm SQLITE_CHECKPOINT_PASSIVE ,
.Nm SQLITE_CHECKPOINT_FULL ,
.Nm SQLITE_CHECKPOINT_RESTART ,
.Nm SQLITE_CHECKPOINT_TRUNCATE
.Nd Checkpoint Mode Values
.Sh SYNOPSIS
.Fd #define SQLITE_CHECKPOINT_PASSIVE
.Fd #define SQLITE_CHECKPOINT_FULL
.Fd #define SQLITE_CHECKPOINT_RESTART
.Fd #define SQLITE_CHECKPOINT_TRUNCATE
.Sh DESCRIPTION
These constants define all valid values for the "checkpoint mode" passed
as the third parameter to the sqlite3_wal_checkpoint_v2()
interface.
See the sqlite3_wal_checkpoint_v2() documentation
for details on the meaning of each of these checkpoint modes.
.Sh SEE ALSO
.Xr sqlite3_wal_checkpoint_v2 3

View File

@ -0,0 +1,397 @@
.Dd March 11, 2017
.Dt SQLITE_CONFIG_SINGLETHREAD 3
.Os
.Sh NAME
.Nm SQLITE_CONFIG_SINGLETHREAD ,
.Nm SQLITE_CONFIG_MULTITHREAD ,
.Nm SQLITE_CONFIG_SERIALIZED ,
.Nm SQLITE_CONFIG_MALLOC ,
.Nm SQLITE_CONFIG_GETMALLOC ,
.Nm SQLITE_CONFIG_SCRATCH ,
.Nm SQLITE_CONFIG_PAGECACHE ,
.Nm SQLITE_CONFIG_HEAP ,
.Nm SQLITE_CONFIG_MEMSTATUS ,
.Nm SQLITE_CONFIG_MUTEX ,
.Nm SQLITE_CONFIG_GETMUTEX ,
.Nm SQLITE_CONFIG_LOOKASIDE ,
.Nm SQLITE_CONFIG_PCACHE ,
.Nm SQLITE_CONFIG_GETPCACHE ,
.Nm SQLITE_CONFIG_LOG ,
.Nm SQLITE_CONFIG_URI ,
.Nm SQLITE_CONFIG_PCACHE2 ,
.Nm SQLITE_CONFIG_GETPCACHE2 ,
.Nm SQLITE_CONFIG_COVERING_INDEX_SCAN ,
.Nm SQLITE_CONFIG_SQLLOG ,
.Nm SQLITE_CONFIG_MMAP_SIZE ,
.Nm SQLITE_CONFIG_WIN32_HEAPSIZE ,
.Nm SQLITE_CONFIG_PCACHE_HDRSZ ,
.Nm SQLITE_CONFIG_PMASZ ,
.Nm SQLITE_CONFIG_STMTJRNL_SPILL
.Nd Configuration Options
.Sh SYNOPSIS
.Fd #define SQLITE_CONFIG_SINGLETHREAD
.Fd #define SQLITE_CONFIG_MULTITHREAD
.Fd #define SQLITE_CONFIG_SERIALIZED
.Fd #define SQLITE_CONFIG_MALLOC
.Fd #define SQLITE_CONFIG_GETMALLOC
.Fd #define SQLITE_CONFIG_SCRATCH
.Fd #define SQLITE_CONFIG_PAGECACHE
.Fd #define SQLITE_CONFIG_HEAP
.Fd #define SQLITE_CONFIG_MEMSTATUS
.Fd #define SQLITE_CONFIG_MUTEX
.Fd #define SQLITE_CONFIG_GETMUTEX
.Fd #define SQLITE_CONFIG_LOOKASIDE
.Fd #define SQLITE_CONFIG_PCACHE
.Fd #define SQLITE_CONFIG_GETPCACHE
.Fd #define SQLITE_CONFIG_LOG
.Fd #define SQLITE_CONFIG_URI
.Fd #define SQLITE_CONFIG_PCACHE2
.Fd #define SQLITE_CONFIG_GETPCACHE2
.Fd #define SQLITE_CONFIG_COVERING_INDEX_SCAN
.Fd #define SQLITE_CONFIG_SQLLOG
.Fd #define SQLITE_CONFIG_MMAP_SIZE
.Fd #define SQLITE_CONFIG_WIN32_HEAPSIZE
.Fd #define SQLITE_CONFIG_PCACHE_HDRSZ
.Fd #define SQLITE_CONFIG_PMASZ
.Fd #define SQLITE_CONFIG_STMTJRNL_SPILL
.Sh DESCRIPTION
These constants are the available integer configuration options that
can be passed as the first argument to the sqlite3_config()
interface.
.Pp
New configuration options may be added in future releases of SQLite.
Existing configuration options might be discontinued.
Applications should check the return code from sqlite3_config()
to make sure that the call worked.
The sqlite3_config() interface will return a non-zero
error code if a discontinued or unsupported configuration
option is invoked.
.Bl -tag -width Ds
.It SQLITE_CONFIG_SINGLETHREAD
There are no arguments to this option.
This option sets the threading mode to Single-thread.
In other words, it disables all mutexing and puts SQLite into a mode
where it can only be used by a single thread.
If SQLite is compiled with the SQLITE_THREADSAFE=0
compile-time option then it is not possible to change the threading mode
from its default value of Single-thread and so sqlite3_config()
will return SQLITE_ERROR if called with the SQLITE_CONFIG_SINGLETHREAD
configuration option.
.It SQLITE_CONFIG_MULTITHREAD
There are no arguments to this option.
This option sets the threading mode to Multi-thread.
In other words, it disables mutexing on database connection
and prepared statement objects.
The application is responsible for serializing access to database connections
and prepared statements.
But other mutexes are enabled so that SQLite will be safe to use in
a multi-threaded environment as long as no two threads attempt to use
the same database connection at the same time.
If SQLite is compiled with the SQLITE_THREADSAFE=0
compile-time option then it is not possible to set the Multi-thread
threading mode and sqlite3_config() will
return SQLITE_ERROR if called with the SQLITE_CONFIG_MULTITHREAD
configuration option.
.It SQLITE_CONFIG_SERIALIZED
There are no arguments to this option.
This option sets the threading mode to Serialized.
In other words, this option enables all mutexes including the recursive
mutexes on database connection and prepared statement
objects.
In this mode (which is the default when SQLite is compiled with SQLITE_THREADSAFE=1)
the SQLite library will itself serialize access to database connections
and prepared statements so that the application
is free to use the same database connection or the
same prepared statement in different threads at the
same time.
If SQLite is compiled with the SQLITE_THREADSAFE=0
compile-time option then it is not possible to set the Serialized threading mode
and sqlite3_config() will return SQLITE_ERROR
if called with the SQLITE_CONFIG_SERIALIZED configuration option.
.It SQLITE_CONFIG_MALLOC
The SQLITE_CONFIG_MALLOC option takes a single argument which is a
pointer to an instance of the sqlite3_mem_methods
structure.
The argument specifies alternative low-level memory allocation routines
to be used in place of the memory allocation routines built into SQLite.
SQLite makes its own private copy of the content of the sqlite3_mem_methods
structure before the sqlite3_config() call returns.
.It SQLITE_CONFIG_GETMALLOC
The SQLITE_CONFIG_GETMALLOC option takes a single argument which is
a pointer to an instance of the sqlite3_mem_methods
structure.
The sqlite3_mem_methods structure is filled with
the currently defined memory allocation routines.
This option can be used to overload the default memory allocation routines
with a wrapper that simulations memory allocation failure or tracks
memory usage, for example.
.It SQLITE_CONFIG_MEMSTATUS
The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
interpreted as a boolean, which enables or disables the collection
of memory allocation statistics.
When memory allocation statistics are disabled, the following SQLite
interfaces become non-operational:
.Bl -bullet
.It
sqlite3_memory_used()
.It
sqlite3_memory_highwater()
.It
sqlite3_soft_heap_limit64()
.It
sqlite3_status64()
.El
.Pp
Memory allocation statistics are enabled by default unless SQLite is
compiled with SQLITE_DEFAULT_MEMSTATUS=0 in
which case memory allocation statistics are disabled by default.
.It SQLITE_CONFIG_SCRATCH
The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer that
SQLite can use for scratch memory.
There are three arguments to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
aligned memory buffer from which the scratch allocations will be drawn,
the size of each scratch allocation (sz), and the maximum number of
scratch allocations (N).
The first argument must be a pointer to an 8-byte aligned buffer of
at least sz*N bytes of memory.
SQLite will not use more than one scratch buffers per thread.
SQLite will never request a scratch buffer that is more than 6 times
the database page size.
If SQLite needs needs additional scratch memory beyond what is provided
by this configuration option, then sqlite3_malloc()
will be used to obtain the memory needed.<p> When the application
provides any amount of scratch memory using SQLITE_CONFIG_SCRATCH,
SQLite avoids unnecessary large heap allocations.
This can help prevent memory allocation failures
due to heap fragmentation in low-memory embedded systems.
.It SQLITE_CONFIG_PAGECACHE
The SQLITE_CONFIG_PAGECACHE option specifies a memory pool that SQLite
can use for the database page cache with the default page cache implementation.
This configuration option is a no-op if an application-define page
cache implementation is loaded using the SQLITE_CONFIG_PCACHE2.
There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
8-byte aligned memory (pMem), the size of each page cache line (sz),
and the number of cache lines (N).
The sz argument should be the size of the largest database page (a
power of two between 512 and 65536) plus some extra bytes for each
page header.
The number of extra bytes needed by the page header can be determined
using SQLITE_CONFIG_PCACHE_HDRSZ.
It is harmless, apart from the wasted memory, for the sz parameter
to be larger than necessary.
The pMem argument must be either a NULL pointer or a pointer to an
8-byte aligned block of memory of at least sz*N bytes, otherwise subsequent
behavior is undefined.
When pMem is not NULL, SQLite will strive to use the memory provided
to satisfy page cache needs, falling back to sqlite3_malloc()
if a page cache line is larger than sz bytes or if all of the pMem
buffer is exhausted.
If pMem is NULL and N is non-zero, then each database connection does
an initial bulk allocation for page cache memory from sqlite3_malloc()
sufficient for N cache lines if N is positive or of -1024*N bytes if
N is negative, .
If additional page cache memory is needed beyond what is provided by
the initial allocation, then SQLite goes to sqlite3_malloc()
separately for each additional cache line.
.It SQLITE_CONFIG_HEAP
The SQLITE_CONFIG_HEAP option specifies a static memory buffer that
SQLite will use for all of its dynamic memory allocation needs beyond
those provided for by SQLITE_CONFIG_SCRATCH and
SQLITE_CONFIG_PAGECACHE.
The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
with either SQLITE_ENABLE_MEMSYS3 or SQLITE_ENABLE_MEMSYS5
and returns SQLITE_ERROR if invoked otherwise.
There are three arguments to SQLITE_CONFIG_HEAP: An 8-byte aligned
pointer to the memory, the number of bytes in the memory buffer, and
the minimum allocation size.
If the first pointer (the memory pointer) is NULL, then SQLite reverts
to using its default memory allocator (the system malloc() implementation),
undoing any prior invocation of SQLITE_CONFIG_MALLOC.
If the memory pointer is not NULL then the alternative memory allocator
is engaged to handle all of SQLites memory allocation needs.
The first pointer (the memory pointer) must be aligned to an 8-byte
boundary or subsequent behavior of SQLite will be undefined.
The minimum allocation size is capped at 2**12.
Reasonable values for the minimum allocation size are 2**5 through
2**8.
.It SQLITE_CONFIG_MUTEX
The SQLITE_CONFIG_MUTEX option takes a single argument which is a pointer
to an instance of the sqlite3_mutex_methods structure.
The argument specifies alternative low-level mutex routines to be used
in place the mutex routines built into SQLite.
SQLite makes a copy of the content of the sqlite3_mutex_methods
structure before the call to sqlite3_config() returns.
If SQLite is compiled with the SQLITE_THREADSAFE=0
compile-time option then the entire mutexing subsystem is omitted from
the build and hence calls to sqlite3_config() with
the SQLITE_CONFIG_MUTEX configuration option will return SQLITE_ERROR.
.It SQLITE_CONFIG_GETMUTEX
The SQLITE_CONFIG_GETMUTEX option takes a single argument which is
a pointer to an instance of the sqlite3_mutex_methods
structure.
The sqlite3_mutex_methods structure is filled
with the currently defined mutex routines.
This option can be used to overload the default mutex allocation routines
with a wrapper used to track mutex usage for performance profiling
or testing, for example.
If SQLite is compiled with the SQLITE_THREADSAFE=0
compile-time option then the entire mutexing subsystem is omitted from
the build and hence calls to sqlite3_config() with
the SQLITE_CONFIG_GETMUTEX configuration option will return SQLITE_ERROR.
.It SQLITE_CONFIG_LOOKASIDE
The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
the default size of lookaside memory on each database connection.
The first argument is the size of each lookaside buffer slot and the
second is the number of slots allocated to each database connection.
SQLITE_CONFIG_LOOKASIDE sets the <i>default</i> lookaside size.
The SQLITE_DBCONFIG_LOOKASIDE option to sqlite3_db_config()
can be used to change the lookaside configuration on individual connections.
.It SQLITE_CONFIG_PCACHE2
The SQLITE_CONFIG_PCACHE2 option takes a single argument which is a
pointer to an sqlite3_pcache_methods2 object.
This object specifies the interface to a custom page cache implementation.
SQLite makes a copy of the sqlite3_pcache_methods2
object.
.It SQLITE_CONFIG_GETPCACHE2
The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which is
a pointer to an sqlite3_pcache_methods2 object.
SQLite copies of the current page cache implementation into that object.
.It SQLITE_CONFIG_LOG
The SQLITE_CONFIG_LOG option is used to configure the SQLite global
error log.
( The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
function with a call signature of void(*)(void*,int,const char*), and
a pointer to void.
If the function pointer is not NULL, it is invoked by sqlite3_log()
to process each logging event.
If the function pointer is NULL, the sqlite3_log() interface
becomes a no-op.
The void pointer that is the second argument to SQLITE_CONFIG_LOG is
passed through as the first parameter to the application-defined logger
function whenever that function is invoked.
The second parameter to the logger function is a copy of the first
parameter to the corresponding sqlite3_log() call and
is intended to be a result code or an extended result code.
The third parameter passed to the logger is log message after formatting
via sqlite3_snprintf().
The SQLite logging interface is not reentrant; the logger function
supplied by the application must not invoke any SQLite interface.
In a multi-threaded application, the application-defined logger function
must be threadsafe.
.It SQLITE_CONFIG_URI The SQLITE_CONFIG_URI option takes a single argument
of type int.
If non-zero, then URI handling is globally enabled.
If the parameter is zero, then URI handling is globally disabled.
If URI handling is globally enabled, all filenames passed to sqlite3_open(),
sqlite3_open_v2(), sqlite3_open16()
or specified as part of ATTACH commands are interpreted as URIs,
regardless of whether or not the SQLITE_OPEN_URI flag
is set when the database connection is opened.
If it is globally disabled, filenames are only interpreted as URIs
if the SQLITE_OPEN_URI flag is set when the database connection is
opened.
By default, URI handling is globally disabled.
The default value may be changed by compiling with the SQLITE_USE_URI
symbol defined.
.It SQLITE_CONFIG_COVERING_INDEX_SCAN The SQLITE_CONFIG_COVERING_INDEX_SCAN
option takes a single integer argument which is interpreted as a boolean
in order to enable or disable the use of covering indices for full
table scans in the query optimizer.
The default setting is determined by the SQLITE_ALLOW_COVERING_INDEX_SCAN
compile-time option, or is "on" if that compile-time option is omitted.
The ability to disable the use of covering indices for full table scans
is because some incorrectly coded legacy applications might malfunction
when the optimization is enabled.
Providing the ability to disable the optimization allows the older,
buggy application code to work without change even with newer versions
of SQLite.
.It SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE These options are
obsolete and should not be used by new code.
They are retained for backwards compatibility but are now no-ops.
.It SQLITE_CONFIG_SQLLOG This option is only available if sqlite is compiled
with the SQLITE_ENABLE_SQLLOG pre-processor macro
defined.
The first argument should be a pointer to a function of type void(*)(void*,sqlite3*,const
char*, int).
The second should be of type (void*).
The callback is invoked by the library in three separate circumstances,
identified by the value passed as the fourth parameter.
If the fourth parameter is 0, then the database connection passed as
the second argument has just been opened.
The third argument points to a buffer containing the name of the main
database file.
If the fourth parameter is 1, then the SQL statement that the third
parameter points to has just been executed.
Or, if the fourth parameter is 2, then the connection being passed
as the second parameter is being closed.
The third parameter is passed NULL In this case.
An example of using this configuration option can be seen in the "test_sqllog.c"
source file in the canonical SQLite source tree.
.It SQLITE_CONFIG_MMAP_SIZE SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer
(sqlite3_int64) values that are the default mmap size limit (the default
setting for PRAGMA mmap_size) and the maximum allowed
mmap size limit.
The default setting can be overridden by each database connection using
either the PRAGMA mmap_size command, or by using the
SQLITE_FCNTL_MMAP_SIZE file control.
The maximum allowed mmap size will be silently truncated if necessary
so that it does not exceed the compile-time maximum mmap size set by
the SQLITE_MAX_MMAP_SIZE compile-time option.
If either argument to this option is negative, then that argument is
changed to its compile-time default.
.It SQLITE_CONFIG_WIN32_HEAPSIZE The SQLITE_CONFIG_WIN32_HEAPSIZE option
is only available if SQLite is compiled for Windows with the SQLITE_WIN32_MALLOC
pre-processor macro defined.
SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
that specifies the maximum size of the created heap.
.It SQLITE_CONFIG_PCACHE_HDRSZ The SQLITE_CONFIG_PCACHE_HDRSZ option takes
a single parameter which is a pointer to an integer and writes into
that integer the number of extra bytes per page required for each page
in SQLITE_CONFIG_PAGECACHE.
The amount of extra space required can change depending on the compiler,
target platform, and SQLite version.
.It SQLITE_CONFIG_PMASZ The SQLITE_CONFIG_PMASZ option takes a single
parameter which is an unsigned integer and sets the "Minimum PMA Size"
for the multithreaded sorter to that integer.
The default minimum PMA Size is set by the SQLITE_SORTER_PMASZ
compile-time option.
New threads are launched to help with sort operations when multithreaded
sorting is enabled (using the PRAGMA threads command)
and the amount of content to be sorted exceeds the page size times
the minimum of the PRAGMA cache_size setting and this
value.
.It SQLITE_CONFIG_STMTJRNL_SPILL The SQLITE_CONFIG_STMTJRNL_SPILL option
takes a single parameter which becomes the statement journal
spill-to-disk threshold.
Statement journals are held in memory until their
size (in bytes) exceeds this threshold, at which point they are written
to disk.
Or if the threshold is -1, statement journals are always held exclusively
in memory.
Since many statement journals never become large, setting the spill
threshold to a value such as 64KiB can greatly reduce the amount of
I/O required to support statement rollback.
The default value for this setting is controlled by the SQLITE_STMTJRNL_SPILL
compile-time option.
.El
.Pp
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_config 3 ,
.Xr sqlite3_db_config 3 ,
.Xr sqlite3_log 3 ,
.Xr sqlite3_malloc 3 ,
.Xr sqlite3_mem_methods 3 ,
.Xr sqlite3_memory_used 3 ,
.Xr sqlite3_mutex_methods 3 ,
.Xr sqlite3_open 3 ,
.Xr sqlite3_pcache_methods2 3 ,
.Xr sqlite3_mprintf 3 ,
.Xr sqlite3_soft_heap_limit64 3 ,
.Xr sqlite3_status 3 ,
.Xr SQLITE_CONFIG_SINGLETHREAD 3 ,
.Xr SQLITE_DBCONFIG_MAINDBNAME 3 ,
.Xr SQLITE_OK 3 ,
.Xr SQLITE_FCNTL_LOCKSTATE 3 ,
.Xr SQLITE_OPEN_READONLY 3

View File

@ -0,0 +1,94 @@
.Dd March 11, 2017
.Dt SQLITE_CREATE_INDEX 3
.Os
.Sh NAME
.Nm SQLITE_CREATE_INDEX ,
.Nm SQLITE_CREATE_TABLE ,
.Nm SQLITE_CREATE_TEMP_INDEX ,
.Nm SQLITE_CREATE_TEMP_TABLE ,
.Nm SQLITE_CREATE_TEMP_TRIGGER ,
.Nm SQLITE_CREATE_TEMP_VIEW ,
.Nm SQLITE_CREATE_TRIGGER ,
.Nm SQLITE_CREATE_VIEW ,
.Nm SQLITE_DELETE ,
.Nm SQLITE_DROP_INDEX ,
.Nm SQLITE_DROP_TABLE ,
.Nm SQLITE_DROP_TEMP_INDEX ,
.Nm SQLITE_DROP_TEMP_TABLE ,
.Nm SQLITE_DROP_TEMP_TRIGGER ,
.Nm SQLITE_DROP_TEMP_VIEW ,
.Nm SQLITE_DROP_TRIGGER ,
.Nm SQLITE_DROP_VIEW ,
.Nm SQLITE_INSERT ,
.Nm SQLITE_PRAGMA ,
.Nm SQLITE_READ ,
.Nm SQLITE_SELECT ,
.Nm SQLITE_TRANSACTION ,
.Nm SQLITE_UPDATE ,
.Nm SQLITE_ATTACH ,
.Nm SQLITE_DETACH ,
.Nm SQLITE_ALTER_TABLE ,
.Nm SQLITE_REINDEX ,
.Nm SQLITE_ANALYZE ,
.Nm SQLITE_CREATE_VTABLE ,
.Nm SQLITE_DROP_VTABLE ,
.Nm SQLITE_FUNCTION ,
.Nm SQLITE_SAVEPOINT ,
.Nm SQLITE_COPY ,
.Nm SQLITE_RECURSIVE
.Nd Authorizer Action Codes
.Sh SYNOPSIS
.Fd #define SQLITE_CREATE_INDEX
.Fd #define SQLITE_CREATE_TABLE
.Fd #define SQLITE_CREATE_TEMP_INDEX
.Fd #define SQLITE_CREATE_TEMP_TABLE
.Fd #define SQLITE_CREATE_TEMP_TRIGGER
.Fd #define SQLITE_CREATE_TEMP_VIEW
.Fd #define SQLITE_CREATE_TRIGGER
.Fd #define SQLITE_CREATE_VIEW
.Fd #define SQLITE_DELETE
.Fd #define SQLITE_DROP_INDEX
.Fd #define SQLITE_DROP_TABLE
.Fd #define SQLITE_DROP_TEMP_INDEX
.Fd #define SQLITE_DROP_TEMP_TABLE
.Fd #define SQLITE_DROP_TEMP_TRIGGER
.Fd #define SQLITE_DROP_TEMP_VIEW
.Fd #define SQLITE_DROP_TRIGGER
.Fd #define SQLITE_DROP_VIEW
.Fd #define SQLITE_INSERT
.Fd #define SQLITE_PRAGMA
.Fd #define SQLITE_READ
.Fd #define SQLITE_SELECT
.Fd #define SQLITE_TRANSACTION
.Fd #define SQLITE_UPDATE
.Fd #define SQLITE_ATTACH
.Fd #define SQLITE_DETACH
.Fd #define SQLITE_ALTER_TABLE
.Fd #define SQLITE_REINDEX
.Fd #define SQLITE_ANALYZE
.Fd #define SQLITE_CREATE_VTABLE
.Fd #define SQLITE_DROP_VTABLE
.Fd #define SQLITE_FUNCTION
.Fd #define SQLITE_SAVEPOINT
.Fd #define SQLITE_COPY
.Fd #define SQLITE_RECURSIVE
.Sh DESCRIPTION
The sqlite3_set_authorizer() interface registers
a callback function that is invoked to authorize certain SQL statement
actions.
The second parameter to the callback is an integer code that specifies
what action is being authorized.
These are the integer action codes that the authorizer callback may
be passed.
.Pp
These action code values signify what kind of operation is to be authorized.
The 3rd and 4th parameters to the authorization callback function will
be parameters or NULL depending on which of these codes is used as
the second parameter.
The 5th parameter to the authorizer callback is the name of the database
("main", "temp", etc.) if applicable.
The 6th parameter to the authorizer callback is the name of the inner-most
trigger or view that is responsible for the access attempt or NULL
if this access attempt is directly from top-level SQL code.
.Sh SEE ALSO
.Xr sqlite3_set_authorizer 3

View File

@ -0,0 +1,115 @@
.Dd December 18, 2016
.Dt SQLITE_DBCONFIG_LOOKASIDE 3
.Os
.Sh NAME
.Nm SQLITE_DBCONFIG_LOOKASIDE ,
.Nm SQLITE_DBCONFIG_ENABLE_FKEY ,
.Nm SQLITE_DBCONFIG_ENABLE_TRIGGER ,
.Nm SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER ,
.Nm SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
.Nd Database Connection Configuration Options
.Sh SYNOPSIS
.Fd #define SQLITE_DBCONFIG_LOOKASIDE
.Fd #define SQLITE_DBCONFIG_ENABLE_FKEY
.Fd #define SQLITE_DBCONFIG_ENABLE_TRIGGER
.Fd #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
.Fd #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
.Sh DESCRIPTION
These constants are the available integer configuration options that
can be passed as the second argument to the sqlite3_db_config()
interface.
.Pp
New configuration options may be added in future releases of SQLite.
Existing configuration options might be discontinued.
Applications should check the return code from sqlite3_db_config()
to make sure that the call worked.
The sqlite3_db_config() interface will return a
non-zero error code if a discontinued or unsupported configuration
option is invoked.
.Bl -tag -width Ds
.It SQLITE_DBCONFIG_LOOKASIDE
This option takes three additional arguments that determine the lookaside memory allocator
configuration for the database connection.
The first argument (the third parameter to sqlite3_db_config()
is a pointer to a memory buffer to use for lookaside memory.
The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb may be
NULL in which case SQLite will allocate the lookaside buffer itself
using sqlite3_malloc().
The second argument is the size of each lookaside buffer slot.
The third argument is the number of slots.
The size of the buffer in the first argument must be greater than or
equal to the product of the second and third arguments.
The buffer must be aligned to an 8-byte boundary.
If the second argument to SQLITE_DBCONFIG_LOOKASIDE is not a multiple
of 8, it is internally rounded down to the next smaller multiple of
8.
The lookaside memory configuration for a database connection can only
be changed when that connection is not currently using lookaside memory,
or in other words when the "current value" returned by sqlite3_db_status(D,SQLITE_CONFIG_LOOKASIDE,...)
is zero.
Any attempt to change the lookaside memory configuration when lookaside
memory is in use leaves the configuration unchanged and returns SQLITE_BUSY.
.It SQLITE_DBCONFIG_ENABLE_FKEY
This option is used to enable or disable the enforcement of foreign key constraints.
There should be two additional arguments.
The first argument is an integer which is 0 to disable FK enforcement,
positive to enable FK enforcement or negative to leave FK enforcement
unchanged.
The second parameter is a pointer to an integer into which is written
0 or 1 to indicate whether FK enforcement is off or on following this
call.
The second parameter may be a NULL pointer, in which case the FK enforcement
setting is not reported back.
.It SQLITE_DBCONFIG_ENABLE_TRIGGER
This option is used to enable or disable triggers.
There should be two additional arguments.
The first argument is an integer which is 0 to disable triggers, positive
to enable triggers or negative to leave the setting unchanged.
The second parameter is a pointer to an integer into which is written
0 or 1 to indicate whether triggers are disabled or enabled following
this call.
The second parameter may be a NULL pointer, in which case the trigger
setting is not reported back.
.It SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
This option is used to enable or disable the two-argument version of
the fts3_tokenizer() function which is part of the
FTS3 full-text search engine extension.
There should be two additional arguments.
The first argument is an integer which is 0 to disable fts3_tokenizer()
or positive to enable fts3_tokenizer() or negative to leave the setting
unchanged.
The second parameter is a pointer to an integer into which is written
0 or 1 to indicate whether fts3_tokenizer is disabled or enabled following
this call.
The second parameter may be a NULL pointer, in which case the new setting
is not reported back.
.It SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
This option is used to enable or disable the sqlite3_load_extension()
interface independently of the load_extension() SQL
function.
The sqlite3_enable_load_extension()
API enables or disables both the C-API sqlite3_load_extension()
and the SQL function load_extension().
There should be two additional arguments.
When the first argument to this interface is 1, then only the C-API
is enabled and the SQL function remains disabled.
If the first argment to this interface is 0, then both the C-API and
the SQL function are disabled.
If the first argument is -1, then no changes are made to state of either
the C-API or the SQL function.
The second parameter is a pointer to an integer into which is written
0 or 1 to indicate whether sqlite3_load_extension()
interface is disabled or enabled following this call.
The second parameter may be a NULL pointer, in which case the new setting
is not reported back.
.El
.Pp
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_db_config 3 ,
.Xr sqlite3_db_status 3 ,
.Xr sqlite3_enable_load_extension 3 ,
.Xr sqlite3_load_extension 3 ,
.Xr sqlite3_malloc 3 ,
.Xr SQLITE_OK 3 ,
.Xr SQLITE_CONFIG_SINGLETHREAD 3

View File

@ -0,0 +1,137 @@
.Dd March 11, 2017
.Dt SQLITE_DBCONFIG_MAINDBNAME 3
.Os
.Sh NAME
.Nm SQLITE_DBCONFIG_MAINDBNAME ,
.Nm SQLITE_DBCONFIG_LOOKASIDE ,
.Nm SQLITE_DBCONFIG_ENABLE_FKEY ,
.Nm SQLITE_DBCONFIG_ENABLE_TRIGGER ,
.Nm SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER ,
.Nm SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION ,
.Nm SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
.Nd Database Connection Configuration Options
.Sh SYNOPSIS
.Fd #define SQLITE_DBCONFIG_MAINDBNAME
.Fd #define SQLITE_DBCONFIG_LOOKASIDE
.Fd #define SQLITE_DBCONFIG_ENABLE_FKEY
.Fd #define SQLITE_DBCONFIG_ENABLE_TRIGGER
.Fd #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
.Fd #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
.Fd #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
.Sh DESCRIPTION
These constants are the available integer configuration options that
can be passed as the second argument to the sqlite3_db_config()
interface.
.Pp
New configuration options may be added in future releases of SQLite.
Existing configuration options might be discontinued.
Applications should check the return code from sqlite3_db_config()
to make sure that the call worked.
The sqlite3_db_config() interface will return a
non-zero error code if a discontinued or unsupported configuration
option is invoked.
.Bl -tag -width Ds
.It SQLITE_DBCONFIG_LOOKASIDE
This option takes three additional arguments that determine the lookaside memory allocator
configuration for the database connection.
The first argument (the third parameter to sqlite3_db_config()
is a pointer to a memory buffer to use for lookaside memory.
The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb may be
NULL in which case SQLite will allocate the lookaside buffer itself
using sqlite3_malloc().
The second argument is the size of each lookaside buffer slot.
The third argument is the number of slots.
The size of the buffer in the first argument must be greater than or
equal to the product of the second and third arguments.
The buffer must be aligned to an 8-byte boundary.
If the second argument to SQLITE_DBCONFIG_LOOKASIDE is not a multiple
of 8, it is internally rounded down to the next smaller multiple of
8.
The lookaside memory configuration for a database connection can only
be changed when that connection is not currently using lookaside memory,
or in other words when the "current value" returned by sqlite3_db_status(D,SQLITE_CONFIG_LOOKASIDE,...)
is zero.
Any attempt to change the lookaside memory configuration when lookaside
memory is in use leaves the configuration unchanged and returns SQLITE_BUSY.
.It SQLITE_DBCONFIG_ENABLE_FKEY
This option is used to enable or disable the enforcement of foreign key constraints.
There should be two additional arguments.
The first argument is an integer which is 0 to disable FK enforcement,
positive to enable FK enforcement or negative to leave FK enforcement
unchanged.
The second parameter is a pointer to an integer into which is written
0 or 1 to indicate whether FK enforcement is off or on following this
call.
The second parameter may be a NULL pointer, in which case the FK enforcement
setting is not reported back.
.It SQLITE_DBCONFIG_ENABLE_TRIGGER
This option is used to enable or disable triggers.
There should be two additional arguments.
The first argument is an integer which is 0 to disable triggers, positive
to enable triggers or negative to leave the setting unchanged.
The second parameter is a pointer to an integer into which is written
0 or 1 to indicate whether triggers are disabled or enabled following
this call.
The second parameter may be a NULL pointer, in which case the trigger
setting is not reported back.
.It SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
This option is used to enable or disable the two-argument version of
the fts3_tokenizer() function which is part of the
FTS3 full-text search engine extension.
There should be two additional arguments.
The first argument is an integer which is 0 to disable fts3_tokenizer()
or positive to enable fts3_tokenizer() or negative to leave the setting
unchanged.
The second parameter is a pointer to an integer into which is written
0 or 1 to indicate whether fts3_tokenizer is disabled or enabled following
this call.
The second parameter may be a NULL pointer, in which case the new setting
is not reported back.
.It SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
This option is used to enable or disable the sqlite3_load_extension()
interface independently of the load_extension() SQL
function.
The sqlite3_enable_load_extension()
API enables or disables both the C-API sqlite3_load_extension()
and the SQL function load_extension().
There should be two additional arguments.
When the first argument to this interface is 1, then only the C-API
is enabled and the SQL function remains disabled.
If the first argument to this interface is 0, then both the C-API and
the SQL function are disabled.
If the first argument is -1, then no changes are made to state of either
the C-API or the SQL function.
The second parameter is a pointer to an integer into which is written
0 or 1 to indicate whether sqlite3_load_extension()
interface is disabled or enabled following this call.
The second parameter may be a NULL pointer, in which case the new setting
is not reported back.
.It SQLITE_DBCONFIG_MAINDBNAME
This option is used to change the name of the "main" database schema.
The sole argument is a pointer to a constant UTF8 string which will
become the new schema name in place of "main".
SQLite does not make a copy of the new main schema name string, so
the application must ensure that the argument passed into this DBCONFIG
option is unchanged until after the database connection closes.
.It SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
Usually, when a database in wal mode is closed or detached from a database
handle, SQLite checks if this will mean that there are now no connections
at all to the database.
If so, it performs a checkpoint operation before closing the connection.
This option may be used to override this behaviour.
The first parameter passed to this operation is an integer - non-zero
to disable checkpoints-on-close, or zero (the default) to enable them.
The second parameter is a pointer to an integer into which is written
0 or 1 to indicate whether checkpoints-on-close have been disabled
- 0 if they are not disabled, 1 if they are.
.El
.Pp
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_db_config 3 ,
.Xr sqlite3_db_status 3 ,
.Xr sqlite3_enable_load_extension 3 ,
.Xr sqlite3_load_extension 3 ,
.Xr sqlite3_malloc 3 ,
.Xr SQLITE_OK 3 ,
.Xr SQLITE_CONFIG_SINGLETHREAD 3

View File

@ -0,0 +1,123 @@
.Dd March 11, 2017
.Dt SQLITE_DBSTATUS_LOOKASIDE_USED 3
.Os
.Sh NAME
.Nm SQLITE_DBSTATUS_LOOKASIDE_USED ,
.Nm SQLITE_DBSTATUS_CACHE_USED ,
.Nm SQLITE_DBSTATUS_SCHEMA_USED ,
.Nm SQLITE_DBSTATUS_STMT_USED ,
.Nm SQLITE_DBSTATUS_LOOKASIDE_HIT ,
.Nm SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE ,
.Nm SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL ,
.Nm SQLITE_DBSTATUS_CACHE_HIT ,
.Nm SQLITE_DBSTATUS_CACHE_MISS ,
.Nm SQLITE_DBSTATUS_CACHE_WRITE ,
.Nm SQLITE_DBSTATUS_DEFERRED_FKS ,
.Nm SQLITE_DBSTATUS_CACHE_USED_SHARED ,
.Nm SQLITE_DBSTATUS_MAX
.Nd Status Parameters for database connections
.Sh SYNOPSIS
.Fd #define SQLITE_DBSTATUS_LOOKASIDE_USED
.Fd #define SQLITE_DBSTATUS_CACHE_USED
.Fd #define SQLITE_DBSTATUS_SCHEMA_USED
.Fd #define SQLITE_DBSTATUS_STMT_USED
.Fd #define SQLITE_DBSTATUS_LOOKASIDE_HIT
.Fd #define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE
.Fd #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL
.Fd #define SQLITE_DBSTATUS_CACHE_HIT
.Fd #define SQLITE_DBSTATUS_CACHE_MISS
.Fd #define SQLITE_DBSTATUS_CACHE_WRITE
.Fd #define SQLITE_DBSTATUS_DEFERRED_FKS
.Fd #define SQLITE_DBSTATUS_CACHE_USED_SHARED
.Fd #define SQLITE_DBSTATUS_MAX
.Sh DESCRIPTION
These constants are the available integer "verbs" that can be passed
as the second argument to the sqlite3_db_status()
interface.
.Pp
New verbs may be added in future releases of SQLite.
Existing verbs might be discontinued.
Applications should check the return code from sqlite3_db_status()
to make sure that the call worked.
The sqlite3_db_status() interface will return a
non-zero error code if a discontinued or unsupported verb is invoked.
.Bl -tag -width Ds
.It SQLITE_DBSTATUS_LOOKASIDE_USED
This parameter returns the number of lookaside memory slots currently
checked out.
.It SQLITE_DBSTATUS_LOOKASIDE_HIT
This parameter returns the number malloc attempts that were satisfied
using lookaside memory.
Only the high-water value is meaningful; the current value is always
zero.
.It SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE
This parameter returns the number malloc attempts that might have been
satisfied using lookaside memory but failed due to the amount of memory
requested being larger than the lookaside slot size.
Only the high-water value is meaningful; the current value is always
zero.
.It SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL
This parameter returns the number malloc attempts that might have been
satisfied using lookaside memory but failed due to all lookaside memory
already being in use.
Only the high-water value is meaningful; the current value is always
zero.
.It SQLITE_DBSTATUS_CACHE_USED
This parameter returns the approximate number of bytes of heap memory
used by all pager caches associated with the database connection.
The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always
0.
.It SQLITE_DBSTATUS_CACHE_USED_SHARED
This parameter is similar to DBSTATUS_CACHE_USED, except that if a
pager cache is shared between two or more connections the bytes of
heap memory used by that pager cache is divided evenly between the
attached connections.
In other words, if none of the pager caches associated with the database
connection are shared, this request returns the same value as DBSTATUS_CACHE_USED.
Or, if one or more or the pager caches are shared, the value returned
by this call will be smaller than that returned by DBSTATUS_CACHE_USED.
The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED_SHARED
is always 0.
.It SQLITE_DBSTATUS_SCHEMA_USED
This parameter returns the approximate number of bytes of heap memory
used to store the schema for all databases associated with the connection
- main, temp, and any ATTACH-ed databases.
The full amount of memory used by the schemas is reported, even if
the schema memory is shared with other database connections due to
shared cache mode being enabled.
The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always
0.
.It SQLITE_DBSTATUS_STMT_USED
This parameter returns the approximate number of bytes of heap and
lookaside memory used by all prepared statements associated with the
database connection.
The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always
0.
.It SQLITE_DBSTATUS_CACHE_HIT
This parameter returns the number of pager cache hits that have occurred.
The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT is always
0.
.It SQLITE_DBSTATUS_CACHE_MISS
This parameter returns the number of pager cache misses that have occurred.
The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS is always
0.
.It SQLITE_DBSTATUS_CACHE_WRITE
This parameter returns the number of dirty cache entries that have
been written to disk.
Specifically, the number of pages written to the wal file in wal mode
databases, or the number of pages written to the database file in rollback
mode databases.
Any pages written as part of transaction rollback or database recovery
operations are not included.
If an IO or other error occurs while writing a page to disk, the effect
on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.
The highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always
0.
.It SQLITE_DBSTATUS_DEFERRED_FKS
This parameter returns zero for the current value if and only if all
foreign key constraints (deferred or immediate) have been resolved.
The highwater mark is always 0.
.El
.Pp
.Sh SEE ALSO
.Xr sqlite3_db_status 3

View File

@ -0,0 +1,25 @@
.Dd March 11, 2017
.Dt SQLITE_DENY 3
.Os
.Sh NAME
.Nm SQLITE_DENY ,
.Nm SQLITE_IGNORE
.Nd Authorizer Return Codes
.Sh SYNOPSIS
.Fd #define SQLITE_DENY
.Fd #define SQLITE_IGNORE
.Sh DESCRIPTION
The authorizer callback function must
return either SQLITE_OK or one of these two constants in order
to signal SQLite whether or not the action is permitted.
See the authorizer documentation for additional
information.
.Pp
Note that SQLITE_IGNORE is also used as a conflict resolution mode
returned from the sqlite3_vtab_on_conflict()
interface.
.Sh SEE ALSO
.Xr SQLITE_ROLLBACK 3 ,
.Xr sqlite3_set_authorizer 3 ,
.Xr sqlite3_vtab_on_conflict 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,15 @@
.Dd March 11, 2017
.Dt SQLITE_DETERMINISTIC 3
.Os
.Sh NAME
.Nm SQLITE_DETERMINISTIC
.Nd Function Flags
.Sh SYNOPSIS
.Fd #define SQLITE_DETERMINISTIC
.Sh DESCRIPTION
These constants may be ORed together with the preferred text encoding
as the fourth argument to sqlite3_create_function(),
sqlite3_create_function16(), or sqlite3_create_function_v2().
.Sh SEE ALSO
.Xr sqlite3_create_function 3 ,
.Xr SQLITE_UTF8 3

View File

@ -0,0 +1,325 @@
.Dd March 11, 2017
.Dt SQLITE_FCNTL_LOCKSTATE 3
.Os
.Sh NAME
.Nm SQLITE_FCNTL_LOCKSTATE ,
.Nm SQLITE_FCNTL_GET_LOCKPROXYFILE ,
.Nm SQLITE_FCNTL_SET_LOCKPROXYFILE ,
.Nm SQLITE_FCNTL_LAST_ERRNO ,
.Nm SQLITE_FCNTL_SIZE_HINT ,
.Nm SQLITE_FCNTL_CHUNK_SIZE ,
.Nm SQLITE_FCNTL_FILE_POINTER ,
.Nm SQLITE_FCNTL_SYNC_OMITTED ,
.Nm SQLITE_FCNTL_WIN32_AV_RETRY ,
.Nm SQLITE_FCNTL_PERSIST_WAL ,
.Nm SQLITE_FCNTL_OVERWRITE ,
.Nm SQLITE_FCNTL_VFSNAME ,
.Nm SQLITE_FCNTL_POWERSAFE_OVERWRITE ,
.Nm SQLITE_FCNTL_PRAGMA ,
.Nm SQLITE_FCNTL_BUSYHANDLER ,
.Nm SQLITE_FCNTL_TEMPFILENAME ,
.Nm SQLITE_FCNTL_MMAP_SIZE ,
.Nm SQLITE_FCNTL_TRACE ,
.Nm SQLITE_FCNTL_HAS_MOVED ,
.Nm SQLITE_FCNTL_SYNC ,
.Nm SQLITE_FCNTL_COMMIT_PHASETWO ,
.Nm SQLITE_FCNTL_WIN32_SET_HANDLE ,
.Nm SQLITE_FCNTL_WAL_BLOCK ,
.Nm SQLITE_FCNTL_ZIPVFS ,
.Nm SQLITE_FCNTL_RBU ,
.Nm SQLITE_FCNTL_VFS_POINTER ,
.Nm SQLITE_FCNTL_JOURNAL_POINTER ,
.Nm SQLITE_FCNTL_WIN32_GET_HANDLE ,
.Nm SQLITE_FCNTL_PDB
.Nd Standard File Control Opcodes
.Sh SYNOPSIS
.Fd #define SQLITE_FCNTL_LOCKSTATE
.Fd #define SQLITE_FCNTL_GET_LOCKPROXYFILE
.Fd #define SQLITE_FCNTL_SET_LOCKPROXYFILE
.Fd #define SQLITE_FCNTL_LAST_ERRNO
.Fd #define SQLITE_FCNTL_SIZE_HINT
.Fd #define SQLITE_FCNTL_CHUNK_SIZE
.Fd #define SQLITE_FCNTL_FILE_POINTER
.Fd #define SQLITE_FCNTL_SYNC_OMITTED
.Fd #define SQLITE_FCNTL_WIN32_AV_RETRY
.Fd #define SQLITE_FCNTL_PERSIST_WAL
.Fd #define SQLITE_FCNTL_OVERWRITE
.Fd #define SQLITE_FCNTL_VFSNAME
.Fd #define SQLITE_FCNTL_POWERSAFE_OVERWRITE
.Fd #define SQLITE_FCNTL_PRAGMA
.Fd #define SQLITE_FCNTL_BUSYHANDLER
.Fd #define SQLITE_FCNTL_TEMPFILENAME
.Fd #define SQLITE_FCNTL_MMAP_SIZE
.Fd #define SQLITE_FCNTL_TRACE
.Fd #define SQLITE_FCNTL_HAS_MOVED
.Fd #define SQLITE_FCNTL_SYNC
.Fd #define SQLITE_FCNTL_COMMIT_PHASETWO
.Fd #define SQLITE_FCNTL_WIN32_SET_HANDLE
.Fd #define SQLITE_FCNTL_WAL_BLOCK
.Fd #define SQLITE_FCNTL_ZIPVFS
.Fd #define SQLITE_FCNTL_RBU
.Fd #define SQLITE_FCNTL_VFS_POINTER
.Fd #define SQLITE_FCNTL_JOURNAL_POINTER
.Fd #define SQLITE_FCNTL_WIN32_GET_HANDLE
.Fd #define SQLITE_FCNTL_PDB
.Sh DESCRIPTION
These integer constants are opcodes for the xFileControl method of
the sqlite3_io_methods object and for the sqlite3_file_control()
interface.
.Bl -bullet
.It
The SQLITE_FCNTL_LOCKSTATE opcode is used for
debugging.
This opcode causes the xFileControl method to write the current state
of the lock (one of SQLITE_LOCK_NONE, SQLITE_LOCK_SHARED,
SQLITE_LOCK_RESERVED, SQLITE_LOCK_PENDING,
or SQLITE_LOCK_EXCLUSIVE) into an integer that
the pArg argument points to.
This capability is used during testing and is only available when the
SQLITE_TEST compile-time option is used.
.It
The SQLITE_FCNTL_SIZE_HINT opcode is used by
SQLite to give the VFS layer a hint of how large the database file
will grow to be during the current transaction.
This hint is not guaranteed to be accurate but it is often close.
The underlying VFS might choose to preallocate database file space
based on this hint in order to help writes to the database file run
faster.
.It
The SQLITE_FCNTL_CHUNK_SIZE opcode is used to
request that the VFS extends and truncates the database file in chunks
of a size specified by the user.
The fourth argument to sqlite3_file_control()
should point to an integer (type int) containing the new chunk-size
to use for the nominated database.
Allocating database file space in large chunks (say 1MB at a time),
may reduce file-system fragmentation and improve performance on some
systems.
.It
The SQLITE_FCNTL_FILE_POINTER opcode is used
to obtain a pointer to the sqlite3_file object associated
with a particular database connection.
See also SQLITE_FCNTL_JOURNAL_POINTER.
.It
The SQLITE_FCNTL_JOURNAL_POINTER opcode
is used to obtain a pointer to the sqlite3_file object
associated with the journal file (either the rollback journal
or the write-ahead log) for a particular database connection.
See also SQLITE_FCNTL_FILE_POINTER.
.It
No longer in use.
.It
The SQLITE_FCNTL_SYNC opcode is generated internally
by SQLite and sent to the VFS immediately before the xSync method is
invoked on a database file descriptor.
Or, if the xSync method is not invoked because the user has configured
SQLite with PRAGMA synchronous=OFF it is invoked
in place of the xSync method.
In most cases, the pointer argument passed with this file-control is
NULL.
However, if the database file is being synced as part of a multi-database
commit, the argument points to a nul-terminated string containing the
transactions master-journal file name.
VFSes that do not need this signal should silently ignore this opcode.
Applications should not call sqlite3_file_control()
with this opcode as doing so may disrupt the operation of the specialized
VFSes that do require it.
.It
The SQLITE_FCNTL_COMMIT_PHASETWO opcode
is generated internally by SQLite and sent to the VFS after a transaction
has been committed immediately but before the database is unlocked.
VFSes that do not need this signal should silently ignore this opcode.
Applications should not call sqlite3_file_control()
with this opcode as doing so may disrupt the operation of the specialized
VFSes that do require it.
.It
The SQLITE_FCNTL_WIN32_AV_RETRY opcode is
used to configure automatic retry counts and intervals for certain
disk I/O operations for the windows VFS in order to provide robustness
in the presence of anti-virus programs.
By default, the windows VFS will retry file read, file write, and file
delete operations up to 10 times, with a delay of 25 milliseconds before
the first retry and with the delay increasing by an additional 25 milliseconds
with each subsequent retry.
This opcode allows these two values (10 retries and 25 milliseconds
of delay) to be adjusted.
The values are changed for all database connections within the same
process.
The argument is a pointer to an array of two integers where the first
integer i the new retry count and the second integer is the delay.
If either integer is negative, then the setting is not changed but
instead the prior value of that setting is written into the array entry,
allowing the current retry settings to be interrogated.
The zDbName parameter is ignored.
.It
The SQLITE_FCNTL_PERSIST_WAL opcode is used
to set or query the persistent Write Ahead Log setting.
By default, the auxiliary write ahead log and shared memory files used
for transaction control are automatically deleted when the latest connection
to the database closes.
Setting persistent WAL mode causes those files to persist after close.
Persisting the files is useful when other processes that do not have
write permission on the directory containing the database file want
to read the database file, as the WAL and shared memory files must
exist in order for the database to be readable.
The fourth parameter to sqlite3_file_control()
for this opcode should be a pointer to an integer.
That integer is 0 to disable persistent WAL mode or 1 to enable persistent
WAL mode.
If the integer is -1, then it is overwritten with the current WAL persistence
setting.
.It
The SQLITE_FCNTL_POWERSAFE_OVERWRITE
opcode is used to set or query the persistent "powersafe-overwrite"
or "PSOW" setting.
The PSOW setting determines the SQLITE_IOCAP_POWERSAFE_OVERWRITE
bit of the xDeviceCharacteristics methods.
The fourth parameter to sqlite3_file_control()
for this opcode should be a pointer to an integer.
That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
mode.
If the integer is -1, then it is overwritten with the current zero-damage
mode setting.
.It
The SQLITE_FCNTL_OVERWRITE opcode is invoked
by SQLite after opening a write transaction to indicate that, unless
it is rolled back for some reason, the entire database file will be
overwritten by the current transaction.
This is used by VACUUM operations.
.It
The SQLITE_FCNTL_VFSNAME opcode can be used to
obtain the names of all VFSes in the VFS stack.
The names are of all VFS shims and the final bottom-level VFS are written
into memory obtained from sqlite3_malloc() and the
result is stored in the char* variable that the fourth parameter of
sqlite3_file_control() points to.
The caller is responsible for freeing the memory when done.
As with all file-control actions, there is no guarantee that this will
actually do anything.
Callers should initialize the char* variable to a NULL pointer in case
this file-control is not implemented.
This file-control is intended for diagnostic use only.
.It
The SQLITE_FCNTL_VFS_POINTER opcode finds a
pointer to the top-level VFSes currently in use.
The argument X in sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X)
must be of type "sqlite3_vfs **".
This opcodes will set *X to a pointer to the top-level VFS.
When there are multiple VFS shims in the stack, this opcode finds the
upper-most shim only.
.It
Whenever a PRAGMA statement is parsed, an SQLITE_FCNTL_PRAGMA
file control is sent to the open sqlite3_file object corresponding
to the database file to which the pragma statement refers.
The argument to the SQLITE_FCNTL_PRAGMA file control
is an array of pointers to strings (char**) in which the second element
of the array is the name of the pragma and the third element is the
argument to the pragma or NULL if the pragma has no argument.
The handler for an SQLITE_FCNTL_PRAGMA file control
can optionally make the first element of the char** argument point
to a string obtained from sqlite3_mprintf() or the
equivalent and that string will become the result of the pragma or
the error message if the pragma fails.
If the SQLITE_FCNTL_PRAGMA file control returns
SQLITE_NOTFOUND, then normal PRAGMA processing
continues.
If the SQLITE_FCNTL_PRAGMA file control returns
SQLITE_OK, then the parser assumes that the VFS has handled
the PRAGMA itself and the parser generates a no-op prepared statement
if result string is NULL, or that returns a copy of the result string
if the string is non-NULL.
If the SQLITE_FCNTL_PRAGMA file control returns
any result code other than SQLITE_OK or SQLITE_NOTFOUND,
that means that the VFS encountered an error while handling the PRAGMA
and the compilation of the PRAGMA fails with an error.
The SQLITE_FCNTL_PRAGMA file control occurs at the
beginning of pragma statement analysis and so it is able to override
built-in PRAGMA statements.
.It
The SQLITE_FCNTL_BUSYHANDLER file-control may
be invoked by SQLite on the database file handle shortly after it is
opened in order to provide a custom VFS with access to the connections
busy-handler callback.
The argument is of type (void **) - an array of two (void *) values.
The first (void *) actually points to a function of type (int (*)(void
*)).
In order to invoke the connections busy-handler, this function should
be invoked with the second (void *) in the array as the only argument.
If it returns non-zero, then the operation should be retried.
If it returns zero, the custom VFS should abandon the current operation.
.It
Application can invoke the SQLITE_FCNTL_TEMPFILENAME
file-control to have SQLite generate a temporary filename using the
same algorithm that is followed to generate temporary filenames for
TEMP tables and other internal uses.
The argument should be a char** which will be filled with the filename
written into memory obtained from sqlite3_malloc().
The caller should invoke sqlite3_free() on the result
to avoid a memory leak.
.It
The SQLITE_FCNTL_MMAP_SIZE file control is used
to query or set the maximum number of bytes that will be used for memory-mapped
I/O.
The argument is a pointer to a value of type sqlite3_int64 that is
an advisory maximum number of bytes in the file to memory map.
The pointer is overwritten with the old value.
The limit is not changed if the value originally pointed to is negative,
and so the current limit can be queried by passing in a pointer to
a negative number.
This file-control is used internally to implement PRAGMA mmap_size.
.It
The SQLITE_FCNTL_TRACE file control provides advisory
information to the VFS about what the higher layers of the SQLite stack
are doing.
This file control is used by some VFS activity tracing shims.
The argument is a zero-terminated string.
Higher layers in the SQLite stack may generate instances of this file
control if the SQLITE_USE_FCNTL_TRACE compile-time
option is enabled.
.It
The SQLITE_FCNTL_HAS_MOVED file control interprets
its argument as a pointer to an integer and it writes a boolean into
that integer depending on whether or not the file has been renamed,
moved, or deleted since it was first opened.
.It
The SQLITE_FCNTL_WIN32_GET_HANDLE opcode
can be used to obtain the underlying native file handle associated
with a file handle.
This file control interprets its argument as a pointer to a native
file handle and writes the resulting value there.
.It
The SQLITE_FCNTL_WIN32_SET_HANDLE opcode
is used for debugging.
This opcode causes the xFileControl method to swap the file handle
with the one pointed to by the pArg argument.
This capability is used during testing and only needs to be supported
when SQLITE_TEST is defined.
.It
The SQLITE_FCNTL_WAL_BLOCK is a signal to the
VFS layer that it might be advantageous to block on the next WAL lock
if the lock is not immediately available.
The WAL subsystem issues this signal during rare circumstances in order
to fix a problem with priority inversion.
Applications should <em>not</em> use this file-control.
.It
The SQLITE_FCNTL_ZIPVFS opcode is implemented by
zipvfs only.
All other VFS should return SQLITE_NOTFOUND for this opcode.
.It
The SQLITE_FCNTL_RBU opcode is implemented by the special
VFS used by the RBU extension only.
All other VFS should return SQLITE_NOTFOUND for this opcode.
.El
.Pp
.Sh SEE ALSO
.Xr sqlite3_file 3 ,
.Xr sqlite3_file_control 3 ,
.Xr sqlite3_malloc 3 ,
.Xr sqlite3_io_methods 3 ,
.Xr sqlite3_malloc 3 ,
.Xr sqlite3_mprintf 3 ,
.Xr sqlite3_vfs 3 ,
.Xr SQLITE_FCNTL_LOCKSTATE 3 ,
.Xr SQLITE_IOCAP_ATOMIC 3 ,
.Xr SQLITE_LOCK_NONE 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,31 @@
.Dd March 11, 2017
.Dt SQLITE_INDEX_CONSTRAINT_EQ 3
.Os
.Sh NAME
.Nm SQLITE_INDEX_CONSTRAINT_EQ ,
.Nm SQLITE_INDEX_CONSTRAINT_GT ,
.Nm SQLITE_INDEX_CONSTRAINT_LE ,
.Nm SQLITE_INDEX_CONSTRAINT_LT ,
.Nm SQLITE_INDEX_CONSTRAINT_GE ,
.Nm SQLITE_INDEX_CONSTRAINT_MATCH ,
.Nm SQLITE_INDEX_CONSTRAINT_LIKE ,
.Nm SQLITE_INDEX_CONSTRAINT_GLOB ,
.Nm SQLITE_INDEX_CONSTRAINT_REGEXP
.Nd Virtual Table Constraint Operator Codes
.Sh SYNOPSIS
.Fd #define SQLITE_INDEX_CONSTRAINT_EQ
.Fd #define SQLITE_INDEX_CONSTRAINT_GT
.Fd #define SQLITE_INDEX_CONSTRAINT_LE
.Fd #define SQLITE_INDEX_CONSTRAINT_LT
.Fd #define SQLITE_INDEX_CONSTRAINT_GE
.Fd #define SQLITE_INDEX_CONSTRAINT_MATCH
.Fd #define SQLITE_INDEX_CONSTRAINT_LIKE
.Fd #define SQLITE_INDEX_CONSTRAINT_GLOB
.Fd #define SQLITE_INDEX_CONSTRAINT_REGEXP
.Sh DESCRIPTION
These macros defined the allowed values for the sqlite3_index_info.aConstraint[].op
field.
Each value represents an operator that is part of a constraint term
in the wHERE clause of a query that uses a virtual table.
.Sh SEE ALSO
.Xr sqlite3_index_info 3

View File

@ -0,0 +1,9 @@
.Dd March 11, 2017
.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

View File

@ -0,0 +1,39 @@
.Dd March 11, 2017
.Dt SQLITE_INTEGER 3
.Os
.Sh NAME
.Nm SQLITE_INTEGER ,
.Nm SQLITE_FLOAT ,
.Nm SQLITE_BLOB ,
.Nm SQLITE_NULL ,
.Nm SQLITE_TEXT ,
.Nm SQLITE3_TEXT
.Nd Fundamental Datatypes
.Sh SYNOPSIS
.Fd #define SQLITE_INTEGER
.Fd #define SQLITE_FLOAT
.Fd #define SQLITE_BLOB
.Fd #define SQLITE_NULL
.Fd #define SQLITE_TEXT
.Fd #define SQLITE3_TEXT
.Sh DESCRIPTION
Every value in SQLite has one of five fundamental datatypes:
.Bl -bullet
.It
64-bit signed integer
.It
64-bit IEEE floating point number
.It
string
.It
BLOB
.It
NULL
.El
.Pp
These constants are codes for each of those types.
.Pp
Note that the SQLITE_TEXT constant was also used in SQLite version
2 for a completely different meaning.
Software that links against both SQLite version 2 and SQLite version
3 should use SQLITE3_TEXT, not SQLITE_TEXT.

View File

@ -0,0 +1,60 @@
.Dd March 11, 2017
.Dt SQLITE_IOCAP_ATOMIC 3
.Os
.Sh NAME
.Nm SQLITE_IOCAP_ATOMIC ,
.Nm SQLITE_IOCAP_ATOMIC512 ,
.Nm SQLITE_IOCAP_ATOMIC1K ,
.Nm SQLITE_IOCAP_ATOMIC2K ,
.Nm SQLITE_IOCAP_ATOMIC4K ,
.Nm SQLITE_IOCAP_ATOMIC8K ,
.Nm SQLITE_IOCAP_ATOMIC16K ,
.Nm SQLITE_IOCAP_ATOMIC32K ,
.Nm SQLITE_IOCAP_ATOMIC64K ,
.Nm SQLITE_IOCAP_SAFE_APPEND ,
.Nm SQLITE_IOCAP_SEQUENTIAL ,
.Nm SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN ,
.Nm SQLITE_IOCAP_POWERSAFE_OVERWRITE ,
.Nm SQLITE_IOCAP_IMMUTABLE
.Nd Device Characteristics
.Sh SYNOPSIS
.Fd #define SQLITE_IOCAP_ATOMIC
.Fd #define SQLITE_IOCAP_ATOMIC512
.Fd #define SQLITE_IOCAP_ATOMIC1K
.Fd #define SQLITE_IOCAP_ATOMIC2K
.Fd #define SQLITE_IOCAP_ATOMIC4K
.Fd #define SQLITE_IOCAP_ATOMIC8K
.Fd #define SQLITE_IOCAP_ATOMIC16K
.Fd #define SQLITE_IOCAP_ATOMIC32K
.Fd #define SQLITE_IOCAP_ATOMIC64K
.Fd #define SQLITE_IOCAP_SAFE_APPEND
.Fd #define SQLITE_IOCAP_SEQUENTIAL
.Fd #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
.Fd #define SQLITE_IOCAP_POWERSAFE_OVERWRITE
.Fd #define SQLITE_IOCAP_IMMUTABLE
.Sh DESCRIPTION
The xDeviceCharacteristics method of the sqlite3_io_methods
object returns an integer which is a vector of these bit values expressing
I/O characteristics of the mass storage device that holds the file
that the sqlite3_io_methods refers to.
.Pp
The SQLITE_IOCAP_ATOMIC property means that all writes of any size
are atomic.
The SQLITE_IOCAP_ATOMICnnn values mean that writes of blocks that are
nnn bytes in size and are aligned to an address which is an integer
multiple of nnn are atomic.
The SQLITE_IOCAP_SAFE_APPEND value means that when data is appended
to a file, the data is appended first then the size of the file is
extended, never the other way around.
The SQLITE_IOCAP_SEQUENTIAL property means that information is written
to disk in the same order as calls to xWrite().
The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that after reboot
following a crash or power loss, the only bytes in a file that were
written at the application level might have changed and that adjacent
bytes, even bytes within the same sector are guaranteed to be unchanged.
The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN flag indicates that a file cannot
be deleted when open.
The SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on read-only
media and cannot be changed even by processes with elevated privileges.
.Sh SEE ALSO
.Xr sqlite3_io_methods 3

View File

@ -0,0 +1,136 @@
.Dd March 11, 2017
.Dt SQLITE_IOERR_READ 3
.Os
.Sh NAME
.Nm SQLITE_IOERR_READ ,
.Nm SQLITE_IOERR_SHORT_READ ,
.Nm SQLITE_IOERR_WRITE ,
.Nm SQLITE_IOERR_FSYNC ,
.Nm SQLITE_IOERR_DIR_FSYNC ,
.Nm SQLITE_IOERR_TRUNCATE ,
.Nm SQLITE_IOERR_FSTAT ,
.Nm SQLITE_IOERR_UNLOCK ,
.Nm SQLITE_IOERR_RDLOCK ,
.Nm SQLITE_IOERR_DELETE ,
.Nm SQLITE_IOERR_BLOCKED ,
.Nm SQLITE_IOERR_NOMEM ,
.Nm SQLITE_IOERR_ACCESS ,
.Nm SQLITE_IOERR_CHECKRESERVEDLOCK ,
.Nm SQLITE_IOERR_LOCK ,
.Nm SQLITE_IOERR_CLOSE ,
.Nm SQLITE_IOERR_DIR_CLOSE ,
.Nm SQLITE_IOERR_SHMOPEN ,
.Nm SQLITE_IOERR_SHMSIZE ,
.Nm SQLITE_IOERR_SHMLOCK ,
.Nm SQLITE_IOERR_SHMMAP ,
.Nm SQLITE_IOERR_SEEK ,
.Nm SQLITE_IOERR_DELETE_NOENT ,
.Nm SQLITE_IOERR_MMAP ,
.Nm SQLITE_IOERR_GETTEMPPATH ,
.Nm SQLITE_IOERR_CONVPATH ,
.Nm SQLITE_IOERR_VNODE ,
.Nm SQLITE_IOERR_AUTH ,
.Nm SQLITE_LOCKED_SHAREDCACHE ,
.Nm SQLITE_BUSY_RECOVERY ,
.Nm SQLITE_BUSY_SNAPSHOT ,
.Nm SQLITE_CANTOPEN_NOTEMPDIR ,
.Nm SQLITE_CANTOPEN_ISDIR ,
.Nm SQLITE_CANTOPEN_FULLPATH ,
.Nm SQLITE_CANTOPEN_CONVPATH ,
.Nm SQLITE_CORRUPT_VTAB ,
.Nm SQLITE_READONLY_RECOVERY ,
.Nm SQLITE_READONLY_CANTLOCK ,
.Nm SQLITE_READONLY_ROLLBACK ,
.Nm SQLITE_READONLY_DBMOVED ,
.Nm SQLITE_ABORT_ROLLBACK ,
.Nm SQLITE_CONSTRAINT_CHECK ,
.Nm SQLITE_CONSTRAINT_COMMITHOOK ,
.Nm SQLITE_CONSTRAINT_FOREIGNKEY ,
.Nm SQLITE_CONSTRAINT_FUNCTION ,
.Nm SQLITE_CONSTRAINT_NOTNULL ,
.Nm SQLITE_CONSTRAINT_PRIMARYKEY ,
.Nm SQLITE_CONSTRAINT_TRIGGER ,
.Nm SQLITE_CONSTRAINT_UNIQUE ,
.Nm SQLITE_CONSTRAINT_VTAB ,
.Nm SQLITE_CONSTRAINT_ROWID ,
.Nm SQLITE_NOTICE_RECOVER_WAL ,
.Nm SQLITE_NOTICE_RECOVER_ROLLBACK ,
.Nm SQLITE_WARNING_AUTOINDEX ,
.Nm SQLITE_AUTH_USER ,
.Nm SQLITE_OK_LOAD_PERMANENTLY
.Nd Extended Result Codes
.Sh SYNOPSIS
.Fd #define SQLITE_IOERR_READ
.Fd #define SQLITE_IOERR_SHORT_READ
.Fd #define SQLITE_IOERR_WRITE
.Fd #define SQLITE_IOERR_FSYNC
.Fd #define SQLITE_IOERR_DIR_FSYNC
.Fd #define SQLITE_IOERR_TRUNCATE
.Fd #define SQLITE_IOERR_FSTAT
.Fd #define SQLITE_IOERR_UNLOCK
.Fd #define SQLITE_IOERR_RDLOCK
.Fd #define SQLITE_IOERR_DELETE
.Fd #define SQLITE_IOERR_BLOCKED
.Fd #define SQLITE_IOERR_NOMEM
.Fd #define SQLITE_IOERR_ACCESS
.Fd #define SQLITE_IOERR_CHECKRESERVEDLOCK
.Fd #define SQLITE_IOERR_LOCK
.Fd #define SQLITE_IOERR_CLOSE
.Fd #define SQLITE_IOERR_DIR_CLOSE
.Fd #define SQLITE_IOERR_SHMOPEN
.Fd #define SQLITE_IOERR_SHMSIZE
.Fd #define SQLITE_IOERR_SHMLOCK
.Fd #define SQLITE_IOERR_SHMMAP
.Fd #define SQLITE_IOERR_SEEK
.Fd #define SQLITE_IOERR_DELETE_NOENT
.Fd #define SQLITE_IOERR_MMAP
.Fd #define SQLITE_IOERR_GETTEMPPATH
.Fd #define SQLITE_IOERR_CONVPATH
.Fd #define SQLITE_IOERR_VNODE
.Fd #define SQLITE_IOERR_AUTH
.Fd #define SQLITE_LOCKED_SHAREDCACHE
.Fd #define SQLITE_BUSY_RECOVERY
.Fd #define SQLITE_BUSY_SNAPSHOT
.Fd #define SQLITE_CANTOPEN_NOTEMPDIR
.Fd #define SQLITE_CANTOPEN_ISDIR
.Fd #define SQLITE_CANTOPEN_FULLPATH
.Fd #define SQLITE_CANTOPEN_CONVPATH
.Fd #define SQLITE_CORRUPT_VTAB
.Fd #define SQLITE_READONLY_RECOVERY
.Fd #define SQLITE_READONLY_CANTLOCK
.Fd #define SQLITE_READONLY_ROLLBACK
.Fd #define SQLITE_READONLY_DBMOVED
.Fd #define SQLITE_ABORT_ROLLBACK
.Fd #define SQLITE_CONSTRAINT_CHECK
.Fd #define SQLITE_CONSTRAINT_COMMITHOOK
.Fd #define SQLITE_CONSTRAINT_FOREIGNKEY
.Fd #define SQLITE_CONSTRAINT_FUNCTION
.Fd #define SQLITE_CONSTRAINT_NOTNULL
.Fd #define SQLITE_CONSTRAINT_PRIMARYKEY
.Fd #define SQLITE_CONSTRAINT_TRIGGER
.Fd #define SQLITE_CONSTRAINT_UNIQUE
.Fd #define SQLITE_CONSTRAINT_VTAB
.Fd #define SQLITE_CONSTRAINT_ROWID
.Fd #define SQLITE_NOTICE_RECOVER_WAL
.Fd #define SQLITE_NOTICE_RECOVER_ROLLBACK
.Fd #define SQLITE_WARNING_AUTOINDEX
.Fd #define SQLITE_AUTH_USER
.Fd #define SQLITE_OK_LOAD_PERMANENTLY
.Sh DESCRIPTION
In its default configuration, SQLite API routines return one of 30
integer result codes.
However, experience has shown that many of these result codes are too
coarse-grained.
They do not provide as much information about problems as programmers
might like.
In an effort to address this, newer versions of SQLite (version 3.3.8
dateof:3.3.8 and later) include support for additional
result codes that provide more detailed information about errors.
These extended result codes are enabled or disabled
on a per database connection basis using the sqlite3_extended_result_codes()
API.
Or, the extended code for the most recent error can be obtained using
sqlite3_extended_errcode().
.Sh SEE ALSO
.Xr sqlite3_errcode 3 ,
.Xr sqlite3_extended_result_codes 3

View File

@ -0,0 +1,72 @@
.Dd March 11, 2017
.Dt SQLITE_LIMIT_LENGTH 3
.Os
.Sh NAME
.Nm SQLITE_LIMIT_LENGTH ,
.Nm SQLITE_LIMIT_SQL_LENGTH ,
.Nm SQLITE_LIMIT_COLUMN ,
.Nm SQLITE_LIMIT_EXPR_DEPTH ,
.Nm SQLITE_LIMIT_COMPOUND_SELECT ,
.Nm SQLITE_LIMIT_VDBE_OP ,
.Nm SQLITE_LIMIT_FUNCTION_ARG ,
.Nm SQLITE_LIMIT_ATTACHED ,
.Nm SQLITE_LIMIT_LIKE_PATTERN_LENGTH ,
.Nm SQLITE_LIMIT_VARIABLE_NUMBER ,
.Nm SQLITE_LIMIT_TRIGGER_DEPTH ,
.Nm SQLITE_LIMIT_WORKER_THREADS
.Nd Run-Time Limit Categories
.Sh SYNOPSIS
.Fd #define SQLITE_LIMIT_LENGTH
.Fd #define SQLITE_LIMIT_SQL_LENGTH
.Fd #define SQLITE_LIMIT_COLUMN
.Fd #define SQLITE_LIMIT_EXPR_DEPTH
.Fd #define SQLITE_LIMIT_COMPOUND_SELECT
.Fd #define SQLITE_LIMIT_VDBE_OP
.Fd #define SQLITE_LIMIT_FUNCTION_ARG
.Fd #define SQLITE_LIMIT_ATTACHED
.Fd #define SQLITE_LIMIT_LIKE_PATTERN_LENGTH
.Fd #define SQLITE_LIMIT_VARIABLE_NUMBER
.Fd #define SQLITE_LIMIT_TRIGGER_DEPTH
.Fd #define SQLITE_LIMIT_WORKER_THREADS
.Sh DESCRIPTION
These constants define various performance limits that can be lowered
at run-time using sqlite3_limit().
The synopsis of the meanings of the various limits is shown below.
Additional information is available at Limits in SQLite.
.Bl -tag -width Ds
.It SQLITE_LIMIT_LENGTH
The maximum size of any string or BLOB or table row, in bytes.
.It SQLITE_LIMIT_SQL_LENGTH
The maximum length of an SQL statement, in bytes.
.It SQLITE_LIMIT_COLUMN
The maximum number of columns in a table definition or in the result
set of a SELECT or the maximum number of columns in an index
or in an ORDER BY or GROUP BY clause.
.It SQLITE_LIMIT_EXPR_DEPTH
The maximum depth of the parse tree on any expression.
.It SQLITE_LIMIT_COMPOUND_SELECT
The maximum number of terms in a compound SELECT statement.
.It SQLITE_LIMIT_VDBE_OP
The maximum number of instructions in a virtual machine program used
to implement an SQL statement.
This limit is not currently enforced, though that might be added in
some future release of SQLite.
.It SQLITE_LIMIT_FUNCTION_ARG
The maximum number of arguments on a function.
.It SQLITE_LIMIT_ATTACHED
The maximum number of attached databases.
.It SQLITE_LIMIT_LIKE_PATTERN_LENGTH
The maximum length of the pattern argument to the LIKE or GLOB
operators.
.It SQLITE_LIMIT_VARIABLE_NUMBER
The maximum index number of any parameter in an SQL statement.
.It SQLITE_LIMIT_TRIGGER_DEPTH
The maximum depth of recursion for triggers.
.It SQLITE_LIMIT_WORKER_THREADS
The maximum number of auxiliary worker threads that a single prepared statement
may start.
.El
.Pp
.Sh SEE ALSO
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_limit 3

View File

@ -0,0 +1,22 @@
.Dd March 11, 2017
.Dt SQLITE_LOCK_NONE 3
.Os
.Sh NAME
.Nm SQLITE_LOCK_NONE ,
.Nm SQLITE_LOCK_SHARED ,
.Nm SQLITE_LOCK_RESERVED ,
.Nm SQLITE_LOCK_PENDING ,
.Nm SQLITE_LOCK_EXCLUSIVE
.Nd File Locking Levels
.Sh SYNOPSIS
.Fd #define SQLITE_LOCK_NONE
.Fd #define SQLITE_LOCK_SHARED
.Fd #define SQLITE_LOCK_RESERVED
.Fd #define SQLITE_LOCK_PENDING
.Fd #define SQLITE_LOCK_EXCLUSIVE
.Sh DESCRIPTION
SQLite uses one of these integer values as the second argument to calls
it makes to the xLock() and xUnlock() methods of an sqlite3_io_methods
object.
.Sh SEE ALSO
.Xr sqlite3_io_methods 3

View File

@ -0,0 +1,48 @@
.Dd March 11, 2017
.Dt SQLITE_MUTEX_FAST 3
.Os
.Sh NAME
.Nm SQLITE_MUTEX_FAST ,
.Nm SQLITE_MUTEX_RECURSIVE ,
.Nm SQLITE_MUTEX_STATIC_MASTER ,
.Nm SQLITE_MUTEX_STATIC_MEM ,
.Nm SQLITE_MUTEX_STATIC_MEM2 ,
.Nm SQLITE_MUTEX_STATIC_OPEN ,
.Nm SQLITE_MUTEX_STATIC_PRNG ,
.Nm SQLITE_MUTEX_STATIC_LRU ,
.Nm SQLITE_MUTEX_STATIC_LRU2 ,
.Nm SQLITE_MUTEX_STATIC_PMEM ,
.Nm SQLITE_MUTEX_STATIC_APP1 ,
.Nm SQLITE_MUTEX_STATIC_APP2 ,
.Nm SQLITE_MUTEX_STATIC_APP3 ,
.Nm SQLITE_MUTEX_STATIC_VFS1 ,
.Nm SQLITE_MUTEX_STATIC_VFS2 ,
.Nm SQLITE_MUTEX_STATIC_VFS3
.Nd Mutex Types
.Sh SYNOPSIS
.Fd #define SQLITE_MUTEX_FAST
.Fd #define SQLITE_MUTEX_RECURSIVE
.Fd #define SQLITE_MUTEX_STATIC_MASTER
.Fd #define SQLITE_MUTEX_STATIC_MEM
.Fd #define SQLITE_MUTEX_STATIC_MEM2
.Fd #define SQLITE_MUTEX_STATIC_OPEN
.Fd #define SQLITE_MUTEX_STATIC_PRNG
.Fd #define SQLITE_MUTEX_STATIC_LRU
.Fd #define SQLITE_MUTEX_STATIC_LRU2
.Fd #define SQLITE_MUTEX_STATIC_PMEM
.Fd #define SQLITE_MUTEX_STATIC_APP1
.Fd #define SQLITE_MUTEX_STATIC_APP2
.Fd #define SQLITE_MUTEX_STATIC_APP3
.Fd #define SQLITE_MUTEX_STATIC_VFS1
.Fd #define SQLITE_MUTEX_STATIC_VFS2
.Fd #define SQLITE_MUTEX_STATIC_VFS3
.Sh DESCRIPTION
The sqlite3_mutex_alloc() interface takes a single
argument which is one of these integer constants.
.Pp
The set of static mutexes may change from one SQLite release to the
next.
Applications that override the built-in mutex logic must be prepared
to accommodate additional static mutexes.
.Sh SEE ALSO
.Xr sqlite3_mutex_alloc 3

View File

@ -0,0 +1,76 @@
.Dd March 11, 2017
.Dt SQLITE_OK 3
.Os
.Sh NAME
.Nm SQLITE_OK ,
.Nm SQLITE_ERROR ,
.Nm SQLITE_INTERNAL ,
.Nm SQLITE_PERM ,
.Nm SQLITE_ABORT ,
.Nm SQLITE_BUSY ,
.Nm SQLITE_LOCKED ,
.Nm SQLITE_NOMEM ,
.Nm SQLITE_READONLY ,
.Nm SQLITE_INTERRUPT ,
.Nm SQLITE_IOERR ,
.Nm SQLITE_CORRUPT ,
.Nm SQLITE_NOTFOUND ,
.Nm SQLITE_FULL ,
.Nm SQLITE_CANTOPEN ,
.Nm SQLITE_PROTOCOL ,
.Nm SQLITE_EMPTY ,
.Nm SQLITE_SCHEMA ,
.Nm SQLITE_TOOBIG ,
.Nm SQLITE_CONSTRAINT ,
.Nm SQLITE_MISMATCH ,
.Nm SQLITE_MISUSE ,
.Nm SQLITE_NOLFS ,
.Nm SQLITE_AUTH ,
.Nm SQLITE_FORMAT ,
.Nm SQLITE_RANGE ,
.Nm SQLITE_NOTADB ,
.Nm SQLITE_NOTICE ,
.Nm SQLITE_WARNING ,
.Nm SQLITE_ROW ,
.Nm SQLITE_DONE
.Nd Result Codes
.Sh SYNOPSIS
.Fd #define SQLITE_OK
.Fd #define SQLITE_ERROR
.Fd #define SQLITE_INTERNAL
.Fd #define SQLITE_PERM
.Fd #define SQLITE_ABORT
.Fd #define SQLITE_BUSY
.Fd #define SQLITE_LOCKED
.Fd #define SQLITE_NOMEM
.Fd #define SQLITE_READONLY
.Fd #define SQLITE_INTERRUPT
.Fd #define SQLITE_IOERR
.Fd #define SQLITE_CORRUPT
.Fd #define SQLITE_NOTFOUND
.Fd #define SQLITE_FULL
.Fd #define SQLITE_CANTOPEN
.Fd #define SQLITE_PROTOCOL
.Fd #define SQLITE_EMPTY
.Fd #define SQLITE_SCHEMA
.Fd #define SQLITE_TOOBIG
.Fd #define SQLITE_CONSTRAINT
.Fd #define SQLITE_MISMATCH
.Fd #define SQLITE_MISUSE
.Fd #define SQLITE_NOLFS
.Fd #define SQLITE_AUTH
.Fd #define SQLITE_FORMAT
.Fd #define SQLITE_RANGE
.Fd #define SQLITE_NOTADB
.Fd #define SQLITE_NOTICE
.Fd #define SQLITE_WARNING
.Fd #define SQLITE_ROW
.Fd #define SQLITE_DONE
.Sh DESCRIPTION
Many SQLite functions return an integer result code from the set shown
here in order to indicate success or failure.
.Pp
New error codes may be added in future versions of SQLite.
.Pp
.Sh SEE ALSO
.Xr SQLITE_IOERR_READ 3

View File

@ -0,0 +1,52 @@
.Dd March 11, 2017
.Dt SQLITE_OPEN_READONLY 3
.Os
.Sh NAME
.Nm SQLITE_OPEN_READONLY ,
.Nm SQLITE_OPEN_READWRITE ,
.Nm SQLITE_OPEN_CREATE ,
.Nm SQLITE_OPEN_DELETEONCLOSE ,
.Nm SQLITE_OPEN_EXCLUSIVE ,
.Nm SQLITE_OPEN_AUTOPROXY ,
.Nm SQLITE_OPEN_URI ,
.Nm SQLITE_OPEN_MEMORY ,
.Nm SQLITE_OPEN_MAIN_DB ,
.Nm SQLITE_OPEN_TEMP_DB ,
.Nm SQLITE_OPEN_TRANSIENT_DB ,
.Nm SQLITE_OPEN_MAIN_JOURNAL ,
.Nm SQLITE_OPEN_TEMP_JOURNAL ,
.Nm SQLITE_OPEN_SUBJOURNAL ,
.Nm SQLITE_OPEN_MASTER_JOURNAL ,
.Nm SQLITE_OPEN_NOMUTEX ,
.Nm SQLITE_OPEN_FULLMUTEX ,
.Nm SQLITE_OPEN_SHAREDCACHE ,
.Nm SQLITE_OPEN_PRIVATECACHE ,
.Nm SQLITE_OPEN_WAL
.Nd Flags For File Open Operations
.Sh SYNOPSIS
.Fd #define SQLITE_OPEN_READONLY
.Fd #define SQLITE_OPEN_READWRITE
.Fd #define SQLITE_OPEN_CREATE
.Fd #define SQLITE_OPEN_DELETEONCLOSE
.Fd #define SQLITE_OPEN_EXCLUSIVE
.Fd #define SQLITE_OPEN_AUTOPROXY
.Fd #define SQLITE_OPEN_URI
.Fd #define SQLITE_OPEN_MEMORY
.Fd #define SQLITE_OPEN_MAIN_DB
.Fd #define SQLITE_OPEN_TEMP_DB
.Fd #define SQLITE_OPEN_TRANSIENT_DB
.Fd #define SQLITE_OPEN_MAIN_JOURNAL
.Fd #define SQLITE_OPEN_TEMP_JOURNAL
.Fd #define SQLITE_OPEN_SUBJOURNAL
.Fd #define SQLITE_OPEN_MASTER_JOURNAL
.Fd #define SQLITE_OPEN_NOMUTEX
.Fd #define SQLITE_OPEN_FULLMUTEX
.Fd #define SQLITE_OPEN_SHAREDCACHE
.Fd #define SQLITE_OPEN_PRIVATECACHE
.Fd #define SQLITE_OPEN_WAL
.Sh DESCRIPTION
These bit values are intended for use in the 3rd parameter to the sqlite3_open_v2()
interface and in the 4th parameter to the sqlite3_vfs.xOpen
method.
.Sh SEE ALSO
.Xr sqlite3_open 3

View File

@ -0,0 +1,25 @@
.Dd March 11, 2017
.Dt SQLITE_ROLLBACK 3
.Os
.Sh NAME
.Nm SQLITE_ROLLBACK ,
.Nm SQLITE_FAIL ,
.Nm SQLITE_REPLACE
.Nd Conflict resolution modes
.Sh SYNOPSIS
.Fd #define SQLITE_ROLLBACK
.Fd #define SQLITE_FAIL
.Fd #define SQLITE_REPLACE
.Sh DESCRIPTION
These constants are returned by sqlite3_vtab_on_conflict()
to inform a virtual table implementation what the ON CONFLICT
mode is for the SQL statement being evaluated.
.Pp
Note that the SQLITE_IGNORE constant is also used as a
potential return value from the sqlite3_set_authorizer()
callback and that SQLITE_ABORT is also a result code.
.Sh SEE ALSO
.Xr sqlite3_set_authorizer 3 ,
.Xr sqlite3_vtab_on_conflict 3 ,
.Xr SQLITE_OK 3 ,
.Xr SQLITE_DENY 3

View File

@ -0,0 +1,62 @@
.Dd March 11, 2017
.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

View File

@ -0,0 +1,15 @@
.Dd March 11, 2017
.Dt SQLITE_SHM_NLOCK 3
.Os
.Sh NAME
.Nm SQLITE_SHM_NLOCK
.Nd Maximum xShmLock index
.Sh SYNOPSIS
.Fd #define SQLITE_SHM_NLOCK
.Sh DESCRIPTION
The xShmLock method on sqlite3_io_methods may use
values between 0 and this upper bound as its "offset" argument.
The SQLite core will never attempt to acquire or release a lock outside
of this range
.Sh SEE ALSO
.Xr sqlite3_io_methods 3

View File

@ -0,0 +1,38 @@
.Dd March 11, 2017
.Dt SQLITE_SHM_UNLOCK 3
.Os
.Sh NAME
.Nm SQLITE_SHM_UNLOCK ,
.Nm SQLITE_SHM_LOCK ,
.Nm SQLITE_SHM_SHARED ,
.Nm SQLITE_SHM_EXCLUSIVE
.Nd Flags for the xShmLock VFS method
.Sh SYNOPSIS
.Fd #define SQLITE_SHM_UNLOCK
.Fd #define SQLITE_SHM_LOCK
.Fd #define SQLITE_SHM_SHARED
.Fd #define SQLITE_SHM_EXCLUSIVE
.Sh DESCRIPTION
These integer constants define the various locking operations allowed
by the xShmLock method of sqlite3_io_methods.
The following are the only legal combinations of flags to the xShmLock
method:
.Bl -bullet
.It
SQLITE_SHM_LOCK | SQLITE_SHM_SHARED
.It
SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE
.It
SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
.It
SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
.El
.Pp
When unlocking, the same SHARED or EXCLUSIVE flag must be supplied
as was given on the corresponding lock.
.Pp
The xShmLock method can transition between unlocked and SHARED or between
unlocked and EXCLUSIVE.
It cannot transition between SHARED and EXCLUSIVE.
.Sh SEE ALSO
.Xr sqlite3_io_methods 3

View File

@ -0,0 +1,103 @@
.Dd March 11, 2017
.Dt SQLITE_STATUS_MEMORY_USED 3
.Os
.Sh NAME
.Nm SQLITE_STATUS_MEMORY_USED ,
.Nm SQLITE_STATUS_PAGECACHE_USED ,
.Nm SQLITE_STATUS_PAGECACHE_OVERFLOW ,
.Nm SQLITE_STATUS_SCRATCH_USED ,
.Nm SQLITE_STATUS_SCRATCH_OVERFLOW ,
.Nm SQLITE_STATUS_MALLOC_SIZE ,
.Nm SQLITE_STATUS_PARSER_STACK ,
.Nm SQLITE_STATUS_PAGECACHE_SIZE ,
.Nm SQLITE_STATUS_SCRATCH_SIZE ,
.Nm SQLITE_STATUS_MALLOC_COUNT
.Nd Status Parameters
.Sh SYNOPSIS
.Fd #define SQLITE_STATUS_MEMORY_USED
.Fd #define SQLITE_STATUS_PAGECACHE_USED
.Fd #define SQLITE_STATUS_PAGECACHE_OVERFLOW
.Fd #define SQLITE_STATUS_SCRATCH_USED
.Fd #define SQLITE_STATUS_SCRATCH_OVERFLOW
.Fd #define SQLITE_STATUS_MALLOC_SIZE
.Fd #define SQLITE_STATUS_PARSER_STACK
.Fd #define SQLITE_STATUS_PAGECACHE_SIZE
.Fd #define SQLITE_STATUS_SCRATCH_SIZE
.Fd #define SQLITE_STATUS_MALLOC_COUNT
.Sh DESCRIPTION
These integer constants designate various run-time status parameters
that can be returned by sqlite3_status().
.Bl -tag -width Ds
.It SQLITE_STATUS_MEMORY_USED
This parameter is the current amount of memory checked out using sqlite3_malloc(),
either directly or indirectly.
The figure includes calls made to sqlite3_malloc()
by the application and internal memory usage by the SQLite library.
Scratch memory controlled by SQLITE_CONFIG_SCRATCH
and auxiliary page-cache memory controlled by SQLITE_CONFIG_PAGECACHE
is not included in this parameter.
The amount returned is the sum of the allocation sizes as reported
by the xSize method in sqlite3_mem_methods.
.It SQLITE_STATUS_MALLOC_SIZE
This parameter records the largest memory allocation request handed
to sqlite3_malloc() or sqlite3_realloc()
(or their internal equivalents).
Only the value returned in the *pHighwater parameter to sqlite3_status()
is of interest.
The value written into the *pCurrent parameter is undefined.
.It SQLITE_STATUS_MALLOC_COUNT
This parameter records the number of separate memory allocations currently
checked out.
.It SQLITE_STATUS_PAGECACHE_USED
This parameter returns the number of pages used out of the pagecache memory allocator
that was configured using SQLITE_CONFIG_PAGECACHE.
The value returned is in pages, not in bytes.
.It SQLITE_STATUS_PAGECACHE_OVERFLOW
This parameter returns the number of bytes of page cache allocation
which could not be satisfied by the SQLITE_CONFIG_PAGECACHE
buffer and where forced to overflow to sqlite3_malloc().
The returned value includes allocations that overflowed because they
where too large (they were larger than the "sz" parameter to SQLITE_CONFIG_PAGECACHE)
and allocations that overflowed because no space was left in the page
cache.
.It SQLITE_STATUS_PAGECACHE_SIZE
This parameter records the largest memory allocation request handed
to pagecache memory allocator.
Only the value returned in the *pHighwater parameter to sqlite3_status()
is of interest.
The value written into the *pCurrent parameter is undefined.
.It SQLITE_STATUS_SCRATCH_USED
This parameter returns the number of allocations used out of the scratch memory allocator
configured using SQLITE_CONFIG_SCRATCH.
The value returned is in allocations, not in bytes.
Since a single thread may only have one scratch allocation outstanding
at time, this parameter also reports the number of threads using scratch
memory at the same time.
.It SQLITE_STATUS_SCRATCH_OVERFLOW
This parameter returns the number of bytes of scratch memory allocation
which could not be satisfied by the SQLITE_CONFIG_SCRATCH
buffer and where forced to overflow to sqlite3_malloc().
The values returned include overflows because the requested allocation
was too larger (that is, because the requested allocation was larger
than the "sz" parameter to SQLITE_CONFIG_SCRATCH)
and because no scratch buffer slots were available.
.It SQLITE_STATUS_SCRATCH_SIZE
This parameter records the largest memory allocation request handed
to scratch memory allocator.
Only the value returned in the *pHighwater parameter to sqlite3_status()
is of interest.
The value written into the *pCurrent parameter is undefined.
.It SQLITE_STATUS_PARSER_STACK
The *pHighwater parameter records the deepest parser stack.
The *pCurrent value is undefined.
The *pHighwater value is only meaningful if SQLite is compiled with
YYTRACKMAXSTACKDEPTH.
.El
.Pp
New status parameters may be added from time to time.
.Sh SEE ALSO
.Xr sqlite3_malloc 3 ,
.Xr sqlite3_mem_methods 3 ,
.Xr sqlite3_malloc 3 ,
.Xr sqlite3_status 3 ,
.Xr SQLITE_CONFIG_SINGLETHREAD 3

View File

@ -0,0 +1,45 @@
.Dd March 11, 2017
.Dt SQLITE_STMTSTATUS_FULLSCAN_STEP 3
.Os
.Sh NAME
.Nm SQLITE_STMTSTATUS_FULLSCAN_STEP ,
.Nm SQLITE_STMTSTATUS_SORT ,
.Nm SQLITE_STMTSTATUS_AUTOINDEX ,
.Nm SQLITE_STMTSTATUS_VM_STEP
.Nd Status Parameters for prepared statements
.Sh SYNOPSIS
.Fd #define SQLITE_STMTSTATUS_FULLSCAN_STEP
.Fd #define SQLITE_STMTSTATUS_SORT
.Fd #define SQLITE_STMTSTATUS_AUTOINDEX
.Fd #define SQLITE_STMTSTATUS_VM_STEP
.Sh DESCRIPTION
These preprocessor macros define integer codes that name counter values
associated with the sqlite3_stmt_status() interface.
The meanings of the various counters are as follows:
.Bl -tag -width Ds
.It SQLITE_STMTSTATUS_FULLSCAN_STEP
This is the number of times that SQLite has stepped forward in a table
as part of a full table scan.
Large numbers for this counter may indicate opportunities for performance
improvement through careful use of indices.
.It SQLITE_STMTSTATUS_SORT
This is the number of sort operations that have occurred.
A non-zero value in this counter may indicate an opportunity to improvement
performance through careful use of indices.
.It SQLITE_STMTSTATUS_AUTOINDEX
This is the number of rows inserted into transient indices that were
created automatically in order to help joins run faster.
A non-zero value in this counter may indicate an opportunity to improvement
performance by adding permanent indices that do not need to be reinitialized
each time the statement is run.
.It SQLITE_STMTSTATUS_VM_STEP
This is the number of virtual machine operations executed by the prepared
statement if that number is less than or equal to 2147483647.
The number of virtual machine operations can be used as a proxy for
the total work done by the prepared statement.
If the number of virtual machine operations exceeds 2147483647 then
the value returned by this statement status code is undefined.
.El
.Pp
.Sh SEE ALSO
.Xr sqlite3_stmt_status 3

View File

@ -0,0 +1,38 @@
.Dd March 11, 2017
.Dt SQLITE_SYNC_NORMAL 3
.Os
.Sh NAME
.Nm SQLITE_SYNC_NORMAL ,
.Nm SQLITE_SYNC_FULL ,
.Nm SQLITE_SYNC_DATAONLY
.Nd Synchronization Type Flags
.Sh SYNOPSIS
.Fd #define SQLITE_SYNC_NORMAL
.Fd #define SQLITE_SYNC_FULL
.Fd #define SQLITE_SYNC_DATAONLY
.Sh DESCRIPTION
When SQLite invokes the xSync() method of an sqlite3_io_methods
object it uses a combination of these integer values as the second
argument.
.Pp
When the SQLITE_SYNC_DATAONLY flag is used, it means that the sync
operation only needs to flush data to mass storage.
Inode information need not be flushed.
If the lower four bits of the flag equal SQLITE_SYNC_NORMAL, that means
to use normal fsync() semantics.
If the lower four bits equal SQLITE_SYNC_FULL, that means to use Mac
OS X style fullsync instead of fsync().
.Pp
Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags with
the PRAGMA synchronous=NORMAL and PRAGMA synchronous=FULL
settings.
The synchronous pragma determines when calls to the
xSync VFS method occur and applies uniformly across all platforms.
The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how energetic
or rigorous or forceful the sync operations are and only make a difference
on Mac OSX for the default SQLite code.
(Third-party VFS implementations might also make the distinction between
SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the operating systems
natively supported by SQLite, only Mac OSX cares about the difference.)
.Sh SEE ALSO
.Xr sqlite3_io_methods 3

View File

@ -0,0 +1,64 @@
.Dd March 11, 2017
.Dt SQLITE_TESTCTRL_FIRST 3
.Os
.Sh NAME
.Nm SQLITE_TESTCTRL_FIRST ,
.Nm SQLITE_TESTCTRL_PRNG_SAVE ,
.Nm SQLITE_TESTCTRL_PRNG_RESTORE ,
.Nm SQLITE_TESTCTRL_PRNG_RESET ,
.Nm SQLITE_TESTCTRL_BITVEC_TEST ,
.Nm SQLITE_TESTCTRL_FAULT_INSTALL ,
.Nm SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS ,
.Nm SQLITE_TESTCTRL_PENDING_BYTE ,
.Nm SQLITE_TESTCTRL_ASSERT ,
.Nm SQLITE_TESTCTRL_ALWAYS ,
.Nm SQLITE_TESTCTRL_RESERVE ,
.Nm SQLITE_TESTCTRL_OPTIMIZATIONS ,
.Nm SQLITE_TESTCTRL_ISKEYWORD ,
.Nm SQLITE_TESTCTRL_SCRATCHMALLOC ,
.Nm SQLITE_TESTCTRL_LOCALTIME_FAULT ,
.Nm SQLITE_TESTCTRL_EXPLAIN_STMT ,
.Nm SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD ,
.Nm SQLITE_TESTCTRL_NEVER_CORRUPT ,
.Nm SQLITE_TESTCTRL_VDBE_COVERAGE ,
.Nm SQLITE_TESTCTRL_BYTEORDER ,
.Nm SQLITE_TESTCTRL_ISINIT ,
.Nm SQLITE_TESTCTRL_SORTER_MMAP ,
.Nm SQLITE_TESTCTRL_IMPOSTER ,
.Nm SQLITE_TESTCTRL_LAST
.Nd Testing Interface Operation Codes
.Sh SYNOPSIS
.Fd #define SQLITE_TESTCTRL_FIRST
.Fd #define SQLITE_TESTCTRL_PRNG_SAVE
.Fd #define SQLITE_TESTCTRL_PRNG_RESTORE
.Fd #define SQLITE_TESTCTRL_PRNG_RESET
.Fd #define SQLITE_TESTCTRL_BITVEC_TEST
.Fd #define SQLITE_TESTCTRL_FAULT_INSTALL
.Fd #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS
.Fd #define SQLITE_TESTCTRL_PENDING_BYTE
.Fd #define SQLITE_TESTCTRL_ASSERT
.Fd #define SQLITE_TESTCTRL_ALWAYS
.Fd #define SQLITE_TESTCTRL_RESERVE
.Fd #define SQLITE_TESTCTRL_OPTIMIZATIONS
.Fd #define SQLITE_TESTCTRL_ISKEYWORD
.Fd #define SQLITE_TESTCTRL_SCRATCHMALLOC
.Fd #define SQLITE_TESTCTRL_LOCALTIME_FAULT
.Fd #define SQLITE_TESTCTRL_EXPLAIN_STMT
.Fd #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD
.Fd #define SQLITE_TESTCTRL_NEVER_CORRUPT
.Fd #define SQLITE_TESTCTRL_VDBE_COVERAGE
.Fd #define SQLITE_TESTCTRL_BYTEORDER
.Fd #define SQLITE_TESTCTRL_ISINIT
.Fd #define SQLITE_TESTCTRL_SORTER_MMAP
.Fd #define SQLITE_TESTCTRL_IMPOSTER
.Fd #define SQLITE_TESTCTRL_LAST
.Sh DESCRIPTION
These constants are the valid operation code parameters used as the
first argument to sqlite3_test_control().
.Pp
These parameters and their meanings are subject to change without notice.
These values are for testing purposes only.
Applications should not use any of these parameters or the sqlite3_test_control()
interface.
.Sh SEE ALSO
.Xr sqlite3_test_control 3

View File

@ -0,0 +1,65 @@
.Dd March 11, 2017
.Dt SQLITE_TRACE_STMT 3
.Os
.Sh NAME
.Nm SQLITE_TRACE_STMT ,
.Nm SQLITE_TRACE_PROFILE ,
.Nm SQLITE_TRACE_ROW ,
.Nm SQLITE_TRACE_CLOSE
.Nd SQL Trace Event Codes
.Sh SYNOPSIS
.Fd #define SQLITE_TRACE_STMT
.Fd #define SQLITE_TRACE_PROFILE
.Fd #define SQLITE_TRACE_ROW
.Fd #define SQLITE_TRACE_CLOSE
.Sh DESCRIPTION
These constants identify classes of events that can be monitored using
the sqlite3_trace_v2() tracing logic.
The third argument to sqlite3_trace_v2() is an OR-ed
combination of one or more of the following constants.
The first argument to the trace callback is one of the following constants.
.Pp
New tracing constants may be added in future releases.
.Pp
A trace callback has four arguments: xCallback(T,C,P,X).
The T argument is one of the integer type codes above.
The C argument is a copy of the context pointer passed in as the fourth
argument to sqlite3_trace_v2().
The P and X arguments are pointers whose meanings depend on T.
.Bl -tag -width Ds
.It SQLITE_TRACE_STMT
An SQLITE_TRACE_STMT callback is invoked when a prepared statement
first begins running and possibly at other times during the execution
of the prepared statement, such as at the start of each trigger subprogram.
The P argument is a pointer to the prepared statement.
The X argument is a pointer to a string which is the unexpanded SQL
text of the prepared statement or an SQL comment that indicates the
invocation of a trigger.
The callback can compute the same text that would have been returned
by the legacy sqlite3_trace() interface by using the
X argument when X begins with "--" and invoking sqlite3_expanded_sql(P)
otherwise.
.It SQLITE_TRACE_PROFILE
An SQLITE_TRACE_PROFILE callback provides approximately the same information
as is provided by the sqlite3_profile() callback.
The P argument is a pointer to the prepared statement
and the X argument points to a 64-bit integer which is the estimated
of the number of nanosecond that the prepared statement took to run.
The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.
.It SQLITE_TRACE_ROW
An SQLITE_TRACE_ROW callback is invoked whenever a prepared statement
generates a single row of result.
The P argument is a pointer to the prepared statement
and the X argument is unused.
.It SQLITE_TRACE_CLOSE
An SQLITE_TRACE_CLOSE callback is invoked when a database connection
closes.
The P argument is a pointer to the database connection
object and the X argument is unused.
.El
.Pp
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_trace 3 ,
.Xr sqlite3_trace_v2 3

View File

@ -0,0 +1,21 @@
.Dd March 11, 2017
.Dt SQLITE_UTF8 3
.Os
.Sh NAME
.Nm SQLITE_UTF8 ,
.Nm SQLITE_UTF16LE ,
.Nm SQLITE_UTF16BE ,
.Nm SQLITE_UTF16 ,
.Nm SQLITE_ANY ,
.Nm SQLITE_UTF16_ALIGNED
.Nd Text Encodings
.Sh SYNOPSIS
.Fd #define SQLITE_UTF8
.Fd #define SQLITE_UTF16LE
.Fd #define SQLITE_UTF16BE
.Fd #define SQLITE_UTF16
.Fd #define SQLITE_ANY
.Fd #define SQLITE_UTF16_ALIGNED
.Sh DESCRIPTION
These constant define integer codes that represent the various text
encodings supported by SQLite.

View File

@ -0,0 +1,36 @@
.Dd March 11, 2017
.Dt SQLITE_VERSION 3
.Os
.Sh NAME
.Nm SQLITE_VERSION ,
.Nm SQLITE_VERSION_NUMBER ,
.Nm SQLITE_SOURCE_ID
.Nd Compile-Time Library Version Numbers
.Sh SYNOPSIS
.Fd #define SQLITE_VERSION
.Fd #define SQLITE_VERSION_NUMBER
.Fd #define SQLITE_SOURCE_ID
.Sh DESCRIPTION
The SQLITE_VERSION C preprocessor macro in the sqlite3.h
header evaluates to a string literal that is the SQLite version in
the format "X.Y.Z" where X is the major version number (always 3 for
SQLite3) and Y is the minor version number and Z is the release number.
The SQLITE_VERSION_NUMBER C preprocessor macro
resolves to an integer with the value (X*1000000 + Y*1000 + Z) where
X, Y, and Z are the same numbers used in SQLITE_VERSION.
The SQLITE_VERSION_NUMBER for any given release of SQLite will also
be larger than the release from which it is derived.
Either Y will be held constant and Z will be incremented or else Y
will be incremented and Z will be reset to zero.
.Pp
Since version 3.6.18 (dateof:3.6.18), SQLite
source code has been stored in the <a href="http://www.fossil-scm.org/">Fossil
configuration management system</a>.
The SQLITE_SOURCE_ID macro evaluates to a string which identifies a
particular check-in of SQLite within its configuration management system.
The SQLITE_SOURCE_ID string contains the date and time of the check-in
(UTC) and an SHA1 hash of the entire source tree.
.Pp
.Sh SEE ALSO
.Xr sqlite3_version 3 ,
.Xr SQLITE_VERSION 3

View File

@ -0,0 +1,49 @@
.Dd March 11, 2017
.Dt SQLITE_VTAB_CONSTRAINT_SUPPORT 3
.Os
.Sh NAME
.Nm SQLITE_VTAB_CONSTRAINT_SUPPORT
.Nd Virtual Table Configuration Options
.Sh SYNOPSIS
.Fd #define SQLITE_VTAB_CONSTRAINT_SUPPORT
.Sh DESCRIPTION
These macros define the various options to the sqlite3_vtab_config()
interface that virtual table implementations can use to
customize and optimize their behavior.
.Bl -tag -width Ds
.It SQLITE_VTAB_CONSTRAINT_SUPPORT Calls of the form sqlite3_vtab_config(db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X)
are supported, where X is an integer.
If X is zero, then the virtual table whose xCreate
or xConnect method invoked sqlite3_vtab_config()
does not support constraints.
In this configuration (which is the default) if a call to the xUpdate
method returns SQLITE_CONSTRAINT, then the entire
statement is rolled back as if OR ABORT had been specified
as part of the users SQL statement, regardless of the actual ON CONFLICT
mode specified.
.Pp
If X is non-zero, then the virtual table implementation guarantees
that if xUpdate returns SQLITE_CONSTRAINT,
it will do so before any modifications to internal or persistent data
structures have been made.
If the ON CONFLICT mode is ABORT, FAIL, IGNORE or ROLLBACK,
SQLite is able to roll back a statement or database transaction, and
abandon or continue processing the current SQL statement as appropriate.
If the ON CONFLICT mode is REPLACE and the xUpdate method returns
SQLITE_CONSTRAINT, SQLite handles this as if the ON
CONFLICT mode had been ABORT.
.Pp
Virtual table implementations that are required to handle OR REPLACE
must do so within the xUpdate method.
If a call to the sqlite3_vtab_on_conflict()
function indicates that the current ON CONFLICT policy is REPLACE,
the virtual table implementation should silently replace the appropriate
rows within the xUpdate callback and return SQLITE_OK.
Or, if this is not possible, it may return SQLITE_CONSTRAINT, in which
case SQLite falls back to OR ABORT constraint handling.
.El
.Pp
.Sh SEE ALSO
.Xr sqlite3_vtab_config 3 ,
.Xr sqlite3_vtab_on_conflict 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,25 @@
.Dd March 11, 2017
.Dt SQLITE3 3
.Os
.Sh NAME
.Nm sqlite3
.Nd Database Connection Handle
.Sh SYNOPSIS
.Vt typedef struct sqlite3 sqlite3;
.Sh DESCRIPTION
Each open SQLite database is represented by a pointer to an instance
of the opaque structure named "sqlite3".
It is useful to think of an sqlite3 pointer as an object.
The sqlite3_open(), sqlite3_open16(),
and sqlite3_open_v2() interfaces are its constructors,
and sqlite3_close() and sqlite3_close_v2()
are its destructors.
There are many other interfaces (such as sqlite3_prepare_v2(),
sqlite3_create_function(), and sqlite3_busy_timeout()
to name but three) that are methods on an sqlite3 object.
.Sh SEE ALSO
.Xr sqlite3_busy_timeout 3 ,
.Xr sqlite3_close 3 ,
.Xr sqlite3_create_function 3 ,
.Xr sqlite3_open 3 ,
.Xr sqlite3_prepare 3

View File

@ -0,0 +1,54 @@
.Dd March 11, 2017
.Dt SQLITE3_AGGREGATE_CONTEXT 3
.Os
.Sh NAME
.Nm sqlite3_aggregate_context
.Nd Obtain Aggregate Function Context
.Sh SYNOPSIS
.Ft void *
.Fo sqlite3_aggregate_context
.Fa "sqlite3_context*"
.Fa "int nBytes"
.Fc
.Sh DESCRIPTION
Implementations of aggregate SQL functions use this routine to allocate
memory for storing their state.
.Pp
The first time the sqlite3_aggregate_context(C,N) routine is called
for a particular aggregate function, SQLite allocates N of memory,
zeroes out that memory, and returns a pointer to the new memory.
On second and subsequent calls to sqlite3_aggregate_context() for the
same aggregate function instance, the same buffer is returned.
Sqlite3_aggregate_context() is normally called once for each invocation
of the xStep callback and then one last time when the xFinal callback
is invoked.
When no rows match an aggregate query, the xStep() callback of the
aggregate function implementation is never called and xFinal() is called
exactly once.
In those cases, sqlite3_aggregate_context() might be called for the
first time from within xFinal().
.Pp
The sqlite3_aggregate_context(C,N) routine returns a NULL pointer when
first called if N is less than or equal to zero or if a memory allocate
error occurs.
.Pp
The amount of space allocated by sqlite3_aggregate_context(C,N) is
determined by the N parameter on first successful call.
Changing the value of N in subsequent call to sqlite3_aggregate_context()
within the same aggregate function instance will not resize the memory
allocation.
Within the xFinal callback, it is customary to set N=0 in calls to
sqlite3_aggregate_context(C,N) so that no pointless memory allocations
occur.
.Pp
SQLite automatically frees the memory allocated by sqlite3_aggregate_context()
when the aggregate query concludes.
.Pp
The first parameter must be a copy of the SQL function context
that is the first parameter to the xStep or xFinal callback routine
that implements the aggregate function.
.Pp
This routine must be called from the same thread in which the aggregate
SQL function is running.
.Sh SEE ALSO
.Xr sqlite3_context 3

View File

@ -0,0 +1,46 @@
.Dd March 11, 2017
.Dt SQLITE3_AGGREGATE_COUNT 3
.Os
.Sh NAME
.Nm sqlite3_aggregate_count ,
.Nm sqlite3_expired ,
.Nm sqlite3_transfer_bindings ,
.Nm sqlite3_global_recover ,
.Nm sqlite3_thread_cleanup ,
.Nm sqlite3_memory_alarm
.Nd Deprecated Functions
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_aggregate_count
.Fa "sqlite3_context*"
.Fc
.Ft int
.Fo sqlite3_expired
.Fa "sqlite3_stmt*"
.Fc
.Ft int
.Fo sqlite3_transfer_bindings
.Fa "sqlite3_stmt*"
.Fa "sqlite3_stmt*"
.Fc
.Ft int
.Fo sqlite3_global_recover
.Fa "void"
.Fc
.Ft void
.Fo sqlite3_thread_cleanup
.Fa "void"
.Fc
.Ft int
.Fo sqlite3_memory_alarm
.Fa "void(*)(void*,sqlite3_int64,int)"
.Fa "void*"
.Fa "sqlite3_int64"
.Fc
.Sh DESCRIPTION
These functions are deprecated.
In order to maintain backwards compatibility with older code, these
functions continue to be supported.
However, new applications should avoid the use of these functions.
To encourage programmers to avoid these functions, we will not explain
what they do.

View File

@ -0,0 +1,13 @@
.Dd March 11, 2017
.Dt SQLITE3_API_ROUTINES 3
.Os
.Sh NAME
.Nm sqlite3_api_routines
.Nd Loadable Extension Thunk
.Sh SYNOPSIS
.Vt typedef struct sqlite3_api_routines sqlite3_api_routines;
.Sh DESCRIPTION
A pointer to the opaque sqlite3_api_routines structure is passed as
the third parameter to entry points of loadable extensions.
This structure must be typedefed in order to work around compiler warnings
on some platforms.

View File

@ -0,0 +1,52 @@
.Dd March 11, 2017
.Dt SQLITE3_AUTO_EXTENSION 3
.Os
.Sh NAME
.Nm sqlite3_auto_extension
.Nd Automatically Load Statically Linked Extensions
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_auto_extension
.Fa "void(*xEntryPoint)(void)"
.Fc
.Sh DESCRIPTION
This interface causes the xEntryPoint() function to be invoked for
each new database connection that is created.
The idea here is that xEntryPoint() is the entry point for a statically
linked SQLite extension that is to be automatically
loaded into all new database connections.
.Pp
Even though the function prototype shows that xEntryPoint() takes no
arguments and returns void, SQLite invokes xEntryPoint() with three
arguments and expects an integer result as if the signature of the
entry point where as follows:
.Bd -ragged
.Bd -literal
int xEntryPoint( sqlite3 *db, const char **pzErrMsg,
const struct sqlite3_api_routines *pThunk );
.Ed
.Pp
.Ed
.Pp
If the xEntryPoint routine encounters an error, it should make *pzErrMsg
point to an appropriate error message (obtained from sqlite3_mprintf())
and return an appropriate error code.
SQLite ensures that *pzErrMsg is NULL before calling the xEntryPoint().
SQLite will invoke sqlite3_free() on *pzErrMsg after
xEntryPoint() returns.
If any xEntryPoint() returns an error, the sqlite3_open(),
sqlite3_open16(), or sqlite3_open_v2()
call that provoked the xEntryPoint() will fail.
.Pp
Calling sqlite3_auto_extension(X) with an entry point X that is already
on the list of automatic extensions is a harmless no-op.
No entry point will be called more than once for each database connection
that is opened.
.Pp
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_cancel_auto_extension 3 ,
.Xr sqlite3_malloc 3 ,
.Xr sqlite3_mprintf 3 ,
.Xr sqlite3_open 3 ,
.Xr sqlite3_reset_auto_extension 3

View File

@ -0,0 +1,16 @@
.Dd March 11, 2017
.Dt SQLITE3_BACKUP 3
.Os
.Sh NAME
.Nm sqlite3_backup
.Nd Online Backup Object
.Sh SYNOPSIS
.Vt typedef struct sqlite3_backup sqlite3_backup;
.Sh DESCRIPTION
The sqlite3_backup object records state information about an ongoing
online backup operation.
The sqlite3_backup object is created by a call to sqlite3_backup_init()
and is destroyed by a call to sqlite3_backup_finish().
.Pp
.Sh SEE ALSO
.Xr sqlite3_backup_init 3

View File

@ -0,0 +1,235 @@
.Dd March 11, 2017
.Dt SQLITE3_BACKUP_INIT 3
.Os
.Sh NAME
.Nm sqlite3_backup_init ,
.Nm sqlite3_backup_step ,
.Nm sqlite3_backup_finish ,
.Nm sqlite3_backup_remaining ,
.Nm sqlite3_backup_pagecount
.Nd Online Backup API.
.Sh SYNOPSIS
.Ft sqlite3_backup *
.Fo sqlite3_backup_init
.Fa "sqlite3 *pDest"
.Fa "const char *zDestName"
.Fa "sqlite3 *pSource"
.Fa "const char *zSourceName "
.Fc
.Ft int
.Fo sqlite3_backup_step
.Fa "sqlite3_backup *p"
.Fa "int nPage"
.Fc
.Ft int
.Fo sqlite3_backup_finish
.Fa "sqlite3_backup *p"
.Fc
.Ft int
.Fo sqlite3_backup_remaining
.Fa "sqlite3_backup *p"
.Fc
.Ft int
.Fo sqlite3_backup_pagecount
.Fa "sqlite3_backup *p"
.Fc
.Sh DESCRIPTION
The backup API copies the content of one database into another.
It is useful either for creating backups of databases or for copying
in-memory databases to or from persistent files.
.Pp
SQLite holds a write transaction open on the destination database file
for the duration of the backup operation.
The source database is read-locked only while it is being read; it
is not locked continuously for the entire backup operation.
Thus, the backup may be performed on a live source database without
preventing other database connections from reading or writing to the
source database while the backup is underway.
.Pp
To perform a backup operation:
.Bl -enum
.It
\fBsqlite3_backup_init()\fP is called once to initialize the backup,
.It
\fBsqlite3_backup_step()\fP is called one or more times to transfer the data
between the two databases, and finally
.It
\fBsqlite3_backup_finish()\fP is called to release all resources associated
with the backup operation.
.El
.Pp
There should be exactly one call to sqlite3_backup_finish() for each
successful call to sqlite3_backup_init().
.Pp
\fBsqlite3_backup_init()\fP
.Pp
The D and N arguments to sqlite3_backup_init(D,N,S,M) are the database connection
associated with the destination database and the database name, respectively.
The database name is "main" for the main database, "temp" for the temporary
database, or the name specified after the AS keyword in an ATTACH
statement for an attached database.
The S and M arguments passed to sqlite3_backup_init(D,N,S,M) identify
the database connection and database name of the
source database, respectively.
The source and destination database connections
(parameters S and D) must be different or else sqlite3_backup_init(D,N,S,M)
will fail with an error.
.Pp
A call to sqlite3_backup_init() will fail, returning NULL, if there
is already a read or read-write transaction open on the destination
database.
.Pp
If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
returned and an error code and error message are stored in the destination
database connection D.
The error code and message for the failed call to sqlite3_backup_init()
can be retrieved using the sqlite3_errcode(), sqlite3_errmsg(),
and/or sqlite3_errmsg16() functions.
A successful call to sqlite3_backup_init() returns a pointer to an
sqlite3_backup object.
The sqlite3_backup object may be used with the sqlite3_backup_step()
and sqlite3_backup_finish() functions to perform the specified backup
operation.
.Pp
\fBsqlite3_backup_step()\fP
.Pp
Function sqlite3_backup_step(B,N) will copy up to N pages between the
source and destination databases specified by sqlite3_backup
object B.
If N is negative, all remaining source pages are copied.
If sqlite3_backup_step(B,N) successfully copies N pages and there are
still more pages to be copied, then the function returns SQLITE_OK.
If sqlite3_backup_step(B,N) successfully finishes copying all pages
from source to destination, then it returns SQLITE_DONE.
If an error occurs while running sqlite3_backup_step(B,N), then an
error code is returned.
As well as SQLITE_OK and SQLITE_DONE, a call to
sqlite3_backup_step() may return SQLITE_READONLY, SQLITE_NOMEM,
SQLITE_BUSY, SQLITE_LOCKED, or an SQLITE_IOERR_XXX
extended error code.
.Pp
The sqlite3_backup_step() might return SQLITE_READONLY
if
.Bl -enum
.It
the destination database was opened read-only, or
.It
the destination database is using write-ahead-log journaling and the
destination and source page sizes differ, or
.It
the destination database is an in-memory database and the destination
and source page sizes differ.
.El
.Pp
If sqlite3_backup_step() cannot obtain a required file-system lock,
then the busy-handler function is invoked (if
one is specified).
If the busy-handler returns non-zero before the lock is available,
then SQLITE_BUSY is returned to the caller.
In this case the call to sqlite3_backup_step() can be retried later.
If the source database connection is being used
to write to the source database when sqlite3_backup_step() is called,
then SQLITE_LOCKED is returned immediately.
Again, in this case the call to sqlite3_backup_step() can be retried
later on.
If SQLITE_IOERR_XXX, SQLITE_NOMEM, or
SQLITE_READONLY is returned, then there is no point
in retrying the call to sqlite3_backup_step().
These errors are considered fatal.
The application must accept that the backup operation has failed and
pass the backup operation handle to the sqlite3_backup_finish() to
release associated resources.
.Pp
The first call to sqlite3_backup_step() obtains an exclusive lock on
the destination file.
The exclusive lock is not released until either sqlite3_backup_finish()
is called or the backup operation is complete and sqlite3_backup_step()
returns SQLITE_DONE.
Every call to sqlite3_backup_step() obtains a shared lock
on the source database that lasts for the duration of the sqlite3_backup_step()
call.
Because the source database is not locked between calls to sqlite3_backup_step(),
the source database may be modified mid-way through the backup process.
If the source database is modified by an external process or via a
database connection other than the one being used by the backup operation,
then the backup will be automatically restarted by the next call to
sqlite3_backup_step().
If the source database is modified by the using the same database connection
as is used by the backup operation, then the backup database is automatically
updated at the same time.
.Pp
\fBsqlite3_backup_finish()\fP
.Pp
When sqlite3_backup_step() has returned SQLITE_DONE, or
when the application wishes to abandon the backup operation, the application
should destroy the sqlite3_backup by passing it to sqlite3_backup_finish().
The sqlite3_backup_finish() interfaces releases all resources associated
with the sqlite3_backup object.
If sqlite3_backup_step() has not yet returned SQLITE_DONE,
then any active write-transaction on the destination database is rolled
back.
The sqlite3_backup object is invalid and may not be used
following a call to sqlite3_backup_finish().
.Pp
The value returned by sqlite3_backup_finish is SQLITE_OK if
no sqlite3_backup_step() errors occurred, regardless or whether or
not sqlite3_backup_step() completed.
If an out-of-memory condition or IO error occurred during any prior
sqlite3_backup_step() call on the same sqlite3_backup
object, then sqlite3_backup_finish() returns the corresponding error code.
.Pp
A return of SQLITE_BUSY or SQLITE_LOCKED from
sqlite3_backup_step() is not a permanent error and does not affect
the return value of sqlite3_backup_finish().
.Pp
\fBsqlite3_backup_remaining() and sqlite3_backup_pagecount()\fP
.Pp
The sqlite3_backup_remaining() routine returns the number of pages
still to be backed up at the conclusion of the most recent sqlite3_backup_step().
The sqlite3_backup_pagecount() routine returns the total number of
pages in the source database at the conclusion of the most recent sqlite3_backup_step().
The values returned by these functions are only updated by sqlite3_backup_step().
If the source database is modified in a way that changes the size of
the source database or the number of pages remaining, those changes
are not reflected in the output of sqlite3_backup_pagecount() and sqlite3_backup_remaining()
until after the next sqlite3_backup_step().
.Pp
\fBConcurrent Usage of Database Handles\fP
.Pp
The source database connection may be used by the
application for other purposes while a backup operation is underway
or being initialized.
If SQLite is compiled and configured to support threadsafe database
connections, then the source database connection may be used concurrently
from within other threads.
.Pp
However, the application must guarantee that the destination database connection
is not passed to any other API (by any thread) after sqlite3_backup_init()
is called and before the corresponding call to sqlite3_backup_finish().
SQLite does not currently check to see if the application incorrectly
accesses the destination database connection and
so no error code is reported, but the operations may malfunction nevertheless.
Use of the destination database connection while a backup is in progress
might also also cause a mutex deadlock.
.Pp
If running in shared cache mode, the application must
guarantee that the shared cache used by the destination database is
not accessed while the backup is running.
In practice this means that the application must guarantee that the
disk file being backed up to is not accessed by any connection within
the process, not just the specific connection that was passed to sqlite3_backup_init().
.Pp
The sqlite3_backup object itself is partially threadsafe.
Multiple threads may safely make multiple concurrent calls to sqlite3_backup_step().
However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
APIs are not strictly speaking threadsafe.
If they are invoked at the same time as another thread is invoking
sqlite3_backup_step() it is possible that they return invalid values.
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_backup 3 ,
.Xr sqlite3_busy_handler 3 ,
.Xr sqlite3_errcode 3 ,
.Xr SQLITE_OK 3 ,
.Xr SQLITE_IOERR_READ 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,224 @@
.Dd March 11, 2017
.Dt SQLITE3_BIND_BLOB 3
.Os
.Sh NAME
.Nm sqlite3_bind_blob ,
.Nm sqlite3_bind_blob64 ,
.Nm sqlite3_bind_double ,
.Nm sqlite3_bind_int ,
.Nm sqlite3_bind_int64 ,
.Nm sqlite3_bind_null ,
.Nm sqlite3_bind_text ,
.Nm sqlite3_bind_text16 ,
.Nm sqlite3_bind_text64 ,
.Nm sqlite3_bind_value ,
.Nm sqlite3_bind_zeroblob ,
.Nm sqlite3_bind_zeroblob64
.Nd Binding Values To Prepared Statements
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_bind_blob
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "const void*"
.Fa "int n"
.Fa "void(*)(void*)"
.Fc
.Ft int
.Fo sqlite3_bind_blob64
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "const void*"
.Fa "sqlite3_uint64"
.Fa "void(*)(void*)"
.Fc
.Ft int
.Fo sqlite3_bind_double
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "double"
.Fc
.Ft int
.Fo sqlite3_bind_int
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "int"
.Fc
.Ft int
.Fo sqlite3_bind_int64
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "sqlite3_int64"
.Fc
.Ft int
.Fo sqlite3_bind_null
.Fa "sqlite3_stmt*"
.Fa "int"
.Fc
.Ft int
.Fo sqlite3_bind_text
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "const char*"
.Fa "int"
.Fa "void(*)(void*)"
.Fc
.Ft int
.Fo sqlite3_bind_text16
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "const void*"
.Fa "int"
.Fa "void(*)(void*)"
.Fc
.Ft int
.Fo sqlite3_bind_text64
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "const char*"
.Fa "sqlite3_uint64"
.Fa "void(*)(void*)"
.Fa "unsigned char encoding"
.Fc
.Ft int
.Fo sqlite3_bind_value
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "const sqlite3_value*"
.Fc
.Ft int
.Fo sqlite3_bind_zeroblob
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "int n"
.Fc
.Ft int
.Fo sqlite3_bind_zeroblob64
.Fa "sqlite3_stmt*"
.Fa "int"
.Fa "sqlite3_uint64"
.Fc
.Sh DESCRIPTION
In the SQL statement text input to sqlite3_prepare_v2()
and its variants, literals may be replaced by a parameter
that matches one of following templates:
.Bl -bullet
.It
?
.It
?NNN
.It
:VVV
.It
@VVV
.It
$VVV
.El
.Pp
In the templates above, NNN represents an integer literal, and VVV
represents an alphanumeric identifier.
The values of these parameters (also called "host parameter names"
or "SQL parameters") can be set using the sqlite3_bind_*() routines
defined here.
.Pp
The first argument to the sqlite3_bind_*() routines is always a pointer
to the sqlite3_stmt object returned from sqlite3_prepare_v2()
or its variants.
.Pp
The second argument is the index of the SQL parameter to be set.
The leftmost SQL parameter has an index of 1.
When the same named SQL parameter is used more than once, second and
subsequent occurrences have the same index as the first occurrence.
The index for named parameters can be looked up using the sqlite3_bind_parameter_index()
API if desired.
The index for "?NNN" parameters is the value of NNN.
The NNN value must be between 1 and the sqlite3_limit()
parameter SQLITE_LIMIT_VARIABLE_NUMBER
(default value: 999).
.Pp
The third argument is the value to bind to the parameter.
If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16()
or sqlite3_bind_blob() is a NULL pointer then the fourth parameter
is ignored and the end result is the same as sqlite3_bind_null().
.Pp
In those routines that have a fourth argument, its value is the number
of bytes in the parameter.
To be clear: the value is the number of <u>bytes</u> in the value,
not the number of characters.
If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16()
is negative, then the length of the string is the number of bytes up
to the first zero terminator.
If the fourth parameter to sqlite3_bind_blob() is negative, then the
behavior is undefined.
If a non-negative fourth parameter is provided to sqlite3_bind_text()
or sqlite3_bind_text16() or sqlite3_bind_text64() then that parameter
must be the byte offset where the NUL terminator would occur assuming
the string were NUL terminated.
If any NUL characters occur at byte offsets less than the value of
the fourth parameter then the resulting string value will contain embedded
NULs.
The result of expressions involving strings with embedded NULs is undefined.
.Pp
The fifth argument to the BLOB and string binding interfaces is a destructor
used to dispose of the BLOB or string after SQLite has finished with
it.
The destructor is called to dispose of the BLOB or string even if the
call to bind API fails.
If the fifth argument is the special value SQLITE_STATIC,
then SQLite assumes that the information is in static, unmanaged space
and does not need to be freed.
If the fifth argument has the value SQLITE_TRANSIENT,
then SQLite makes its own private copy of the data immediately, before
the sqlite3_bind_*() routine returns.
.Pp
The sixth argument to sqlite3_bind_text64() must be one of SQLITE_UTF8,
SQLITE_UTF16, SQLITE_UTF16BE, or SQLITE_UTF16LE
to specify the encoding of the text in the third parameter.
If the sixth argument to sqlite3_bind_text64() is not one of the allowed
values shown above, or if the text encoding is different from the encoding
specified by the sixth parameter, then the behavior is undefined.
.Pp
The sqlite3_bind_zeroblob() routine binds a BLOB of length N that is
filled with zeroes.
A zeroblob uses a fixed amount of memory (just an integer to hold its
size) while it is being processed.
Zeroblobs are intended to serve as placeholders for BLOBs whose content
is later written using incremental BLOB I/O routines.
A negative value for the zeroblob results in a zero-length BLOB.
.Pp
If any of the sqlite3_bind_*() routines are called with a NULL pointer
for the prepared statement or with a prepared statement
for which sqlite3_step() has been called more recently
than sqlite3_reset(), then the call will return SQLITE_MISUSE.
If any sqlite3_bind_() routine is passed a prepared statement
that has been finalized, the result is undefined and probably harmful.
.Pp
Bindings are not cleared by the sqlite3_reset() routine.
Unbound parameters are interpreted as NULL.
.Pp
The sqlite3_bind_* routines return SQLITE_OK on success or
an error code if anything goes wrong.
SQLITE_TOOBIG might be returned if the size of a string
or BLOB exceeds limits imposed by sqlite3_limit(SQLITE_LIMIT_LENGTH)
or SQLITE_MAX_LENGTH.
SQLITE_RANGE is returned if the parameter index is out
of range.
SQLITE_NOMEM is returned if malloc() fails.
.Pp
.Sh SEE ALSO
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_bind_parameter_count 3 ,
.Xr sqlite3_bind_parameter_index 3 ,
.Xr sqlite3_bind_parameter_name 3 ,
.Xr sqlite3_blob_open 3 ,
.Xr sqlite3_limit 3 ,
.Xr sqlite3_prepare 3 ,
.Xr sqlite3_reset 3 ,
.Xr sqlite3_step 3 ,
.Xr sqlite3_stmt 3 ,
.Xr SQLITE_LIMIT_LENGTH 3 ,
.Xr SQLITE_OK 3 ,
.Xr sqlite3_destructor_type 3 ,
.Xr SQLITE_OK 3 ,
.Xr sqlite3_destructor_type 3 ,
.Xr SQLITE_UTF8 3

View File

@ -0,0 +1,29 @@
.Dd March 11, 2017
.Dt SQLITE3_BIND_PARAMETER_COUNT 3
.Os
.Sh NAME
.Nm sqlite3_bind_parameter_count
.Nd Number Of SQL Parameters
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_bind_parameter_count
.Fa "sqlite3_stmt*"
.Fc
.Sh DESCRIPTION
This routine can be used to find the number of SQL parameters
in a prepared statement.
SQL parameters are tokens of the form "?", "?NNN", ":AAA", "$AAA",
or "@AAA" that serve as placeholders for values that are bound
to the parameters at a later time.
.Pp
This routine actually returns the index of the largest (rightmost)
parameter.
For all forms except ?NNN, this will correspond to the number of unique
parameters.
If parameters of the ?NNN form are used, there may be gaps in the list.
.Pp
.Sh SEE ALSO
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_bind_blob 3 ,
.Xr sqlite3_bind_parameter_index 3 ,
.Xr sqlite3_bind_parameter_name 3

View File

@ -0,0 +1,25 @@
.Dd March 11, 2017
.Dt SQLITE3_BIND_PARAMETER_INDEX 3
.Os
.Sh NAME
.Nm sqlite3_bind_parameter_index
.Nd Index Of A Parameter With A Given Name
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_bind_parameter_index
.Fa "sqlite3_stmt*"
.Fa "const char *zName"
.Fc
.Sh DESCRIPTION
Return the index of an SQL parameter given its name.
The index value returned is suitable for use as the second parameter
to sqlite3_bind().
A zero is returned if no matching parameter is found.
The parameter name must be given in UTF-8 even if the original statement
was prepared from UTF-16 text using sqlite3_prepare16_v2().
.Pp
.Sh SEE ALSO
.Xr sqlite3_bind_blob 3 ,
.Xr sqlite3_bind_parameter_count 3 ,
.Xr sqlite3_bind_parameter_name 3 ,
.Xr sqlite3_prepare 3

View File

@ -0,0 +1,37 @@
.Dd March 11, 2017
.Dt SQLITE3_BIND_PARAMETER_NAME 3
.Os
.Sh NAME
.Nm sqlite3_bind_parameter_name
.Nd Name Of A Host Parameter
.Sh SYNOPSIS
.Ft const char *
.Fo sqlite3_bind_parameter_name
.Fa "sqlite3_stmt*"
.Fa "int"
.Fc
.Sh DESCRIPTION
The sqlite3_bind_parameter_name(P,N) interface returns the name of
the N-th SQL parameter in the prepared statement
P.
SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA" have
a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA" respectively.
In other words, the initial ":" or "$" or "@" or "?" is included as
part of the name.
Parameters of the form "?" without a following integer have no name
and are referred to as "nameless" or "anonymous parameters".
.Pp
The first host parameter has an index of 1, not 0.
.Pp
If the value N is out of range or if the N-th parameter is nameless,
then NULL is returned.
The returned string is always in UTF-8 encoding even if the named parameter
was originally specified as UTF-16 in sqlite3_prepare16()
or sqlite3_prepare16_v2().
.Pp
.Sh SEE ALSO
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_bind_blob 3 ,
.Xr sqlite3_bind_parameter_count 3 ,
.Xr sqlite3_bind_parameter_index 3 ,
.Xr sqlite3_prepare 3

View File

@ -0,0 +1,23 @@
.Dd March 11, 2017
.Dt SQLITE3_BLOB 3
.Os
.Sh NAME
.Nm sqlite3_blob
.Nd A Handle To An Open BLOB
.Sh SYNOPSIS
.Vt typedef struct sqlite3_blob sqlite3_blob;
.Sh DESCRIPTION
An instance of this object represents an open BLOB on which incremental BLOB I/O
can be performed.
Objects of this type are created by sqlite3_blob_open()
and destroyed by sqlite3_blob_close().
The sqlite3_blob_read() and sqlite3_blob_write()
interfaces can be used to read or write small subsections of the BLOB.
The sqlite3_blob_bytes() interface returns the
size of the BLOB in bytes.
.Sh SEE ALSO
.Xr sqlite3_blob_bytes 3 ,
.Xr sqlite3_blob_close 3 ,
.Xr sqlite3_blob_open 3 ,
.Xr sqlite3_blob_read 3 ,
.Xr sqlite3_blob_write 3

View File

@ -0,0 +1,26 @@
.Dd March 11, 2017
.Dt SQLITE3_BLOB_BYTES 3
.Os
.Sh NAME
.Nm sqlite3_blob_bytes
.Nd Return The Size Of An Open BLOB
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_blob_bytes
.Fa "sqlite3_blob *"
.Fc
.Sh DESCRIPTION
Returns the size in bytes of the BLOB accessible via the successfully
opened BLOB handle in its only argument.
The incremental blob I/O routines can only read or overwriting existing
blob content; they cannot change the size of a blob.
.Pp
This routine only works on a BLOB handle which has been
created by a prior successful call to sqlite3_blob_open()
and which has not been closed by sqlite3_blob_close().
Passing any other pointer in to this routine results in undefined and
probably undesirable behavior.
.Sh SEE ALSO
.Xr sqlite3_blob 3 ,
.Xr sqlite3_blob_close 3 ,
.Xr sqlite3_blob_open 3

View File

@ -0,0 +1,34 @@
.Dd March 11, 2017
.Dt SQLITE3_BLOB_CLOSE 3
.Os
.Sh NAME
.Nm sqlite3_blob_close
.Nd Close A BLOB Handle
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_blob_close
.Fa "sqlite3_blob *"
.Fc
.Sh DESCRIPTION
This function closes an open BLOB handle.
The BLOB handle is closed unconditionally.
Even if this routine returns an error code, the handle is still closed.
.Pp
If the blob handle being closed was opened for read-write access, and
if the database is in auto-commit mode and there are no other open
read-write blob handles or active write statements, the current transaction
is committed.
If an error occurs while committing the transaction, an error code
is returned and the transaction rolled back.
.Pp
Calling this function with an argument that is not a NULL pointer or
an open blob handle results in undefined behaviour.
Calling this routine with a null pointer (such as would be returned
by a failed call to sqlite3_blob_open()) is a harmless
no-op.
Otherwise, if this function is passed a valid open blob handle, the
values returned by the sqlite3_errcode() and sqlite3_errmsg() functions
are set before returning.
.Sh SEE ALSO
.Xr sqlite3_blob 3 ,
.Xr sqlite3_blob_open 3

View File

@ -0,0 +1,116 @@
.Dd March 11, 2017
.Dt SQLITE3_BLOB_OPEN 3
.Os
.Sh NAME
.Nm sqlite3_blob_open
.Nd Open A BLOB For Incremental I/O
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_blob_open
.Fa "sqlite3*"
.Fa "const char *zDb"
.Fa "const char *zTable"
.Fa "const char *zColumn"
.Fa "sqlite3_int64 iRow"
.Fa "int flags"
.Fa "sqlite3_blob **ppBlob "
.Fc
.Sh DESCRIPTION
This interfaces opens a handle to the BLOB located in row iRow,
column zColumn, table zTable in database zDb; in other words, the same
BLOB that would be selected by:
.Bd -literal
SELECT zColumn FROM zDb.zTable WHERE rowid = iRow;
.Ed
.Pp
Parameter zDb is not the filename that contains the database, but rather
the symbolic name of the database.
For attached databases, this is the name that appears after the AS
keyword in the ATTACH statement.
For the main database file, the database name is "main".
For TEMP tables, the database name is "temp".
.Pp
If the flags parameter is non-zero, then the BLOB is opened for read
and write access.
If the flags parameter is zero, the BLOB is opened for read-only access.
.Pp
On success, SQLITE_OK is returned and the new BLOB handle
is stored in *ppBlob.
Otherwise an error code is returned and, unless the error
code is SQLITE_MISUSE, *ppBlob is set to NULL.
This means that, provided the API is not misused, it is always safe
to call sqlite3_blob_close() on *ppBlob after this
function it returns.
.Pp
This function fails with SQLITE_ERROR if any of the following are true:
.Bl -bullet
.It
Database zDb does not exist ,
.It
Table zTable does not exist within database zDb ,
.It
Table zTable is a WITHOUT ROWID table ,
.It
Column zColumn does not exist ,
.It
Row iRow is not present in the table ,
.It
The specified column of row iRow contains a value that is not a TEXT
or BLOB value ,
.It
Column zColumn is part of an index, PRIMARY KEY or UNIQUE constraint
and the blob is being opened for read/write access ,
.It
Foreign key constraints are enabled, column
zColumn is part of a child key definition and the blob is
being opened for read/write access .
.El
.Pp
Unless it returns SQLITE_MISUSE, this function sets the database connection
error code and message accessible via sqlite3_errcode()
and sqlite3_errmsg() and related functions.
.Pp
A BLOB referenced by sqlite3_blob_open() may be read using the sqlite3_blob_read()
interface and modified by using sqlite3_blob_write().
The BLOB handle can be moved to a different row of the same
table using the sqlite3_blob_reopen() interface.
However, the column, table, or database of a BLOB handle
cannot be changed after the BLOB handle is opened.
.Pp
If the row that a BLOB handle points to is modified by an UPDATE,
DELETE, or by ON CONFLICT side-effects then the BLOB
handle is marked as "expired".
This is true if any column of the row is changed, even a column other
than the one the BLOB handle is open on.
Calls to sqlite3_blob_read() and sqlite3_blob_write()
for an expired BLOB handle fail with a return code of SQLITE_ABORT.
Changes written into a BLOB prior to the BLOB expiring are not rolled
back by the expiration of the BLOB.
Such changes will eventually commit if the transaction continues to
completion.
.Pp
Use the sqlite3_blob_bytes() interface to determine
the size of the opened blob.
The size of a blob may not be changed by this interface.
Use the UPDATE SQL command to change the size of a blob.
.Pp
The sqlite3_bind_zeroblob() and sqlite3_result_zeroblob()
interfaces and the built-in zeroblob SQL function may be used
to create a zero-filled blob to read or write using the incremental-blob
interface.
.Pp
To avoid a resource leak, every open BLOB handle should
eventually be released by a call to sqlite3_blob_close().
.Pp
.Sh SEE ALSO
.Xr sqlite3_blob 3 ,
.Xr sqlite3 3 ,
.Xr sqlite3_bind_blob 3 ,
.Xr sqlite3_blob_bytes 3 ,
.Xr sqlite3_blob_close 3 ,
.Xr sqlite3_blob_read 3 ,
.Xr sqlite3_blob_reopen 3 ,
.Xr sqlite3_blob_write 3 ,
.Xr sqlite3_errcode 3 ,
.Xr sqlite3_result_blob 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,47 @@
.Dd March 11, 2017
.Dt SQLITE3_BLOB_READ 3
.Os
.Sh NAME
.Nm sqlite3_blob_read
.Nd Read Data From A BLOB Incrementally
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_blob_read
.Fa "sqlite3_blob *"
.Fa "void *Z"
.Fa "int N"
.Fa "int iOffset"
.Fc
.Sh DESCRIPTION
This function is used to read data from an open BLOB handle
into a caller-supplied buffer.
N bytes of data are copied into buffer Z from the open BLOB, starting
at offset iOffset.
.Pp
If offset iOffset is less than N bytes from the end of the BLOB, SQLITE_ERROR
is returned and no data is read.
If N or iOffset is less than zero, SQLITE_ERROR is returned
and no data is read.
The size of the blob (and hence the maximum value of N+iOffset) can
be determined using the sqlite3_blob_bytes() interface.
.Pp
An attempt to read from an expired BLOB handle fails with
an error code of SQLITE_ABORT.
.Pp
On success, sqlite3_blob_read() returns SQLITE_OK.
Otherwise, an error code or an extended error code
is returned.
.Pp
This routine only works on a BLOB handle which has been
created by a prior successful call to sqlite3_blob_open()
and which has not been closed by sqlite3_blob_close().
Passing any other pointer in to this routine results in undefined and
probably undesirable behavior.
.Pp
.Sh SEE ALSO
.Xr sqlite3_blob 3 ,
.Xr sqlite3_blob_bytes 3 ,
.Xr sqlite3_blob_close 3 ,
.Xr sqlite3_blob_open 3 ,
.Xr sqlite3_blob_write 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,42 @@
.Dd March 11, 2017
.Dt SQLITE3_BLOB_REOPEN 3
.Os
.Sh NAME
.Nm sqlite3_blob_reopen
.Nd Move a BLOB Handle to a New Row
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_blob_reopen
.Fa "sqlite3_blob *"
.Fa "sqlite3_int64"
.Fc
.Sh DESCRIPTION
This function is used to move an existing BLOB handle so
that it points to a different row of the same database table.
The new row is identified by the rowid value passed as the second argument.
Only the row can be changed.
The database, table and column on which the blob handle is open remain
the same.
Moving an existing BLOB handle to a new row is faster than
closing the existing handle and opening a new one.
.Pp
The new row must meet the same criteria as for sqlite3_blob_open()
- it must exist and there must be either a blob or text value stored
in the nominated column.
If the new row is not present in the table, or if it does not contain
a blob or text value, or if another error occurs, an SQLite error code
is returned and the blob handle is considered aborted.
All subsequent calls to sqlite3_blob_read(), sqlite3_blob_write()
or sqlite3_blob_reopen() on an aborted blob handle
immediately return SQLITE_ABORT.
Calling sqlite3_blob_bytes() on an aborted blob
handle always returns zero.
.Pp
This function sets the database handle error code and message.
.Sh SEE ALSO
.Xr sqlite3_blob 3 ,
.Xr sqlite3_blob_bytes 3 ,
.Xr sqlite3_blob_open 3 ,
.Xr sqlite3_blob_read 3 ,
.Xr sqlite3_blob_reopen 3 ,
.Xr sqlite3_blob_write 3

View File

@ -0,0 +1,62 @@
.Dd March 11, 2017
.Dt SQLITE3_BLOB_WRITE 3
.Os
.Sh NAME
.Nm sqlite3_blob_write
.Nd Write Data Into A BLOB Incrementally
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_blob_write
.Fa "sqlite3_blob *"
.Fa "const void *z"
.Fa "int n"
.Fa "int iOffset"
.Fc
.Sh DESCRIPTION
This function is used to write data into an open BLOB handle
from a caller-supplied buffer.
N bytes of data are copied from the buffer Z into the open BLOB, starting
at offset iOffset.
.Pp
On success, sqlite3_blob_write() returns SQLITE_OK.
Otherwise, an error code or an extended error code
is returned.
Unless SQLITE_MISUSE is returned, this function sets the database connection
error code and message accessible via sqlite3_errcode()
and sqlite3_errmsg() and related functions.
.Pp
If the BLOB handle passed as the first argument was not
opened for writing (the flags parameter to sqlite3_blob_open()
was zero), this function returns SQLITE_READONLY.
.Pp
This function may only modify the contents of the BLOB; it is not possible
to increase the size of a BLOB using this API.
If offset iOffset is less than N bytes from the end of the BLOB, SQLITE_ERROR
is returned and no data is written.
The size of the BLOB (and hence the maximum value of N+iOffset) can
be determined using the sqlite3_blob_bytes() interface.
If N or iOffset are less than zero SQLITE_ERROR is returned
and no data is written.
.Pp
An attempt to write to an expired BLOB handle fails with
an error code of SQLITE_ABORT.
Writes to the BLOB that occurred before the BLOB handle
expired are not rolled back by the expiration of the handle, though
of course those changes might have been overwritten by the statement
that expired the BLOB handle or by other independent statements.
.Pp
This routine only works on a BLOB handle which has been
created by a prior successful call to sqlite3_blob_open()
and which has not been closed by sqlite3_blob_close().
Passing any other pointer in to this routine results in undefined and
probably undesirable behavior.
.Pp
.Sh SEE ALSO
.Xr sqlite3_blob 3 ,
.Xr sqlite3 3 ,
.Xr sqlite3_blob_bytes 3 ,
.Xr sqlite3_blob_close 3 ,
.Xr sqlite3_blob_open 3 ,
.Xr sqlite3_blob_read 3 ,
.Xr sqlite3_errcode 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,73 @@
.Dd March 11, 2017
.Dt SQLITE3_BUSY_HANDLER 3
.Os
.Sh NAME
.Nm sqlite3_busy_handler
.Nd Register A Callback To Handle SQLITE_BUSY Errors
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_busy_handler
.Fa "sqlite3*"
.Fa "int(*)(void*,int)"
.Fa "void*"
.Fc
.Sh DESCRIPTION
The sqlite3_busy_handler(D,X,P) routine sets a callback function X
that might be invoked with argument P whenever an attempt is made to
access a database table associated with database connection
D when another thread or process has the table locked.
The sqlite3_busy_handler() interface is used to implement sqlite3_busy_timeout()
and PRAGMA busy_timeout.
.Pp
If the busy callback is NULL, then SQLITE_BUSY is returned
immediately upon encountering the lock.
If the busy callback is not NULL, then the callback might be invoked
with two arguments.
.Pp
The first argument to the busy handler is a copy of the void* pointer
which is the third argument to sqlite3_busy_handler().
The second argument to the busy handler callback is the number of times
that the busy handler has been invoked previously for the same locking
event.
If the busy callback returns 0, then no additional attempts are made
to access the database and SQLITE_BUSY is returned to the
application.
If the callback returns non-zero, then another attempt is made to access
the database and the cycle repeats.
.Pp
The presence of a busy handler does not guarantee that it will be invoked
when there is lock contention.
If SQLite determines that invoking the busy handler could result in
a deadlock, it will go ahead and return SQLITE_BUSY to the
application instead of invoking the busy handler.
Consider a scenario where one process is holding a read lock that it
is trying to promote to a reserved lock and a second process is holding
a reserved lock that it is trying to promote to an exclusive lock.
The first process cannot proceed because it is blocked by the second
and the second process cannot proceed because it is blocked by the
first.
If both processes invoke the busy handlers, neither will make any progress.
Therefore, SQLite returns SQLITE_BUSY for the first process,
hoping that this will induce the first process to release its read
lock and allow the second process to proceed.
.Pp
The default busy callback is NULL.
.Pp
There can only be a single busy handler defined for each database connection.
Setting a new busy handler clears any previously set handler.
Note that calling sqlite3_busy_timeout() or evaluating
PRAGMA busy_timeout=N will change the busy handler
and thus clear any previously set busy handler.
.Pp
The busy callback should not take any actions which modify the database
connection that invoked the busy handler.
In other words, the busy handler is not reentrant.
Any such actions result in undefined behavior.
.Pp
A busy handler must not close the database connection or prepared statement
that invoked the busy handler.
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_busy_timeout 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,33 @@
.Dd March 11, 2017
.Dt SQLITE3_BUSY_TIMEOUT 3
.Os
.Sh NAME
.Nm sqlite3_busy_timeout
.Nd Set A Busy Timeout
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_busy_timeout
.Fa "sqlite3*"
.Fa "int ms"
.Fc
.Sh DESCRIPTION
This routine sets a busy handler that sleeps for a specified
amount of time when a table is locked.
The handler will sleep multiple times until at least "ms" milliseconds
of sleeping have accumulated.
After at least "ms" milliseconds of sleeping, the handler returns 0
which causes sqlite3_step() to return SQLITE_BUSY.
.Pp
Calling this routine with an argument less than or equal to zero turns
off all busy handlers.
.Pp
There can only be a single busy handler for a particular database connection
at any given moment.
If another busy handler was defined (using sqlite3_busy_handler())
prior to calling this routine, that other busy handler is cleared.
.Pp
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_busy_handler 3 ,
.Xr sqlite3_step 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,18 @@
.Dd March 11, 2017
.Dt SQLITE3_CANCEL_AUTO_EXTENSION 3
.Os
.Sh NAME
.Nm sqlite3_cancel_auto_extension
.Nd Cancel Automatic Extension Loading
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_cancel_auto_extension
.Fa "void(*xEntryPoint)(void)"
.Fc
.Sh DESCRIPTION
The sqlite3_cancel_auto_extension(X)
interface unregisters the initialization routine X that was registered
using a prior call to sqlite3_auto_extension(X).
The sqlite3_cancel_auto_extension(X)
routine returns 1 if initialization routine X was successfully unregistered
and it returns 0 if X was not on the list of initialization routines.

View File

@ -0,0 +1,9 @@
.Dd March 11, 2017
.Dt SQLITE3_CHANGEGROUP 3
.Os
.Sh NAME
.Nm sqlite3_changegroup
.Nd Changegroup Handle
.Sh SYNOPSIS
.Vt typedef struct sqlite3_changegroup sqlite3_changegroup;
.Sh DESCRIPTION

View File

@ -0,0 +1,62 @@
.Dd March 11, 2017
.Dt SQLITE3_CHANGES 3
.Os
.Sh NAME
.Nm sqlite3_changes
.Nd Count The Number Of Rows Modified
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_changes
.Fa "sqlite3*"
.Fc
.Sh DESCRIPTION
This function returns the number of rows modified, inserted or deleted
by the most recently completed INSERT, UPDATE or DELETE statement on
the database connection specified by the only parameter.
Executing any other type of SQL statement does not modify the value
returned by this function.
.Pp
Only changes made directly by the INSERT, UPDATE or DELETE statement
are considered - auxiliary changes caused by triggers, foreign key actions
or REPLACE constraint resolution are not counted.
.Pp
Changes to a view that are intercepted by INSTEAD OF triggers
are not counted.
The value returned by sqlite3_changes() immediately after an INSERT,
UPDATE or DELETE statement run on a view is always zero.
Only changes made to real tables are counted.
.Pp
Things are more complicated if the sqlite3_changes() function is executed
while a trigger program is running.
This may happen if the program uses the changes() SQL function,
or if some other callback function invokes sqlite3_changes() directly.
Essentially:
.Bl -bullet
.It
Before entering a trigger program the value returned by sqlite3_changes()
function is saved.
After the trigger program has finished, the original value is restored.
.It
Within a trigger program each INSERT, UPDATE and DELETE statement sets
the value returned by sqlite3_changes() upon completion as normal.
Of course, this value will not include any changes performed by sub-triggers,
as the sqlite3_changes() value will be saved and restored after each
sub-trigger has run.
.El
.Pp
This means that if the changes() SQL function (or similar) is used
by the first INSERT, UPDATE or DELETE statement within a trigger, it
returns the value as set when the calling statement began executing.
If it is used by the second or subsequent such statement within a trigger
program, the value returned reflects the number of rows modified by
the previous INSERT, UPDATE or DELETE statement within the same trigger.
.Pp
See also the sqlite3_total_changes() interface,
the count_changes pragma, and the changes() SQL function.
.Pp
If a separate thread makes changes on the same database connection
while sqlite3_changes() is running then the value
returned is unpredictable and not meaningful.
.Sh SEE ALSO
.Xr sqlite3_changes 3 ,
.Xr sqlite3_total_changes 3

View File

@ -0,0 +1,9 @@
.Dd March 11, 2017
.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

View File

@ -0,0 +1,19 @@
.Dd March 11, 2017
.Dt SQLITE3_CLEAR_BINDINGS 3
.Os
.Sh NAME
.Nm sqlite3_clear_bindings
.Nd Reset All Bindings On A Prepared Statement
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_clear_bindings
.Fa "sqlite3_stmt*"
.Fc
.Sh DESCRIPTION
Contrary to the intuition of many, sqlite3_reset() does
not reset the bindings on a prepared statement.
Use this routine to reset all host parameters to NULL.
.Sh SEE ALSO
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_bind_blob 3 ,
.Xr sqlite3_reset 3

View File

@ -0,0 +1,66 @@
.Dd March 11, 2017
.Dt SQLITE3_CLOSE 3
.Os
.Sh NAME
.Nm sqlite3_close ,
.Nm sqlite3_close_v2
.Nd Closing A Database Connection
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_close
.Fa "sqlite3*"
.Fc
.Ft int
.Fo sqlite3_close_v2
.Fa "sqlite3*"
.Fc
.Sh DESCRIPTION
The sqlite3_close() and sqlite3_close_v2() routines are destructors
for the sqlite3 object.
Calls to sqlite3_close() and sqlite3_close_v2() return SQLITE_OK
if the sqlite3 object is successfully destroyed and all associated
resources are deallocated.
.Pp
If the database connection is associated with unfinalized prepared
statements or unfinished sqlite3_backup objects then sqlite3_close()
will leave the database connection open and return SQLITE_BUSY.
If sqlite3_close_v2() is called with unfinalized prepared statements
and/or unfinished sqlite3_backups, then the database connection becomes
an unusable "zombie" which will automatically be deallocated when the
last prepared statement is finalized or the last sqlite3_backup is
finished.
The sqlite3_close_v2() interface is intended for use with host languages
that are garbage collected, and where the order in which destructors
are called is arbitrary.
.Pp
Applications should finalize all prepared statements,
close all BLOB handles, and finish all sqlite3_backup
objects associated with the sqlite3 object prior to attempting
to close the object.
If sqlite3_close_v2() is called on a database connection
that still has outstanding prepared statements,
BLOB handles, and/or sqlite3_backup objects
then it returns SQLITE_OK and the deallocation of resources
is deferred until all prepared statements, BLOB handles,
and sqlite3_backup objects are also destroyed.
.Pp
If an sqlite3 object is destroyed while a transaction is open,
the transaction is automatically rolled back.
.Pp
The C parameter to sqlite3_close(C) and sqlite3_close_v2(C)
must be either a NULL pointer or an sqlite3 object pointer obtained
from sqlite3_open(), sqlite3_open16(),
or sqlite3_open_v2(), and not previously closed.
Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer argument
is a harmless no-op.
.Sh SEE ALSO
.Xr sqlite3_blob 3 ,
.Xr sqlite3 3 ,
.Xr sqlite3_stmt 3 ,
.Xr sqlite3 3 ,
.Xr sqlite3_backup 3 ,
.Xr sqlite3_backup_init 3 ,
.Xr sqlite3_blob_close 3 ,
.Xr sqlite3_finalize 3 ,
.Xr sqlite3_open 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,47 @@
.Dd March 11, 2017
.Dt SQLITE3_COLLATION_NEEDED 3
.Os
.Sh NAME
.Nm sqlite3_collation_needed ,
.Nm sqlite3_collation_needed16
.Nd Collation Needed Callbacks
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_collation_needed
.Fa "sqlite3*"
.Fa "void*"
.Fa "void(*)(void*,sqlite3*,int eTextRep,const char*) "
.Fc
.Ft int
.Fo sqlite3_collation_needed16
.Fa "sqlite3*"
.Fa "void*"
.Fa "void(*)(void*,sqlite3*,int eTextRep,const void*) "
.Fc
.Sh DESCRIPTION
To avoid having to register all collation sequences before a database
can be used, a single callback function may be registered with the
database connection to be invoked whenever an undefined
collation sequence is required.
.Pp
If the function is registered using the sqlite3_collation_needed()
API, then it is passed the names of undefined collation sequences as
strings encoded in UTF-8.
If sqlite3_collation_needed16() is used, the names are passed as UTF-16
in machine native byte order.
A call to either function replaces the existing collation-needed callback.
.Pp
When the callback is invoked, the first argument passed is a copy of
the second argument to sqlite3_collation_needed() or sqlite3_collation_needed16().
The second argument is the database connection.
The third argument is one of SQLITE_UTF8, SQLITE_UTF16BE,
or SQLITE_UTF16LE, indicating the most desirable form
of the collation sequence function required.
The fourth parameter is the name of the required collation sequence.
.Pp
The callback function should register the desired collation using sqlite3_create_collation(),
sqlite3_create_collation16(), or sqlite3_create_collation_v2().
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_create_collation 3 ,
.Xr SQLITE_UTF8 3

View File

@ -0,0 +1,248 @@
.Dd March 11, 2017
.Dt SQLITE3_COLUMN_BLOB 3
.Os
.Sh NAME
.Nm sqlite3_column_blob ,
.Nm sqlite3_column_bytes ,
.Nm sqlite3_column_bytes16 ,
.Nm sqlite3_column_double ,
.Nm sqlite3_column_int ,
.Nm sqlite3_column_int64 ,
.Nm sqlite3_column_text ,
.Nm sqlite3_column_text16 ,
.Nm sqlite3_column_type ,
.Nm sqlite3_column_value
.Nd Result Values From A Query
.Sh SYNOPSIS
.Ft const void *
.Fo sqlite3_column_blob
.Fa "sqlite3_stmt*"
.Fa "int iCol"
.Fc
.Ft int
.Fo sqlite3_column_bytes
.Fa "sqlite3_stmt*"
.Fa "int iCol"
.Fc
.Ft int
.Fo sqlite3_column_bytes16
.Fa "sqlite3_stmt*"
.Fa "int iCol"
.Fc
.Ft double
.Fo sqlite3_column_double
.Fa "sqlite3_stmt*"
.Fa "int iCol"
.Fc
.Ft int
.Fo sqlite3_column_int
.Fa "sqlite3_stmt*"
.Fa "int iCol"
.Fc
.Ft sqlite3_int64
.Fo sqlite3_column_int64
.Fa "sqlite3_stmt*"
.Fa "int iCol"
.Fc
.Ft const unsigned char *
.Fo sqlite3_column_text
.Fa "sqlite3_stmt*"
.Fa "int iCol"
.Fc
.Ft const void *
.Fo sqlite3_column_text16
.Fa "sqlite3_stmt*"
.Fa "int iCol"
.Fc
.Ft int
.Fo sqlite3_column_type
.Fa "sqlite3_stmt*"
.Fa "int iCol"
.Fc
.Ft sqlite3_value *
.Fo sqlite3_column_value
.Fa "sqlite3_stmt*"
.Fa "int iCol"
.Fc
.Sh DESCRIPTION
These routines return information about a single column of the current
result row of a query.
In every case the first argument is a pointer to the prepared statement
that is being evaluated (the sqlite3_stmt* that was returned
from sqlite3_prepare_v2() or one of its variants)
and the second argument is the index of the column for which information
should be returned.
The leftmost column of the result set has the index 0.
The number of columns in the result can be determined using sqlite3_column_count().
.Pp
If the SQL statement does not currently point to a valid row, or if
the column index is out of range, the result is undefined.
These routines may only be called when the most recent call to sqlite3_step()
has returned SQLITE_ROW and neither sqlite3_reset()
nor sqlite3_finalize() have been called subsequently.
If any of these routines are called after sqlite3_reset()
or sqlite3_finalize() or after sqlite3_step()
has returned something other than SQLITE_ROW, the results
are undefined.
If sqlite3_step() or sqlite3_reset() or
sqlite3_finalize() are called from a different thread
while any of these routines are pending, then the results are undefined.
.Pp
The sqlite3_column_type() routine returns the datatype code
for the initial data type of the result column.
The returned value is one of SQLITE_INTEGER, SQLITE_FLOAT,
SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL.
The value returned by sqlite3_column_type() is only meaningful if no
type conversions have occurred as described below.
After a type conversion, the value returned by sqlite3_column_type()
is undefined.
Future versions of SQLite may change the behavior of sqlite3_column_type()
following a type conversion.
.Pp
If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
routine returns the number of bytes in that BLOB or string.
If the result is a UTF-16 string, then sqlite3_column_bytes() converts
the string to UTF-8 and then returns the number of bytes.
If the result is a numeric value then sqlite3_column_bytes() uses sqlite3_snprintf()
to convert that value to a UTF-8 string and returns the number of bytes
in that string.
If the result is NULL, then sqlite3_column_bytes() returns zero.
.Pp
If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16()
routine returns the number of bytes in that BLOB or string.
If the result is a UTF-8 string, then sqlite3_column_bytes16() converts
the string to UTF-16 and then returns the number of bytes.
If the result is a numeric value then sqlite3_column_bytes16() uses
sqlite3_snprintf() to convert that value to a UTF-16
string and returns the number of bytes in that string.
If the result is NULL, then sqlite3_column_bytes16() returns zero.
.Pp
The values returned by sqlite3_column_bytes()
and sqlite3_column_bytes16() do not include
the zero terminators at the end of the string.
For clarity: the values returned by sqlite3_column_bytes()
and sqlite3_column_bytes16() are the number
of bytes in the string, not the number of characters.
.Pp
Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
even empty strings, are always zero-terminated.
The return value from sqlite3_column_blob() for a zero-length BLOB
is a NULL pointer.
.Pp
\fBWarning:\fP The object returned by sqlite3_column_value()
is an unprotected sqlite3_value object.
In a multithreaded environment, an unprotected sqlite3_value object
may only be used safely with sqlite3_bind_value()
and sqlite3_result_value().
If the unprotected sqlite3_value object returned
by sqlite3_column_value() is used in any other
way, including calls to routines like sqlite3_value_int(),
sqlite3_value_text(), or sqlite3_value_bytes(),
the behavior is not threadsafe.
.Pp
These routines attempt to convert the value where appropriate.
For example, if the internal representation is FLOAT and a text result
is requested, sqlite3_snprintf() is used internally
to perform the conversion automatically.
The following table details the conversions that are applied:
.Bd -ragged
<table border="1"> <tr><th> Internal<br>Type <th> Requested<br>Type
<th> Conversion
.Pp
<tr><td> NULL <td> INTEGER <td> Result is 0 <tr><td> NULL
<td> FLOAT <td> Result is 0.0 <tr><td> NULL <td> TEXT
<td> Result is a NULL pointer <tr><td> NULL <td> BLOB <td>
Result is a NULL pointer <tr><td> INTEGER <td> FLOAT <td> Convert
from integer to float <tr><td> INTEGER <td> TEXT <td> ASCII rendering
of the integer <tr><td> INTEGER <td> BLOB <td> Same as INTEGER->TEXT
<tr><td> FLOAT <td> INTEGER <td> CAST to INTEGER <tr><td>
FLOAT <td> TEXT <td> ASCII rendering of the float <tr><td>
FLOAT <td> BLOB <td> CAST to BLOB <tr><td> TEXT <td>
INTEGER <td> CAST to INTEGER <tr><td> TEXT <td> FLOAT
<td> CAST to REAL <tr><td> TEXT <td> BLOB <td> No change
<tr><td> BLOB <td> INTEGER <td> CAST to INTEGER <tr><td>
BLOB <td> FLOAT <td> CAST to REAL <tr><td> BLOB <td>
TEXT <td> Add a zero terminator if needed </table>
.Ed
.Pp
Note that when type conversions occur, pointers returned by prior calls
to sqlite3_column_blob(), sqlite3_column_text(), and/or sqlite3_column_text16()
may be invalidated.
Type conversions and pointer invalidations might occur in the following
cases:
.Bl -bullet
.It
The initial content is a BLOB and sqlite3_column_text() or sqlite3_column_text16()
is called.
A zero-terminator might need to be added to the string.
.It
The initial content is UTF-8 text and sqlite3_column_bytes16() or sqlite3_column_text16()
is called.
The content must be converted to UTF-16.
.It
The initial content is UTF-16 text and sqlite3_column_bytes() or sqlite3_column_text()
is called.
The content must be converted to UTF-8.
.El
.Pp
Conversions between UTF-16be and UTF-16le are always done in place
and do not invalidate a prior pointer, though of course the content
of the buffer that the prior pointer references will have been modified.
Other kinds of conversion are done in place when it is possible, but
sometimes they are not possible and in those cases prior pointers are
invalidated.
.Pp
The safest policy is to invoke these routines in one of the following
ways:
.Bl -bullet
.It
sqlite3_column_text() followed by sqlite3_column_bytes()
.It
sqlite3_column_blob() followed by sqlite3_column_bytes()
.It
sqlite3_column_text16() followed by sqlite3_column_bytes16()
.El
.Pp
In other words, you should call sqlite3_column_text(), sqlite3_column_blob(),
or sqlite3_column_text16() first to force the result into the desired
format, then invoke sqlite3_column_bytes() or sqlite3_column_bytes16()
to find the size of the result.
Do not mix calls to sqlite3_column_text() or sqlite3_column_blob()
with calls to sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()
with calls to sqlite3_column_bytes().
.Pp
The pointers returned are valid until a type conversion occurs as described
above, or until sqlite3_step() or sqlite3_reset()
or sqlite3_finalize() is called.
The memory space used to hold strings and BLOBs is freed automatically.
Do <em>not</em> pass the pointers returned from sqlite3_column_blob(),
sqlite3_column_text(), etc.
into sqlite3_free().
.Pp
If a memory allocation error occurs during the evaluation of any of
these routines, a default value is returned.
The default value is either the integer 0, the floating point number
0.0, or a NULL pointer.
Subsequent calls to sqlite3_errcode() will return
SQLITE_NOMEM.
.Sh SEE ALSO
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_bind_blob 3 ,
.Xr sqlite3_column_blob 3 ,
.Xr sqlite3_column_count 3 ,
.Xr sqlite3_column_blob 3 ,
.Xr sqlite3_errcode 3 ,
.Xr sqlite3_finalize 3 ,
.Xr sqlite3_malloc 3 ,
.Xr sqlite3_prepare 3 ,
.Xr sqlite3_reset 3 ,
.Xr sqlite3_result_blob 3 ,
.Xr sqlite3_mprintf 3 ,
.Xr sqlite3_step 3 ,
.Xr sqlite3_value_blob 3 ,
.Xr SQLITE_INTEGER 3 ,
.Xr SQLITE_OK 3 ,
.Xr SQLITE_INTEGER 3 ,
.Xr SQLITE_OK 3 ,
.Xr SQLITE_INTEGER 3 ,
.Xr sqlite3_value 3

View File

@ -0,0 +1,24 @@
.Dd March 11, 2017
.Dt SQLITE3_COLUMN_COUNT 3
.Os
.Sh NAME
.Nm sqlite3_column_count
.Nd Number Of Columns In A Result Set
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_column_count
.Fa "sqlite3_stmt *pStmt"
.Fc
.Sh DESCRIPTION
Return the number of columns in the result set returned by the prepared statement.
If this routine returns 0, that means the prepared statement
returns no data (for example an UPDATE).
However, just because this routine returns a positive number does not
mean that one or more rows of data will be returned.
A SELECT statement will always have a positive sqlite3_column_count()
but depending on the WHERE clause constraints and the table content,
it might return no rows.
.Pp
.Sh SEE ALSO
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_data_count 3

View File

@ -0,0 +1,89 @@
.Dd March 11, 2017
.Dt SQLITE3_COLUMN_DATABASE_NAME 3
.Os
.Sh NAME
.Nm sqlite3_column_database_name ,
.Nm sqlite3_column_database_name16 ,
.Nm sqlite3_column_table_name ,
.Nm sqlite3_column_table_name16 ,
.Nm sqlite3_column_origin_name ,
.Nm sqlite3_column_origin_name16
.Nd Source Of Data In A Query Result
.Sh SYNOPSIS
.Ft const char *
.Fo sqlite3_column_database_name
.Fa "sqlite3_stmt*"
.Fa "int"
.Fc
.Ft const void *
.Fo sqlite3_column_database_name16
.Fa "sqlite3_stmt*"
.Fa "int"
.Fc
.Ft const char *
.Fo sqlite3_column_table_name
.Fa "sqlite3_stmt*"
.Fa "int"
.Fc
.Ft const void *
.Fo sqlite3_column_table_name16
.Fa "sqlite3_stmt*"
.Fa "int"
.Fc
.Ft const char *
.Fo sqlite3_column_origin_name
.Fa "sqlite3_stmt*"
.Fa "int"
.Fc
.Ft const void *
.Fo sqlite3_column_origin_name16
.Fa "sqlite3_stmt*"
.Fa "int"
.Fc
.Sh DESCRIPTION
These routines provide a means to determine the database, table, and
table column that is the origin of a particular result column in SELECT
statement.
The name of the database or table or column can be returned as either
a UTF-8 or UTF-16 string.
The _database_ routines return the database name, the _table_ routines
return the table name, and the origin_ routines return the column name.
The returned string is valid until the prepared statement
is destroyed using sqlite3_finalize() or until the
statement is automatically reprepared by the first call to sqlite3_step()
for a particular run or until the same information is requested again
in a different encoding.
.Pp
The names returned are the original un-aliased names of the database,
table, and column.
.Pp
The first argument to these interfaces is a prepared statement.
These functions return information about the Nth result column returned
by the statement, where N is the second function argument.
The left-most column is column 0 for these routines.
.Pp
If the Nth column returned by the statement is an expression or subquery
and is not a column value, then all of these functions return NULL.
These routine might also return NULL if a memory allocation error occurs.
Otherwise, they return the name of the attached database, table, or
column that query result column was extracted from.
.Pp
As with all other SQLite APIs, those whose names end with "16" return
UTF-16 encoded strings and the other functions return UTF-8.
.Pp
These APIs are only available if the library was compiled with the
SQLITE_ENABLE_COLUMN_METADATA C-preprocessor
symbol.
.Pp
If two or more threads call one or more of these routines against the
same prepared statement and column at the same time then the results
are undefined.
.Pp
If two or more threads call one or more column metadata interfaces
for the same prepared statement and result column
at the same time then the results are undefined.
.Sh SEE ALSO
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_column_database_name 3 ,
.Xr sqlite3_finalize 3 ,
.Xr sqlite3_step 3

View File

@ -0,0 +1,47 @@
.Dd March 11, 2017
.Dt SQLITE3_COLUMN_DECLTYPE 3
.Os
.Sh NAME
.Nm sqlite3_column_decltype ,
.Nm sqlite3_column_decltype16
.Nd Declared Datatype Of A Query Result
.Sh SYNOPSIS
.Ft const char *
.Fo sqlite3_column_decltype
.Fa "sqlite3_stmt*"
.Fa "int"
.Fc
.Ft const void *
.Fo sqlite3_column_decltype16
.Fa "sqlite3_stmt*"
.Fa "int"
.Fc
.Sh DESCRIPTION
The first parameter is a prepared statement.
If this statement is a SELECT statement and the Nth column of
the returned result set of that SELECT is a table column (not
an expression or subquery) then the declared type of the table column
is returned.
If the Nth column of the result set is an expression or subquery, then
a NULL pointer is returned.
The returned string is always UTF-8 encoded.
.Pp
For example, given the database schema:
.Pp
CREATE TABLE t1(c1 VARIANT);
.Pp
and the following statement to be compiled:
.Pp
SELECT c1 + 1, c1 FROM t1;
.Pp
this routine would return the string "VARIANT" for the second result
column (i==1), and a NULL pointer for the first result column (i==0).
.Pp
SQLite uses dynamic run-time typing.
So just because a column is declared to contain a particular type does
not mean that the data stored in that column is of the declared type.
SQLite is strongly typed, but the typing is dynamic not static.
Type is associated with individual values, not with the containers
used to hold those values.
.Sh SEE ALSO
.Xr sqlite3_stmt 3

View File

@ -0,0 +1,47 @@
.Dd March 11, 2017
.Dt SQLITE3_COLUMN_NAME 3
.Os
.Sh NAME
.Nm sqlite3_column_name ,
.Nm sqlite3_column_name16
.Nd Column Names In A Result Set
.Sh SYNOPSIS
.Ft const char *
.Fo sqlite3_column_name
.Fa "sqlite3_stmt*"
.Fa "int N"
.Fc
.Ft const void *
.Fo sqlite3_column_name16
.Fa "sqlite3_stmt*"
.Fa "int N"
.Fc
.Sh DESCRIPTION
These routines return the name assigned to a particular column in the
result set of a SELECT statement.
The sqlite3_column_name() interface returns a pointer to a zero-terminated
UTF-8 string and sqlite3_column_name16() returns a pointer to a zero-terminated
UTF-16 string.
The first parameter is the prepared statement that
implements the SELECT statement.
The second parameter is the column number.
The leftmost column is number 0.
.Pp
The returned string pointer is valid until either the prepared statement
is destroyed by sqlite3_finalize() or until the statement
is automatically reprepared by the first call to sqlite3_step()
for a particular run or until the next call to sqlite3_column_name()
or sqlite3_column_name16() on the same column.
.Pp
If sqlite3_malloc() fails during the processing of either routine (for
example during a conversion from UTF-8 to UTF-16) then a NULL pointer
is returned.
.Pp
The name of a result column is the value of the "AS" clause for that
column, if there is an AS clause.
If there is no AS clause then the name of the column is unspecified
and may change from one release of SQLite to the next.
.Sh SEE ALSO
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_finalize 3 ,
.Xr sqlite3_step 3

View File

@ -0,0 +1,70 @@
.Dd March 11, 2017
.Dt SQLITE3_COMMIT_HOOK 3
.Os
.Sh NAME
.Nm sqlite3_commit_hook ,
.Nm sqlite3_rollback_hook
.Nd Commit And Rollback Notification Callbacks
.Sh SYNOPSIS
.Ft void *
.Fo sqlite3_commit_hook
.Fa "sqlite3*"
.Fa "int(*)(void*)"
.Fa "void*"
.Fc
.Ft void *
.Fo sqlite3_rollback_hook
.Fa "sqlite3*"
.Fa "void(*)(void *)"
.Fa "void*"
.Fc
.Sh DESCRIPTION
The sqlite3_commit_hook() interface registers a callback function to
be invoked whenever a transaction is committed.
Any callback set by a previous call to sqlite3_commit_hook() for the
same database connection is overridden.
The sqlite3_rollback_hook() interface registers a callback function
to be invoked whenever a transaction is rolled back.
Any callback set by a previous call to sqlite3_rollback_hook() for
the same database connection is overridden.
The pArg argument is passed through to the callback.
If the callback on a commit hook function returns non-zero, then the
commit is converted into a rollback.
.Pp
The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions
return the P argument from the previous call of the same function on
the same database connection D, or NULL for the
first call for each function on D.
.Pp
The commit and rollback hook callbacks are not reentrant.
The callback implementation must not do anything that will modify the
database connection that invoked the callback.
Any actions to modify the database connection must be deferred until
after the completion of the sqlite3_step() call that
triggered the commit or rollback hook in the first place.
Note that running any other SQL statements, including SELECT statements,
or merely calling sqlite3_prepare_v2() and sqlite3_step()
will modify the database connections for the meaning of "modify" in
this paragraph.
.Pp
Registering a NULL function disables the callback.
.Pp
When the commit hook callback routine returns zero, the COMMIT
operation is allowed to continue normally.
If the commit hook returns non-zero, then the COMMIT is converted
into a ROLLBACK.
The rollback hook is invoked on a rollback that results from a commit
hook returning non-zero, just as it would be with any other rollback.
.Pp
For the purposes of this API, a transaction is said to have been rolled
back if an explicit "ROLLBACK" statement is executed, or an error or
constraint causes an implicit rollback to occur.
The rollback callback is not invoked if a transaction is automatically
rolled back because the database connection is closed.
.Pp
See also the sqlite3_update_hook() interface.
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_prepare 3 ,
.Xr sqlite3_step 3 ,
.Xr sqlite3_update_hook 3

View File

@ -0,0 +1,31 @@
.Dd March 11, 2017
.Dt SQLITE3_COMPILEOPTION_USED 3
.Os
.Sh NAME
.Nm sqlite3_compileoption_used ,
.Nm sqlite3_compileoption_get
.Nd Run-Time Library Compilation Options Diagnostics
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_compileoption_used
.Fa "const char *zOptName"
.Fc
.Ft const char *
.Fo sqlite3_compileoption_get
.Fa "int N"
.Fc
.Sh DESCRIPTION
The sqlite3_compileoption_used() function returns 0 or 1 indicating
whether the specified option was defined at compile time.
The SQLITE_ prefix may be omitted from the option name passed to sqlite3_compileoption_used().
.Pp
The sqlite3_compileoption_get() function allows iterating over the
list of options that were defined at compile time by returning the
N-th compile time option string.
If N is out of range, sqlite3_compileoption_get() returns a NULL pointer.
The SQLITE_ prefix is omitted from any strings returned by sqlite3_compileoption_get().
.Pp
Support for the diagnostic functions sqlite3_compileoption_used() and
sqlite3_compileoption_get() may be omitted by specifying the SQLITE_OMIT_COMPILEOPTION_DIAGS
option at compile time.
.Pp

View File

@ -0,0 +1,51 @@
.Dd March 11, 2017
.Dt SQLITE3_COMPLETE 3
.Os
.Sh NAME
.Nm sqlite3_complete ,
.Nm sqlite3_complete16
.Nd Determine If An SQL Statement Is Complete
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_complete
.Fa "const char *sql"
.Fc
.Ft int
.Fo sqlite3_complete16
.Fa "const void *sql"
.Fc
.Sh DESCRIPTION
These routines are useful during command-line input to determine if
the currently entered text seems to form a complete SQL statement or
if additional input is needed before sending the text into SQLite for
parsing.
These routines return 1 if the input string appears to be a complete
SQL statement.
A statement is judged to be complete if it ends with a semicolon token
and is not a prefix of a well-formed CREATE TRIGGER statement.
Semicolons that are embedded within string literals or quoted identifier
names or comments are not independent tokens (they are part of the
token in which they are embedded) and thus do not count as a statement
terminator.
Whitespace and comments that follow the final semicolon are ignored.
.Pp
These routines return 0 if the statement is incomplete.
If a memory allocation fails, then SQLITE_NOMEM is returned.
.Pp
These routines do not parse the SQL statements thus will not detect
syntactically incorrect SQL.
.Pp
If SQLite has not been initialized using sqlite3_initialize()
prior to invoking sqlite3_complete16() then sqlite3_initialize() is
invoked automatically by sqlite3_complete16().
If that initialization fails, then the return value from sqlite3_complete16()
will be non-zero regardless of whether or not the input SQL is complete.
.Pp
The input to sqlite3_complete() must be a zero-terminated
UTF-8 string.
.Pp
The input to sqlite3_complete16() must be a zero-terminated
UTF-16 string in native byte order.
.Sh SEE ALSO
.Xr sqlite3_complete 3 ,
.Xr sqlite3_initialize 3

View File

@ -0,0 +1,45 @@
.Dd March 11, 2017
.Dt SQLITE3_CONFIG 3
.Os
.Sh NAME
.Nm sqlite3_config
.Nd Configuring The SQLite Library
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_config
.Fa "int"
.Fa "..."
.Fc
.Sh DESCRIPTION
The sqlite3_config() interface is used to make global configuration
changes to SQLite in order to tune SQLite to the specific needs of
the application.
The default configuration is recommended for most applications and
so this routine is usually not necessary.
It is provided to support rare applications with unusual needs.
.Pp
\fBThe sqlite3_config() interface is not threadsafe.
The application must ensure that no other SQLite interfaces are invoked
by other threads while sqlite3_config() is running.\fP
.Pp
The sqlite3_config() interface may only be invoked prior to library
initialization using sqlite3_initialize() or after
shutdown by sqlite3_shutdown().
If sqlite3_config() is called after sqlite3_initialize()
and before sqlite3_shutdown() then it will return
SQLITE_MISUSE.
Note, however, that sqlite3_config() can be called as part of the
implementation of an application-defined sqlite3_os_init().
.Pp
The first argument to sqlite3_config() is an integer configuration option
that determines what property of SQLite is to be configured.
Subsequent arguments vary depending on the configuration option
in the first argument.
.Pp
When a configuration option is set, sqlite3_config() returns SQLITE_OK.
If the option is unknown or SQLite is unable to set the option then
this routine returns a non-zero error code.
.Sh SEE ALSO
.Xr SQLITE_CONFIG_SINGLETHREAD 3 ,
.Xr sqlite3_initialize 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,25 @@
.Dd March 11, 2017
.Dt SQLITE3_CONTEXT 3
.Os
.Sh NAME
.Nm sqlite3_context
.Nd SQL Function Context Object
.Sh SYNOPSIS
.Vt typedef struct sqlite3_context sqlite3_context;
.Sh DESCRIPTION
The context in which an SQL function executes is stored in an sqlite3_context
object.
A pointer to an sqlite3_context object is always first parameter to
application-defined SQL functions.
The application-defined SQL function implementation will pass this
pointer through into calls to sqlite3_result(), sqlite3_aggregate_context(),
sqlite3_user_data(), sqlite3_context_db_handle(),
sqlite3_get_auxdata(), and/or sqlite3_set_auxdata().
.Sh SEE ALSO
.Xr sqlite3_create_function 3 ,
.Xr sqlite3_aggregate_context 3 ,
.Xr sqlite3_context_db_handle 3 ,
.Xr sqlite3_get_auxdata 3 ,
.Xr sqlite3_result_blob 3 ,
.Xr sqlite3_get_auxdata 3 ,
.Xr sqlite3_user_data 3

View File

@ -0,0 +1,19 @@
.Dd March 11, 2017
.Dt SQLITE3_CONTEXT_DB_HANDLE 3
.Os
.Sh NAME
.Nm sqlite3_context_db_handle
.Nd Database Connection For Functions
.Sh SYNOPSIS
.Ft sqlite3 *
.Fo sqlite3_context_db_handle
.Fa "sqlite3_context*"
.Fc
.Sh DESCRIPTION
The sqlite3_context_db_handle() interface returns a copy of the pointer
to the database connection (the 1st parameter) of
the sqlite3_create_function() and sqlite3_create_function16()
routines that originally registered the application defined function.
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_create_function 3

View File

@ -0,0 +1,128 @@
.Dd March 11, 2017
.Dt SQLITE3_CREATE_COLLATION 3
.Os
.Sh NAME
.Nm sqlite3_create_collation ,
.Nm sqlite3_create_collation_v2 ,
.Nm sqlite3_create_collation16
.Nd Define New Collating Sequences
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_create_collation
.Fa "sqlite3*"
.Fa "const char *zName"
.Fa "int eTextRep"
.Fa "void *pArg"
.Fa "int(*xCompare)(void*,int,const void*,int,const void*) "
.Fc
.Ft int
.Fo sqlite3_create_collation_v2
.Fa "sqlite3*"
.Fa "const char *zName"
.Fa "int eTextRep"
.Fa "void *pArg"
.Fa "int(*xCompare)(void*,int,const void*,int,const void*)"
.Fa "void(*xDestroy)(void*) "
.Fc
.Ft int
.Fo sqlite3_create_collation16
.Fa "sqlite3*"
.Fa "const void *zName"
.Fa "int eTextRep"
.Fa "void *pArg"
.Fa "int(*xCompare)(void*,int,const void*,int,const void*) "
.Fc
.Sh DESCRIPTION
These functions add, remove, or modify a collation associated
with the database connection specified as the first
argument.
.Pp
The name of the collation is a UTF-8 string for sqlite3_create_collation()
and sqlite3_create_collation_v2() and a UTF-16 string in native byte
order for sqlite3_create_collation16().
Collation names that compare equal according to sqlite3_strnicmp()
are considered to be the same name.
.Pp
The third argument (eTextRep) must be one of the constants:
.Bl -bullet
.It
SQLITE_UTF8,
.It
SQLITE_UTF16LE,
.It
SQLITE_UTF16BE,
.It
SQLITE_UTF16, or
.It
SQLITE_UTF16_ALIGNED.
.El
.Pp
The eTextRep argument determines the encoding of strings passed to
the collating function callback, xCallback.
The SQLITE_UTF16 and SQLITE_UTF16_ALIGNED
values for eTextRep force strings to be UTF16 with native byte order.
The SQLITE_UTF16_ALIGNED value for eTextRep forces
strings to begin on an even byte address.
.Pp
The fourth argument, pArg, is an application data pointer that is passed
through as the first argument to the collating function callback.
.Pp
The fifth argument, xCallback, is a pointer to the collating function.
Multiple collating functions can be registered using the same name
but with different eTextRep parameters and SQLite will use whichever
function requires the least amount of data transformation.
If the xCallback argument is NULL then the collating function is deleted.
When all collating functions having the same name are deleted, that
collation is no longer usable.
.Pp
The collating function callback is invoked with a copy of the pArg
application data pointer and with two strings in the encoding specified
by the eTextRep argument.
The collating function must return an integer that is negative, zero,
or positive if the first string is less than, equal to, or greater
than the second, respectively.
A collating function must always return the same answer given the same
inputs.
If two or more collating functions are registered to the same collation
name (using different eTextRep values) then all must give an equivalent
answer when invoked with equivalent strings.
The collating function must obey the following properties for all strings
A, B, and C:
.Bl -enum
.It
If A==B then B==A.
.It
If A==B and B==C then A==C.
.It
If A<B THEN B>A.
.It
If A<B and B<C then A<C.
.El
.Pp
If a collating function fails any of the above constraints and that
collating function is registered and used, then the behavior of SQLite
is undefined.
.Pp
The sqlite3_create_collation_v2() works like sqlite3_create_collation()
with the addition that the xDestroy callback is invoked on pArg when
the collating function is deleted.
Collating functions are deleted when they are overridden by later calls
to the collation creation functions or when the database connection
is closed using sqlite3_close().
.Pp
The xDestroy callback is <u>not</u> called if the sqlite3_create_collation_v2()
function fails.
Applications that invoke sqlite3_create_collation_v2() with a non-NULL
xDestroy argument should check the return code and dispose of the application
data pointer themselves rather than expecting SQLite to deal with it
for them.
This is different from every other SQLite interface.
The inconsistency is unfortunate but cannot be changed without breaking
backwards compatibility.
.Pp
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_close 3 ,
.Xr sqlite3_collation_needed 3 ,
.Xr sqlite3_stricmp 3 ,
.Xr SQLITE_UTF8 3

View File

@ -0,0 +1,147 @@
.Dd March 11, 2017
.Dt SQLITE3_CREATE_FUNCTION 3
.Os
.Sh NAME
.Nm sqlite3_create_function ,
.Nm sqlite3_create_function16 ,
.Nm sqlite3_create_function_v2
.Nd Create Or Redefine SQL Functions
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_create_function
.Fa "sqlite3 *db"
.Fa "const char *zFunctionName"
.Fa "int nArg"
.Fa "int eTextRep"
.Fa "void *pApp"
.Fa "void (*xFunc)(sqlite3_context*,int,sqlite3_value**)"
.Fa "void (*xStep)(sqlite3_context*,int,sqlite3_value**)"
.Fa "void (*xFinal)(sqlite3_context*) "
.Fc
.Ft int
.Fo sqlite3_create_function16
.Fa "sqlite3 *db"
.Fa "const void *zFunctionName"
.Fa "int nArg"
.Fa "int eTextRep"
.Fa "void *pApp"
.Fa "void (*xFunc)(sqlite3_context*,int,sqlite3_value**)"
.Fa "void (*xStep)(sqlite3_context*,int,sqlite3_value**)"
.Fa "void (*xFinal)(sqlite3_context*) "
.Fc
.Ft int
.Fo sqlite3_create_function_v2
.Fa "sqlite3 *db"
.Fa "const char *zFunctionName"
.Fa "int nArg"
.Fa "int eTextRep"
.Fa "void *pApp"
.Fa "void (*xFunc)(sqlite3_context*,int,sqlite3_value**)"
.Fa "void (*xStep)(sqlite3_context*,int,sqlite3_value**)"
.Fa "void (*xFinal)(sqlite3_context*)"
.Fa "void(*xDestroy)(void*) "
.Fc
.Sh DESCRIPTION
These functions (collectively known as "function creation routines")
are used to add SQL functions or aggregates or to redefine the behavior
of existing SQL functions or aggregates.
The only differences between these routines are the text encoding expected
for the second parameter (the name of the function being created) and
the presence or absence of a destructor callback for the application
data pointer.
.Pp
The first parameter is the database connection to
which the SQL function is to be added.
If an application uses more than one database connection then application-defined
SQL functions must be added to each database connection separately.
.Pp
The second parameter is the name of the SQL function to be created
or redefined.
The length of the name is limited to 255 bytes in a UTF-8 representation,
exclusive of the zero-terminator.
Note that the name length limit is in UTF-8 bytes, not characters nor
UTF-16 bytes.
Any attempt to create a function with a longer name will result in
SQLITE_MISUSE being returned.
.Pp
The third parameter (nArg) is the number of arguments that the SQL
function or aggregate takes.
If this parameter is -1, then the SQL function or aggregate may take
any number of arguments between 0 and the limit set by sqlite3_limit(SQLITE_LIMIT_FUNCTION_ARG).
If the third parameter is less than -1 or greater than 127 then the
behavior is undefined.
.Pp
The fourth parameter, eTextRep, specifies what text encoding
this SQL function prefers for its parameters.
The application should set this parameter to SQLITE_UTF16LE
if the function implementation invokes sqlite3_value_text16le()
on an input, or SQLITE_UTF16BE if the implementation
invokes sqlite3_value_text16be() on an input,
or SQLITE_UTF16 if sqlite3_value_text16()
is used, or SQLITE_UTF8 otherwise.
The same SQL function may be registered multiple times using different
preferred text encodings, with different implementations for each encoding.
When multiple implementations of the same function are available, SQLite
will pick the one that involves the least amount of data conversion.
.Pp
The fourth parameter may optionally be ORed with SQLITE_DETERMINISTIC
to signal that the function will always return the same result given
the same inputs within a single SQL statement.
Most SQL functions are deterministic.
The built-in random() SQL function is an example of a function
that is not deterministic.
The SQLite query planner is able to perform additional optimizations
on deterministic functions, so use of the SQLITE_DETERMINISTIC
flag is recommended where possible.
.Pp
The fifth parameter is an arbitrary pointer.
The implementation of the function can gain access to this pointer
using sqlite3_user_data().
.Pp
The sixth, seventh and eighth parameters, xFunc, xStep and xFinal,
are pointers to C-language functions that implement the SQL function
or aggregate.
A scalar SQL function requires an implementation of the xFunc callback
only; NULL pointers must be passed as the xStep and xFinal parameters.
An aggregate SQL function requires an implementation of xStep and xFinal
and NULL pointer must be passed for xFunc.
To delete an existing SQL function or aggregate, pass NULL pointers
for all three function callbacks.
.Pp
If the ninth parameter to sqlite3_create_function_v2() is not NULL,
then it is destructor for the application data pointer.
The destructor is invoked when the function is deleted, either by being
overloaded or when the database connection closes.
The destructor is also invoked if the call to sqlite3_create_function_v2()
fails.
When the destructor callback of the tenth parameter is invoked, it
is passed a single argument which is a copy of the application data
pointer which was the fifth parameter to sqlite3_create_function_v2().
.Pp
It is permitted to register multiple implementations of the same functions
with the same name but with either differing numbers of arguments or
differing preferred text encodings.
SQLite will use the implementation that most closely matches the way
in which the SQL function is used.
A function implementation with a non-negative nArg parameter is a better
match than a function implementation with a negative nArg.
A function where the preferred text encoding matches the database encoding
is a better match than a function where the encoding is different.
A function where the encoding difference is between UTF16le and UTF16be
is a closer match than a function where the encoding difference is
between UTF8 and UTF16.
.Pp
Built-in functions may be overloaded by new application-defined functions.
.Pp
An application-defined function is permitted to call other SQLite interfaces.
However, such calls must not close the database connection nor finalize
or reset the prepared statement in which the function is running.
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_limit 3 ,
.Xr sqlite3_user_data 3 ,
.Xr sqlite3_value_blob 3 ,
.Xr SQLITE_DETERMINISTIC 3 ,
.Xr SQLITE_LIMIT_LENGTH 3 ,
.Xr SQLITE_OK 3 ,
.Xr SQLITE_UTF8 3

View File

@ -0,0 +1,50 @@
.Dd March 11, 2017
.Dt SQLITE3_CREATE_MODULE 3
.Os
.Sh NAME
.Nm sqlite3_create_module ,
.Nm sqlite3_create_module_v2
.Nd Register A Virtual Table Implementation
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_create_module
.Fa "sqlite3 *db"
.Fa "const char *zName"
.Fa "const sqlite3_module *p"
.Fa "void *pClientData "
.Fc
.Ft int
.Fo sqlite3_create_module_v2
.Fa "sqlite3 *db"
.Fa "const char *zName"
.Fa "const sqlite3_module *p"
.Fa "void *pClientData"
.Fa "void(*xDestroy)(void*) "
.Fc
.Sh DESCRIPTION
These routines are used to register a new virtual table module
name.
Module names must be registered before creating a new virtual table
using the module and before using a preexisting virtual table
for the module.
.Pp
The module name is registered on the database connection
specified by the first parameter.
The name of the module is given by the second parameter.
The third parameter is a pointer to the implementation of the virtual table module.
The fourth parameter is an arbitrary client data pointer that is passed
through into the xCreate and xConnect methods of the
virtual table module when a new virtual table is be being created or
reinitialized.
.Pp
The sqlite3_create_module_v2() interface has a fifth parameter which
is a pointer to a destructor for the pClientData.
SQLite will invoke the destructor function (if it is not NULL) when
SQLite no longer needs the pClientData pointer.
The destructor will also be invoked if the call to sqlite3_create_module_v2()
fails.
The sqlite3_create_module() interface is equivalent to sqlite3_create_module_v2()
with a NULL destructor.
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_module 3

View File

@ -0,0 +1,33 @@
.Dd March 11, 2017
.Dt SQLITE3_DATA_COUNT 3
.Os
.Sh NAME
.Nm sqlite3_data_count
.Nd Number of columns in a result set
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_data_count
.Fa "sqlite3_stmt *pStmt"
.Fc
.Sh DESCRIPTION
The sqlite3_data_count(P) interface returns the number of columns in
the current row of the result set of prepared statement
P.
If prepared statement P does not have results ready to return (via
calls to the sqlite3_column_*() of interfaces)
then sqlite3_data_count(P) returns 0.
The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.
The sqlite3_data_count(P) routine returns 0 if the previous call to
sqlite3_step(P) returned SQLITE_DONE.
The sqlite3_data_count(P) will return non-zero if previous call to
sqlite3_step(P) returned SQLITE_ROW, except in
the case of the PRAGMA incremental_vacuum
where it always returns zero since each step of that multi-step pragma
returns 0 columns of data.
.Pp
.Sh SEE ALSO
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_column_count 3 ,
.Xr sqlite3_column_blob 3 ,
.Xr sqlite3_step 3 ,
.Xr SQLITE_OK 3

View File

@ -0,0 +1,45 @@
.Dd March 11, 2017
.Dt SQLITE3_DATA_DIRECTORY 3
.Os
.Sh NAME
.Nm sqlite3_data_directory
.Nd Name Of The Folder Holding Database Files
.Sh SYNOPSIS
.Vt char *sqlite3_data_directory;
.Sh DESCRIPTION
If this global variable is made to point to a string which is the name
of a folder (a.k.a.
directory), then all database files specified with a relative pathname
and created or accessed by SQLite when using a built-in windows VFS
will be assumed to be relative to that directory.
If this variable is a NULL pointer, then SQLite assumes that all database
files specified with a relative pathname are relative to the current
directory for the process.
Only the windows VFS makes use of this global variable; it is ignored
by the unix VFS.
.Pp
Changing the value of this variable while a database connection is
open can result in a corrupt database.
.Pp
It is not safe to read or modify this variable in more than one thread
at a time.
It is not safe to read or modify this variable if a database connection
is being used at the same time in a separate thread.
It is intended that this variable be set once as part of process initialization
and before any SQLite interface routines have been called and that
this variable remain unchanged thereafter.
.Pp
The data_store_directory pragma may modify
this variable and cause it to point to memory obtained from sqlite3_malloc.
Furthermore, the data_store_directory pragma
always assumes that any string that this variable points to is held
in memory obtained from sqlite3_malloc and the pragma
may attempt to free that memory using sqlite3_free.
Hence, if this variable is modified directly, either it should be made
NULL or made to point to memory obtained from sqlite3_malloc
or else the use of the data_store_directory pragma
should be avoided.
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_malloc 3 ,
.Xr sqlite3_vfs 3

View File

@ -0,0 +1,46 @@
.Dd March 11, 2017
.Dt SQLITE3_DB_CACHEFLUSH 3
.Os
.Sh NAME
.Nm sqlite3_db_cacheflush
.Nd Flush caches to disk mid-transaction
.Sh SYNOPSIS
.Ft int
.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

View File

@ -0,0 +1,31 @@
.Dd March 11, 2017
.Dt SQLITE3_DB_CONFIG 3
.Os
.Sh NAME
.Nm sqlite3_db_config
.Nd Configure database connections
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_db_config
.Fa "sqlite3*"
.Fa "int op"
.Fa "..."
.Fc
.Sh DESCRIPTION
The sqlite3_db_config() interface is used to make configuration changes
to a database connection.
The interface is similar to sqlite3_config() except
that the changes apply to a single database connection
(specified in the first argument).
.Pp
The second argument to sqlite3_db_config(D,V,...) is the configuration verb
- an integer code that indicates what aspect of the database connection
is being configured.
Subsequent arguments vary depending on the configuration verb.
.Pp
Calls to sqlite3_db_config() return SQLITE_OK if and only if the call
is considered successful.
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_config 3 ,
.Xr SQLITE_DBCONFIG_MAINDBNAME 3

View File

@ -0,0 +1,25 @@
.Dd March 11, 2017
.Dt SQLITE3_DB_FILENAME 3
.Os
.Sh NAME
.Nm sqlite3_db_filename
.Nd Return The Filename For A Database Connection
.Sh SYNOPSIS
.Ft const char *
.Fo sqlite3_db_filename
.Fa "sqlite3 *db"
.Fa "const char *zDbName"
.Fc
.Sh DESCRIPTION
The sqlite3_db_filename(D,N) interface returns a pointer to a filename
associated with database N of connection D.
The main database file has the name "main".
If there is no attached database N on the database connection D, or
if database N is a temporary or in-memory database, then a NULL pointer
is returned.
.Pp
The filename returned by this function is the output of the xFullPathname
method of the VFS.
In other words, the filename will be an absolute pathname, even if
the filename used to open the database originally was a URI or relative
pathname.

View File

@ -0,0 +1,22 @@
.Dd March 11, 2017
.Dt SQLITE3_DB_HANDLE 3
.Os
.Sh NAME
.Nm sqlite3_db_handle
.Nd Find The Database Handle Of A Prepared Statement
.Sh SYNOPSIS
.Ft sqlite3 *
.Fo sqlite3_db_handle
.Fa "sqlite3_stmt*"
.Fc
.Sh DESCRIPTION
The sqlite3_db_handle interface returns the database connection
handle to which a prepared statement belongs.
The database connection returned by sqlite3_db_handle
is the same database connection that was the first
argument to the sqlite3_prepare_v2() call (or its
variants) that was used to create the statement in the first place.
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_stmt 3 ,
.Xr sqlite3_prepare 3

View File

@ -0,0 +1,20 @@
.Dd March 11, 2017
.Dt SQLITE3_DB_MUTEX 3
.Os
.Sh NAME
.Nm sqlite3_db_mutex
.Nd Retrieve the mutex for a database connection
.Sh SYNOPSIS
.Ft sqlite3_mutex *
.Fo sqlite3_db_mutex
.Fa "sqlite3*"
.Fc
.Sh DESCRIPTION
This interface returns a pointer the sqlite3_mutex object
that serializes access to the database connection
given in the argument when the threading mode is Serialized.
If the threading mode is Single-thread or Multi-thread
then this routine returns a NULL pointer.
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_mutex 3

View File

@ -0,0 +1,16 @@
.Dd March 11, 2017
.Dt SQLITE3_DB_READONLY 3
.Os
.Sh NAME
.Nm sqlite3_db_readonly
.Nd Determine if a database is read-only
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_db_readonly
.Fa "sqlite3 *db"
.Fa "const char *zDbName"
.Fc
.Sh DESCRIPTION
The sqlite3_db_readonly(D,N) interface returns 1 if the database N
of connection D is read-only, 0 if it is read/write, or -1 if N is
not the name of a database on connection D.

View File

@ -0,0 +1,20 @@
.Dd March 11, 2017
.Dt SQLITE3_DB_RELEASE_MEMORY 3
.Os
.Sh NAME
.Nm sqlite3_db_release_memory
.Nd Free Memory Used By A Database Connection
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_db_release_memory
.Fa "sqlite3*"
.Fc
.Sh DESCRIPTION
The sqlite3_db_release_memory(D) interface attempts to free as much
heap memory as possible from database connection D.
Unlike the sqlite3_release_memory() interface,
this interface is in effect even when the SQLITE_ENABLE_MEMORY_MANAGEMENT
compile-time option is omitted.
.Pp
.Sh SEE ALSO
.Xr sqlite3_release_memory 3

View File

@ -0,0 +1,37 @@
.Dd March 11, 2017
.Dt SQLITE3_DB_STATUS 3
.Os
.Sh NAME
.Nm sqlite3_db_status
.Nd Database Connection Status
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_db_status
.Fa "sqlite3*"
.Fa "int op"
.Fa "int *pCur"
.Fa "int *pHiwtr"
.Fa "int resetFlg"
.Fc
.Sh DESCRIPTION
This interface is used to retrieve runtime status information about
a single database connection.
The first argument is the database connection object to be interrogated.
The second argument is an integer constant, taken from the set of SQLITE_DBSTATUS options,
that determines the parameter to interrogate.
The set of SQLITE_DBSTATUS options is likely
to grow in future releases of SQLite.
.Pp
The current value of the requested parameter is written into *pCur
and the highest instantaneous value is written into *pHiwtr.
If the resetFlg is true, then the highest instantaneous value is reset
back down to the current value.
.Pp
The sqlite3_db_status() routine returns SQLITE_OK on success and a
non-zero error code on failure.
.Pp
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_status 3 ,
.Xr sqlite3_stmt_status 3 ,
.Xr SQLITE_DBSTATUS_LOOKASIDE_USED 3

View File

@ -0,0 +1,18 @@
.Dd March 11, 2017
.Dt SQLITE3_DECLARE_VTAB 3
.Os
.Sh NAME
.Nm sqlite3_declare_vtab
.Nd Declare The Schema Of A Virtual Table
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_declare_vtab
.Fa "sqlite3*"
.Fa "const char *zSQL"
.Fc
.Sh DESCRIPTION
The xCreate and xConnect methods of a virtual table module
call this interface to declare the format (the names and datatypes
of the columns) of the virtual tables they implement.
.Sh SEE ALSO
.Xr sqlite3_module 3

View File

@ -0,0 +1,25 @@
.Dd March 11, 2017
.Dt SQLITE3_DESTRUCTOR_TYPE 3
.Os
.Sh NAME
.Nm sqlite3_destructor_type ,
.Nm SQLITE_STATIC ,
.Nm SQLITE_TRANSIENT
.Nd Constants Defining Special Destructor Behavior
.Sh SYNOPSIS
.Vt typedef void (*sqlite3_destructor_type)(void*);
.Fd #define SQLITE_STATIC
.Fd #define SQLITE_TRANSIENT
.Sh DESCRIPTION
These are special values for the destructor that is passed in as the
final argument to routines like sqlite3_result_blob().
If the destructor argument is SQLITE_STATIC, it means that the content
pointer is constant and will never change.
It does not need to be destroyed.
The SQLITE_TRANSIENT value means that the content will likely change
in the near future and that SQLite should make its own private copy
of the content before returning.
.Pp
The typedef is necessary to work around problems in certain C++ compilers.
.Sh SEE ALSO
.Xr sqlite3_result_blob 3

View File

@ -0,0 +1,39 @@
.Dd March 11, 2017
.Dt SQLITE3_ENABLE_LOAD_EXTENSION 3
.Os
.Sh NAME
.Nm sqlite3_enable_load_extension
.Nd Enable Or Disable Extension Loading
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_enable_load_extension
.Fa "sqlite3 *db"
.Fa "int onoff"
.Fc
.Sh DESCRIPTION
So as not to open security holes in older applications that are unprepared
to deal with extension loading, and as a means of
disabling extension loading while evaluating user-entered
SQL, the following API is provided to turn the sqlite3_load_extension()
mechanism on and off.
.Pp
Extension loading is off by default.
Call the sqlite3_enable_load_extension() routine with onoff==1 to turn
extension loading on and call it with onoff==0 to turn it back off
again.
.Pp
This interface enables or disables both the C-API sqlite3_load_extension()
and the SQL function load_extension().
Use sqlite3_db_config(db,SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,..)
to enable or disable only the C-API.
.Pp
\fBSecurity warning:\fP It is recommended that extension loading be disabled
using the SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
method rather than this interface, so the load_extension()
SQL function remains disabled.
This will prevent SQL injections from giving attackers access to extension
loading capabilities.
.Sh SEE ALSO
.Xr sqlite3_db_config 3 ,
.Xr sqlite3_load_extension 3 ,
.Xr SQLITE_DBCONFIG_MAINDBNAME 3

View File

@ -0,0 +1,50 @@
.Dd March 11, 2017
.Dt SQLITE3_ENABLE_SHARED_CACHE 3
.Os
.Sh NAME
.Nm sqlite3_enable_shared_cache
.Nd Enable Or Disable Shared Pager Cache
.Sh SYNOPSIS
.Ft int
.Fo sqlite3_enable_shared_cache
.Fa "int"
.Fc
.Sh DESCRIPTION
This routine enables or disables the sharing of the database cache
and schema data structures between connections to the
same database.
Sharing is enabled if the argument is true and disabled if the argument
is false.
.Pp
Cache sharing is enabled and disabled for an entire process.
This is a change as of SQLite version 3.5.0 (dateof:3.5.0).
In prior versions of SQLite, sharing was enabled or disabled for each
thread separately.
.Pp
The cache sharing mode set by this interface effects all subsequent
calls to sqlite3_open(), sqlite3_open_v2(),
and sqlite3_open16().
Existing database connections continue use the sharing mode that was
in effect at the time they were opened.
.Pp
This routine returns SQLITE_OK if shared cache was enabled
or disabled successfully.
An error code is returned otherwise.
.Pp
Shared cache is disabled by default.
But this might change in future releases of SQLite.
Applications that care about shared cache setting should set it explicitly.
.Pp
Note: This method is disabled on MacOS X 10.7 and iOS version 5.0 and
will always return SQLITE_MISUSE.
On those systems, shared cache mode should be enabled per-database
connection via sqlite3_open_v2() with SQLITE_OPEN_SHAREDCACHE.
.Pp
This interface is threadsafe on processors where writing a 32-bit integer
is atomic.
.Pp
.Sh SEE ALSO
.Xr sqlite3 3 ,
.Xr sqlite3_open 3 ,
.Xr SQLITE_OK 3 ,
.Xr SQLITE_OPEN_READONLY 3

Some files were not shown because too many files have changed in this diff Show More