tartrazine/x2.html
2024-08-21 21:22:36 -03:00

13486 lines
1.7 MiB

<html>
<style type="text/css">
/* Background */ .bg { color: #e5e5e5; background-color: #000000; }
/* PreWrapper */ .chroma { color: #e5e5e5; background-color: #000000; }
/* Error */ .chroma .err { color: #ff0000 }
/* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit }
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
/* LineHighlight */ .chroma .hl { background-color: #191919 }
/* LineNumbersTable */ .chroma .lnt { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #727272 }
/* LineNumbers */ .chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #727272 }
/* Line */ .chroma .line { display: flex; }
/* Keyword */ .chroma .k { color: #ffffff; font-weight: bold }
/* KeywordConstant */ .chroma .kc { color: #ffffff; font-weight: bold }
/* KeywordDeclaration */ .chroma .kd { color: #ffffff; font-weight: bold }
/* KeywordNamespace */ .chroma .kn { color: #ffffff; font-weight: bold }
/* KeywordPseudo */ .chroma .kp { color: #ffffff; font-weight: bold }
/* KeywordReserved */ .chroma .kr { color: #ffffff; font-weight: bold }
/* KeywordType */ .chroma .kt { color: #ffffff; font-weight: bold }
/* NameAttribute */ .chroma .na { color: #007f7f }
/* NameBuiltin */ .chroma .nb { color: #ffffff; font-weight: bold }
/* NameTag */ .chroma .nt { font-weight: bold }
/* LiteralDate */ .chroma .ld { color: #ffff00; font-weight: bold }
/* LiteralString */ .chroma .s { color: #00ffff; font-weight: bold }
/* LiteralStringAffix */ .chroma .sa { color: #00ffff; font-weight: bold }
/* LiteralStringBacktick */ .chroma .sb { color: #00ffff; font-weight: bold }
/* LiteralStringChar */ .chroma .sc { color: #00ffff; font-weight: bold }
/* LiteralStringDelimiter */ .chroma .dl { color: #00ffff; font-weight: bold }
/* LiteralStringDoc */ .chroma .sd { color: #00ffff; font-weight: bold }
/* LiteralStringDouble */ .chroma .s2 { color: #00ffff; font-weight: bold }
/* LiteralStringEscape */ .chroma .se { color: #00ffff; font-weight: bold }
/* LiteralStringHeredoc */ .chroma .sh { color: #00ffff; font-weight: bold }
/* LiteralStringInterpol */ .chroma .si { color: #00ffff; font-weight: bold }
/* LiteralStringOther */ .chroma .sx { color: #00ffff; font-weight: bold }
/* LiteralStringRegex */ .chroma .sr { color: #00ffff; font-weight: bold }
/* LiteralStringSingle */ .chroma .s1 { color: #00ffff; font-weight: bold }
/* LiteralStringSymbol */ .chroma .ss { color: #00ffff; font-weight: bold }
/* LiteralNumber */ .chroma .m { color: #ffff00; font-weight: bold }
/* LiteralNumberBin */ .chroma .mb { color: #ffff00; font-weight: bold }
/* LiteralNumberFloat */ .chroma .mf { color: #ffff00; font-weight: bold }
/* LiteralNumberHex */ .chroma .mh { color: #ffff00; font-weight: bold }
/* LiteralNumberInteger */ .chroma .mi { color: #ffff00; font-weight: bold }
/* LiteralNumberIntegerLong */ .chroma .il { color: #ffff00; font-weight: bold }
/* LiteralNumberOct */ .chroma .mo { color: #ffff00; font-weight: bold }
/* Comment */ .chroma .c { color: #007f7f }
/* CommentHashbang */ .chroma .ch { color: #007f7f }
/* CommentMultiline */ .chroma .cm { color: #007f7f }
/* CommentSingle */ .chroma .c1 { color: #007f7f }
/* CommentSpecial */ .chroma .cs { color: #007f7f }
/* CommentPreproc */ .chroma .cp { color: #00ff00; font-weight: bold }
/* CommentPreprocFile */ .chroma .cpf { color: #00ff00; font-weight: bold }
/* GenericHeading */ .chroma .gh { font-weight: bold }
/* GenericStrong */ .chroma .gs { font-weight: bold }
/* GenericSubheading */ .chroma .gu { font-weight: bold }
/* GenericUnderline */ .chroma .gl { text-decoration: underline }
body { color:#e5e5e5;background-color:#000;; }
</style><body class="bg">
<pre class="chroma"><code><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** 2001-09-15
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The author disclaims copyright to this source code. In place of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a legal notice, here is a blessing:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** May you do good and not evil.
</span></span></span><span class="line"><span class="cl"><span class="cm">** May you find forgiveness for yourself and forgive others.
</span></span></span><span class="line"><span class="cl"><span class="cm">** May you share freely, never taking more than you give.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">*************************************************************************
</span></span></span><span class="line"><span class="cl"><span class="cm">** This header file defines the interface that the SQLite library
</span></span></span><span class="line"><span class="cl"><span class="cm">** presents to client programs. If a C-function, structure, datatype,
</span></span></span><span class="line"><span class="cl"><span class="cm">** or constant definition does not appear in this file, then it is
</span></span></span><span class="line"><span class="cl"><span class="cm">** not a published API of SQLite, is subject to change without
</span></span></span><span class="line"><span class="cl"><span class="cm">** notice, and should not be referenced by programs that use SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Some of the definitions that are in this file are marked as
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;experimental&#34;. Experimental interfaces are normally new
</span></span></span><span class="line"><span class="cl"><span class="cm">** features recently added to SQLite. We do not anticipate changes
</span></span></span><span class="line"><span class="cl"><span class="cm">** to experimental interfaces but reserve the right to make minor changes
</span></span></span><span class="line"><span class="cl"><span class="cm">** if experience from use &#34;in the wild&#34; suggest such changes are prudent.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The official C-language API documentation for SQLite is derived
</span></span></span><span class="line"><span class="cl"><span class="cm">** from comments in this file. This file is the authoritative source
</span></span></span><span class="line"><span class="cl"><span class="cm">** on how SQLite interfaces are supposed to operate.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The name of this file under configuration management is &#34;sqlite.h.in&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The makefile makes some minor changes to this file (such as inserting
</span></span></span><span class="line"><span class="cl"><span class="cm">** the version number) and changes its name to &#34;sqlite3.h&#34; as
</span></span></span><span class="line"><span class="cl"><span class="cm">** part of the build process.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifndef SQLITE3_H
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE3_H
</span></span></span><span class="line"><span class="cl"><span class="cp">#include</span> <span class="cpf">&lt;stdarg.h&gt; /* Needed for the definition of va_list */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Make sure we can call this stuff from C++.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef __cplusplus
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="k">extern</span> <span class="s">&#34;C&#34;</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Facilitate override of interface linkage and calling conventions.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Be aware that these macros may not be used within this particular
</span></span></span><span class="line"><span class="cl"><span class="cm">** translation of the amalgamation and its associated header file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_EXTERN and SQLITE_API macros are used to instruct the
</span></span></span><span class="line"><span class="cl"><span class="cm">** compiler that the target identifier should have external linkage.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_CDECL macro is used to set the calling convention for
</span></span></span><span class="line"><span class="cl"><span class="cm">** public functions that accept a variable number of arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_APICALL macro is used to set the calling convention for
</span></span></span><span class="line"><span class="cl"><span class="cm">** public functions that accept a fixed number of arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_STDCALL macro is no longer used and is now deprecated.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_CALLBACK macro is used to set the calling convention for
</span></span></span><span class="line"><span class="cl"><span class="cm">** function pointers.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_SYSAPI macro is used to set the calling convention for
</span></span></span><span class="line"><span class="cl"><span class="cm">** functions provided by the operating system.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Currently, the SQLITE_CDECL, SQLITE_APICALL, SQLITE_CALLBACK, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_SYSAPI macros are used only when building for environments
</span></span></span><span class="line"><span class="cl"><span class="cm">** that require non-default calling conventions.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifndef SQLITE_EXTERN
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_EXTERN extern
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#ifndef SQLITE_API
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_API
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#ifndef SQLITE_CDECL
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_CDECL
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#ifndef SQLITE_APICALL
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_APICALL
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#ifndef SQLITE_STDCALL
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_STDCALL SQLITE_APICALL
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#ifndef SQLITE_CALLBACK
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_CALLBACK
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#ifndef SQLITE_SYSAPI
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_SYSAPI
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** These no-op macros are used in front of interfaces to mark those
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces as either deprecated or experimental. New applications
</span></span></span><span class="line"><span class="cl"><span class="cm">** should not use deprecated interfaces - they are supported for backwards
</span></span></span><span class="line"><span class="cl"><span class="cm">** compatibility only. Application writers should be aware that
</span></span></span><span class="line"><span class="cl"><span class="cm">** experimental interfaces are subject to change in point releases.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These macros used to resolve to various kinds of compiler magic that
</span></span></span><span class="line"><span class="cl"><span class="cm">** would generate warning messages when they were used. But that
</span></span></span><span class="line"><span class="cl"><span class="cm">** compiler magic ended up generating such a flurry of bug reports
</span></span></span><span class="line"><span class="cl"><span class="cm">** that we have taken it all out and gone back to using simple
</span></span></span><span class="line"><span class="cl"><span class="cm">** noop macros.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DEPRECATED
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_EXPERIMENTAL
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Ensure these symbols were not defined by some previous header file.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef SQLITE_VERSION
</span></span></span><span class="line"><span class="cl"><span class="cp"># undef SQLITE_VERSION
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#ifdef SQLITE_VERSION_NUMBER
</span></span></span><span class="line"><span class="cl"><span class="cp"># undef SQLITE_VERSION_NUMBER
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Compile-Time Library Version Numbers
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header
</span></span></span><span class="line"><span class="cl"><span class="cm">** evaluates to a string literal that is the SQLite version in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** format &#34;X.Y.Z&#34; where X is the major version number (always 3 for
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite3) and Y is the minor version number and Z is the release number.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** numbers used in [SQLITE_VERSION].)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
</span></span></span><span class="line"><span class="cl"><span class="cm">** be larger than the release from which it is derived. Either Y will
</span></span></span><span class="line"><span class="cl"><span class="cm">** be held constant and Z will be incremented or else Y will be incremented
</span></span></span><span class="line"><span class="cl"><span class="cm">** and Z will be reset to zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Since [version 3.6.18] ([dateof:3.6.18]),
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite source code has been stored in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;a href=&#34;http://www.fossil-scm.org/&#34;&gt;Fossil configuration management
</span></span></span><span class="line"><span class="cl"><span class="cm">** system&lt;/a&gt;. ^The SQLITE_SOURCE_ID macro evaluates to
</span></span></span><span class="line"><span class="cl"><span class="cm">** a string which identifies a particular check-in of SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** within its configuration management system. ^The SQLITE_SOURCE_ID
</span></span></span><span class="line"><span class="cl"><span class="cm">** string contains the date and time of the check-in (UTC) and a SHA1
</span></span></span><span class="line"><span class="cl"><span class="cm">** or SHA3-256 hash of the entire source tree. If the source code has
</span></span></span><span class="line"><span class="cl"><span class="cm">** been edited in any way since it was last checked in, then the last
</span></span></span><span class="line"><span class="cl"><span class="cm">** four hexadecimal digits of the hash may be modified.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_libversion()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_libversion_number()], [sqlite3_sourceid()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite_version()] and [sqlite_source_id()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_VERSION &#34;3.46.0&#34;
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_VERSION_NUMBER 3046000
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SOURCE_ID &#34;2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebalt1&#34;
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Run-Time Library Version Numbers
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: sqlite3_version sqlite3_sourceid
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These interfaces provide the same information as the [SQLITE_VERSION],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
</span></span></span><span class="line"><span class="cl"><span class="cm">** but are associated with the library instead of the header file. ^(Cautious
</span></span></span><span class="line"><span class="cl"><span class="cm">** programmers might include assert() statements in their application to
</span></span></span><span class="line"><span class="cl"><span class="cm">** verify that values returned by these interfaces match the macros in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the header, and thus ensure that the application is
</span></span></span><span class="line"><span class="cl"><span class="cm">** compiled with matching library and header files.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;&lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
</span></span></span><span class="line"><span class="cl"><span class="cm">** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
</span></span></span><span class="line"><span class="cl"><span class="cm">** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;&lt;/blockquote&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]
</span></span></span><span class="line"><span class="cl"><span class="cm">** macro. ^The sqlite3_libversion() function returns a pointer to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the sqlite3_version[] string constant. The sqlite3_libversion()
</span></span></span><span class="line"><span class="cl"><span class="cm">** function is provided for use in DLLs since DLL users usually do not have
</span></span></span><span class="line"><span class="cl"><span class="cm">** direct access to string constants within the DLL. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_libversion_number() function returns an integer equal to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to a string constant whose value is the same as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built
</span></span></span><span class="line"><span class="cl"><span class="cm">** using an edited copy of [the amalgamation], then the last four characters
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the hash might be different from [SQLITE_SOURCE_ID].)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite_version()] and [sqlite_source_id()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_EXTERN</span> <span class="k">const</span> <span class="kt">char</span> <span class="n">sqlite3_version</span><span class="p">[];</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_libversion</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_sourceid</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_libversion_number</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Run-Time Library Compilation Options Diagnostics
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_compileoption_used() function returns 0 or 1
</span></span></span><span class="line"><span class="cl"><span class="cm">** indicating whether the specified option was defined at
</span></span></span><span class="line"><span class="cl"><span class="cm">** compile time. ^The SQLITE_ prefix may be omitted from the
</span></span></span><span class="line"><span class="cl"><span class="cm">** option name passed to sqlite3_compileoption_used().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_compileoption_get() function allows iterating
</span></span></span><span class="line"><span class="cl"><span class="cm">** over the list of options that were defined at compile time by
</span></span></span><span class="line"><span class="cl"><span class="cm">** returning the N-th compile time option string. ^If N is out of range,
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_
</span></span></span><span class="line"><span class="cl"><span class="cm">** prefix is omitted from any strings returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_compileoption_get().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Support for the diagnostic functions sqlite3_compileoption_used()
</span></span></span><span class="line"><span class="cl"><span class="cm">** and sqlite3_compileoption_get() may be omitted by specifying the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: SQL functions [sqlite_compileoption_used()] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite_compileoption_get()] and the [compile_options pragma].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_compileoption_used</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zOptName</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_compileoption_get</span><span class="p">(</span><span class="kt">int</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="cp">#else
</span></span></span><span class="line"><span class="cl"><span class="cp"># define sqlite3_compileoption_used(X) 0
</span></span></span><span class="line"><span class="cl"><span class="cp"># define sqlite3_compileoption_get(X) ((void*)0)
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Test To See If The Library Is Threadsafe
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_threadsafe() function returns zero if and only if
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite was compiled with mutexing code omitted due to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_THREADSAFE] compile-time option being set to 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite can be compiled with or without mutexes. When
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes
</span></span></span><span class="line"><span class="cl"><span class="cm">** are enabled and SQLite is threadsafe. When the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_THREADSAFE] macro is 0,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the mutexes are omitted. Without the mutexes, it is not safe
</span></span></span><span class="line"><span class="cl"><span class="cm">** to use SQLite concurrently from more than one thread.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Enabling mutexes incurs a measurable performance penalty.
</span></span></span><span class="line"><span class="cl"><span class="cm">** So if speed is of utmost importance, it makes sense to disable
</span></span></span><span class="line"><span class="cl"><span class="cm">** the mutexes. But for maximum safety, mutexes should be enabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The default behavior is for mutexes to be enabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface can be used by an application to make sure that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** version of SQLite that it is linking against was compiled with
</span></span></span><span class="line"><span class="cl"><span class="cm">** the desired setting of the [SQLITE_THREADSAFE] macro.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface only reports on the compile-time mutex setting
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be fully or partially disabled using a call to [sqlite3_config()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_threadsafe() function shows only the compile-time setting of
</span></span></span><span class="line"><span class="cl"><span class="cm">** thread safety, not any run-time changes to that setting made by
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is unchanged by calls to sqlite3_config().)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See the [threading mode] documentation for additional information.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_threadsafe</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Database Connection Handle
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {database connection} {database connections}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Each open SQLite database is represented by a pointer to an instance of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the opaque structure named &#34;sqlite3&#34;. It is useful to think of an sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and [sqlite3_close_v2()] are its destructors. There are many other
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces (such as
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_busy_timeout()] to name but three) that are methods on an
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3 object.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3</span> <span class="n">sqlite3</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: 64-Bit Integer Types
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: sqlite_int64 sqlite_uint64
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Because there is no cross-platform way to specify 64-bit integer types
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite includes typedefs for 64-bit signed and unsigned integers.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite_int64 and sqlite_uint64 types are supported for backwards
</span></span></span><span class="line"><span class="cl"><span class="cm">** compatibility only.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_int64 and sqlite_int64 types can store integer values
</span></span></span><span class="line"><span class="cl"><span class="cm">** between -9223372036854775808 and +9223372036854775807 inclusive. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_uint64 and sqlite_uint64 types can store integer values
</span></span></span><span class="line"><span class="cl"><span class="cm">** between 0 and +18446744073709551615 inclusive.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef SQLITE_INT64_TYPE
</span></span></span><span class="line"><span class="cl"><span class="cp"></span> <span class="k">typedef</span> <span class="n">SQLITE_INT64_TYPE</span> <span class="n">sqlite_int64</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="cp"># ifdef SQLITE_UINT64_TYPE
</span></span></span><span class="line"><span class="cl"><span class="cp"></span> <span class="k">typedef</span> <span class="n">SQLITE_UINT64_TYPE</span> <span class="n">sqlite_uint64</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="cp"># else
</span></span></span><span class="line"><span class="cl"><span class="cp"></span> <span class="k">typedef</span> <span class="kt">unsigned</span> <span class="n">SQLITE_INT64_TYPE</span> <span class="n">sqlite_uint64</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="cp"># endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#elif defined(_MSC_VER) || defined(__BORLANDC__)
</span></span></span><span class="line"><span class="cl"><span class="cp"></span> <span class="k">typedef</span> <span class="kr">__int64</span> <span class="n">sqlite_int64</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="k">typedef</span> <span class="kt">unsigned</span> <span class="kr">__int64</span> <span class="n">sqlite_uint64</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="cp">#else
</span></span></span><span class="line"><span class="cl"><span class="cp"></span> <span class="k">typedef</span> <span class="kt">long</span> <span class="kt">long</span> <span class="kt">int</span> <span class="n">sqlite_int64</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="k">typedef</span> <span class="kt">unsigned</span> <span class="kt">long</span> <span class="kt">long</span> <span class="kt">int</span> <span class="n">sqlite_uint64</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="k">typedef</span> <span class="n">sqlite_int64</span> <span class="n">sqlite3_int64</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="n">sqlite_uint64</span> <span class="n">sqlite3_uint64</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** If compiling for a processor that lacks floating point support,
</span></span></span><span class="line"><span class="cl"><span class="cm">** substitute integer for floating-point.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef SQLITE_OMIT_FLOATING_POINT
</span></span></span><span class="line"><span class="cl"><span class="cp"># define double sqlite3_int64
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Closing A Database Connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** DESTRUCTOR: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the [sqlite3] object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3] object is successfully destroyed and all associated
</span></span></span><span class="line"><span class="cl"><span class="cm">** resources are deallocated.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Ideally, applications should [sqlite3_finalize | finalize] all
</span></span></span><span class="line"><span class="cl"><span class="cm">** [prepared statements], [sqlite3_blob_close | close] all [BLOB handles], and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the [sqlite3] object prior to attempting to close the object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the database connection is associated with unfinalized prepared
</span></span></span><span class="line"><span class="cl"><span class="cm">** statements, BLOB handlers, and/or unfinished sqlite3_backup objects then
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_close() will leave the database connection open and return
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_BUSY]. ^If sqlite3_close_v2() is called with unfinalized prepared
</span></span></span><span class="line"><span class="cl"><span class="cm">** statements, unclosed BLOB handlers, and/or unfinished sqlite3_backups,
</span></span></span><span class="line"><span class="cl"><span class="cm">** it returns [SQLITE_OK] regardless, but instead of deallocating the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection immediately, it marks the database connection as an unusable
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;zombie&#34; and makes arrangements to automatically deallocate the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection after all prepared statements are finalized, all BLOB handles
</span></span></span><span class="line"><span class="cl"><span class="cm">** are closed, and all backups have finished. The sqlite3_close_v2() interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** is intended for use with host languages that are garbage collected, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** where the order in which destructors are called is arbitrary.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If an [sqlite3] object is destroyed while a transaction is open,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the transaction is automatically rolled back.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)]
</span></span></span><span class="line"><span class="cl"><span class="cm">** must be either a NULL
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer or an [sqlite3] object pointer obtained
</span></span></span><span class="line"><span class="cl"><span class="cm">** from [sqlite3_open()], [sqlite3_open16()], or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_open_v2()], and not previously closed.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument is a harmless no-op.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_close</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_close_v2</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** The type for a callback function.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This is legacy and deprecated. It is included for historical
</span></span></span><span class="line"><span class="cl"><span class="cm">** compatibility and is not documented.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">sqlite3_callback</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="kt">char</span><span class="o">**</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: One-Step Query Execution Interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_exec() interface is a convenience wrapper around
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** that allows an application to run multiple statements of SQL
</span></span></span><span class="line"><span class="cl"><span class="cm">** without having to use a lot of C code.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
</span></span></span><span class="line"><span class="cl"><span class="cm">** semicolon-separate SQL statements passed into its 2nd argument,
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the context of the [database connection] passed in as its 1st
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument. ^If the callback function of the 3rd argument to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_exec() is not NULL, then it is invoked for each result row
</span></span></span><span class="line"><span class="cl"><span class="cm">** coming out of the evaluated SQL statements. ^The 4th argument to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_exec() is relayed through to the 1st argument of each
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback invocation. ^If the callback pointer to sqlite3_exec()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is NULL, then no callback is ever invoked and result rows are
</span></span></span><span class="line"><span class="cl"><span class="cm">** ignored.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If an error occurs while evaluating the SQL statements passed into
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_exec(), then execution of the current statement stops and
</span></span></span><span class="line"><span class="cl"><span class="cm">** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not NULL then any error message is written into memory obtained
</span></span></span><span class="line"><span class="cl"><span class="cm">** from [sqlite3_malloc()] and passed back through the 5th parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">** To avoid memory leaks, the application should invoke [sqlite3_free()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** on error message strings returned through the 5th parameter of
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_exec() after the error message string is no longer needed.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
</span></span></span><span class="line"><span class="cl"><span class="cm">** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL before returning.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine returns SQLITE_ABORT without invoking the callback again and
</span></span></span><span class="line"><span class="cl"><span class="cm">** without running any subsequent SQL statements.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The 2nd argument to the sqlite3_exec() callback function is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** number of columns in the result. ^The 3rd argument to the sqlite3_exec()
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback is an array of pointers to strings obtained as if from
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_column_text()], one for each column. ^If an element of a
</span></span></span><span class="line"><span class="cl"><span class="cm">** result row is NULL then the corresponding string pointer for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_exec() callback is an array of pointers to strings where each
</span></span></span><span class="line"><span class="cl"><span class="cm">** entry represents the name of corresponding result column as obtained
</span></span></span><span class="line"><span class="cl"><span class="cm">** from [sqlite3_column_name()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** to an empty string, or a pointer that contains only whitespace and/or
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL comments, then no SQL statements are evaluated and the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not changed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Restrictions:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The application must ensure that the 1st parameter to sqlite3_exec()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a valid and open [database connection].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The application must not close the [database connection] specified by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The application must not modify the SQL statement text passed into
</span></span></span><span class="line"><span class="cl"><span class="cm">** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The application must not dereference the arrays or string pointers
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed as the 3rd and 4th callback parameters after it returns.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_exec</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="cm">/* An open database */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">sql</span><span class="p">,</span> <span class="cm">/* SQL to be evaluated */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">callback</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="kt">char</span><span class="o">**</span><span class="p">,</span><span class="kt">char</span><span class="o">**</span><span class="p">),</span> <span class="cm">/* Callback function */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="p">,</span> <span class="cm">/* 1st argument to callback */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="o">**</span><span class="n">errmsg</span> <span class="cm">/* Error msg written here */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Result Codes
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {result code definitions}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Many SQLite functions return an integer result code from the set shown
</span></span></span><span class="line"><span class="cl"><span class="cm">** here in order to indicate success or failure.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** New error codes may be added in future versions of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [extended result code definitions]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OK 0 </span><span class="cm">/* Successful result */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="cm">/* beginning-of-error-codes */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ERROR 1 </span><span class="cm">/* Generic error */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INTERNAL 2 </span><span class="cm">/* Internal logic error in SQLite */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_PERM 3 </span><span class="cm">/* Access permission denied */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ABORT 4 </span><span class="cm">/* Callback routine requested an abort */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_BUSY 5 </span><span class="cm">/* The database file is locked */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LOCKED 6 </span><span class="cm">/* A table in the database is locked */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_NOMEM 7 </span><span class="cm">/* A malloc() failed */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_READONLY 8 </span><span class="cm">/* Attempt to write a readonly database */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INTERRUPT 9 </span><span class="cm">/* Operation terminated by sqlite3_interrupt()*/</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR 10 </span><span class="cm">/* Some kind of disk I/O error occurred */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CORRUPT 11 </span><span class="cm">/* The database disk image is malformed */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_NOTFOUND 12 </span><span class="cm">/* Unknown opcode in sqlite3_file_control() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FULL 13 </span><span class="cm">/* Insertion failed because database is full */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CANTOPEN 14 </span><span class="cm">/* Unable to open the database file */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_PROTOCOL 15 </span><span class="cm">/* Database lock protocol error */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_EMPTY 16 </span><span class="cm">/* Internal use only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SCHEMA 17 </span><span class="cm">/* The database schema changed */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TOOBIG 18 </span><span class="cm">/* String or BLOB exceeds size limit */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT 19 </span><span class="cm">/* Abort due to constraint violation */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MISMATCH 20 </span><span class="cm">/* Data type mismatch */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MISUSE 21 </span><span class="cm">/* Library used incorrectly */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_NOLFS 22 </span><span class="cm">/* Uses OS features not supported on host */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_AUTH 23 </span><span class="cm">/* Authorization denied */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FORMAT 24 </span><span class="cm">/* Not used */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_RANGE 25 </span><span class="cm">/* 2nd parameter to sqlite3_bind out of range */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_NOTADB 26 </span><span class="cm">/* File opened that is not a database file */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_NOTICE 27 </span><span class="cm">/* Notifications from sqlite3_log() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_WARNING 28 </span><span class="cm">/* Warnings from sqlite3_log() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ROW 100 </span><span class="cm">/* sqlite3_step() has another row ready */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DONE 101 </span><span class="cm">/* sqlite3_step() has finished executing */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="cm">/* end-of-error-codes */</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Extended Result Codes
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {extended result code definitions}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In its default configuration, SQLite API routines return one of 30 integer
</span></span></span><span class="line"><span class="cl"><span class="cm">** [result codes]. However, experience has shown that many of
</span></span></span><span class="line"><span class="cl"><span class="cm">** these result codes are too coarse-grained. They do not provide as
</span></span></span><span class="line"><span class="cl"><span class="cm">** much information about problems as programmers might like. In an effort to
</span></span></span><span class="line"><span class="cl"><span class="cm">** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and later) include
</span></span></span><span class="line"><span class="cl"><span class="cm">** support for additional result codes that provide more detailed information
</span></span></span><span class="line"><span class="cl"><span class="cm">** about errors. These [extended result codes] are enabled or disabled
</span></span></span><span class="line"><span class="cl"><span class="cm">** on a per database connection basis using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_extended_result_codes()] API. Or, the extended code for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the most recent error can be obtained using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_extended_errcode()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_READ (SQLITE_IOERR | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_BEGIN_ATOMIC (SQLITE_IOERR | (29&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_DATA (SQLITE_IOERR | (32&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOERR_IN_PAGE (SQLITE_IOERR | (34&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_BUSY_TIMEOUT (SQLITE_BUSY | (3&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CANTOPEN_DIRTYWAL (SQLITE_CANTOPEN | (5&lt;&lt;8)) </span><span class="cm">/* Not Used */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CANTOPEN_SYMLINK (SQLITE_CANTOPEN | (6&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CORRUPT_SEQUENCE (SQLITE_CORRUPT | (2&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CORRUPT_INDEX (SQLITE_CORRUPT | (3&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_READONLY_CANTINIT (SQLITE_READONLY | (5&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_READONLY_DIRECTORY (SQLITE_READONLY | (6&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_NOTNULL (SQLITE_CONSTRAINT | (5&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_PRIMARYKEY (SQLITE_CONSTRAINT | (6&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_TRIGGER (SQLITE_CONSTRAINT | (7&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_UNIQUE (SQLITE_CONSTRAINT | (8&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_PINNED (SQLITE_CONSTRAINT |(11&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONSTRAINT_DATATYPE (SQLITE_CONSTRAINT |(12&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_NOTICE_RBU (SQLITE_NOTICE | (3&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_AUTH_USER (SQLITE_AUTH | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1&lt;&lt;8))
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OK_SYMLINK (SQLITE_OK | (2&lt;&lt;8)) </span><span class="cm">/* internal use only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Flags For File Open Operations
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These bit values are intended for use in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** 3rd parameter to the [sqlite3_open_v2()] interface and
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the 4th parameter to the [sqlite3_vfs.xOpen] method.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Only those flags marked as &#34;Ok for sqlite3_open_v2()&#34; may be
</span></span></span><span class="line"><span class="cl"><span class="cm">** used as the third argument to the [sqlite3_open_v2()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The other flags have historically been ignored by sqlite3_open_v2(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** though future versions of SQLite might change so that an error is
</span></span></span><span class="line"><span class="cl"><span class="cm">** raised if any of the disallowed bits are passed into sqlite3_open_v2().
</span></span></span><span class="line"><span class="cl"><span class="cm">** Applications should not depend on the historical behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_open_v2()] does *not* cause the underlying database file
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_open_v2()] has historically be a no-op and might become an
</span></span></span><span class="line"><span class="cl"><span class="cm">** error in future versions of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_READONLY 0x00000001 </span><span class="cm">/* Ok for sqlite3_open_v2() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_READWRITE 0x00000002 </span><span class="cm">/* Ok for sqlite3_open_v2() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_CREATE 0x00000004 </span><span class="cm">/* Ok for sqlite3_open_v2() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_DELETEONCLOSE 0x00000008 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_EXCLUSIVE 0x00000010 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_AUTOPROXY 0x00000020 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_URI 0x00000040 </span><span class="cm">/* Ok for sqlite3_open_v2() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_MEMORY 0x00000080 </span><span class="cm">/* Ok for sqlite3_open_v2() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_MAIN_DB 0x00000100 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_TEMP_DB 0x00000200 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_SUBJOURNAL 0x00002000 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_SUPER_JOURNAL 0x00004000 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_NOMUTEX 0x00008000 </span><span class="cm">/* Ok for sqlite3_open_v2() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_FULLMUTEX 0x00010000 </span><span class="cm">/* Ok for sqlite3_open_v2() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_SHAREDCACHE 0x00020000 </span><span class="cm">/* Ok for sqlite3_open_v2() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_PRIVATECACHE 0x00040000 </span><span class="cm">/* Ok for sqlite3_open_v2() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_WAL 0x00080000 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_NOFOLLOW 0x01000000 </span><span class="cm">/* Ok for sqlite3_open_v2() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_EXRESCODE 0x02000000 </span><span class="cm">/* Extended result codes */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/* Reserved: 0x00F00000 */</span>
</span></span><span class="line"><span class="cl"><span class="cm">/* Legacy compatibility: */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 </span><span class="cm">/* VFS only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Device Characteristics
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xDeviceCharacteristics method of the [sqlite3_io_methods]
</span></span></span><span class="line"><span class="cl"><span class="cm">** object returns an integer which is a vector of these
</span></span></span><span class="line"><span class="cl"><span class="cm">** bit values expressing I/O characteristics of the mass storage
</span></span></span><span class="line"><span class="cl"><span class="cm">** device that holds the file that the [sqlite3_io_methods]
</span></span></span><span class="line"><span class="cl"><span class="cm">** refers to.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_IOCAP_ATOMIC property means that all writes of
</span></span></span><span class="line"><span class="cl"><span class="cm">** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
</span></span></span><span class="line"><span class="cl"><span class="cm">** mean that writes of blocks that are nnn bytes in size and
</span></span></span><span class="line"><span class="cl"><span class="cm">** are aligned to an address which is an integer multiple of
</span></span></span><span class="line"><span class="cl"><span class="cm">** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
</span></span></span><span class="line"><span class="cl"><span class="cm">** that when data is appended to a file, the data is appended
</span></span></span><span class="line"><span class="cl"><span class="cm">** first then the size of the file is extended, never the other
</span></span></span><span class="line"><span class="cl"><span class="cm">** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
</span></span></span><span class="line"><span class="cl"><span class="cm">** information is written to disk in the same order as calls
</span></span></span><span class="line"><span class="cl"><span class="cm">** to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
</span></span></span><span class="line"><span class="cl"><span class="cm">** after reboot following a crash or power loss, the only bytes in a
</span></span></span><span class="line"><span class="cl"><span class="cm">** file that were written at the application level might have changed
</span></span></span><span class="line"><span class="cl"><span class="cm">** and that adjacent bytes, even bytes within the same sector are
</span></span></span><span class="line"><span class="cl"><span class="cm">** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag indicates that a file cannot be deleted when open. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
</span></span></span><span class="line"><span class="cl"><span class="cm">** read-only media and cannot be changed even by processes with
</span></span></span><span class="line"><span class="cl"><span class="cm">** elevated privileges.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
</span></span></span><span class="line"><span class="cl"><span class="cm">** filesystem supports doing multiple write operations atomically when those
</span></span></span><span class="line"><span class="cl"><span class="cm">** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_ATOMIC 0x00000001
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_ATOMIC512 0x00000002
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_ATOMIC1K 0x00000004
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_ATOMIC2K 0x00000008
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_ATOMIC4K 0x00000010
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_ATOMIC8K 0x00000020
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_ATOMIC16K 0x00000040
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_ATOMIC32K 0x00000080
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_ATOMIC64K 0x00000100
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_SAFE_APPEND 0x00000200
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_SEQUENTIAL 0x00000400
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_IMMUTABLE 0x00002000
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: File Locking Levels
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite uses one of these integer values as the second
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument to calls it makes to the xLock() and xUnlock() methods
</span></span></span><span class="line"><span class="cl"><span class="cm">** of an [sqlite3_io_methods] object. These values are ordered from
</span></span></span><span class="line"><span class="cl"><span class="cm">** lest restrictive to most restrictive.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The argument to xLock() is always SHARED or higher. The argument to
</span></span></span><span class="line"><span class="cl"><span class="cm">** xUnlock is either SHARED or NONE.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LOCK_NONE 0 </span><span class="cm">/* xUnlock() only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LOCK_SHARED 1 </span><span class="cm">/* xLock() or xUnlock() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LOCK_RESERVED 2 </span><span class="cm">/* xLock() only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LOCK_PENDING 3 </span><span class="cm">/* xLock() only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LOCK_EXCLUSIVE 4 </span><span class="cm">/* xLock() only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Synchronization Type Flags
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When SQLite invokes the xSync() method of an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_io_methods] object it uses a combination of
</span></span></span><span class="line"><span class="cl"><span class="cm">** these integer values as the second argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sync operation only needs to flush data to mass storage. Inode
</span></span></span><span class="line"><span class="cl"><span class="cm">** information need not be flushed. If the lower four bits of the flag
</span></span></span><span class="line"><span class="cl"><span class="cm">** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the lower four bits equal SQLITE_SYNC_FULL, that means
</span></span></span><span class="line"><span class="cl"><span class="cm">** to use Mac OS X style fullsync instead of fsync().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
</span></span></span><span class="line"><span class="cl"><span class="cm">** settings. The [synchronous pragma] determines when calls to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xSync VFS method occur and applies uniformly across all platforms.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
</span></span></span><span class="line"><span class="cl"><span class="cm">** energetic or rigorous or forceful the sync operations are and
</span></span></span><span class="line"><span class="cl"><span class="cm">** only make a difference on Mac OSX for the default SQLite code.
</span></span></span><span class="line"><span class="cl"><span class="cm">** (Third-party VFS implementations might also make the distinction
</span></span></span><span class="line"><span class="cl"><span class="cm">** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
</span></span></span><span class="line"><span class="cl"><span class="cm">** operating systems natively supported by SQLite, only Mac OSX
</span></span></span><span class="line"><span class="cl"><span class="cm">** cares about the difference.)
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SYNC_NORMAL 0x00002
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SYNC_FULL 0x00003
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SYNC_DATAONLY 0x00010
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: OS Interface Open File Handle
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An [sqlite3_file] object represents an open file in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_vfs | OS interface layer]. Individual OS interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementations will
</span></span></span><span class="line"><span class="cl"><span class="cm">** want to subclass this object by appending additional fields
</span></span></span><span class="line"><span class="cl"><span class="cm">** for their own use. The pMethods entry is a pointer to an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_io_methods] object that defines methods for performing
</span></span></span><span class="line"><span class="cl"><span class="cm">** I/O operations on the open file.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_file</span> <span class="n">sqlite3_file</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_file</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="k">struct</span> <span class="n">sqlite3_io_methods</span> <span class="o">*</span><span class="n">pMethods</span><span class="p">;</span> <span class="cm">/* Methods for an open file */</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: OS Interface File Virtual Methods Object
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Every file opened by the [sqlite3_vfs.xOpen] method populates an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_file] object (or, more commonly, a subclass of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_file] object) with a pointer to an instance of this object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This object defines the methods used to perform various operations
</span></span></span><span class="line"><span class="cl"><span class="cm">** against the open file represented by the [sqlite3_file] object.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a non-NULL pointer, then the sqlite3_io_methods.xClose method
</span></span></span><span class="line"><span class="cl"><span class="cm">** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]
</span></span></span><span class="line"><span class="cl"><span class="cm">** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element
</span></span></span><span class="line"><span class="cl"><span class="cm">** to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY]
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag may be ORed in to indicate that only the data of the file
</span></span></span><span class="line"><span class="cl"><span class="cm">** and not its inode needs to be synced.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The integer values to xLock() and xUnlock() are one of
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_LOCK_NONE],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_LOCK_SHARED],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_LOCK_RESERVED],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_LOCK_PENDING], or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_LOCK_EXCLUSIVE].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** xLock() upgrades the database file lock. In other words, xLock() moves the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database file lock in the direction NONE toward EXCLUSIVE. The argument to
</span></span></span><span class="line"><span class="cl"><span class="cm">** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_LOCK_NONE. If the database file lock is already at or above the
</span></span></span><span class="line"><span class="cl"><span class="cm">** requested lock, then the call to xLock() is a no-op.
</span></span></span><span class="line"><span class="cl"><span class="cm">** xUnlock() downgrades the database file lock to either SHARED or NONE.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the lock is already at or below the requested lock state, then the call
</span></span></span><span class="line"><span class="cl"><span class="cm">** to xUnlock() is a no-op.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xCheckReservedLock() method checks whether any database connection,
</span></span></span><span class="line"><span class="cl"><span class="cm">** either in this process or in some other process, is holding a RESERVED,
</span></span></span><span class="line"><span class="cl"><span class="cm">** PENDING, or EXCLUSIVE lock on the file. It returns true
</span></span></span><span class="line"><span class="cl"><span class="cm">** if such a lock exists and false otherwise.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xFileControl() method is a generic interface that allows custom
</span></span></span><span class="line"><span class="cl"><span class="cm">** VFS implementations to directly control an open file using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_file_control()] interface. The second &#34;op&#34; argument is an
</span></span></span><span class="line"><span class="cl"><span class="cm">** integer opcode. The third argument is a generic pointer intended to
</span></span></span><span class="line"><span class="cl"><span class="cm">** point to a structure that may contain arguments or space in which to
</span></span></span><span class="line"><span class="cl"><span class="cm">** write return values. Potential uses for xFileControl() might be
</span></span></span><span class="line"><span class="cl"><span class="cm">** functions to enable blocking locks with timeouts, to change the
</span></span></span><span class="line"><span class="cl"><span class="cm">** locking strategy (for example to use dot-file locks), to inquire
</span></span></span><span class="line"><span class="cl"><span class="cm">** about the status of a lock, or to break stale locks. The SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** core reserves all opcodes less than 100 for its own use.
</span></span></span><span class="line"><span class="cl"><span class="cm">** A [file control opcodes | list of opcodes] less than 100 is available.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Applications that define a custom xFileControl method should use opcodes
</span></span></span><span class="line"><span class="cl"><span class="cm">** greater than 100 to avoid conflicts. VFS implementations should
</span></span></span><span class="line"><span class="cl"><span class="cm">** return [SQLITE_NOTFOUND] for file control opcodes that they do not
</span></span></span><span class="line"><span class="cl"><span class="cm">** recognize.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xSectorSize() method returns the sector size of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** device that underlies the file. The sector size is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** minimum write that can be performed without disturbing
</span></span></span><span class="line"><span class="cl"><span class="cm">** other bytes in the file. The xDeviceCharacteristics()
</span></span></span><span class="line"><span class="cl"><span class="cm">** method returns a bit vector describing behaviors of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** underlying device:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_ATOMIC]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_ATOMIC512]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_ATOMIC1K]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_ATOMIC2K]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_ATOMIC4K]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_ATOMIC8K]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_ATOMIC16K]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_ATOMIC32K]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_ATOMIC64K]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_SAFE_APPEND]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_SEQUENTIAL]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_IMMUTABLE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_IOCAP_BATCH_ATOMIC]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_IOCAP_ATOMIC property means that all writes of
</span></span></span><span class="line"><span class="cl"><span class="cm">** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
</span></span></span><span class="line"><span class="cl"><span class="cm">** mean that writes of blocks that are nnn bytes in size and
</span></span></span><span class="line"><span class="cl"><span class="cm">** are aligned to an address which is an integer multiple of
</span></span></span><span class="line"><span class="cl"><span class="cm">** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
</span></span></span><span class="line"><span class="cl"><span class="cm">** that when data is appended to a file, the data is appended
</span></span></span><span class="line"><span class="cl"><span class="cm">** first then the size of the file is extended, never the other
</span></span></span><span class="line"><span class="cl"><span class="cm">** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
</span></span></span><span class="line"><span class="cl"><span class="cm">** information is written to disk in the same order as calls
</span></span></span><span class="line"><span class="cl"><span class="cm">** to xWrite().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the unread portions of the buffer with zeros. A VFS that
</span></span></span><span class="line"><span class="cl"><span class="cm">** fails to zero-fill short reads might seem to work. However,
</span></span></span><span class="line"><span class="cl"><span class="cm">** failure to zero-fill short reads will eventually lead to
</span></span></span><span class="line"><span class="cl"><span class="cm">** database corruption.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_io_methods</span> <span class="n">sqlite3_io_methods</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_io_methods</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iVersion</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xClose</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xRead</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iAmt</span><span class="p">,</span> <span class="n">sqlite3_int64</span> <span class="n">iOfst</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xWrite</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iAmt</span><span class="p">,</span> <span class="n">sqlite3_int64</span> <span class="n">iOfst</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xTruncate</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_int64</span> <span class="n">size</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xSync</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">flags</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xFileSize</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_int64</span> <span class="o">*</span><span class="n">pSize</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xLock</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xUnlock</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xCheckReservedLock</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pResOut</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xFileControl</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">op</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pArg</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xSectorSize</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xDeviceCharacteristics</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Methods above are valid for version 1 */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xShmMap</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iPg</span><span class="p">,</span> <span class="kt">int</span> <span class="n">pgsz</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">void</span> <span class="k">volatile</span><span class="o">**</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xShmLock</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">offset</span><span class="p">,</span> <span class="kt">int</span> <span class="n">n</span><span class="p">,</span> <span class="kt">int</span> <span class="n">flags</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xShmBarrier</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xShmUnmap</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">deleteFlag</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Methods above are valid for version 2 */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xFetch</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_int64</span> <span class="n">iOfst</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iAmt</span><span class="p">,</span> <span class="kt">void</span> <span class="o">**</span><span class="n">pp</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xUnfetch</span><span class="p">)(</span><span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_int64</span> <span class="n">iOfst</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">p</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Methods above are valid for version 3 */</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Additional methods may be added in future releases */</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Standard File Control Opcodes
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {file control opcodes} {file control opcode}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These integer constants are opcodes for the xFileControl method
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_LOCKSTATE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
</span></span></span><span class="line"><span class="cl"><span class="cm">** opcode causes the xFileControl method to write the current state of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
</span></span></span><span class="line"><span class="cl"><span class="cm">** into an integer that the pArg argument points to.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This capability is only available if SQLite is compiled with [SQLITE_DEBUG].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_SIZE_HINT]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
</span></span></span><span class="line"><span class="cl"><span class="cm">** layer a hint of how large the database file will grow to be during the
</span></span></span><span class="line"><span class="cl"><span class="cm">** current transaction. This hint is not guaranteed to be accurate but it
</span></span></span><span class="line"><span class="cl"><span class="cm">** is often close. The underlying VFS might choose to preallocate database
</span></span></span><span class="line"><span class="cl"><span class="cm">** file space based on this hint in order to help writes to the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** file run faster.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_SIZE_LIMIT]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that
</span></span></span><span class="line"><span class="cl"><span class="cm">** implements [sqlite3_deserialize()] to set an upper bound on the size
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the in-memory database. The argument is a pointer to a [sqlite3_int64].
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the integer pointed to is negative, then it is filled in with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** current limit. Otherwise the limit is set to the larger of the value
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the integer pointed to and the current database size. The integer
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointed to is set to the new limit.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_CHUNK_SIZE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
</span></span></span><span class="line"><span class="cl"><span class="cm">** extends and truncates the database file in chunks of a size specified
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the user. The fourth argument to [sqlite3_file_control()] should
</span></span></span><span class="line"><span class="cl"><span class="cm">** point to an integer (type int) containing the new chunk-size to use
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the nominated database. Allocating database file space in large
</span></span></span><span class="line"><span class="cl"><span class="cm">** chunks (say 1MB at a time), may reduce file-system fragmentation and
</span></span></span><span class="line"><span class="cl"><span class="cm">** improve performance on some systems.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_FILE_POINTER]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the [sqlite3_file] object associated with a particular database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection. See also [SQLITE_FCNTL_JOURNAL_POINTER].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_JOURNAL_POINTER]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the [sqlite3_file] object associated with the journal file (either
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [rollback journal] or the [write-ahead log]) for a particular database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection. See also [SQLITE_FCNTL_FILE_POINTER].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_SYNC_OMITTED]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** No longer in use.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_SYNC]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
</span></span></span><span class="line"><span class="cl"><span class="cm">** sent to the VFS immediately before the xSync method is invoked on a
</span></span></span><span class="line"><span class="cl"><span class="cm">** database file descriptor. Or, if the xSync method is not invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** because the user has configured SQLite with
</span></span></span><span class="line"><span class="cl"><span class="cm">** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the xSync method. In most cases, the pointer argument passed with
</span></span></span><span class="line"><span class="cl"><span class="cm">** this file-control is NULL. However, if the database file is being synced
</span></span></span><span class="line"><span class="cl"><span class="cm">** as part of a multi-database commit, the argument points to a nul-terminated
</span></span></span><span class="line"><span class="cl"><span class="cm">** string containing the transactions super-journal file name. VFSes that
</span></span></span><span class="line"><span class="cl"><span class="cm">** do not need this signal should silently ignore this opcode. Applications
</span></span></span><span class="line"><span class="cl"><span class="cm">** should not call [sqlite3_file_control()] with this opcode as doing so may
</span></span></span><span class="line"><span class="cl"><span class="cm">** disrupt the operation of the specialized VFSes that do require it.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_COMMIT_PHASETWO]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** and sent to the VFS after a transaction has been committed immediately
</span></span></span><span class="line"><span class="cl"><span class="cm">** but before the database is unlocked. VFSes that do not need this signal
</span></span></span><span class="line"><span class="cl"><span class="cm">** should silently ignore this opcode. Applications should not call
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_file_control()] with this opcode as doing so may disrupt the
</span></span></span><span class="line"><span class="cl"><span class="cm">** operation of the specialized VFSes that do require it.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_WIN32_AV_RETRY]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
</span></span></span><span class="line"><span class="cl"><span class="cm">** retry counts and intervals for certain disk I/O operations for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** windows [VFS] in order to provide robustness in the presence of
</span></span></span><span class="line"><span class="cl"><span class="cm">** anti-virus programs. By default, the windows VFS will retry file read,
</span></span></span><span class="line"><span class="cl"><span class="cm">** file write, and file delete operations up to 10 times, with a delay
</span></span></span><span class="line"><span class="cl"><span class="cm">** of 25 milliseconds before the first retry and with the delay increasing
</span></span></span><span class="line"><span class="cl"><span class="cm">** by an additional 25 milliseconds with each subsequent retry. This
</span></span></span><span class="line"><span class="cl"><span class="cm">** opcode allows these two values (10 retries and 25 milliseconds of delay)
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be adjusted. The values are changed for all database connections
</span></span></span><span class="line"><span class="cl"><span class="cm">** within the same process. The argument is a pointer to an array of two
</span></span></span><span class="line"><span class="cl"><span class="cm">** integers where the first integer is the new retry count and the second
</span></span></span><span class="line"><span class="cl"><span class="cm">** integer is the delay. If either integer is negative, then the setting
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not changed but instead the prior value of that setting is written
</span></span></span><span class="line"><span class="cl"><span class="cm">** into the array entry, allowing the current retry settings to be
</span></span></span><span class="line"><span class="cl"><span class="cm">** interrogated. The zDbName parameter is ignored.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_PERSIST_WAL]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
</span></span></span><span class="line"><span class="cl"><span class="cm">** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary
</span></span></span><span class="line"><span class="cl"><span class="cm">** write ahead log ([WAL file]) and shared memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** files used for transaction control
</span></span></span><span class="line"><span class="cl"><span class="cm">** are automatically deleted when the latest connection to the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** closes. Setting persistent WAL mode causes those files to persist after
</span></span></span><span class="line"><span class="cl"><span class="cm">** close. Persisting the files is useful when other processes that do not
</span></span></span><span class="line"><span class="cl"><span class="cm">** have write permission on the directory containing the database file want
</span></span></span><span class="line"><span class="cl"><span class="cm">** to read the database file, as the WAL and shared memory files must exist
</span></span></span><span class="line"><span class="cl"><span class="cm">** in order for the database to be readable. The fourth parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** That integer is 0 to disable persistent WAL mode or 1 to enable persistent
</span></span></span><span class="line"><span class="cl"><span class="cm">** WAL mode. If the integer is -1, then it is overwritten with the current
</span></span></span><span class="line"><span class="cl"><span class="cm">** WAL persistence setting.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the
</span></span></span><span class="line"><span class="cl"><span class="cm">** persistent &#34;powersafe-overwrite&#34; or &#34;PSOW&#34; setting. The PSOW setting
</span></span></span><span class="line"><span class="cl"><span class="cm">** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xDeviceCharacteristics methods. The fourth parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
</span></span></span><span class="line"><span class="cl"><span class="cm">** mode. If the integer is -1, then it is overwritten with the current
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero-damage mode setting.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_OVERWRITE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening
</span></span></span><span class="line"><span class="cl"><span class="cm">** a write transaction to indicate that, unless it is rolled back for some
</span></span></span><span class="line"><span class="cl"><span class="cm">** reason, the entire database file will be overwritten by the current
</span></span></span><span class="line"><span class="cl"><span class="cm">** transaction. This is used by VACUUM operations.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_VFSNAME]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
</span></span></span><span class="line"><span class="cl"><span class="cm">** all [VFSes] in the VFS stack. The names are of all VFS shims and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** final bottom-level VFS are written into memory obtained from
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_malloc()] and the result is stored in the char* variable
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the fourth parameter of [sqlite3_file_control()] points to.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The caller is responsible for freeing the memory when done. As with
</span></span></span><span class="line"><span class="cl"><span class="cm">** all file-control actions, there is no guarantee that this will actually
</span></span></span><span class="line"><span class="cl"><span class="cm">** do anything. Callers should initialize the char* variable to a NULL
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer in case this file-control is not implemented. This file-control
</span></span></span><span class="line"><span class="cl"><span class="cm">** is intended for diagnostic use only.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_VFS_POINTER]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
</span></span></span><span class="line"><span class="cl"><span class="cm">** [VFSes] currently in use. ^(The argument X in
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
</span></span></span><span class="line"><span class="cl"><span class="cm">** of type &#34;[sqlite3_vfs] **&#34;. This opcodes will set *X
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a pointer to the top-level VFS.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When there are multiple VFS shims in the stack, this opcode finds the
</span></span></span><span class="line"><span class="cl"><span class="cm">** upper-most shim only.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_PRAGMA]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
</span></span></span><span class="line"><span class="cl"><span class="cm">** file control is sent to the open [sqlite3_file] object corresponding
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the database file to which the pragma statement refers. ^The argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the [SQLITE_FCNTL_PRAGMA] file control is an array of
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointers to strings (char**) in which the second element of the array
</span></span></span><span class="line"><span class="cl"><span class="cm">** is the name of the pragma and the third element is the argument to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** pragma or NULL if the pragma has no argument. ^The handler for an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the char** argument point to a string obtained from [sqlite3_mprintf()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or the equivalent and that string will become the result of the pragma or
</span></span></span><span class="line"><span class="cl"><span class="cm">** the error message if the pragma fails. ^If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal
</span></span></span><span class="line"><span class="cl"><span class="cm">** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA]
</span></span></span><span class="line"><span class="cl"><span class="cm">** file control returns [SQLITE_OK], then the parser assumes that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** VFS has handled the PRAGMA itself and the parser generates a no-op
</span></span></span><span class="line"><span class="cl"><span class="cm">** prepared statement if result string is NULL, or that returns a copy
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the result string if the string is non-NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the [SQLITE_FCNTL_PRAGMA] file control returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the VFS encountered an error while handling the [PRAGMA] and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA]
</span></span></span><span class="line"><span class="cl"><span class="cm">** file control occurs at the beginning of pragma statement analysis and so
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is able to override built-in [PRAGMA] statements.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_BUSYHANDLER]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_FCNTL_BUSYHANDLER]
</span></span></span><span class="line"><span class="cl"><span class="cm">** file-control may be invoked by SQLite on the database file handle
</span></span></span><span class="line"><span class="cl"><span class="cm">** shortly after it is opened in order to provide a custom VFS with access
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the connection&#39;s busy-handler callback. The argument is of type (void**)
</span></span></span><span class="line"><span class="cl"><span class="cm">** - an array of two (void *) values. The first (void *) actually points
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a function of type (int (*)(void *)). In order to invoke the connection&#39;s
</span></span></span><span class="line"><span class="cl"><span class="cm">** busy-handler, this function should be invoked with the second (void *) in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the array as the only argument. If it returns non-zero, then the operation
</span></span></span><span class="line"><span class="cl"><span class="cm">** should be retried. If it returns zero, the custom VFS should abandon the
</span></span></span><span class="line"><span class="cl"><span class="cm">** current operation.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_TEMPFILENAME]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
</span></span></span><span class="line"><span class="cl"><span class="cm">** to have SQLite generate a
</span></span></span><span class="line"><span class="cl"><span class="cm">** temporary filename using the same algorithm that is followed to generate
</span></span></span><span class="line"><span class="cl"><span class="cm">** temporary filenames for TEMP tables and other internal uses. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument should be a char** which will be filled with the filename
</span></span></span><span class="line"><span class="cl"><span class="cm">** written into memory obtained from [sqlite3_malloc()]. The caller should
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoke [sqlite3_free()] on the result to avoid a memory leak.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_MMAP_SIZE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the
</span></span></span><span class="line"><span class="cl"><span class="cm">** maximum number of bytes that will be used for memory-mapped I/O.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The argument is a pointer to a value of type sqlite3_int64 that
</span></span></span><span class="line"><span class="cl"><span class="cm">** is an advisory maximum number of bytes in the file to memory map. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer is overwritten with the old value. The limit is not changed if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the value originally pointed to is negative, and so the current limit
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be queried by passing in a pointer to a negative number. This
</span></span></span><span class="line"><span class="cl"><span class="cm">** file-control is used internally to implement [PRAGMA mmap_size].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_TRACE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_TRACE] file control provides advisory information
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the VFS about what the higher layers of the SQLite stack are doing.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This file control is used by some VFS activity tracing [shims].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The argument is a zero-terminated string. Higher layers in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite stack may generate instances of this file control if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_HAS_MOVED]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer to an integer and it writes a boolean into that integer depending
</span></span></span><span class="line"><span class="cl"><span class="cm">** on whether or not the file has been renamed, moved, or deleted since it
</span></span></span><span class="line"><span class="cl"><span class="cm">** was first opened.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_WIN32_GET_HANDLE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the
</span></span></span><span class="line"><span class="cl"><span class="cm">** underlying native file handle associated with a file handle. This file
</span></span></span><span class="line"><span class="cl"><span class="cm">** control interprets its argument as a pointer to a native file handle and
</span></span></span><span class="line"><span class="cl"><span class="cm">** writes the resulting value there.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
</span></span></span><span class="line"><span class="cl"><span class="cm">** opcode causes the xFileControl method to swap the file handle with the one
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointed to by the pArg argument. This capability is used during testing
</span></span></span><span class="line"><span class="cl"><span class="cm">** and only needs to be supported when SQLITE_TEST is defined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_WAL_BLOCK]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
</span></span></span><span class="line"><span class="cl"><span class="cm">** be advantageous to block on the next WAL lock if the lock is not immediately
</span></span></span><span class="line"><span class="cl"><span class="cm">** available. The WAL subsystem issues this signal during rare
</span></span></span><span class="line"><span class="cl"><span class="cm">** circumstances in order to fix a problem with priority inversion.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Applications should &lt;em&gt;not&lt;/em&gt; use this file-control.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_ZIPVFS]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
</span></span></span><span class="line"><span class="cl"><span class="cm">** VFS should return SQLITE_NOTFOUND for this opcode.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_RBU]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for
</span></span></span><span class="line"><span class="cl"><span class="cm">** this opcode.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the file descriptor is placed in &#34;batch write mode&#34;, which
</span></span></span><span class="line"><span class="cl"><span class="cm">** means all subsequent write operations will be deferred and done
</span></span></span><span class="line"><span class="cl"><span class="cm">** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems
</span></span></span><span class="line"><span class="cl"><span class="cm">** that do not support batch atomic writes will return SQLITE_NOTFOUND.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
</span></span></span><span class="line"><span class="cl"><span class="cm">** no VFS interface calls on the same [sqlite3_file] file descriptor
</span></span></span><span class="line"><span class="cl"><span class="cm">** except for calls to the xWrite method and the xFileControl method
</span></span></span><span class="line"><span class="cl"><span class="cm">** with [SQLITE_FCNTL_SIZE_HINT].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
</span></span></span><span class="line"><span class="cl"><span class="cm">** operations since the previous successful call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This file control returns [SQLITE_OK] if and only if the writes were
</span></span></span><span class="line"><span class="cl"><span class="cm">** all performed successfully and have been committed to persistent storage.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Regardless of whether or not it is successful, this file control takes
</span></span></span><span class="line"><span class="cl"><span class="cm">** the file descriptor out of batch write mode so that all subsequent
</span></span></span><span class="line"><span class="cl"><span class="cm">** write operations are independent.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
</span></span></span><span class="line"><span class="cl"><span class="cm">** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
</span></span></span><span class="line"><span class="cl"><span class="cm">** operations since the previous successful call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This file control takes the file descriptor out of batch write mode
</span></span></span><span class="line"><span class="cl"><span class="cm">** so that all subsequent write operations are independent.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
</span></span></span><span class="line"><span class="cl"><span class="cm">** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_LOCK_TIMEOUT]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode is used to configure a VFS
</span></span></span><span class="line"><span class="cl"><span class="cm">** to block for up to M milliseconds before failing when attempting to
</span></span></span><span class="line"><span class="cl"><span class="cm">** obtain a file lock using the xLock or xShmLock methods of the VFS.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The parameter is a pointer to a 32-bit signed integer that contains
</span></span></span><span class="line"><span class="cl"><span class="cm">** the value that M is to be set to. Before returning, the 32-bit signed
</span></span></span><span class="line"><span class="cl"><span class="cm">** integer is overwritten with the previous value of M.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_DATA_VERSION]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
</span></span></span><span class="line"><span class="cl"><span class="cm">** a database file. The argument is a pointer to a 32-bit unsigned integer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The &#34;data version&#34; for the pager is written into the pointer. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;data version&#34; changes whenever any change occurs to the corresponding
</span></span></span><span class="line"><span class="cl"><span class="cm">** database file, either through SQL statements on the same database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection or through transactions committed by separate database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connections possibly in other processes. The [sqlite3_total_changes()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface can be used to find if any database on the connection has changed,
</span></span></span><span class="line"><span class="cl"><span class="cm">** but that interface responds to changes on TEMP as well as MAIN and does
</span></span></span><span class="line"><span class="cl"><span class="cm">** not provide a mechanism to detect changes to MAIN only. Also, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_total_changes()] interface responds to internal changes only and
</span></span></span><span class="line"><span class="cl"><span class="cm">** omits changes made by other database connections. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** [PRAGMA data_version] command provides a mechanism to detect changes to
</span></span></span><span class="line"><span class="cl"><span class="cm">** a single attached database that occur due to other database connections,
</span></span></span><span class="line"><span class="cl"><span class="cm">** but omits changes implemented by the database connection on which it is
</span></span></span><span class="line"><span class="cl"><span class="cm">** called. This file control is the only mechanism to detect changes that
</span></span></span><span class="line"><span class="cl"><span class="cm">** happen either internally or externally and that are associated with
</span></span></span><span class="line"><span class="cl"><span class="cm">** a particular attached database.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_CKPT_START]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_CKPT_START] opcode is invoked from within a checkpoint
</span></span></span><span class="line"><span class="cl"><span class="cm">** in wal mode before the client starts to copy pages from the wal
</span></span></span><span class="line"><span class="cl"><span class="cm">** file to the database file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_CKPT_DONE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint
</span></span></span><span class="line"><span class="cl"><span class="cm">** in wal mode after the client has finished copying pages from the wal
</span></span></span><span class="line"><span class="cl"><span class="cm">** file to the database file, but before the *-shm file is updated to
</span></span></span><span class="line"><span class="cl"><span class="cm">** record the fact that the pages have been checkpointed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_EXTERNAL_READER]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
</span></span></span><span class="line"><span class="cl"><span class="cm">** whether or not there is a database client in another process with a wal-mode
</span></span></span><span class="line"><span class="cl"><span class="cm">** transaction open on the database or not. It is only available on unix.The
</span></span></span><span class="line"><span class="cl"><span class="cm">** (void*) argument passed with this file-control should be a pointer to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** value of type (int). The integer value is set to 1 if the database is a wal
</span></span></span><span class="line"><span class="cl"><span class="cm">** mode database and there exists at least one client in another process that
</span></span></span><span class="line"><span class="cl"><span class="cm">** currently has an SQL transaction open on the database. It is set to 0 if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database is not a wal-mode db, or if there is no such connection in any
</span></span></span><span class="line"><span class="cl"><span class="cm">** other process. This opcode cannot be used to detect transactions opened
</span></span></span><span class="line"><span class="cl"><span class="cm">** by clients within the current process, only within other processes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_CKSM_FILE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use internally by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [checksum VFS shim] only.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;[[SQLITE_FCNTL_RESET_CACHE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** If there is currently no transaction open on the database, and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control
</span></span></span><span class="line"><span class="cl"><span class="cm">** purges the contents of the in-memory page cache. If there is an open
</span></span></span><span class="line"><span class="cl"><span class="cm">** transaction, or if the db is a temp-db, this opcode is a no-op, not an error.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_LOCKSTATE 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_LAST_ERRNO 4
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_SIZE_HINT 5
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_CHUNK_SIZE 6
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_FILE_POINTER 7
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_SYNC_OMITTED 8
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_WIN32_AV_RETRY 9
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_PERSIST_WAL 10
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_OVERWRITE 11
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_VFSNAME 12
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_POWERSAFE_OVERWRITE 13
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_PRAGMA 14
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_BUSYHANDLER 15
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_TEMPFILENAME 16
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_MMAP_SIZE 18
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_TRACE 19
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_HAS_MOVED 20
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_SYNC 21
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_COMMIT_PHASETWO 22
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_WIN32_SET_HANDLE 23
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_WAL_BLOCK 24
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_ZIPVFS 25
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_RBU 26
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_VFS_POINTER 27
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_JOURNAL_POINTER 28
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_WIN32_GET_HANDLE 29
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_PDB 30
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_LOCK_TIMEOUT 34
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_DATA_VERSION 35
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_SIZE_LIMIT 36
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_CKPT_DONE 37
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_RESERVE_BYTES 38
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_CKPT_START 39
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_EXTERNAL_READER 40
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_CKSM_FILE 41
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FCNTL_RESET_CACHE 42
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/* deprecated names */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Mutex Handle
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The mutex module within SQLite defines [sqlite3_mutex] to be an
</span></span></span><span class="line"><span class="cl"><span class="cm">** abstract type for a mutex object. The SQLite core never looks
</span></span></span><span class="line"><span class="cl"><span class="cm">** at the internal representation of an [sqlite3_mutex]. It only
</span></span></span><span class="line"><span class="cl"><span class="cm">** deals with pointers to the [sqlite3_mutex] object.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Mutexes are created using [sqlite3_mutex_alloc()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_mutex</span> <span class="n">sqlite3_mutex</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Loadable Extension Thunk
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A pointer to the opaque sqlite3_api_routines structure is passed as
</span></span></span><span class="line"><span class="cl"><span class="cm">** the third parameter to entry points of [loadable extensions]. This
</span></span></span><span class="line"><span class="cl"><span class="cm">** structure must be typedefed in order to work around compiler warnings
</span></span></span><span class="line"><span class="cl"><span class="cm">** on some platforms.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_api_routines</span> <span class="n">sqlite3_api_routines</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: File Name
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Type [sqlite3_filename] is used by SQLite to pass filenames to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xOpen method of a [VFS]. It may be cast to (const char*) and treated
</span></span></span><span class="line"><span class="cl"><span class="cm">** as a normal, nul-terminated, UTF-8 buffer containing the filename, but
</span></span></span><span class="line"><span class="cl"><span class="cm">** may also be passed to special APIs such as:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_filename_database()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_filename_journal()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_filename_wal()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_uri_parameter()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_uri_boolean()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_uri_int64()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_uri_key()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">sqlite3_filename</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: OS Interface Object
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An instance of the sqlite3_vfs object defines the interface between
</span></span></span><span class="line"><span class="cl"><span class="cm">** the SQLite core and the underlying operating system. The &#34;vfs&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the name of the object stands for &#34;virtual file system&#34;. See
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [VFS | VFS documentation] for further information.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The VFS interface is sometimes extended by adding new methods onto
</span></span></span><span class="line"><span class="cl"><span class="cm">** the end. Each time such an extension occurs, the iVersion field
</span></span></span><span class="line"><span class="cl"><span class="cm">** is incremented. The iVersion value started out as 1 in
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
</span></span></span><span class="line"><span class="cl"><span class="cm">** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
</span></span></span><span class="line"><span class="cl"><span class="cm">** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields
</span></span></span><span class="line"><span class="cl"><span class="cm">** may be appended to the sqlite3_vfs object and the iVersion value
</span></span></span><span class="line"><span class="cl"><span class="cm">** may increase again in future versions of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that due to an oversight, the structure
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the sqlite3_vfs object changed in the transition from
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and yet the iVersion field was not increased.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The szOsFile field is the size of the subclassed [sqlite3_file]
</span></span></span><span class="line"><span class="cl"><span class="cm">** structure used by this VFS. mxPathname is the maximum length of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pathname in this VFS.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Registered sqlite3_vfs objects are kept on a linked list formed by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the pNext pointer. The [sqlite3_vfs_register()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and [sqlite3_vfs_unregister()] interfaces manage this list
</span></span></span><span class="line"><span class="cl"><span class="cm">** in a thread-safe way. The [sqlite3_vfs_find()] interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** searches the list. Neither the application code nor the VFS
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation should use the pNext pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The pNext field is the only field in the sqlite3_vfs
</span></span></span><span class="line"><span class="cl"><span class="cm">** structure that SQLite will ever modify. SQLite will only access
</span></span></span><span class="line"><span class="cl"><span class="cm">** or modify this field while holding a particular static mutex.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The application should never modify anything within the sqlite3_vfs
</span></span></span><span class="line"><span class="cl"><span class="cm">** object once the object has been registered.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The zName field holds the name of the VFS module. The name must
</span></span></span><span class="line"><span class="cl"><span class="cm">** be unique across all VFS modules.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[sqlite3_vfs.xOpen]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite guarantees that the zFilename parameter to xOpen
</span></span></span><span class="line"><span class="cl"><span class="cm">** is either a NULL pointer or string obtained
</span></span></span><span class="line"><span class="cl"><span class="cm">** from xFullPathname() with an optional suffix added.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If a suffix is added to the zFilename parameter, it will
</span></span></span><span class="line"><span class="cl"><span class="cm">** consist of a single &#34;-&#34; character followed by no more than
</span></span></span><span class="line"><span class="cl"><span class="cm">** 11 alphanumeric and/or &#34;-&#34; characters.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite further guarantees that
</span></span></span><span class="line"><span class="cl"><span class="cm">** the string will be valid and unchanged until xClose() is
</span></span></span><span class="line"><span class="cl"><span class="cm">** called. Because of the previous sentence,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3_file] can safely store a pointer to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** filename if it needs to remember the filename for some reason.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the zFilename parameter to xOpen is a NULL pointer then xOpen
</span></span></span><span class="line"><span class="cl"><span class="cm">** must invent its own temporary name for the file. ^Whenever the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xFilename parameter is NULL it will also be the case that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The flags argument to xOpen() includes all bits set in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [sqlite3_open16()] is used, then flags includes at least
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
</span></span></span><span class="line"><span class="cl"><span class="cm">** If xOpen() opens a file read-only then it sets *pOutFlags to
</span></span></span><span class="line"><span class="cl"><span class="cm">** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(SQLite will also add one of the following flags to the xOpen()
</span></span></span><span class="line"><span class="cl"><span class="cm">** call, depending on the object being opened:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_OPEN_MAIN_DB]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_OPEN_MAIN_JOURNAL]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_OPEN_TEMP_DB]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_OPEN_TEMP_JOURNAL]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_OPEN_TRANSIENT_DB]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_OPEN_SUBJOURNAL]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_OPEN_SUPER_JOURNAL]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_OPEN_WAL]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The file I/O implementation can use the object type flags to
</span></span></span><span class="line"><span class="cl"><span class="cm">** change the way it deals with files. For example, an application
</span></span></span><span class="line"><span class="cl"><span class="cm">** that does not care about crash recovery or rollback might make
</span></span></span><span class="line"><span class="cl"><span class="cm">** the open of a journal file a no-op. Writes to this journal would
</span></span></span><span class="line"><span class="cl"><span class="cm">** also be no-ops, and any attempt to read the journal would return
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_IOERR. Or the implementation might recognize that a database
</span></span></span><span class="line"><span class="cl"><span class="cm">** file will be doing page-aligned sector reads and writes in a random
</span></span></span><span class="line"><span class="cl"><span class="cm">** order and set up its I/O subsystem accordingly.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite might also add one of the following flags to the xOpen method:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_OPEN_DELETEONCLOSE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_OPEN_EXCLUSIVE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
</span></span></span><span class="line"><span class="cl"><span class="cm">** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be set for TEMP databases and their journals, transient
</span></span></span><span class="line"><span class="cl"><span class="cm">** databases, and subjournals.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the [SQLITE_OPEN_CREATE] flag, which are both directly
</span></span></span><span class="line"><span class="cl"><span class="cm">** analogous to the O_EXCL and O_CREAT flags of the POSIX open()
</span></span></span><span class="line"><span class="cl"><span class="cm">** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OPEN_CREATE, is used to indicate that file should always
</span></span></span><span class="line"><span class="cl"><span class="cm">** be created, and that it is an error if it already exists.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is &lt;i&gt;not&lt;/i&gt; used to indicate the file should be opened
</span></span></span><span class="line"><span class="cl"><span class="cm">** for exclusive access.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^At least szOsFile bytes of memory are allocated by SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** to hold the [sqlite3_file] structure passed as the third
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument to xOpen. The xOpen method does not have to
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocate the structure; it should just fill it in. Note that
</span></span></span><span class="line"><span class="cl"><span class="cm">** the xOpen method must set the sqlite3_file.pMethods to either
</span></span></span><span class="line"><span class="cl"><span class="cm">** a valid [sqlite3_io_methods] object or to NULL. xOpen must do
</span></span></span><span class="line"><span class="cl"><span class="cm">** this even if the open fails. SQLite expects that the sqlite3_file.pMethods
</span></span></span><span class="line"><span class="cl"><span class="cm">** element will be valid after xOpen returns regardless of the success
</span></span></span><span class="line"><span class="cl"><span class="cm">** or failure of the xOpen call.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[sqlite3_vfs.xAccess]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
</span></span></span><span class="line"><span class="cl"><span class="cm">** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to test whether a file is at least readable. The SQLITE_ACCESS_READ
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag is never actually used and is not implemented in the built-in
</span></span></span><span class="line"><span class="cl"><span class="cm">** VFSes of SQLite. The file is named by the second argument and can be a
</span></span></span><span class="line"><span class="cl"><span class="cm">** directory. The xAccess method returns [SQLITE_OK] on success or some
</span></span></span><span class="line"><span class="cl"><span class="cm">** non-zero error code if there is an I/O error or if the name of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the file given in the second argument is illegal. If SQLITE_OK
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned, then non-zero or zero is written into *pResOut to indicate
</span></span></span><span class="line"><span class="cl"><span class="cm">** whether or not the file is accessible.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite will always allocate at least mxPathname+1 bytes for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** output buffer xFullPathname. The exact size of the output buffer
</span></span></span><span class="line"><span class="cl"><span class="cm">** is also passed as a parameter to both methods. If the output buffer
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
</span></span></span><span class="line"><span class="cl"><span class="cm">** handled as a fatal error by SQLite, vfs implementations should endeavor
</span></span></span><span class="line"><span class="cl"><span class="cm">** to prevent this by setting mxPathname to a sufficiently large value.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces are not strictly a part of the filesystem, but they are
</span></span></span><span class="line"><span class="cl"><span class="cm">** included in the VFS structure for completeness.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xRandomness() function attempts to return nBytes bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** of good-quality randomness into zOut. The return value is
</span></span></span><span class="line"><span class="cl"><span class="cm">** the actual number of bytes of randomness obtained.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xSleep() method causes the calling thread to sleep for at
</span></span></span><span class="line"><span class="cl"><span class="cm">** least the number of microseconds given. ^The xCurrentTime()
</span></span></span><span class="line"><span class="cl"><span class="cm">** method returns a Julian Day Number for the current date and time as
</span></span></span><span class="line"><span class="cl"><span class="cm">** a floating point value.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The xCurrentTimeInt64() method returns, as an integer, the Julian
</span></span></span><span class="line"><span class="cl"><span class="cm">** Day Number multiplied by 86400000 (the number of milliseconds in
</span></span></span><span class="line"><span class="cl"><span class="cm">** a 24-hour day).
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite will use the xCurrentTimeInt64() method to get the current
</span></span></span><span class="line"><span class="cl"><span class="cm">** date and time if that method is available (if iVersion is 2 or
</span></span></span><span class="line"><span class="cl"><span class="cm">** greater and the function pointer is not NULL) and will fall back
</span></span></span><span class="line"><span class="cl"><span class="cm">** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** are not used by the SQLite core. These optional interfaces are provided
</span></span></span><span class="line"><span class="cl"><span class="cm">** by some VFSes to facilitate testing of the VFS code. By overriding
</span></span></span><span class="line"><span class="cl"><span class="cm">** system calls with functions under its control, a test program can
</span></span></span><span class="line"><span class="cl"><span class="cm">** simulate faults and error conditions that would otherwise be difficult
</span></span></span><span class="line"><span class="cl"><span class="cm">** or impossible to induce. The set of system calls that can be overridden
</span></span></span><span class="line"><span class="cl"><span class="cm">** varies from one VFS to another, and from one version of the same VFS to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** next. Applications that use these interfaces must be prepared for any
</span></span></span><span class="line"><span class="cl"><span class="cm">** or all of these interfaces to be NULL or for their behavior to change
</span></span></span><span class="line"><span class="cl"><span class="cm">** from one release to the next. Applications must not attempt to access
</span></span></span><span class="line"><span class="cl"><span class="cm">** any of these methods if the iVersion of the VFS is less than 3.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_vfs</span> <span class="n">sqlite3_vfs</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="nf">void</span> <span class="p">(</span><span class="o">*</span><span class="n">sqlite3_syscall_ptr</span><span class="p">)(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_vfs</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iVersion</span><span class="p">;</span> <span class="cm">/* Structure version number (currently 3) */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">szOsFile</span><span class="p">;</span> <span class="cm">/* Size of subclassed sqlite3_file */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">mxPathname</span><span class="p">;</span> <span class="cm">/* Maximum file pathname length */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_vfs</span> <span class="o">*</span><span class="n">pNext</span><span class="p">;</span> <span class="cm">/* Next registered VFS */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">;</span> <span class="cm">/* Name of this virtual file system */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pAppData</span><span class="p">;</span> <span class="cm">/* Pointer to application-specific data */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xOpen</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_filename</span> <span class="n">zName</span><span class="p">,</span> <span class="n">sqlite3_file</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">flags</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pOutFlags</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xDelete</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span> <span class="kt">int</span> <span class="n">syncDir</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xAccess</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span> <span class="kt">int</span> <span class="n">flags</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pResOut</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xFullPathname</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nOut</span><span class="p">,</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zOut</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xDlOpen</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zFilename</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xDlError</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nByte</span><span class="p">,</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zErrMsg</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xDlSym</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSymbol</span><span class="p">))(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xDlClose</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xRandomness</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nByte</span><span class="p">,</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zOut</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xSleep</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">microseconds</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xCurrentTime</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="kt">double</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xGetLastError</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">char</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm"> ** The methods above are in version 1 of the sqlite_vfs object
</span></span></span><span class="line"><span class="cl"><span class="cm"> ** definition. Those that follow are added in version 2 or later
</span></span></span><span class="line"><span class="cl"><span class="cm"> */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xCurrentTimeInt64</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_int64</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm"> ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
</span></span></span><span class="line"><span class="cl"><span class="cm"> ** Those below are for version 3 and greater.
</span></span></span><span class="line"><span class="cl"><span class="cm"> */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xSetSystemCall</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span> <span class="n">sqlite3_syscall_ptr</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="nf">sqlite3_syscall_ptr</span> <span class="p">(</span><span class="o">*</span><span class="n">xGetSystemCall</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xNextSystemCall</span><span class="p">)(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm"> ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
</span></span></span><span class="line"><span class="cl"><span class="cm"> ** New fields may be appended in future versions. The iVersion
</span></span></span><span class="line"><span class="cl"><span class="cm"> ** value will increment whenever this happens.
</span></span></span><span class="line"><span class="cl"><span class="cm"> */</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Flags for the xAccess VFS method
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These integer constants can be used as the third parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the xAccess method of an [sqlite3_vfs] object. They determine
</span></span></span><span class="line"><span class="cl"><span class="cm">** what kind of permissions the xAccess method is looking for.
</span></span></span><span class="line"><span class="cl"><span class="cm">** With SQLITE_ACCESS_EXISTS, the xAccess method
</span></span></span><span class="line"><span class="cl"><span class="cm">** simply checks whether the file exists.
</span></span></span><span class="line"><span class="cl"><span class="cm">** With SQLITE_ACCESS_READWRITE, the xAccess method
</span></span></span><span class="line"><span class="cl"><span class="cm">** checks whether the named directory is both readable and writable
</span></span></span><span class="line"><span class="cl"><span class="cm">** (in other words, if files can be added, removed, and renamed within
</span></span></span><span class="line"><span class="cl"><span class="cm">** the directory).
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_ACCESS_READWRITE constant is currently used only by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [temp_store_directory pragma], though this could change in a future
</span></span></span><span class="line"><span class="cl"><span class="cm">** release of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">** With SQLITE_ACCESS_READ, the xAccess method
</span></span></span><span class="line"><span class="cl"><span class="cm">** checks whether the file is readable. The SQLITE_ACCESS_READ constant is
</span></span></span><span class="line"><span class="cl"><span class="cm">** currently unused, though it might be used in a future release of
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ACCESS_EXISTS 0
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ACCESS_READWRITE 1 </span><span class="cm">/* Used by PRAGMA temp_store_directory */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ACCESS_READ 2 </span><span class="cm">/* Unused */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Flags for the xShmLock VFS method
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These integer constants define the various locking operations
</span></span></span><span class="line"><span class="cl"><span class="cm">** allowed by the xShmLock method of [sqlite3_io_methods]. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** following are the only legal combinations of flags to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xShmLock method:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_SHM_LOCK | SQLITE_SHM_SHARED
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
</span></span></span><span class="line"><span class="cl"><span class="cm">** was given on the corresponding lock.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xShmLock method can transition between unlocked and SHARED or
</span></span></span><span class="line"><span class="cl"><span class="cm">** between unlocked and EXCLUSIVE. It cannot transition between SHARED
</span></span></span><span class="line"><span class="cl"><span class="cm">** and EXCLUSIVE.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SHM_UNLOCK 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SHM_LOCK 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SHM_SHARED 4
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SHM_EXCLUSIVE 8
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Maximum xShmLock index
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xShmLock method on [sqlite3_io_methods] may use values
</span></span></span><span class="line"><span class="cl"><span class="cm">** between 0 and this upper bound as its &#34;offset&#34; argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLite core will never attempt to acquire or release a
</span></span></span><span class="line"><span class="cl"><span class="cm">** lock outside of this range
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SHM_NLOCK 8
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Initialize The SQLite Library
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_initialize() routine initializes the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite library. ^The sqlite3_shutdown() routine
</span></span></span><span class="line"><span class="cl"><span class="cm">** deallocates any resources that were allocated by sqlite3_initialize().
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines are designed to aid in process initialization and
</span></span></span><span class="line"><span class="cl"><span class="cm">** shutdown on embedded systems. Workstation applications using
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite normally do not need to invoke either of these routines.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A call to sqlite3_initialize() is an &#34;effective&#34; call if it is
</span></span></span><span class="line"><span class="cl"><span class="cm">** the first time sqlite3_initialize() is invoked during the lifetime of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the process, or if it is the first time sqlite3_initialize() is invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** following a call to sqlite3_shutdown(). ^(Only an effective call
</span></span></span><span class="line"><span class="cl"><span class="cm">** of sqlite3_initialize() does any initialization. All other calls
</span></span></span><span class="line"><span class="cl"><span class="cm">** are harmless no-ops.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A call to sqlite3_shutdown() is an &#34;effective&#34; call if it is the first
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only
</span></span></span><span class="line"><span class="cl"><span class="cm">** an effective call to sqlite3_shutdown() does any deinitialization.
</span></span></span><span class="line"><span class="cl"><span class="cm">** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not. The sqlite3_shutdown() interface must only be called from a
</span></span></span><span class="line"><span class="cl"><span class="cm">** single thread. All open [database connections] must be closed and all
</span></span></span><span class="line"><span class="cl"><span class="cm">** other SQLite resources must be deallocated prior to invoking
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_shutdown().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Among other things, ^sqlite3_initialize() will invoke
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_os_init(). Similarly, ^sqlite3_shutdown()
</span></span></span><span class="line"><span class="cl"><span class="cm">** will invoke sqlite3_os_end().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If for some reason, sqlite3_initialize() is unable to initialize
</span></span></span><span class="line"><span class="cl"><span class="cm">** the library (perhaps it is unable to allocate a needed resource such
</span></span></span><span class="line"><span class="cl"><span class="cm">** as a mutex) it returns an [error code] other than [SQLITE_OK].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_initialize() routine is called internally by many other
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite interfaces so that an application usually does not need to
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoke sqlite3_initialize() directly. For example, [sqlite3_open()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** calls sqlite3_initialize() so the SQLite library will be automatically
</span></span></span><span class="line"><span class="cl"><span class="cm">** initialized when [sqlite3_open()] is called if it has not be initialized
</span></span></span><span class="line"><span class="cl"><span class="cm">** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
</span></span></span><span class="line"><span class="cl"><span class="cm">** compile-time option, then the automatic calls to sqlite3_initialize()
</span></span></span><span class="line"><span class="cl"><span class="cm">** are omitted and the application must call sqlite3_initialize() directly
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior to using any other SQLite interface. For maximum portability,
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is recommended that applications always invoke sqlite3_initialize()
</span></span></span><span class="line"><span class="cl"><span class="cm">** directly prior to using any other SQLite interface. Future releases
</span></span></span><span class="line"><span class="cl"><span class="cm">** of SQLite may require this. In other words, the behavior exhibited
</span></span></span><span class="line"><span class="cl"><span class="cm">** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the
</span></span></span><span class="line"><span class="cl"><span class="cm">** default behavior in some future release of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_os_init() routine does operating-system specific
</span></span></span><span class="line"><span class="cl"><span class="cm">** initialization of the SQLite library. The sqlite3_os_end()
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine undoes the effect of sqlite3_os_init(). Typical tasks
</span></span></span><span class="line"><span class="cl"><span class="cm">** performed by these routines include allocation or deallocation
</span></span></span><span class="line"><span class="cl"><span class="cm">** of static resources, initialization of global variables,
</span></span></span><span class="line"><span class="cl"><span class="cm">** setting up a default [sqlite3_vfs] module, or setting up
</span></span></span><span class="line"><span class="cl"><span class="cm">** a default configuration using [sqlite3_config()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The application should never invoke either sqlite3_os_init()
</span></span></span><span class="line"><span class="cl"><span class="cm">** or sqlite3_os_end() directly. The application should only invoke
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface is called automatically by sqlite3_initialize() and
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementations for sqlite3_os_init() and sqlite3_os_end()
</span></span></span><span class="line"><span class="cl"><span class="cm">** are built into SQLite when it is compiled for Unix, Windows, or OS/2.
</span></span></span><span class="line"><span class="cl"><span class="cm">** When [custom builds | built for other platforms]
</span></span></span><span class="line"><span class="cl"><span class="cm">** (using the [SQLITE_OS_OTHER=1] compile-time
</span></span></span><span class="line"><span class="cl"><span class="cm">** option) the application must supply a suitable implementation for
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation of sqlite3_os_init() or sqlite3_os_end()
</span></span></span><span class="line"><span class="cl"><span class="cm">** must return [SQLITE_OK] on success and some other [error code] upon
</span></span></span><span class="line"><span class="cl"><span class="cm">** failure.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_initialize</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_shutdown</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_os_init</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_os_end</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Configuring The SQLite Library
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_config() interface is used to make global configuration
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes to SQLite in order to tune SQLite to the specific needs of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the application. The default configuration is recommended for most
</span></span></span><span class="line"><span class="cl"><span class="cm">** applications and so this routine is usually not necessary. It is
</span></span></span><span class="line"><span class="cl"><span class="cm">** provided to support rare applications with unusual needs.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;The sqlite3_config() interface is not threadsafe. The application
</span></span></span><span class="line"><span class="cl"><span class="cm">** must ensure that no other SQLite interfaces are invoked by other
</span></span></span><span class="line"><span class="cl"><span class="cm">** threads while sqlite3_config() is running.&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument to sqlite3_config() is an integer
</span></span></span><span class="line"><span class="cl"><span class="cm">** [configuration option] that determines
</span></span></span><span class="line"><span class="cl"><span class="cm">** what property of SQLite is to be configured. Subsequent arguments
</span></span></span><span class="line"><span class="cl"><span class="cm">** vary depending on the [configuration option]
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the first argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For most configuration options, the sqlite3_config() interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** may only be invoked prior to library initialization using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The exceptional configuration options that may be invoked at any time
</span></span></span><span class="line"><span class="cl"><span class="cm">** are called &#34;anytime configuration options&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_shutdown()] with a first argument that is not an anytime
</span></span></span><span class="line"><span class="cl"><span class="cm">** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note, however, that ^sqlite3_config() can be called as part of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation of an application-defined [sqlite3_os_init()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the option is unknown or SQLite is unable to set the option
</span></span></span><span class="line"><span class="cl"><span class="cm">** then this routine returns a non-zero [error code].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_config</span><span class="p">(</span><span class="kt">int</span><span class="p">,</span> <span class="p">...);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Configure database connections
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_db_config() interface is used to make configuration
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes to a [database connection]. The interface is similar to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config()] except that the changes apply to a single
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] (specified in the first argument).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second argument to sqlite3_db_config(D,V,...) is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code
</span></span></span><span class="line"><span class="cl"><span class="cm">** that indicates what aspect of the [database connection] is being configured.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Subsequent arguments vary depending on the configuration verb.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the call is considered successful.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_db_config</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">op</span><span class="p">,</span> <span class="p">...);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Memory Allocation Routines
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An instance of this object defines the interface between SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** and low-level memory allocation routines.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This object is used in only one place in the SQLite interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">** A pointer to an instance of this object is the argument to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config()] when the configuration option is
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].
</span></span></span><span class="line"><span class="cl"><span class="cm">** By creating an instance of this object
</span></span></span><span class="line"><span class="cl"><span class="cm">** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
</span></span></span><span class="line"><span class="cl"><span class="cm">** during configuration, an application can specify an alternative
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory allocation subsystem for SQLite to use for all of its
</span></span></span><span class="line"><span class="cl"><span class="cm">** dynamic memory needs.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that SQLite comes with several [built-in memory allocators]
</span></span></span><span class="line"><span class="cl"><span class="cm">** that are perfectly adequate for the overwhelming majority of applications
</span></span></span><span class="line"><span class="cl"><span class="cm">** and that this object is only useful to a tiny minority of applications
</span></span></span><span class="line"><span class="cl"><span class="cm">** with specialized memory allocation requirements. This object is
</span></span></span><span class="line"><span class="cl"><span class="cm">** also used during testing of SQLite in order to specify an alternative
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory allocator that simulates memory out-of-memory conditions in
</span></span></span><span class="line"><span class="cl"><span class="cm">** order to verify that SQLite recovers gracefully from such
</span></span></span><span class="line"><span class="cl"><span class="cm">** conditions.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xMalloc, xRealloc, and xFree methods must work like the
</span></span></span><span class="line"><span class="cl"><span class="cm">** malloc(), realloc() and free() functions from the standard C library.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite guarantees that the second argument to
</span></span></span><span class="line"><span class="cl"><span class="cm">** xRealloc is always a value returned by a prior call to xRoundup.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xSize should return the allocated size of a memory allocation
</span></span></span><span class="line"><span class="cl"><span class="cm">** previously obtained from xMalloc or xRealloc. The allocated size
</span></span></span><span class="line"><span class="cl"><span class="cm">** is always at least as big as the requested size but may be larger.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xRoundup method returns what would be the allocated size of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a memory allocation given a particular requested size. Most memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocators round up memory allocations at least to the next multiple
</span></span></span><span class="line"><span class="cl"><span class="cm">** of 8. Some allocators round up to a larger multiple or to a power of 2.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Every memory allocation request coming in through [sqlite3_malloc()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0,
</span></span></span><span class="line"><span class="cl"><span class="cm">** that causes the corresponding memory allocation to fail.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xInit method initializes the memory allocator. For example,
</span></span></span><span class="line"><span class="cl"><span class="cm">** it might allocate any required mutexes or initialize internal data
</span></span></span><span class="line"><span class="cl"><span class="cm">** structures. The xShutdown method is invoked (indirectly) by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_shutdown()] and should deallocate any resources acquired
</span></span></span><span class="line"><span class="cl"><span class="cm">** by xInit. The pAppData pointer is used as the only parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** xInit and xShutdown.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes
</span></span></span><span class="line"><span class="cl"><span class="cm">** the xInit method, so the xInit method need not be threadsafe. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** xShutdown method is only called from [sqlite3_shutdown()] so it does
</span></span></span><span class="line"><span class="cl"><span class="cm">** not need to be threadsafe either. For all other methods, SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is by default) and so the methods are automatically serialized.
</span></span></span><span class="line"><span class="cl"><span class="cm">** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
</span></span></span><span class="line"><span class="cl"><span class="cm">** methods must be threadsafe or else make their own arrangements for
</span></span></span><span class="line"><span class="cl"><span class="cm">** serialization.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite will never invoke xInit() more than once without an intervening
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to xShutdown().
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_mem_methods</span> <span class="n">sqlite3_mem_methods</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_mem_methods</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xMalloc</span><span class="p">)(</span><span class="kt">int</span><span class="p">);</span> <span class="cm">/* Memory allocation function */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xFree</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span> <span class="cm">/* Free a prior allocation */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xRealloc</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span> <span class="cm">/* Resize an allocation */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xSize</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span> <span class="cm">/* Return the size of an allocation */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xRoundup</span><span class="p">)(</span><span class="kt">int</span><span class="p">);</span> <span class="cm">/* Round up request size to allocation size */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInit</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span> <span class="cm">/* Initialize the memory allocator */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xShutdown</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span> <span class="cm">/* Deinitialize the memory allocator */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pAppData</span><span class="p">;</span> <span class="cm">/* Argument to xInit() and xShutdown() */</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Configuration Options
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {configuration option}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants are the available integer configuration options that
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be passed as the first argument to the [sqlite3_config()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Most of the configuration options for sqlite3_config()
</span></span></span><span class="line"><span class="cl"><span class="cm">** will only work if invoked prior to [sqlite3_initialize()] or after
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_shutdown()]. The few exceptions to this rule are called
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;anytime configuration options&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Calling [sqlite3_config()] with a first argument that is not an
</span></span></span><span class="line"><span class="cl"><span class="cm">** anytime configuration option in between calls to [sqlite3_initialize()] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The set of anytime configuration options can change (by insertions
</span></span></span><span class="line"><span class="cl"><span class="cm">** and/or deletions) from one release of SQLite to the next.
</span></span></span><span class="line"><span class="cl"><span class="cm">** As of SQLite version 3.42.0, the complete set of anytime configuration
</span></span></span><span class="line"><span class="cl"><span class="cm">** options is:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_CONFIG_LOG
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_CONFIG_PCACHE_HDRSZ
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** New configuration options may be added in future releases of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Existing configuration options might be discontinued. Applications
</span></span></span><span class="line"><span class="cl"><span class="cm">** should check the return code from [sqlite3_config()] to make sure that
</span></span></span><span class="line"><span class="cl"><span class="cm">** the call worked. The [sqlite3_config()] interface will return a
</span></span></span><span class="line"><span class="cl"><span class="cm">** non-zero [error code] if a discontinued or unsupported configuration option
</span></span></span><span class="line"><span class="cl"><span class="cm">** is invoked.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_SINGLETHREAD]] &lt;dt&gt;SQLITE_CONFIG_SINGLETHREAD&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;There are no arguments to this option. ^This option sets the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [threading mode] to Single-thread. In other words, it disables
</span></span></span><span class="line"><span class="cl"><span class="cm">** all mutexing and puts SQLite into a mode where it can only be used
</span></span></span><span class="line"><span class="cl"><span class="cm">** by a single thread. ^If SQLite is compiled with
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is not possible to change the [threading mode] from its default
</span></span></span><span class="line"><span class="cl"><span class="cm">** value of Single-thread and so [sqlite3_config()] will return
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD
</span></span></span><span class="line"><span class="cl"><span class="cm">** configuration option.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_MULTITHREAD]] &lt;dt&gt;SQLITE_CONFIG_MULTITHREAD&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;There are no arguments to this option. ^This option sets the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [threading mode] to Multi-thread. In other words, it disables
</span></span></span><span class="line"><span class="cl"><span class="cm">** mutexing on [database connection] and [prepared statement] objects.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The application is responsible for serializing access to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connections] and [prepared statements]. But other mutexes
</span></span></span><span class="line"><span class="cl"><span class="cm">** are enabled so that SQLite will be safe to use in a multi-threaded
</span></span></span><span class="line"><span class="cl"><span class="cm">** environment as long as no two threads attempt to use the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] at the same time. ^If SQLite is compiled with
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is not possible to set the Multi-thread [threading mode] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_CONFIG_MULTITHREAD configuration option.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_SERIALIZED]] &lt;dt&gt;SQLITE_CONFIG_SERIALIZED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;There are no arguments to this option. ^This option sets the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [threading mode] to Serialized. In other words, this option enables
</span></span></span><span class="line"><span class="cl"><span class="cm">** all mutexes including the recursive
</span></span></span><span class="line"><span class="cl"><span class="cm">** mutexes on [database connection] and [prepared statement] objects.
</span></span></span><span class="line"><span class="cl"><span class="cm">** In this mode (which is the default when SQLite is compiled with
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access
</span></span></span><span class="line"><span class="cl"><span class="cm">** to [database connections] and [prepared statements] so that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** application is free to use the same [database connection] or the
</span></span></span><span class="line"><span class="cl"><span class="cm">** same [prepared statement] in different threads at the same time.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If SQLite is compiled with
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is not possible to set the Serialized [threading mode] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_CONFIG_SERIALIZED configuration option.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_MALLOC]] &lt;dt&gt;SQLITE_CONFIG_MALLOC&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to an instance of the [sqlite3_mem_methods] structure.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The argument specifies
</span></span></span><span class="line"><span class="cl"><span class="cm">** alternative low-level memory allocation routines to be used in place of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the memory allocation routines built into SQLite.)^ ^SQLite makes
</span></span></span><span class="line"><span class="cl"><span class="cm">** its own private copy of the content of the [sqlite3_mem_methods] structure
</span></span></span><span class="line"><span class="cl"><span class="cm">** before the [sqlite3_config()] call returns.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_GETMALLOC]] &lt;dt&gt;SQLITE_CONFIG_GETMALLOC&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a pointer to an instance of the [sqlite3_mem_methods] structure.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_mem_methods]
</span></span></span><span class="line"><span class="cl"><span class="cm">** structure is filled with the currently defined memory allocation routines.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** This option can be used to overload the default memory allocation
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines with a wrapper that simulations memory allocation failure or
</span></span></span><span class="line"><span class="cl"><span class="cm">** tracks memory usage, for example. &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_SMALL_MALLOC]] &lt;dt&gt;SQLITE_CONFIG_SMALL_MALLOC&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
</span></span></span><span class="line"><span class="cl"><span class="cm">** type int, interpreted as a boolean, which if true provides a hint to
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite that it should avoid large memory allocations if possible.
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite will run faster if it is free to make large memory allocations,
</span></span></span><span class="line"><span class="cl"><span class="cm">** but some application might prefer to run slower in exchange for
</span></span></span><span class="line"><span class="cl"><span class="cm">** guarantees about memory fragmentation that are possible if large
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocations are avoided. This hint is normally off.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_MEMSTATUS]] &lt;dt&gt;SQLITE_CONFIG_MEMSTATUS&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
</span></span></span><span class="line"><span class="cl"><span class="cm">** interpreted as a boolean, which enables or disables the collection of
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory allocation statistics. ^(When memory allocation statistics are
</span></span></span><span class="line"><span class="cl"><span class="cm">** disabled, the following SQLite interfaces become non-operational:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_hard_heap_limit64()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_memory_used()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_memory_highwater()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_soft_heap_limit64()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_status64()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Memory allocation statistics are enabled by default unless SQLite is
</span></span></span><span class="line"><span class="cl"><span class="cm">** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocation statistics are disabled by default.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_SCRATCH]] &lt;dt&gt;SQLITE_CONFIG_SCRATCH&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; The SQLITE_CONFIG_SCRATCH option is no longer used.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_PAGECACHE]] &lt;dt&gt;SQLITE_CONFIG_PAGECACHE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool
</span></span></span><span class="line"><span class="cl"><span class="cm">** that SQLite can use for the database page cache with the default page
</span></span></span><span class="line"><span class="cl"><span class="cm">** cache implementation.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This configuration option is a no-op if an application-defined page
</span></span></span><span class="line"><span class="cl"><span class="cm">** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
</span></span></span><span class="line"><span class="cl"><span class="cm">** 8-byte aligned memory (pMem), the size of each page cache line (sz),
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the number of cache lines (N).
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sz argument should be the size of the largest database page
</span></span></span><span class="line"><span class="cl"><span class="cm">** (a power of two between 512 and 65536) plus some extra bytes for each
</span></span></span><span class="line"><span class="cl"><span class="cm">** page header. ^The number of extra bytes needed by the page header
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be determined using [SQLITE_CONFIG_PCACHE_HDRSZ].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^It is harmless, apart from the wasted memory,
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the sz parameter to be larger than necessary. The pMem
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument must be either a NULL pointer or a pointer to an 8-byte
</span></span></span><span class="line"><span class="cl"><span class="cm">** aligned block of memory of at least sz*N bytes, otherwise
</span></span></span><span class="line"><span class="cl"><span class="cm">** subsequent behavior is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When pMem is not NULL, SQLite will strive to use the memory provided
</span></span></span><span class="line"><span class="cl"><span class="cm">** to satisfy page cache needs, falling back to [sqlite3_malloc()] if
</span></span></span><span class="line"><span class="cl"><span class="cm">** a page cache line is larger than sz bytes or if all of the pMem buffer
</span></span></span><span class="line"><span class="cl"><span class="cm">** is exhausted.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If pMem is NULL and N is non-zero, then each database connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** does an initial bulk allocation for page cache memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
</span></span></span><span class="line"><span class="cl"><span class="cm">** of -1024*N bytes if N is negative, . ^If additional
</span></span></span><span class="line"><span class="cl"><span class="cm">** page cache memory is needed beyond what is provided by the initial
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocation, then SQLite goes to [sqlite3_malloc()] separately for each
</span></span></span><span class="line"><span class="cl"><span class="cm">** additional cache line. &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_HEAP]] &lt;dt&gt;SQLITE_CONFIG_HEAP&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
</span></span></span><span class="line"><span class="cl"><span class="cm">** that SQLite will use for all of its dynamic memory allocation needs
</span></span></span><span class="line"><span class="cl"><span class="cm">** beyond those provided for by [SQLITE_CONFIG_PAGECACHE].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
</span></span></span><span class="line"><span class="cl"><span class="cm">** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ERROR] if invoked otherwise.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^There are three arguments to SQLITE_CONFIG_HEAP:
</span></span></span><span class="line"><span class="cl"><span class="cm">** An 8-byte aligned pointer to the memory,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the number of bytes in the memory buffer, and the minimum allocation size.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
</span></span></span><span class="line"><span class="cl"><span class="cm">** to using its default memory allocator (the system malloc() implementation),
</span></span></span><span class="line"><span class="cl"><span class="cm">** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory pointer is not NULL then the alternative memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocator is engaged to handle all of SQLites memory allocation needs.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first pointer (the memory pointer) must be aligned to an 8-byte
</span></span></span><span class="line"><span class="cl"><span class="cm">** boundary or subsequent behavior of SQLite will be undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The minimum allocation size is capped at 2**12. Reasonable values
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the minimum allocation size are 2**5 through 2**8.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_MUTEX]] &lt;dt&gt;SQLITE_CONFIG_MUTEX&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer to an instance of the [sqlite3_mutex_methods] structure.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The argument specifies alternative low-level mutex routines to be used
</span></span></span><span class="line"><span class="cl"><span class="cm">** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the content of the [sqlite3_mutex_methods] structure before the call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config()] returns. ^If SQLite is compiled with
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the entire mutexing subsystem is omitted from the build and hence calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
</span></span></span><span class="line"><span class="cl"><span class="cm">** return [SQLITE_ERROR].&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_GETMUTEX]] &lt;dt&gt;SQLITE_CONFIG_GETMUTEX&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_mutex_methods]
</span></span></span><span class="line"><span class="cl"><span class="cm">** structure is filled with the currently defined mutex routines.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** This option can be used to overload the default mutex allocation
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines with a wrapper used to track mutex usage for performance
</span></span></span><span class="line"><span class="cl"><span class="cm">** profiling or testing, for example. ^If SQLite is compiled with
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the entire mutexing subsystem is omitted from the build and hence calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
</span></span></span><span class="line"><span class="cl"><span class="cm">** return [SQLITE_ERROR].&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_LOOKASIDE]] &lt;dt&gt;SQLITE_CONFIG_LOOKASIDE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
</span></span></span><span class="line"><span class="cl"><span class="cm">** the default size of lookaside memory on each [database connection].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** size of each lookaside buffer slot and the second is the number of
</span></span></span><span class="line"><span class="cl"><span class="cm">** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
</span></span></span><span class="line"><span class="cl"><span class="cm">** sets the &lt;i&gt;default&lt;/i&gt; lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** option to [sqlite3_db_config()] can be used to change the lookaside
</span></span></span><span class="line"><span class="cl"><span class="cm">** configuration on individual connections.)^ &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_PCACHE2]] &lt;dt&gt;SQLITE_CONFIG_PCACHE2&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to an [sqlite3_pcache_methods2] object. This object specifies
</span></span></span><span class="line"><span class="cl"><span class="cm">** the interface to a custom page cache implementation.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_GETPCACHE2]] &lt;dt&gt;SQLITE_CONFIG_GETPCACHE2&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the current page cache implementation into that object.)^ &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_LOG]] &lt;dt&gt;SQLITE_CONFIG_LOG&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; The SQLITE_CONFIG_LOG option is used to configure the SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** global [error log].
</span></span></span><span class="line"><span class="cl"><span class="cm">** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** function with a call signature of void(*)(void*,int,const char*),
</span></span></span><span class="line"><span class="cl"><span class="cm">** and a pointer to void. ^If the function pointer is not NULL, it is
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked by [sqlite3_log()] to process each logging event. ^If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed through as the first parameter to the application-defined logger
</span></span></span><span class="line"><span class="cl"><span class="cm">** function whenever that function is invoked. ^The second parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the logger function is a copy of the first parameter to the corresponding
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_log()] call and is intended to be a [result code] or an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [extended result code]. ^The third parameter passed to the logger is
</span></span></span><span class="line"><span class="cl"><span class="cm">** log message after formatting via [sqlite3_snprintf()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLite logging interface is not reentrant; the logger function
</span></span></span><span class="line"><span class="cl"><span class="cm">** supplied by the application must not invoke any SQLite interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">** In a multi-threaded application, the application-defined logger
</span></span></span><span class="line"><span class="cl"><span class="cm">** function must be threadsafe. &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_URI]] &lt;dt&gt;SQLITE_CONFIG_URI
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^(The SQLITE_CONFIG_URI option takes a single argument of type int.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If non-zero, then URI handling is globally enabled. If the parameter is zero,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then URI handling is globally disabled.)^ ^If URI handling is globally
</span></span></span><span class="line"><span class="cl"><span class="cm">** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_open16()] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** specified as part of [ATTACH] commands are interpreted as URIs, regardless
</span></span></span><span class="line"><span class="cl"><span class="cm">** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection is opened. ^If it is globally disabled, filenames are
</span></span></span><span class="line"><span class="cl"><span class="cm">** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connection is opened. ^(By default, URI handling is globally
</span></span></span><span class="line"><span class="cl"><span class="cm">** disabled. The default value may be changed by compiling with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_USE_URI] symbol defined.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] &lt;dt&gt;SQLITE_CONFIG_COVERING_INDEX_SCAN
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument which is interpreted as a boolean in order to enable or disable
</span></span></span><span class="line"><span class="cl"><span class="cm">** the use of covering indices for full table scans in the query optimizer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The default setting is determined
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is &#34;on&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** if that compile-time option is omitted.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The ability to disable the use of covering indices for full table scans
</span></span></span><span class="line"><span class="cl"><span class="cm">** is because some incorrectly coded legacy applications might malfunction
</span></span></span><span class="line"><span class="cl"><span class="cm">** when the optimization is enabled. Providing the ability to
</span></span></span><span class="line"><span class="cl"><span class="cm">** disable the optimization allows the older, buggy application code to work
</span></span></span><span class="line"><span class="cl"><span class="cm">** without change even with newer versions of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; These options are obsolete and should not be used by new code.
</span></span></span><span class="line"><span class="cl"><span class="cm">** They are retained for backwards compatibility but are now no-ops.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_SQLLOG]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CONFIG_SQLLOG
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This option is only available if sqlite is compiled with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should
</span></span></span><span class="line"><span class="cl"><span class="cm">** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int).
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second should be of type (void*). The callback is invoked by the library
</span></span></span><span class="line"><span class="cl"><span class="cm">** in three separate circumstances, identified by the value passed as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** fourth parameter. If the fourth parameter is 0, then the database connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed as the second argument has just been opened. The third argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** points to a buffer containing the name of the main database file. If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** fourth parameter is 1, then the SQL statement that the third parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** points to has just been executed. Or, if the fourth parameter is 2, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the connection being passed as the second parameter is being closed. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** third parameter is passed NULL In this case. An example of using this
</span></span></span><span class="line"><span class="cl"><span class="cm">** configuration option can be seen in the &#34;test_sqllog.c&#34; source file in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the canonical SQLite source tree.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_MMAP_SIZE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CONFIG_MMAP_SIZE
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values
</span></span></span><span class="line"><span class="cl"><span class="cm">** that are the default mmap size limit (the default setting for
</span></span></span><span class="line"><span class="cl"><span class="cm">** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The default setting can be overridden by each database connection using
</span></span></span><span class="line"><span class="cl"><span class="cm">** either the [PRAGMA mmap_size] command, or by using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be silently truncated if necessary so that it does not exceed the
</span></span></span><span class="line"><span class="cl"><span class="cm">** compile-time maximum mmap size set by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If either argument to this option is negative, then that argument is
</span></span></span><span class="line"><span class="cl"><span class="cm">** changed to its compile-time default.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CONFIG_WIN32_HEAPSIZE
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is
</span></span></span><span class="line"><span class="cl"><span class="cm">** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro
</span></span></span><span class="line"><span class="cl"><span class="cm">** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
</span></span></span><span class="line"><span class="cl"><span class="cm">** that specifies the maximum size of the created heap.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_PCACHE_HDRSZ]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CONFIG_PCACHE_HDRSZ
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a pointer to an integer and writes into that integer the number of extra
</span></span></span><span class="line"><span class="cl"><span class="cm">** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The amount of extra space required can change depending on the compiler,
</span></span></span><span class="line"><span class="cl"><span class="cm">** target platform, and SQLite version.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_PMASZ]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CONFIG_PMASZ
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The SQLITE_CONFIG_PMASZ option takes a single parameter which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is an unsigned integer and sets the &#34;Minimum PMA Size&#34; for the multithreaded
</span></span></span><span class="line"><span class="cl"><span class="cm">** sorter to that integer. The default minimum PMA Size is set by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_SORTER_PMASZ] compile-time option. New threads are launched
</span></span></span><span class="line"><span class="cl"><span class="cm">** to help with sort operations when multithreaded sorting
</span></span></span><span class="line"><span class="cl"><span class="cm">** is enabled (using the [PRAGMA threads] command) and the amount of content
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be sorted exceeds the page size times the minimum of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [PRAGMA cache_size] setting and this value.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_STMTJRNL_SPILL]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CONFIG_STMTJRNL_SPILL
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The SQLITE_CONFIG_STMTJRNL_SPILL option takes a single parameter which
</span></span></span><span class="line"><span class="cl"><span class="cm">** becomes the [statement journal] spill-to-disk threshold.
</span></span></span><span class="line"><span class="cl"><span class="cm">** [Statement journals] are held in memory until their size (in bytes)
</span></span></span><span class="line"><span class="cl"><span class="cm">** exceeds this threshold, at which point they are written to disk.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Or if the threshold is -1, statement journals are always held
</span></span></span><span class="line"><span class="cl"><span class="cm">** exclusively in memory.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Since many statement journals never become large, setting the spill
</span></span></span><span class="line"><span class="cl"><span class="cm">** threshold to a value such as 64KiB can greatly reduce the amount of
</span></span></span><span class="line"><span class="cl"><span class="cm">** I/O required to support statement rollback.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The default value for this setting is controlled by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_STMTJRNL_SPILL] compile-time option.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_SORTERREF_SIZE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CONFIG_SORTERREF_SIZE
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** of type (int) - the new value of the sorter-reference size threshold.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Usually, when SQLite uses an external sort to order records according
</span></span></span><span class="line"><span class="cl"><span class="cm">** to an ORDER BY clause, all fields required by the caller are present in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sorted records. However, if SQLite determines based on the declared type
</span></span></span><span class="line"><span class="cl"><span class="cm">** of a table column that its values are likely to be very large - larger
</span></span></span><span class="line"><span class="cl"><span class="cm">** than the configured sorter-reference size threshold - then a reference
</span></span></span><span class="line"><span class="cl"><span class="cm">** is stored in each sorted record and the required column values loaded
</span></span></span><span class="line"><span class="cl"><span class="cm">** from the database as records are returned in sorted order. The default
</span></span></span><span class="line"><span class="cl"><span class="cm">** value for this option is to never use this optimization. Specifying a
</span></span></span><span class="line"><span class="cl"><span class="cm">** negative value for this option restores the default behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This option is only available if SQLite is compiled with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_MEMDB_MAXSIZE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CONFIG_MEMDB_MAXSIZE
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_CONFIG_MEMDB_MAXSIZE option accepts a single parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_int64] parameter which is the default maximum size for an in-memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** database created using [sqlite3_deserialize()]. This default maximum
</span></span></span><span class="line"><span class="cl"><span class="cm">** size can be adjusted up or down for individual databases using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FCNTL_SIZE_LIMIT] [sqlite3_file_control|file-control]. If this
</span></span></span><span class="line"><span class="cl"><span class="cm">** configuration setting is never used, then the default maximum is determined
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
</span></span></span><span class="line"><span class="cl"><span class="cm">** compile-time option is not set, then the default maximum is 1073741824.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_CONFIG_ROWID_IN_VIEW]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CONFIG_ROWID_IN_VIEW
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability
</span></span></span><span class="line"><span class="cl"><span class="cm">** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is
</span></span></span><span class="line"><span class="cl"><span class="cm">** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability
</span></span></span><span class="line"><span class="cl"><span class="cm">** defaults to on. This configuration option queries the current setting or
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes the setting to off or on. The argument is a pointer to an integer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If that integer initially holds a value of 1, then the ability for VIEWs to
</span></span></span><span class="line"><span class="cl"><span class="cm">** have ROWIDs is activated. If the integer initially holds zero, then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** ability is deactivated. Any other initial value for the integer leaves the
</span></span></span><span class="line"><span class="cl"><span class="cm">** setting unchanged. After changes, if any, the integer is written with
</span></span></span><span class="line"><span class="cl"><span class="cm">** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and
</span></span></span><span class="line"><span class="cl"><span class="cm">** recommended case) then the integer is always filled with zero, regardless
</span></span></span><span class="line"><span class="cl"><span class="cm">** if its initial value.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_SINGLETHREAD 1 </span><span class="cm">/* nil */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_MULTITHREAD 2 </span><span class="cm">/* nil */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_SERIALIZED 3 </span><span class="cm">/* nil */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_MALLOC 4 </span><span class="cm">/* sqlite3_mem_methods* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_GETMALLOC 5 </span><span class="cm">/* sqlite3_mem_methods* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_SCRATCH 6 </span><span class="cm">/* No longer used */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_PAGECACHE 7 </span><span class="cm">/* void*, int sz, int N */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_HEAP 8 </span><span class="cm">/* void*, int nByte, int min */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_MEMSTATUS 9 </span><span class="cm">/* boolean */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_MUTEX 10 </span><span class="cm">/* sqlite3_mutex_methods* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_GETMUTEX 11 </span><span class="cm">/* sqlite3_mutex_methods* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="cm">/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_LOOKASIDE 13 </span><span class="cm">/* int int */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_PCACHE 14 </span><span class="cm">/* no-op */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_GETPCACHE 15 </span><span class="cm">/* no-op */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_LOG 16 </span><span class="cm">/* xFunc, void* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_URI 17 </span><span class="cm">/* int */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_PCACHE2 18 </span><span class="cm">/* sqlite3_pcache_methods2* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_GETPCACHE2 19 </span><span class="cm">/* sqlite3_pcache_methods2* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 </span><span class="cm">/* int */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_SQLLOG 21 </span><span class="cm">/* xSqllog, void* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_MMAP_SIZE 22 </span><span class="cm">/* sqlite3_int64, sqlite3_int64 */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 </span><span class="cm">/* int nByte */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_PCACHE_HDRSZ 24 </span><span class="cm">/* int *psz */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_PMASZ 25 </span><span class="cm">/* unsigned int szPma */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_STMTJRNL_SPILL 26 </span><span class="cm">/* int nByte */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_SMALL_MALLOC 27 </span><span class="cm">/* boolean */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_SORTERREF_SIZE 28 </span><span class="cm">/* int nByte */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 </span><span class="cm">/* sqlite3_int64 */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CONFIG_ROWID_IN_VIEW 30 </span><span class="cm">/* int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Database Connection Configuration Options
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants are the available integer configuration options that
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be passed as the second argument to the [sqlite3_db_config()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** New configuration options may be added in future releases of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Existing configuration options might be discontinued. Applications
</span></span></span><span class="line"><span class="cl"><span class="cm">** should check the return code from [sqlite3_db_config()] to make sure that
</span></span></span><span class="line"><span class="cl"><span class="cm">** the call worked. ^The [sqlite3_db_config()] interface will return a
</span></span></span><span class="line"><span class="cl"><span class="cm">** non-zero [error code] if a discontinued or unsupported configuration option
</span></span></span><span class="line"><span class="cl"><span class="cm">** is invoked.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_LOOKASIDE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_LOOKASIDE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^This option takes three additional arguments that determine the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [lookaside memory allocator] configuration for the [database connection].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first argument (the third parameter to [sqlite3_db_config()] is a
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer to a memory buffer to use for lookaside memory.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
</span></span></span><span class="line"><span class="cl"><span class="cm">** may be NULL in which case SQLite will allocate the
</span></span></span><span class="line"><span class="cl"><span class="cm">** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** size of each lookaside buffer slot. ^The third argument is the number of
</span></span></span><span class="line"><span class="cl"><span class="cm">** slots. The size of the buffer in the first argument must be greater than
</span></span></span><span class="line"><span class="cl"><span class="cm">** or equal to the product of the second and third arguments. The buffer
</span></span></span><span class="line"><span class="cl"><span class="cm">** must be aligned to an 8-byte boundary. ^If the second argument to
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
</span></span></span><span class="line"><span class="cl"><span class="cm">** rounded down to the next smaller multiple of 8. ^(The lookaside memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** configuration for a database connection can only be changed when that
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection is not currently using lookaside memory, or in other words
</span></span></span><span class="line"><span class="cl"><span class="cm">** when the &#34;current value&#34; returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Any attempt to change the lookaside memory configuration when lookaside
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory is in use leaves the configuration unchanged and returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_BUSY].)^&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_ENABLE_FKEY&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^This option is used to enable or disable the enforcement of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [foreign key constraints]. There should be two additional arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument is an integer which is 0 to disable FK enforcement,
</span></span></span><span class="line"><span class="cl"><span class="cm">** positive to enable FK enforcement or negative to leave FK enforcement
</span></span></span><span class="line"><span class="cl"><span class="cm">** unchanged. The second parameter is a pointer to an integer into which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is written 0 or 1 to indicate whether FK enforcement is off or on
</span></span></span><span class="line"><span class="cl"><span class="cm">** following this call. The second parameter may be a NULL pointer, in
</span></span></span><span class="line"><span class="cl"><span class="cm">** which case the FK enforcement setting is not reported back. &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_ENABLE_TRIGGER]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_ENABLE_TRIGGER&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^This option is used to enable or disable [CREATE TRIGGER | triggers].
</span></span></span><span class="line"><span class="cl"><span class="cm">** There should be two additional arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument is an integer which is 0 to disable triggers,
</span></span></span><span class="line"><span class="cl"><span class="cm">** positive to enable triggers or negative to leave the setting unchanged.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second parameter is a pointer to an integer into which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is written 0 or 1 to indicate whether triggers are disabled or enabled
</span></span></span><span class="line"><span class="cl"><span class="cm">** following this call. The second parameter may be a NULL pointer, in
</span></span></span><span class="line"><span class="cl"><span class="cm">** which case the trigger setting is not reported back.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;Originally this option disabled all triggers. ^(However, since
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite version 3.35.0, TEMP triggers are still allowed even if
</span></span></span><span class="line"><span class="cl"><span class="cm">** this option is off. So, in other words, this option now only disables
</span></span></span><span class="line"><span class="cl"><span class="cm">** triggers in the main database schema or in the schemas of ATTACH-ed
</span></span></span><span class="line"><span class="cl"><span class="cm">** databases.)^ &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_ENABLE_VIEW&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^This option is used to enable or disable [CREATE VIEW | views].
</span></span></span><span class="line"><span class="cl"><span class="cm">** There should be two additional arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument is an integer which is 0 to disable views,
</span></span></span><span class="line"><span class="cl"><span class="cm">** positive to enable views or negative to leave the setting unchanged.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second parameter is a pointer to an integer into which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is written 0 or 1 to indicate whether views are disabled or enabled
</span></span></span><span class="line"><span class="cl"><span class="cm">** following this call. The second parameter may be a NULL pointer, in
</span></span></span><span class="line"><span class="cl"><span class="cm">** which case the view setting is not reported back.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;Originally this option disabled all views. ^(However, since
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite version 3.35.0, TEMP views are still allowed even if
</span></span></span><span class="line"><span class="cl"><span class="cm">** this option is off. So, in other words, this option now only disables
</span></span></span><span class="line"><span class="cl"><span class="cm">** views in the main database schema or in the schemas of ATTACH-ed
</span></span></span><span class="line"><span class="cl"><span class="cm">** databases.)^ &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^This option is used to enable or disable the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [fts3_tokenizer()] function which is part of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [FTS3] full-text search engine extension.
</span></span></span><span class="line"><span class="cl"><span class="cm">** There should be two additional arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument is an integer which is 0 to disable fts3_tokenizer() or
</span></span></span><span class="line"><span class="cl"><span class="cm">** positive to enable fts3_tokenizer() or negative to leave the setting
</span></span></span><span class="line"><span class="cl"><span class="cm">** unchanged.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second parameter is a pointer to an integer into which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled
</span></span></span><span class="line"><span class="cl"><span class="cm">** following this call. The second parameter may be a NULL pointer, in
</span></span></span><span class="line"><span class="cl"><span class="cm">** which case the new setting is not reported back. &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^This option is used to enable or disable the [sqlite3_load_extension()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface independently of the [load_extension()] SQL function.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_enable_load_extension()] API enables or disables both the
</span></span></span><span class="line"><span class="cl"><span class="cm">** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** There should be two additional arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">** When the first argument to this interface is 1, then only the C-API is
</span></span></span><span class="line"><span class="cl"><span class="cm">** enabled and the SQL function remains disabled. If the first argument to
</span></span></span><span class="line"><span class="cl"><span class="cm">** this interface is 0, then both the C-API and the SQL function are disabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the first argument is -1, then no changes are made to state of either the
</span></span></span><span class="line"><span class="cl"><span class="cm">** C-API or the SQL function.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second parameter is a pointer to an integer into which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** is disabled or enabled following this call. The second parameter may
</span></span></span><span class="line"><span class="cl"><span class="cm">** be a NULL pointer, in which case the new setting is not reported back.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_MAINDBNAME]] &lt;dt&gt;SQLITE_DBCONFIG_MAINDBNAME&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; ^This option is used to change the name of the &#34;main&#34; database
</span></span></span><span class="line"><span class="cl"><span class="cm">** schema. ^The sole argument is a pointer to a constant UTF8 string
</span></span></span><span class="line"><span class="cl"><span class="cm">** which will become the new schema name in place of &#34;main&#34;. ^SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** does not make a copy of the new main schema name string, so the application
</span></span></span><span class="line"><span class="cl"><span class="cm">** must ensure that the argument passed into this DBCONFIG option is unchanged
</span></span></span><span class="line"><span class="cl"><span class="cm">** until after the database connection closes.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; Usually, when a database in wal mode is closed or detached from a
</span></span></span><span class="line"><span class="cl"><span class="cm">** database handle, SQLite checks if this will mean that there are now no
</span></span></span><span class="line"><span class="cl"><span class="cm">** connections at all to the database. If so, it performs a checkpoint
</span></span></span><span class="line"><span class="cl"><span class="cm">** operation before closing the connection. This option may be used to
</span></span></span><span class="line"><span class="cl"><span class="cm">** override this behavior. The first parameter passed to this operation
</span></span></span><span class="line"><span class="cl"><span class="cm">** is an integer - positive to disable checkpoints-on-close, or zero (the
</span></span></span><span class="line"><span class="cl"><span class="cm">** default) to enable them, and negative to leave the setting unchanged.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second parameter is a pointer to an integer
</span></span></span><span class="line"><span class="cl"><span class="cm">** into which is written 0 or 1 to indicate whether checkpoints-on-close
</span></span></span><span class="line"><span class="cl"><span class="cm">** have been disabled - 0 if they are not disabled, 1 if they are.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_ENABLE_QPSG]] &lt;dt&gt;SQLITE_DBCONFIG_ENABLE_QPSG&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [query planner stability guarantee] (QPSG). When the QPSG is active,
</span></span></span><span class="line"><span class="cl"><span class="cm">** a single SQL query statement will always use the same algorithm regardless
</span></span></span><span class="line"><span class="cl"><span class="cm">** of values of [bound parameters].)^ The QPSG disables some query optimizations
</span></span></span><span class="line"><span class="cl"><span class="cm">** that look at the values of bound parameters, which can make some queries
</span></span></span><span class="line"><span class="cl"><span class="cm">** slower. But the QPSG has the advantage of more predictable behavior. With
</span></span></span><span class="line"><span class="cl"><span class="cm">** the QPSG active, SQLite will always use the same query plan in the field as
</span></span></span><span class="line"><span class="cl"><span class="cm">** was used during testing in the lab.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument to this setting is an integer which is 0 to disable
</span></span></span><span class="line"><span class="cl"><span class="cm">** the QPSG, positive to enable QPSG, or negative to leave the setting
</span></span></span><span class="line"><span class="cl"><span class="cm">** unchanged. The second parameter is a pointer to an integer into which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is written 0 or 1 to indicate whether the QPSG is disabled or enabled
</span></span></span><span class="line"><span class="cl"><span class="cm">** following this call.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_TRIGGER_EQP]] &lt;dt&gt;SQLITE_DBCONFIG_TRIGGER_EQP&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; By default, the output of EXPLAIN QUERY PLAN commands does not
</span></span></span><span class="line"><span class="cl"><span class="cm">** include output for any operations performed by trigger programs. This
</span></span></span><span class="line"><span class="cl"><span class="cm">** option is used to set or clear (the default) a flag that governs this
</span></span></span><span class="line"><span class="cl"><span class="cm">** behavior. The first parameter passed to this operation is an integer -
</span></span></span><span class="line"><span class="cl"><span class="cm">** positive to enable output for trigger programs, or zero to disable it,
</span></span></span><span class="line"><span class="cl"><span class="cm">** or negative to leave the setting unchanged.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second parameter is a pointer to an integer into which is written
</span></span></span><span class="line"><span class="cl"><span class="cm">** 0 or 1 to indicate whether output-for-triggers has been disabled - 0 if
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is not disabled, 1 if it is.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_RESET_DATABASE]] &lt;dt&gt;SQLITE_DBCONFIG_RESET_DATABASE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt; Set the SQLITE_DBCONFIG_RESET_DATABASE flag and then run
</span></span></span><span class="line"><span class="cl"><span class="cm">** [VACUUM] in order to reset a database back to an empty database
</span></span></span><span class="line"><span class="cl"><span class="cm">** with no schema and no content. The following process works even for
</span></span></span><span class="line"><span class="cl"><span class="cm">** a badly corrupted database file:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; If the database connection is newly opened, make sure it has read the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database schema by preparing then discarding some query against the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database, or calling sqlite3_table_column_metadata(), ignoring any
</span></span></span><span class="line"><span class="cl"><span class="cm">** errors. This step is only necessary if the application desires to keep
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database in WAL mode after the reset if it was in WAL mode before
</span></span></span><span class="line"><span class="cl"><span class="cm">** the reset.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0);
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_exec](db, &#34;[VACUUM]&#34;, 0, 0, 0);
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0);
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Because resetting a database is destructive and irreversible, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** process requires the use of this obscure API and multiple steps to
</span></span></span><span class="line"><span class="cl"><span class="cm">** help ensure that it does not happen by accident. Because this
</span></span></span><span class="line"><span class="cl"><span class="cm">** feature must be capable of resetting corrupt databases, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** shutting down virtual tables may require access to that corrupt
</span></span></span><span class="line"><span class="cl"><span class="cm">** storage, the library must abandon any installed virtual tables
</span></span></span><span class="line"><span class="cl"><span class="cm">** without calling their xDestroy() methods.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_DEFENSIVE]] &lt;dt&gt;SQLITE_DBCONFIG_DEFENSIVE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;defensive&#34; flag for a database connection. When the defensive
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag is enabled, language features that allow ordinary SQL to
</span></span></span><span class="line"><span class="cl"><span class="cm">** deliberately corrupt the database file are disabled. The disabled
</span></span></span><span class="line"><span class="cl"><span class="cm">** features include but are not limited to the following:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The [PRAGMA writable_schema=ON] statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The [PRAGMA journal_mode=OFF] statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The [PRAGMA schema_version=N] statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Writes to the [sqlite_dbpage] virtual table.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Direct writes to [shadow tables].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] &lt;dt&gt;SQLITE_DBCONFIG_WRITABLE_SCHEMA&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;writable_schema&#34; flag. This has the same effect and is logically equivalent
</span></span></span><span class="line"><span class="cl"><span class="cm">** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument to this setting is an integer which is 0 to disable
</span></span></span><span class="line"><span class="cl"><span class="cm">** the writable_schema, positive to enable writable_schema, or negative to
</span></span></span><span class="line"><span class="cl"><span class="cm">** leave the setting unchanged. The second parameter is a pointer to an
</span></span></span><span class="line"><span class="cl"><span class="cm">** integer into which is written 0 or 1 to indicate whether the writable_schema
</span></span></span><span class="line"><span class="cl"><span class="cm">** is enabled or disabled following this call.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_LEGACY_ALTER_TABLE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
</span></span></span><span class="line"><span class="cl"><span class="cm">** the legacy behavior of the [ALTER TABLE RENAME] command such it
</span></span></span><span class="line"><span class="cl"><span class="cm">** behaves as it did prior to [version 3.24.0] (2018-06-04). See the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;Compatibility Notice&#34; on the [ALTER TABLE RENAME documentation] for
</span></span></span><span class="line"><span class="cl"><span class="cm">** additional information. This feature can also be turned on and off
</span></span></span><span class="line"><span class="cl"><span class="cm">** using the [PRAGMA legacy_alter_table] statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_DQS_DML]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_DQS_DML&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
</span></span></span><span class="line"><span class="cl"><span class="cm">** the legacy [double-quoted string literal] misfeature for DML statements
</span></span></span><span class="line"><span class="cl"><span class="cm">** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** default value of this setting is determined by the [-DSQLITE_DQS]
</span></span></span><span class="line"><span class="cl"><span class="cm">** compile-time option.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_DQS_DDL]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_DQS_DDL&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_DBCONFIG_DQS option activates or deactivates
</span></span></span><span class="line"><span class="cl"><span class="cm">** the legacy [double-quoted string literal] misfeature for DDL statements,
</span></span></span><span class="line"><span class="cl"><span class="cm">** such as CREATE TABLE and CREATE INDEX. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** default value of this setting is determined by the [-DSQLITE_DQS]
</span></span></span><span class="line"><span class="cl"><span class="cm">** compile-time option.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_TRUSTED_SCHEMA]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_TRUSTED_SCHEMA&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_DBCONFIG_TRUSTED_SCHEMA option tells SQLite to
</span></span></span><span class="line"><span class="cl"><span class="cm">** assume that database schemas are untainted by malicious content.
</span></span></span><span class="line"><span class="cl"><span class="cm">** When the SQLITE_DBCONFIG_TRUSTED_SCHEMA option is disabled, SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** takes additional defensive steps to protect the application from harm
</span></span></span><span class="line"><span class="cl"><span class="cm">** including:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Prohibit the use of SQL functions inside triggers, views,
</span></span></span><span class="line"><span class="cl"><span class="cm">** CHECK constraints, DEFAULT clauses, expression indexes,
</span></span></span><span class="line"><span class="cl"><span class="cm">** partial indexes, or generated columns
</span></span></span><span class="line"><span class="cl"><span class="cm">** unless those functions are tagged with [SQLITE_INNOCUOUS].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Prohibit the use of virtual tables inside of triggers or views
</span></span></span><span class="line"><span class="cl"><span class="cm">** unless those virtual tables are tagged with [SQLITE_VTAB_INNOCUOUS].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** This setting defaults to &#34;on&#34; for legacy compatibility, however
</span></span></span><span class="line"><span class="cl"><span class="cm">** all applications are advised to turn it off if possible. This setting
</span></span></span><span class="line"><span class="cl"><span class="cm">** can also be controlled using the [PRAGMA trusted_schema] statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_LEGACY_FILE_FORMAT&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
</span></span></span><span class="line"><span class="cl"><span class="cm">** the legacy file format flag. When activated, this flag causes all newly
</span></span></span><span class="line"><span class="cl"><span class="cm">** created database file to have a schema format version number (the 4-byte
</span></span></span><span class="line"><span class="cl"><span class="cm">** integer found at offset 44 into the database header) of 1. This in turn
</span></span></span><span class="line"><span class="cl"><span class="cm">** means that the resulting database file will be readable and writable by
</span></span></span><span class="line"><span class="cl"><span class="cm">** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting,
</span></span></span><span class="line"><span class="cl"><span class="cm">** newly created databases are generally not understandable by SQLite versions
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior to 3.3.0 ([dateof:3.3.0]). As these words are written, there
</span></span></span><span class="line"><span class="cl"><span class="cm">** is now scarcely any need to generate database files that are compatible
</span></span></span><span class="line"><span class="cl"><span class="cm">** all the way back to version 3.0.0, and so this setting is of little
</span></span></span><span class="line"><span class="cl"><span class="cm">** practical use, but is provided so that SQLite can continue to claim the
</span></span></span><span class="line"><span class="cl"><span class="cm">** ability to generate new database files that are compatible with version
</span></span></span><span class="line"><span class="cl"><span class="cm">** 3.0.0.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;Note that when the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT setting is on,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [VACUUM] command will fail with an obscure error when attempting to
</span></span></span><span class="line"><span class="cl"><span class="cm">** process a table with generated columns and a descending index. This is
</span></span></span><span class="line"><span class="cl"><span class="cm">** not considered a bug since SQLite versions 3.3.0 and earlier do not support
</span></span></span><span class="line"><span class="cl"><span class="cm">** either generated columns or descending indexes.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_STMT_SCANSTATUS&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
</span></span></span><span class="line"><span class="cl"><span class="cm">** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
</span></span></span><span class="line"><span class="cl"><span class="cm">** statistics. For statistics to be collected, the flag must be set on
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database handle both when the SQL statement is prepared and when it
</span></span></span><span class="line"><span class="cl"><span class="cm">** is stepped. The flag is set (collection of statistics is enabled)
</span></span></span><span class="line"><span class="cl"><span class="cm">** by default. This option takes two arguments: an integer and a pointer to
</span></span></span><span class="line"><span class="cl"><span class="cm">** an integer.. The first argument is 1, 0, or -1 to enable, disable, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** leave unchanged the statement scanstatus option. If the second argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not NULL, then the value of the statement scanstatus setting after
</span></span></span><span class="line"><span class="cl"><span class="cm">** processing the first argument is written into the integer that the second
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument points to.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_DBCONFIG_REVERSE_SCANORDER&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_DBCONFIG_REVERSE_SCANORDER option changes the default order
</span></span></span><span class="line"><span class="cl"><span class="cm">** in which tables and indexes are scanned so that the scans start at the end
</span></span></span><span class="line"><span class="cl"><span class="cm">** and work toward the beginning rather than starting at the beginning and
</span></span></span><span class="line"><span class="cl"><span class="cm">** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** same as setting [PRAGMA reverse_unordered_selects]. This option takes
</span></span></span><span class="line"><span class="cl"><span class="cm">** two arguments which are an integer and a pointer to an integer. The first
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument is 1, 0, or -1 to enable, disable, or leave unchanged the
</span></span></span><span class="line"><span class="cl"><span class="cm">** reverse scan order flag, respectively. If the second argument is not NULL,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then 0 or 1 is written into the integer that the second argument points to
</span></span></span><span class="line"><span class="cl"><span class="cm">** depending on if the reverse scan order flag is set after processing the
</span></span></span><span class="line"><span class="cl"><span class="cm">** first argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_MAINDBNAME 1000 </span><span class="cm">/* const char* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_LOOKASIDE 1001 </span><span class="cm">/* void* int int */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_TRIGGER_EQP 1008 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_RESET_DATABASE 1009 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_DEFENSIVE 1010 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_DQS_DML 1013 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_DQS_DDL 1014 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 </span><span class="cm">/* int int* */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBCONFIG_MAX 1019 </span><span class="cm">/* Largest DBCONFIG */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Enable Or Disable Extended Result Codes
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_extended_result_codes() routine enables or disables the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [extended result codes] feature of SQLite. ^The extended result
</span></span></span><span class="line"><span class="cl"><span class="cm">** codes are disabled by default for historical compatibility.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_extended_result_codes</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">onoff</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Last Insert Rowid
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
</span></span></span><span class="line"><span class="cl"><span class="cm">** has a unique 64-bit signed
</span></span></span><span class="line"><span class="cl"><span class="cm">** integer key called the [ROWID | &#34;rowid&#34;]. ^The rowid is always available
</span></span></span><span class="line"><span class="cl"><span class="cm">** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
</span></span></span><span class="line"><span class="cl"><span class="cm">** names are not also used by explicitly declared columns. ^If
</span></span></span><span class="line"><span class="cl"><span class="cm">** the table has a column of type [INTEGER PRIMARY KEY] then that column
</span></span></span><span class="line"><span class="cl"><span class="cm">** is another alias for the rowid.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the most recent successful [INSERT] into a rowid table or [virtual table]
</span></span></span><span class="line"><span class="cl"><span class="cm">** on database connection D. ^Inserts into [WITHOUT ROWID] tables are not
</span></span></span><span class="line"><span class="cl"><span class="cm">** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the database connection D, then sqlite3_last_insert_rowid(D) returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** As well as being set automatically as rows are inserted into database
</span></span></span><span class="line"><span class="cl"><span class="cm">** tables, the value returned by this function may be set explicitly by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_set_last_insert_rowid()]
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Some virtual table implementations may INSERT rows into rowid tables as
</span></span></span><span class="line"><span class="cl"><span class="cm">** part of committing a transaction (e.g. to flush data accumulated in memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** to disk). In this case subsequent calls to this function return the rowid
</span></span></span><span class="line"><span class="cl"><span class="cm">** associated with these internal INSERT operations, which leads to
</span></span></span><span class="line"><span class="cl"><span class="cm">** unintuitive results. Virtual table implementations that do write to rowid
</span></span></span><span class="line"><span class="cl"><span class="cm">** tables in this way can avoid this problem by restoring the original
</span></span></span><span class="line"><span class="cl"><span class="cm">** rowid value using [sqlite3_set_last_insert_rowid()] before returning
</span></span></span><span class="line"><span class="cl"><span class="cm">** control to the user.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If an [INSERT] occurs within a trigger then this routine will
</span></span></span><span class="line"><span class="cl"><span class="cm">** return the [rowid] of the inserted row as long as the trigger is
</span></span></span><span class="line"><span class="cl"><span class="cm">** running. Once the trigger program ends, the value returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** by this routine reverts to what it was before the trigger was fired.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^An [INSERT] that fails due to a constraint violation is not a
</span></span></span><span class="line"><span class="cl"><span class="cm">** successful [INSERT] and does not change the value returned by this
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,
</span></span></span><span class="line"><span class="cl"><span class="cm">** and INSERT OR ABORT make no changes to the return value of this
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine when their insertion fails. ^(When INSERT OR REPLACE
</span></span></span><span class="line"><span class="cl"><span class="cm">** encounters a constraint violation, it does not fail. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** INSERT continues to completion after deleting rows that caused
</span></span></span><span class="line"><span class="cl"><span class="cm">** the constraint problem so INSERT OR REPLACE will always change
</span></span></span><span class="line"><span class="cl"><span class="cm">** the return value of this interface.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^For the purposes of this routine, an [INSERT] is considered to
</span></span></span><span class="line"><span class="cl"><span class="cm">** be successful even if it is subsequently rolled back.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is accessible to SQL statements via the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [last_insert_rowid() SQL function].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a separate thread performs a new [INSERT] on the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connection while the [sqlite3_last_insert_rowid()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** function is running and thus changes the last insert [rowid],
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the value returned by [sqlite3_last_insert_rowid()] is
</span></span></span><span class="line"><span class="cl"><span class="cm">** unpredictable and might not equal either the old or the new
</span></span></span><span class="line"><span class="cl"><span class="cm">** last insert [rowid].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3_last_insert_rowid</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Set the Last Insert Rowid value.
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_set_last_insert_rowid(D, R) method allows the application to
</span></span></span><span class="line"><span class="cl"><span class="cm">** set the value returned by calling sqlite3_last_insert_rowid(D) to R
</span></span></span><span class="line"><span class="cl"><span class="cm">** without inserting a row into the database.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_set_last_insert_rowid</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span><span class="n">sqlite3_int64</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Count The Number Of Rows Modified
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These functions return the number of rows modified, inserted or
</span></span></span><span class="line"><span class="cl"><span class="cm">** deleted by the most recently completed INSERT, UPDATE or DELETE
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement on the database connection specified by the only parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The two functions are identical except for the type of the return value
</span></span></span><span class="line"><span class="cl"><span class="cm">** and that if the number of rows modified by the most recent INSERT, UPDATE
</span></span></span><span class="line"><span class="cl"><span class="cm">** or DELETE is greater than the maximum value supported by type &#34;int&#34;, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the return value of sqlite3_changes() is undefined. ^Executing any other
</span></span></span><span class="line"><span class="cl"><span class="cm">** type of SQL statement does not modify the value returned by these functions.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
</span></span></span><span class="line"><span class="cl"><span class="cm">** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [foreign key actions] or [REPLACE] constraint resolution are not counted.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Changes to a view that are intercepted by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned by sqlite3_changes() immediately after an INSERT, UPDATE or
</span></span></span><span class="line"><span class="cl"><span class="cm">** DELETE statement run on a view is always zero. Only changes made to real
</span></span></span><span class="line"><span class="cl"><span class="cm">** tables are counted.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Things are more complicated if the sqlite3_changes() function is
</span></span></span><span class="line"><span class="cl"><span class="cm">** executed while a trigger program is running. This may happen if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** program uses the [changes() SQL function], or if some other callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** function invokes sqlite3_changes() directly. Essentially:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(Before entering a trigger program the value returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_changes() function is saved. After the trigger program
</span></span></span><span class="line"><span class="cl"><span class="cm">** has finished, the original value is restored.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(Within a trigger program each INSERT, UPDATE and DELETE
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement sets the value returned by sqlite3_changes()
</span></span></span><span class="line"><span class="cl"><span class="cm">** upon completion as normal. Of course, this value will not include
</span></span></span><span class="line"><span class="cl"><span class="cm">** any changes performed by sub-triggers, as the sqlite3_changes()
</span></span></span><span class="line"><span class="cl"><span class="cm">** value will be saved and restored after each sub-trigger has run.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This means that if the changes() SQL function (or similar) is used
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the first INSERT, UPDATE or DELETE statement within a trigger, it
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns the value as set when the calling statement began executing.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If it is used by the second or subsequent such statement within a trigger
</span></span></span><span class="line"><span class="cl"><span class="cm">** program, the value returned reflects the number of rows modified by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** previous INSERT, UPDATE or DELETE statement within the same trigger.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a separate thread makes changes on the same database connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** while [sqlite3_changes()] is running then the value returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** is unpredictable and not meaningful.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the [sqlite3_total_changes()] interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the [count_changes pragma]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the [changes() SQL function]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the [data_version pragma]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_changes</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3_changes64</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Total Number Of Rows Modified
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These functions return the total number of rows inserted, modified or
</span></span></span><span class="line"><span class="cl"><span class="cm">** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
</span></span></span><span class="line"><span class="cl"><span class="cm">** since the database connection was opened, including those executed as
</span></span></span><span class="line"><span class="cl"><span class="cm">** part of trigger programs. The two functions are identical except for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** type of the return value and that if the number of rows modified by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection exceeds the maximum value supported by type &#34;int&#34;, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the return value of sqlite3_total_changes() is undefined. ^Executing
</span></span></span><span class="line"><span class="cl"><span class="cm">** any other type of SQL statement does not affect the value returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_total_changes().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Changes made as part of [foreign key actions] are included in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** count, but those made as part of REPLACE constraint resolution are
</span></span></span><span class="line"><span class="cl"><span class="cm">** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
</span></span></span><span class="line"><span class="cl"><span class="cm">** are not counted.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_total_changes(D)] interface only reports the number
</span></span></span><span class="line"><span class="cl"><span class="cm">** of rows that changed due to SQL statement run against database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection D. Any changes by other database connections are ignored.
</span></span></span><span class="line"><span class="cl"><span class="cm">** To detect changes against a database file from other database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connections use the [PRAGMA data_version] command or the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FCNTL_DATA_VERSION] [file control].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a separate thread makes changes on the same database connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** while [sqlite3_total_changes()] is running then the value
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned is unpredictable and not meaningful.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the [sqlite3_changes()] interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the [count_changes pragma]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the [changes() SQL function]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the [data_version pragma]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the [SQLITE_FCNTL_DATA_VERSION] [file control]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_total_changes</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3_total_changes64</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Interrupt A Long-Running Query
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This function causes any pending database operation to abort and
</span></span></span><span class="line"><span class="cl"><span class="cm">** return at its earliest opportunity. This routine is typically
</span></span></span><span class="line"><span class="cl"><span class="cm">** called in response to a user action such as pressing &#34;Cancel&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** or Ctrl-C where the user wants a long query operation to halt
</span></span></span><span class="line"><span class="cl"><span class="cm">** immediately.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^It is safe to call this routine from a thread different from the
</span></span></span><span class="line"><span class="cl"><span class="cm">** thread that is currently running the database operation. But it
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not safe to call this routine with a [database connection] that
</span></span></span><span class="line"><span class="cl"><span class="cm">** is closed or might close before sqlite3_interrupt() returns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If an SQL operation is very nearly finished at the time when
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_interrupt() is called, then it might not have an opportunity
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be interrupted and might continue to completion.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
</span></span></span><span class="line"><span class="cl"><span class="cm">** that is inside an explicit transaction, then the entire transaction
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be rolled back automatically.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_interrupt(D) call is in effect until all currently running
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL statements on [database connection] D complete. ^Any new SQL statements
</span></span></span><span class="line"><span class="cl"><span class="cm">** that are started after the sqlite3_interrupt() call and before the
</span></span></span><span class="line"><span class="cl"><span class="cm">** running statement count reaches zero are interrupted as if they had been
</span></span></span><span class="line"><span class="cl"><span class="cm">** running prior to the sqlite3_interrupt() call. ^New SQL statements
</span></span></span><span class="line"><span class="cl"><span class="cm">** that are started after the running statement count reaches zero are
</span></span></span><span class="line"><span class="cl"><span class="cm">** not effected by the sqlite3_interrupt().
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A call to sqlite3_interrupt(D) that occurs when there are no running
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL statements is a no-op and has no effect on SQL statements
</span></span></span><span class="line"><span class="cl"><span class="cm">** that are started after the sqlite3_interrupt() call returns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_is_interrupted(D)] interface can be used to determine whether
</span></span></span><span class="line"><span class="cl"><span class="cm">** or not an interrupt is currently in effect for [database connection] D.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It returns 1 if an interrupt is currently in effect, or 0 otherwise.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_interrupt</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_is_interrupted</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Determine If An SQL Statement Is Complete
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines are useful during command-line input to determine if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** currently entered text seems to form a complete SQL statement or
</span></span></span><span class="line"><span class="cl"><span class="cm">** if additional input is needed before sending the text into
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite for parsing. ^These routines return 1 if the input string
</span></span></span><span class="line"><span class="cl"><span class="cm">** appears to be a complete SQL statement. ^A statement is judged to be
</span></span></span><span class="line"><span class="cl"><span class="cm">** complete if it ends with a semicolon token and is not a prefix of a
</span></span></span><span class="line"><span class="cl"><span class="cm">** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within
</span></span></span><span class="line"><span class="cl"><span class="cm">** string literals or quoted identifier names or comments are not
</span></span></span><span class="line"><span class="cl"><span class="cm">** independent tokens (they are part of the token in which they are
</span></span></span><span class="line"><span class="cl"><span class="cm">** embedded) and thus do not count as a statement terminator. ^Whitespace
</span></span></span><span class="line"><span class="cl"><span class="cm">** and comments that follow the final semicolon are ignored.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These routines return 0 if the statement is incomplete. ^If a
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory allocation fails, then SQLITE_NOMEM is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These routines do not parse the SQL statements thus
</span></span></span><span class="line"><span class="cl"><span class="cm">** will not detect syntactically incorrect SQL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior
</span></span></span><span class="line"><span class="cl"><span class="cm">** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** automatically by sqlite3_complete16(). If that initialization fails,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the return value from sqlite3_complete16() will be non-zero
</span></span></span><span class="line"><span class="cl"><span class="cm">** regardless of whether or not the input SQL is complete.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The input to [sqlite3_complete()] must be a zero-terminated
</span></span></span><span class="line"><span class="cl"><span class="cm">** UTF-8 string.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The input to [sqlite3_complete16()] must be a zero-terminated
</span></span></span><span class="line"><span class="cl"><span class="cm">** UTF-16 string in native byte order.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_complete</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">sql</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_complete16</span><span class="p">(</span><span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">sql</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {busy-handler callback} {busy handler}
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
</span></span></span><span class="line"><span class="cl"><span class="cm">** that might be invoked with argument P whenever
</span></span></span><span class="line"><span class="cl"><span class="cm">** an attempt is made to access a database table associated with
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] D when another thread
</span></span></span><span class="line"><span class="cl"><span class="cm">** or process has the table locked.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_busy_handler() interface is used to implement
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the busy callback is NULL, then [SQLITE_BUSY]
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned immediately upon encountering the lock. ^If the busy callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not NULL, then the callback might be invoked with two arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first argument to the busy handler is a copy of the void* pointer which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is the third argument to sqlite3_busy_handler(). ^The second argument to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the busy handler callback is the number of times that the busy handler has
</span></span></span><span class="line"><span class="cl"><span class="cm">** been invoked previously for the same locking event. ^If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** busy callback returns 0, then no additional attempts are made to
</span></span></span><span class="line"><span class="cl"><span class="cm">** access the database and [SQLITE_BUSY] is returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the application.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the callback returns non-zero, then another attempt
</span></span></span><span class="line"><span class="cl"><span class="cm">** is made to access the database and the cycle repeats.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The presence of a busy handler does not guarantee that it will be invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** when there is lock contention. ^If SQLite determines that invoking the busy
</span></span></span><span class="line"><span class="cl"><span class="cm">** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the application instead of invoking the
</span></span></span><span class="line"><span class="cl"><span class="cm">** busy handler.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Consider a scenario where one process is holding a read lock that
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is trying to promote to a reserved lock and
</span></span></span><span class="line"><span class="cl"><span class="cm">** a second process is holding a reserved lock that it is trying
</span></span></span><span class="line"><span class="cl"><span class="cm">** to promote to an exclusive lock. The first process cannot proceed
</span></span></span><span class="line"><span class="cl"><span class="cm">** because it is blocked by the second and the second process cannot
</span></span></span><span class="line"><span class="cl"><span class="cm">** proceed because it is blocked by the first. If both processes
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoke the busy handlers, neither will make any progress. Therefore,
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite returns [SQLITE_BUSY] for the first process, hoping that this
</span></span></span><span class="line"><span class="cl"><span class="cm">** will induce the first process to release its read lock and allow
</span></span></span><span class="line"><span class="cl"><span class="cm">** the second process to proceed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The default busy callback is NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(There can only be a single busy handler defined for each
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection]. Setting a new busy handler clears any
</span></span></span><span class="line"><span class="cl"><span class="cm">** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or evaluating [PRAGMA busy_timeout=N] will change the
</span></span></span><span class="line"><span class="cl"><span class="cm">** busy handler and thus clear any previously set busy handler.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The busy callback should not take any actions which modify the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connection that invoked the busy handler. In other words,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the busy handler is not reentrant. Any such actions
</span></span></span><span class="line"><span class="cl"><span class="cm">** result in undefined behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A busy handler must not close the database connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [prepared statement] that invoked the busy handler.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_busy_handler</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">),</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Set A Busy Timeout
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
</span></span></span><span class="line"><span class="cl"><span class="cm">** for a specified amount of time when a table is locked. ^The handler
</span></span></span><span class="line"><span class="cl"><span class="cm">** will sleep multiple times until at least &#34;ms&#34; milliseconds of sleeping
</span></span></span><span class="line"><span class="cl"><span class="cm">** have accumulated. ^After at least &#34;ms&#34; milliseconds of sleeping,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the handler returns 0 which causes [sqlite3_step()] to return
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_BUSY].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Calling this routine with an argument less than or equal to zero
</span></span></span><span class="line"><span class="cl"><span class="cm">** turns off all busy handlers.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(There can only be a single busy handler for a particular
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] at any given moment. If another busy handler
</span></span></span><span class="line"><span class="cl"><span class="cm">** was defined (using [sqlite3_busy_handler()]) prior to calling
</span></span></span><span class="line"><span class="cl"><span class="cm">** this routine, that other busy handler is cleared.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [PRAGMA busy_timeout]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_busy_timeout</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">ms</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Convenience Routines For Running Queries
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This is a legacy interface that is preserved for backwards compatibility.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Use of this interface is not recommended.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Definition: A &lt;b&gt;result table&lt;/b&gt; is memory data structure created by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_get_table()] interface. A result table records the
</span></span></span><span class="line"><span class="cl"><span class="cm">** complete query results from one or more queries.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The table conceptually has a number of rows and columns. But
</span></span></span><span class="line"><span class="cl"><span class="cm">** these numbers are not part of the result table itself. These
</span></span></span><span class="line"><span class="cl"><span class="cm">** numbers are obtained separately. Let N be the number of rows
</span></span></span><span class="line"><span class="cl"><span class="cm">** and M be the number of columns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A result table is an array of pointers to zero-terminated UTF-8 strings.
</span></span></span><span class="line"><span class="cl"><span class="cm">** There are (N+1)*M elements in the array. The first M pointers point
</span></span></span><span class="line"><span class="cl"><span class="cm">** to zero-terminated strings that contain the names of the columns.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The remaining entries all point to query results. NULL values result
</span></span></span><span class="line"><span class="cl"><span class="cm">** in NULL pointers. All other values are in their UTF-8 zero-terminated
</span></span></span><span class="line"><span class="cl"><span class="cm">** string representation as returned by [sqlite3_column_text()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A result table might consist of one or more memory allocations.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is not safe to pass a result table directly to [sqlite3_free()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** A result table should be deallocated using [sqlite3_free_table()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(As an example of the result table format, suppose a query result
</span></span></span><span class="line"><span class="cl"><span class="cm">** is as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;&lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Name | Age
</span></span></span><span class="line"><span class="cl"><span class="cm">** -----------------------
</span></span></span><span class="line"><span class="cl"><span class="cm">** Alice | 43
</span></span></span><span class="line"><span class="cl"><span class="cm">** Bob | 28
</span></span></span><span class="line"><span class="cl"><span class="cm">** Cindy | 21
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;&lt;/blockquote&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** There are two columns (M==2) and three rows (N==3). Thus the
</span></span></span><span class="line"><span class="cl"><span class="cm">** result table has 8 entries. Suppose the result table is stored
</span></span></span><span class="line"><span class="cl"><span class="cm">** in an array named azResult. Then azResult holds this content:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;&lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** azResult&amp;#91;0] = &#34;Name&#34;;
</span></span></span><span class="line"><span class="cl"><span class="cm">** azResult&amp;#91;1] = &#34;Age&#34;;
</span></span></span><span class="line"><span class="cl"><span class="cm">** azResult&amp;#91;2] = &#34;Alice&#34;;
</span></span></span><span class="line"><span class="cl"><span class="cm">** azResult&amp;#91;3] = &#34;43&#34;;
</span></span></span><span class="line"><span class="cl"><span class="cm">** azResult&amp;#91;4] = &#34;Bob&#34;;
</span></span></span><span class="line"><span class="cl"><span class="cm">** azResult&amp;#91;5] = &#34;28&#34;;
</span></span></span><span class="line"><span class="cl"><span class="cm">** azResult&amp;#91;6] = &#34;Cindy&#34;;
</span></span></span><span class="line"><span class="cl"><span class="cm">** azResult&amp;#91;7] = &#34;21&#34;;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;&lt;/blockquote&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_get_table() function evaluates one or more
</span></span></span><span class="line"><span class="cl"><span class="cm">** semicolon-separated SQL statements in the zero-terminated UTF-8
</span></span></span><span class="line"><span class="cl"><span class="cm">** string of its 2nd parameter and returns a result table to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer given in its 3rd parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** After the application has finished with the result from sqlite3_get_table(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** it must pass the result table pointer to sqlite3_free_table() in order to
</span></span></span><span class="line"><span class="cl"><span class="cm">** release the memory that was malloced. Because of the way the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling
</span></span></span><span class="line"><span class="cl"><span class="cm">** function must not try to call [sqlite3_free()] directly. Only
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_free_table()] is able to release the memory properly and safely.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_get_table() interface is implemented as a wrapper around
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access
</span></span></span><span class="line"><span class="cl"><span class="cm">** to any internal data structures of SQLite. It uses only the public
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface defined here. As a consequence, errors that occur in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** wrapper layer outside of the internal [sqlite3_exec()] call are not
</span></span></span><span class="line"><span class="cl"><span class="cm">** reflected in subsequent calls to [sqlite3_errcode()] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_errmsg()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_get_table</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* An open database */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSql</span><span class="p">,</span> <span class="cm">/* SQL to be evaluated */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="o">***</span><span class="n">pazResult</span><span class="p">,</span> <span class="cm">/* Results of the query */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnRow</span><span class="p">,</span> <span class="cm">/* Number of result rows written here */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnColumn</span><span class="p">,</span> <span class="cm">/* Number of result columns written here */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="o">**</span><span class="n">pzErrmsg</span> <span class="cm">/* Error msg written here */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_free_table</span><span class="p">(</span><span class="kt">char</span> <span class="o">**</span><span class="n">result</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Formatted String Printing Functions
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines are work-alikes of the &#34;printf()&#34; family of functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** from the standard C library.
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines understand most of the common formatting options from
</span></span></span><span class="line"><span class="cl"><span class="cm">** the standard library printf()
</span></span></span><span class="line"><span class="cl"><span class="cm">** plus some additional non-standard formats ([%q], [%Q], [%w], and [%z]).
</span></span></span><span class="line"><span class="cl"><span class="cm">** See the [built-in printf()] documentation for details.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
</span></span></span><span class="line"><span class="cl"><span class="cm">** results into memory obtained from [sqlite3_malloc64()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The strings returned by these two routines should be
</span></span></span><span class="line"><span class="cl"><span class="cm">** released by [sqlite3_free()]. ^Both routines return a
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL pointer if [sqlite3_malloc64()] is unable to allocate enough
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory to hold the resulting string.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The sqlite3_snprintf() routine is similar to &#34;snprintf()&#34; from
</span></span></span><span class="line"><span class="cl"><span class="cm">** the standard C library. The result is written into the
</span></span></span><span class="line"><span class="cl"><span class="cm">** buffer supplied as the second parameter whose size is given by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the first parameter. Note that the order of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** first two parameters is reversed from snprintf().)^ This is an
</span></span></span><span class="line"><span class="cl"><span class="cm">** historical accident that cannot be fixed without breaking
</span></span></span><span class="line"><span class="cl"><span class="cm">** backwards compatibility. ^(Note also that sqlite3_snprintf()
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns a pointer to its buffer instead of the number of
</span></span></span><span class="line"><span class="cl"><span class="cm">** characters actually written into the buffer.)^ We admit that
</span></span></span><span class="line"><span class="cl"><span class="cm">** the number of characters written would be a more useful return
</span></span></span><span class="line"><span class="cl"><span class="cm">** value but we cannot change the implementation of sqlite3_snprintf()
</span></span></span><span class="line"><span class="cl"><span class="cm">** now without breaking compatibility.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^As long as the buffer size is greater than zero, sqlite3_snprintf()
</span></span></span><span class="line"><span class="cl"><span class="cm">** guarantees that the buffer is always zero-terminated. ^The first
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter &#34;n&#34; is the total size of the buffer, including space for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the zero terminator. So the longest string that can be completely
</span></span></span><span class="line"><span class="cl"><span class="cm">** written will be n-1 characters.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [built-in printf()], [printf() SQL function]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_mprintf</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,...);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_vmprintf</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span> <span class="n">va_list</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_snprintf</span><span class="p">(</span><span class="kt">int</span><span class="p">,</span><span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span> <span class="p">...);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_vsnprintf</span><span class="p">(</span><span class="kt">int</span><span class="p">,</span><span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span> <span class="n">va_list</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Memory Allocation Subsystem
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLite core uses these three routines for all of its own
</span></span></span><span class="line"><span class="cl"><span class="cm">** internal memory allocation needs. &#34;Core&#34; in the previous sentence
</span></span></span><span class="line"><span class="cl"><span class="cm">** does not include operating-system specific [VFS] implementation. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** Windows VFS uses native malloc() and free() for some operations.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_malloc() routine returns a pointer to a block
</span></span></span><span class="line"><span class="cl"><span class="cm">** of memory at least N bytes in length, where N is the parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If sqlite3_malloc() is unable to obtain sufficient free
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory, it returns a NULL pointer. ^If the parameter N to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_malloc64(N) routine works just like
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_malloc(N) except that N is an unsigned 64-bit integer instead
</span></span></span><span class="line"><span class="cl"><span class="cm">** of a signed 32-bit integer.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Calling sqlite3_free() with a pointer previously returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
</span></span></span><span class="line"><span class="cl"><span class="cm">** that it might be reused. ^The sqlite3_free() routine is
</span></span></span><span class="line"><span class="cl"><span class="cm">** a no-op if is called with a NULL pointer. Passing a NULL pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** to sqlite3_free() is harmless. After being freed, memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** should neither be read nor written. Even reading previously freed
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory might result in a segmentation fault or other severe error.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Memory corruption, a segmentation fault, or other severe error
</span></span></span><span class="line"><span class="cl"><span class="cm">** might result if sqlite3_free() is called with a non-NULL pointer that
</span></span></span><span class="line"><span class="cl"><span class="cm">** was not obtained from sqlite3_malloc() or sqlite3_realloc().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_realloc(X,N) interface attempts to resize a
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior memory allocation X to be at least N bytes.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the X parameter to sqlite3_realloc(X,N)
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a NULL pointer then its behavior is identical to calling
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_malloc(N).
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the N parameter to sqlite3_realloc(X,N) is zero or
</span></span></span><span class="line"><span class="cl"><span class="cm">** negative then the behavior is exactly the same as calling
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_free(X).
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation
</span></span></span><span class="line"><span class="cl"><span class="cm">** of at least N bytes in size or NULL if insufficient memory is available.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If M is the size of the prior allocation, then min(N,M) bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the prior allocation are copied into the beginning of buffer returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** by sqlite3_realloc(X,N) and the prior allocation is freed.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior allocation is not freed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_realloc64(X,N) interfaces works the same as
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead
</span></span></span><span class="line"><span class="cl"><span class="cm">** of a 32-bit signed integer.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If X is a memory allocation previously obtained from sqlite3_malloc(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_malloc64(), sqlite3_realloc(), or sqlite3_realloc64(), then
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_msize(X) returns the size of that memory allocation in bytes.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The value returned by sqlite3_msize(X) might be larger than the number
</span></span></span><span class="line"><span class="cl"><span class="cm">** of bytes requested when X was allocated. ^If X is a NULL pointer then
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_msize(X) returns zero. If X points to something that is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** the beginning of memory allocation, or if it points to a formerly
</span></span></span><span class="line"><span class="cl"><span class="cm">** valid memory allocation that has now been freed, then the behavior
</span></span></span><span class="line"><span class="cl"><span class="cm">** of sqlite3_msize(X) is undefined and possibly harmful.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_malloc64(), and sqlite3_realloc64()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is always aligned to at least an 8 byte boundary, or to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time
</span></span></span><span class="line"><span class="cl"><span class="cm">** option is used.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** must be either NULL or else pointers obtained from a prior
</span></span></span><span class="line"><span class="cl"><span class="cm">** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
</span></span></span><span class="line"><span class="cl"><span class="cm">** not yet been released.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The application must not read or write any part of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a block of memory after it has been released using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_free()] or [sqlite3_realloc()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_malloc</span><span class="p">(</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_malloc64</span><span class="p">(</span><span class="n">sqlite3_uint64</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_realloc</span><span class="p">(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_realloc64</span><span class="p">(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_uint64</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_free</span><span class="p">(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_uint64</span> <span class="nf">sqlite3_msize</span><span class="p">(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Memory Allocator Statistics
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite provides these two interfaces for reporting on the status
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines, which form the built-in memory allocation subsystem.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_memory_used()] routine returns the number of bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** of memory currently outstanding (malloced but not freed).
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_memory_highwater()] routine returns the maximum
</span></span></span><span class="line"><span class="cl"><span class="cm">** value of [sqlite3_memory_used()] since the high-water mark
</span></span></span><span class="line"><span class="cl"><span class="cm">** was last reset. ^The values returned by [sqlite3_memory_used()] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_memory_highwater()] include any overhead
</span></span></span><span class="line"><span class="cl"><span class="cm">** added by SQLite in its implementation of [sqlite3_malloc()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** but not overhead added by the any underlying system library
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines that [sqlite3_malloc()] may call.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The memory high-water mark is reset to the current value of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_memory_used()] if and only if the parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_memory_highwater()] is true. ^The value returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** by [sqlite3_memory_highwater(1)] is the high-water mark
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior to the reset.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3_memory_used</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3_memory_highwater</span><span class="p">(</span><span class="kt">int</span> <span class="n">resetFlag</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Pseudo-Random Number Generator
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
</span></span></span><span class="line"><span class="cl"><span class="cm">** select random [ROWID | ROWIDs] when inserting new records into a table that
</span></span></span><span class="line"><span class="cl"><span class="cm">** already uses the largest possible [ROWID]. The PRNG is also used for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the built-in random() and randomblob() SQL functions. This interface allows
</span></span></span><span class="line"><span class="cl"><span class="cm">** applications to access the same PRNG for other purposes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A call to this routine stores N bytes of randomness into buffer P.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The P parameter can be a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If this routine has not been previously called or if the previous
</span></span></span><span class="line"><span class="cl"><span class="cm">** call had N less than one or a NULL pointer for P, then the PRNG is
</span></span></span><span class="line"><span class="cl"><span class="cm">** seeded using randomness obtained from the xRandomness method of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the default [sqlite3_vfs] object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the previous call to this routine had an N of 1 or more and a
</span></span></span><span class="line"><span class="cl"><span class="cm">** non-NULL P then the pseudo-randomness is generated
</span></span></span><span class="line"><span class="cl"><span class="cm">** internally and without recourse to the [sqlite3_vfs] xRandomness
</span></span></span><span class="line"><span class="cl"><span class="cm">** method.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_randomness</span><span class="p">(</span><span class="kt">int</span> <span class="n">N</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">P</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Compile-Time Authorization Callbacks
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {authorizer callback}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This routine registers an authorizer callback with a particular
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection], supplied in the first argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The authorizer callback is invoked as SQL statements are being compiled
</span></span></span><span class="line"><span class="cl"><span class="cm">** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** and [sqlite3_prepare16_v3()]. ^At various
</span></span></span><span class="line"><span class="cl"><span class="cm">** points during the compilation process, as logic is being created
</span></span></span><span class="line"><span class="cl"><span class="cm">** to perform various actions, the authorizer callback is invoked to
</span></span></span><span class="line"><span class="cl"><span class="cm">** see if those actions are allowed. ^The authorizer callback should
</span></span></span><span class="line"><span class="cl"><span class="cm">** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the
</span></span></span><span class="line"><span class="cl"><span class="cm">** specific action but allow the SQL statement to continue to be
</span></span></span><span class="line"><span class="cl"><span class="cm">** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
</span></span></span><span class="line"><span class="cl"><span class="cm">** rejected with an error. ^If the authorizer callback returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the [sqlite3_prepare_v2()] or equivalent call that triggered
</span></span></span><span class="line"><span class="cl"><span class="cm">** the authorizer will fail with an error message.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When the callback returns [SQLITE_OK], that means the operation
</span></span></span><span class="line"><span class="cl"><span class="cm">** requested is ok. ^When the callback returns [SQLITE_DENY], the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare_v2()] or equivalent call that triggered the
</span></span></span><span class="line"><span class="cl"><span class="cm">** authorizer will fail with an error message explaining that
</span></span></span><span class="line"><span class="cl"><span class="cm">** access is denied.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first parameter to the authorizer callback is a copy of the third
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the callback is an integer [SQLITE_COPY | action code] that specifies
</span></span></span><span class="line"><span class="cl"><span class="cm">** the particular action to be authorized. ^The third through sixth parameters
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the callback are either NULL pointers or zero-terminated strings
</span></span></span><span class="line"><span class="cl"><span class="cm">** that contain additional details about the action to be authorized.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Applications must always be prepared to encounter a NULL pointer in any
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the third through the sixth parameters of the authorization callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the action code is [SQLITE_READ]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the callback returns [SQLITE_IGNORE] then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [prepared statement] statement is constructed to substitute
</span></span></span><span class="line"><span class="cl"><span class="cm">** a NULL value in place of the table column that would have
</span></span></span><span class="line"><span class="cl"><span class="cm">** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** return can be used to deny an untrusted user access to individual
</span></span></span><span class="line"><span class="cl"><span class="cm">** columns of a table.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When a table is referenced by a [SELECT] but no column values are
</span></span></span><span class="line"><span class="cl"><span class="cm">** extracted from that table (for example in a query like
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;SELECT count(*) FROM tab&#34;) then the [SQLITE_READ] authorizer callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** is invoked once for that table with a column name that is an empty string.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the action code is [SQLITE_DELETE] and the callback returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [truncate optimization] is disabled and all rows are deleted individually.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An authorizer is used when [sqlite3_prepare | preparing]
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL statements from an untrusted source, to ensure that the SQL statements
</span></span></span><span class="line"><span class="cl"><span class="cm">** do not try to access data they are not allowed to see, or that they do not
</span></span></span><span class="line"><span class="cl"><span class="cm">** try to execute malicious statements that damage the database. For
</span></span></span><span class="line"><span class="cl"><span class="cm">** example, an application may allow a user to enter arbitrary
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL queries for evaluation by a database. But the application does
</span></span></span><span class="line"><span class="cl"><span class="cm">** not want the user to be able to make arbitrary changes to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database. An authorizer could then be put in place while the
</span></span></span><span class="line"><span class="cl"><span class="cm">** user-entered SQL is being [sqlite3_prepare | prepared] that
</span></span></span><span class="line"><span class="cl"><span class="cm">** disallows everything except [SELECT] statements.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Applications that need to process SQL from untrusted sources
</span></span></span><span class="line"><span class="cl"><span class="cm">** might also consider lowering resource limits using [sqlite3_limit()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and limiting database size using the [max_page_count] [PRAGMA]
</span></span></span><span class="line"><span class="cl"><span class="cm">** in addition to using an authorizer.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Only a single authorizer can be in place on a database connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** at a time. Each call to sqlite3_set_authorizer overrides the
</span></span></span><span class="line"><span class="cl"><span class="cm">** previous call.)^ ^Disable the authorizer by installing a NULL callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The authorizer is disabled by default.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The authorizer callback must not do anything that will modify
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database connection that invoked the authorizer callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connections for the meaning of &#34;modify&#34; in this paragraph.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement might be re-prepared during [sqlite3_step()] due to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** schema change. Hence, the application should ensure that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** correct authorizer callback remains in place during the [sqlite3_step()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Note that the authorizer callback is invoked only during
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare()] or its variants. Authorization is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** performed during statement evaluation in [sqlite3_step()], unless
</span></span></span><span class="line"><span class="cl"><span class="cm">** as stated in the previous paragraph, sqlite3_step() invokes
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_prepare_v2() to reprepare a statement after a schema change.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_set_authorizer</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xAuth</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pUserData</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Authorizer Return Codes
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_set_authorizer | authorizer callback function] must
</span></span></span><span class="line"><span class="cl"><span class="cm">** return either [SQLITE_OK] or one of these two constants in order
</span></span></span><span class="line"><span class="cl"><span class="cm">** to signal SQLite whether or not the action is permitted. See the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_set_authorizer | authorizer documentation] for additional
</span></span></span><span class="line"><span class="cl"><span class="cm">** information.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that SQLITE_IGNORE is also used as a [conflict resolution mode]
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned from the [sqlite3_vtab_on_conflict()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DENY 1 </span><span class="cm">/* Abort the SQL statement with an error */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_IGNORE 2 </span><span class="cm">/* Don&#39;t allow access, but don&#39;t generate an error */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Authorizer Action Codes
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_set_authorizer()] interface registers a callback function
</span></span></span><span class="line"><span class="cl"><span class="cm">** that is invoked to authorize certain SQL statement actions. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** second parameter to the callback is an integer code that specifies
</span></span></span><span class="line"><span class="cl"><span class="cm">** what action is being authorized. These are the integer action codes that
</span></span></span><span class="line"><span class="cl"><span class="cm">** the authorizer callback may be passed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These action code values signify what kind of operation is to be
</span></span></span><span class="line"><span class="cl"><span class="cm">** authorized. The 3rd and 4th parameters to the authorization
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback function will be parameters or NULL depending on which of these
</span></span></span><span class="line"><span class="cl"><span class="cm">** codes is used as the second parameter. ^(The 5th parameter to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** authorizer callback is the name of the database (&#34;main&#34;, &#34;temp&#34;,
</span></span></span><span class="line"><span class="cl"><span class="cm">** etc.) if applicable.)^ ^The 6th parameter to the authorizer callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** is the name of the inner-most trigger or view that is responsible for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the access attempt or NULL if this access attempt is directly from
</span></span></span><span class="line"><span class="cl"><span class="cm">** top-level SQL code.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cm">/******************************************* 3rd ************ 4th ***********/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CREATE_INDEX 1 </span><span class="cm">/* Index Name Table Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CREATE_TABLE 2 </span><span class="cm">/* Table Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CREATE_TEMP_INDEX 3 </span><span class="cm">/* Index Name Table Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CREATE_TEMP_TABLE 4 </span><span class="cm">/* Table Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CREATE_TEMP_TRIGGER 5 </span><span class="cm">/* Trigger Name Table Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CREATE_TEMP_VIEW 6 </span><span class="cm">/* View Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CREATE_TRIGGER 7 </span><span class="cm">/* Trigger Name Table Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CREATE_VIEW 8 </span><span class="cm">/* View Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DELETE 9 </span><span class="cm">/* Table Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DROP_INDEX 10 </span><span class="cm">/* Index Name Table Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DROP_TABLE 11 </span><span class="cm">/* Table Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DROP_TEMP_INDEX 12 </span><span class="cm">/* Index Name Table Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DROP_TEMP_TABLE 13 </span><span class="cm">/* Table Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DROP_TEMP_TRIGGER 14 </span><span class="cm">/* Trigger Name Table Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DROP_TEMP_VIEW 15 </span><span class="cm">/* View Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DROP_TRIGGER 16 </span><span class="cm">/* Trigger Name Table Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DROP_VIEW 17 </span><span class="cm">/* View Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INSERT 18 </span><span class="cm">/* Table Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_PRAGMA 19 </span><span class="cm">/* Pragma Name 1st arg or NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_READ 20 </span><span class="cm">/* Table Name Column Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SELECT 21 </span><span class="cm">/* NULL NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TRANSACTION 22 </span><span class="cm">/* Operation NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_UPDATE 23 </span><span class="cm">/* Table Name Column Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ATTACH 24 </span><span class="cm">/* Filename NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DETACH 25 </span><span class="cm">/* Database Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ALTER_TABLE 26 </span><span class="cm">/* Database Name Table Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_REINDEX 27 </span><span class="cm">/* Index Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ANALYZE 28 </span><span class="cm">/* Table Name NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CREATE_VTABLE 29 </span><span class="cm">/* Table Name Module Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DROP_VTABLE 30 </span><span class="cm">/* Table Name Module Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FUNCTION 31 </span><span class="cm">/* NULL Function Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SAVEPOINT 32 </span><span class="cm">/* Operation Savepoint Name */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_COPY 0 </span><span class="cm">/* No longer used */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_RECURSIVE 33 </span><span class="cm">/* NULL NULL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Deprecated Tracing And Profiling Functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** DEPRECATED
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** instead of the routines described here.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines register callback functions that can be used for
</span></span></span><span class="line"><span class="cl"><span class="cm">** tracing and profiling the execution of SQL statements.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The callback function registered by sqlite3_trace() is invoked at
</span></span></span><span class="line"><span class="cl"><span class="cm">** various times when an SQL statement is being run by [sqlite3_step()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL statement text as the statement first begins executing.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Additional sqlite3_trace() callbacks might occur
</span></span></span><span class="line"><span class="cl"><span class="cm">** as each triggered subprogram is entered. The callbacks for triggers
</span></span></span><span class="line"><span class="cl"><span class="cm">** contain a UTF-8 SQL comment that identifies the trigger.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit
</span></span></span><span class="line"><span class="cl"><span class="cm">** the length of [bound parameter] expansion in the output of sqlite3_trace().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The callback function registered by sqlite3_profile() is invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** as each SQL statement finishes. ^The profile callback contains
</span></span></span><span class="line"><span class="cl"><span class="cm">** the original statement text and an estimate of wall-clock time
</span></span></span><span class="line"><span class="cl"><span class="cm">** of how long that statement took to run. ^The profile callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** time is in units of nanoseconds, however the current implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** is only capable of millisecond resolution so the six least significant
</span></span></span><span class="line"><span class="cl"><span class="cm">** digits in the time are meaningless. Future versions of SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** might provide greater resolution on the profiler callback. Invoking
</span></span></span><span class="line"><span class="cl"><span class="cm">** either [sqlite3_trace()] or [sqlite3_trace_v2()] will cancel the
</span></span></span><span class="line"><span class="cl"><span class="cm">** profile callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_DEPRECATED</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_trace</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="n">xTrace</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">),</span> <span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_DEPRECATED</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_profile</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="n">xProfile</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="n">sqlite3_uint64</span><span class="p">),</span> <span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: SQL Trace Event Codes
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: SQLITE_TRACE
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants identify classes of events that can be monitored
</span></span></span><span class="line"><span class="cl"><span class="cm">** using the [sqlite3_trace_v2()] tracing logic. The M argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** to [sqlite3_trace_v2(D,M,X,P)] is an OR-ed combination of one or more of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the following constants. ^The first argument to the trace callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** is one of the following constants.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** New tracing constants may be added in future releases.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A trace callback has four arguments: xCallback(T,C,P,X).
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The T argument is one of the integer type codes above.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The C argument is a copy of the context pointer passed in as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** fourth argument to [sqlite3_trace_v2()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The P and X arguments are pointers whose meanings depend on T.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_TRACE_STMT]] &lt;dt&gt;SQLITE_TRACE_STMT&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^An SQLITE_TRACE_STMT callback is invoked when a prepared statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** first begins running and possibly at other times during the
</span></span></span><span class="line"><span class="cl"><span class="cm">** execution of the prepared statement, such as at the start of each
</span></span></span><span class="line"><span class="cl"><span class="cm">** trigger subprogram. ^The P argument is a pointer to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [prepared statement]. ^The X argument is a pointer to a string which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is the unexpanded SQL text of the prepared statement or an SQL comment
</span></span></span><span class="line"><span class="cl"><span class="cm">** that indicates the invocation of a trigger. ^The callback can compute
</span></span></span><span class="line"><span class="cl"><span class="cm">** the same text that would have been returned by the legacy [sqlite3_trace()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface by using the X argument when X begins with &#34;--&#34; and invoking
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_expanded_sql(P)] otherwise.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_TRACE_PROFILE]] &lt;dt&gt;SQLITE_TRACE_PROFILE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^An SQLITE_TRACE_PROFILE callback provides approximately the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** information as is provided by the [sqlite3_profile()] callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The P argument is a pointer to the [prepared statement] and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** X argument points to a 64-bit integer which is approximately
</span></span></span><span class="line"><span class="cl"><span class="cm">** the number of nanoseconds that the prepared statement took to run.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_TRACE_ROW]] &lt;dt&gt;SQLITE_TRACE_ROW&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^An SQLITE_TRACE_ROW callback is invoked whenever a prepared
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement generates a single row of result.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The P argument is a pointer to the [prepared statement] and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** X argument is unused.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_TRACE_CLOSE]] &lt;dt&gt;SQLITE_TRACE_CLOSE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^An SQLITE_TRACE_CLOSE callback is invoked when a database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection closes.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The P argument is a pointer to the [database connection] object
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the X argument is unused.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TRACE_STMT 0x01
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TRACE_PROFILE 0x02
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TRACE_ROW 0x04
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TRACE_CLOSE 0x08
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: SQL Trace Hook
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** function X against [database connection] D, using property mask M
</span></span></span><span class="line"><span class="cl"><span class="cm">** and context pointer P. ^If the X callback is
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL or if the M mask is zero, then tracing is disabled. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** M argument should be the bitwise OR-ed combination of
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero or more [SQLITE_TRACE] constants.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Each call to either sqlite3_trace(D,X,P) or sqlite3_trace_v2(D,M,X,P)
</span></span></span><span class="line"><span class="cl"><span class="cm">** overrides (cancels) all prior calls to sqlite3_trace(D,X,P) or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_trace_v2(D,M,X,P) for the [database connection] D. Each
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connection may have at most one trace callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The X callback is invoked whenever any of the events identified by
</span></span></span><span class="line"><span class="cl"><span class="cm">** mask M occur. ^The integer return value from the callback is currently
</span></span></span><span class="line"><span class="cl"><span class="cm">** ignored, though this may change in future releases. Callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementations should return zero to ensure future compatibility.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A trace callback is invoked with four arguments: callback(T,C,P,X).
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The T argument is one of the [SQLITE_TRACE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** constants to indicate why the callback was invoked.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The C argument is a copy of the context pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The P and X arguments are pointers whose meanings depend on T.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_trace_v2() interface is intended to replace the legacy
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
</span></span></span><span class="line"><span class="cl"><span class="cm">** are deprecated.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_trace_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="n">uMask</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xCallback</span><span class="p">)(</span><span class="kt">unsigned</span><span class="p">,</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">void</span><span class="o">*</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Query Progress Callbacks
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** function X to be invoked periodically during long running calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_step()] and [sqlite3_prepare()] and similar for
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connection D. An example use for this
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface is to keep a GUI updated during a large query.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The parameter P is passed through as the only parameter to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback function X. ^The parameter N is the approximate number of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [virtual machine instructions] that are evaluated between successive
</span></span></span><span class="line"><span class="cl"><span class="cm">** invocations of the callback X. ^If N is less than one then the progress
</span></span></span><span class="line"><span class="cl"><span class="cm">** handler is disabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Only a single progress handler may be defined at one time per
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection]; setting a new progress handler cancels the
</span></span></span><span class="line"><span class="cl"><span class="cm">** old one. ^Setting parameter X to NULL disables the progress handler.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The progress handler is also disabled by setting N to a value less
</span></span></span><span class="line"><span class="cl"><span class="cm">** than 1.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the progress callback returns non-zero, the operation is
</span></span></span><span class="line"><span class="cl"><span class="cm">** interrupted. This feature can be used to implement a
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;Cancel&#34; button on a GUI progress dialog box.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The progress handler callback must not do anything that will modify
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database connection that invoked the progress handler.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connections for the meaning of &#34;modify&#34; in this paragraph.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The progress handler callback would originally only be invoked from the
</span></span></span><span class="line"><span class="cl"><span class="cm">** bytecode engine. It still might be invoked during [sqlite3_prepare()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and similar because those routines might force a reparse of the schema
</span></span></span><span class="line"><span class="cl"><span class="cm">** which involves running the bytecode engine. However, beginning with
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite version 3.41.0, the progress handler callback might also be
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked directly from [sqlite3_prepare()] while analyzing and generating
</span></span></span><span class="line"><span class="cl"><span class="cm">** code for complex queries.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_progress_handler</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">),</span> <span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Opening A New Database Connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** CONSTRUCTOR: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These routines open an SQLite database file as specified by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** filename argument. ^The filename argument is interpreted as UTF-8 for
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte
</span></span></span><span class="line"><span class="cl"><span class="cm">** order for sqlite3_open16(). ^(A [database connection] handle is usually
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned in *ppDb, even if an error occurs. The only exception is that
</span></span></span><span class="line"><span class="cl"><span class="cm">** if SQLite is unable to allocate memory to hold the [sqlite3] object,
</span></span></span><span class="line"><span class="cl"><span class="cm">** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]
</span></span></span><span class="line"><span class="cl"><span class="cm">** object.)^ ^(If the database is opened (and/or created) successfully, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain
</span></span></span><span class="line"><span class="cl"><span class="cm">** an English language description of the error following a failure of any
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the sqlite3_open() routines.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The default encoding will be UTF-8 for databases created using
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_open() or sqlite3_open_v2(). ^The default encoding for databases
</span></span></span><span class="line"><span class="cl"><span class="cm">** created using sqlite3_open16() will be UTF-16 in the native byte order.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Whether or not an error occurs when it is opened, resources
</span></span></span><span class="line"><span class="cl"><span class="cm">** associated with the [database connection] handle should be released by
</span></span></span><span class="line"><span class="cl"><span class="cm">** passing it to [sqlite3_close()] when it is no longer required.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_open_v2() interface works like sqlite3_open()
</span></span></span><span class="line"><span class="cl"><span class="cm">** except that it accepts two additional parameters for additional control
</span></span></span><span class="line"><span class="cl"><span class="cm">** over the new database connection. ^(The flags parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_open_v2() must include, at a minimum, one of the following
</span></span></span><span class="line"><span class="cl"><span class="cm">** three flag combinations:)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;[SQLITE_OPEN_READONLY]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The database is opened in read-only mode. If the database does
</span></span></span><span class="line"><span class="cl"><span class="cm">** not already exist, an error is returned.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;[SQLITE_OPEN_READWRITE]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The database is opened for reading and writing if possible, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** reading only if the file is write protected by the operating
</span></span></span><span class="line"><span class="cl"><span class="cm">** system. In either case the database must already exist, otherwise
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error is returned. For historical reasons, if opening in
</span></span></span><span class="line"><span class="cl"><span class="cm">** read-write mode fails due to OS-level permissions, an attempt is
</span></span></span><span class="line"><span class="cl"><span class="cm">** made to open it in read-only mode. [sqlite3_db_readonly()] can be
</span></span></span><span class="line"><span class="cl"><span class="cm">** used to determine whether the database is actually
</span></span></span><span class="line"><span class="cl"><span class="cm">** read-write.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The database is opened for reading and writing, and is created if
</span></span></span><span class="line"><span class="cl"><span class="cm">** it does not already exist. This is the behavior that is always used for
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_open() and sqlite3_open16().&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In addition to the required flags, the following optional flags are
</span></span></span><span class="line"><span class="cl"><span class="cm">** also supported:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;[SQLITE_OPEN_URI]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The filename can be interpreted as a URI if this flag is set.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;[SQLITE_OPEN_MEMORY]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The database will be opened as an in-memory database. The database
</span></span></span><span class="line"><span class="cl"><span class="cm">** is named by the &#34;filename&#34; argument for the purposes of cache-sharing,
</span></span></span><span class="line"><span class="cl"><span class="cm">** if shared cache mode is enabled, but the &#34;filename&#34; is otherwise ignored.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;[SQLITE_OPEN_NOMUTEX]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The new database connection will use the &#34;multi-thread&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [threading mode].)^ This means that separate threads are allowed
</span></span></span><span class="line"><span class="cl"><span class="cm">** to use SQLite at the same time, as long as each thread is using
</span></span></span><span class="line"><span class="cl"><span class="cm">** a different [database connection].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;[SQLITE_OPEN_FULLMUTEX]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The new database connection will use the &#34;serialized&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [threading mode].)^ This means the multiple threads can safely
</span></span></span><span class="line"><span class="cl"><span class="cm">** attempt to use the same database connection at the same time.
</span></span></span><span class="line"><span class="cl"><span class="cm">** (Mutexes will block any actual concurrency, but in this mode
</span></span></span><span class="line"><span class="cl"><span class="cm">** there is no harm in trying.)
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;[SQLITE_OPEN_SHAREDCACHE]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The database is opened [shared cache] enabled, overriding
</span></span></span><span class="line"><span class="cl"><span class="cm">** the default shared cache setting provided by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_enable_shared_cache()].)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [use of shared cache mode is discouraged] and hence shared cache
</span></span></span><span class="line"><span class="cl"><span class="cm">** capabilities may be omitted from many builds of SQLite. In such cases,
</span></span></span><span class="line"><span class="cl"><span class="cm">** this option is a no-op.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;[SQLITE_OPEN_PRIVATECACHE]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The database is opened [shared cache] disabled, overriding
</span></span></span><span class="line"><span class="cl"><span class="cm">** the default shared cache setting provided by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_enable_shared_cache()].)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[OPEN_EXRESCODE]] ^(&lt;dt&gt;[SQLITE_OPEN_EXRESCODE]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The database connection comes up in &#34;extended result code mode&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** In other words, the database behaves has if
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_extended_result_codes(db,1)] where called on the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection as soon as the connection is created. In addition to setting
</span></span></span><span class="line"><span class="cl"><span class="cm">** the extended result code mode, this flag also causes [sqlite3_open_v2()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to return an extended result code.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[OPEN_NOFOLLOW]] ^(&lt;dt&gt;[SQLITE_OPEN_NOFOLLOW]&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The database filename is not allowed to contain a symbolic link&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the 3rd parameter to sqlite3_open_v2() is not one of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** required combinations shown above optionally combined with other
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the behavior is undefined. Historic versions of SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** have silently ignored surplus bits in the flags parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_open_v2(), however that behavior might not be carried through
</span></span></span><span class="line"><span class="cl"><span class="cm">** into future versions of SQLite and so applications should not rely
</span></span></span><span class="line"><span class="cl"><span class="cm">** upon it. Note in particular that the SQLITE_OPEN_EXCLUSIVE flag is a no-op
</span></span></span><span class="line"><span class="cl"><span class="cm">** for sqlite3_open_v2(). The SQLITE_OPEN_EXCLUSIVE does *not* cause
</span></span></span><span class="line"><span class="cl"><span class="cm">** the open to fail if the database already exists. The SQLITE_OPEN_EXCLUSIVE
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag is intended for use by the [sqlite3_vfs|VFS interface] only, and not
</span></span></span><span class="line"><span class="cl"><span class="cm">** by sqlite3_open_v2().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The fourth parameter to sqlite3_open_v2() is the name of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_vfs] object that defines the operating system interface that
</span></span></span><span class="line"><span class="cl"><span class="cm">** the new database connection should use. ^If the fourth parameter is
</span></span></span><span class="line"><span class="cl"><span class="cm">** a NULL pointer then the default [sqlite3_vfs] object is used.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the filename is &#34;:memory:&#34;, then a private, temporary in-memory database
</span></span></span><span class="line"><span class="cl"><span class="cm">** is created for the connection. ^This in-memory database will vanish when
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database connection is closed. Future versions of SQLite might
</span></span></span><span class="line"><span class="cl"><span class="cm">** make use of additional special filenames that begin with the &#34;:&#34; character.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is recommended that when a database filename actually does begin with
</span></span></span><span class="line"><span class="cl"><span class="cm">** a &#34;:&#34; character you should prefix the filename with a pathname such as
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;./&#34; to avoid ambiguity.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the filename is an empty string, then a private, temporary
</span></span></span><span class="line"><span class="cl"><span class="cm">** on-disk database will be created. ^This private database will be
</span></span></span><span class="line"><span class="cl"><span class="cm">** automatically deleted as soon as the database connection is closed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[URI filenames in sqlite3_open()]] &lt;h3&gt;URI Filenames&lt;/h3&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If [URI filename] interpretation is enabled, and the filename argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** begins with &#34;file:&#34;, then the filename is interpreted as a URI. ^URI
</span></span></span><span class="line"><span class="cl"><span class="cm">** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is
</span></span></span><span class="line"><span class="cl"><span class="cm">** set in the third argument to sqlite3_open_v2(), or if it has
</span></span></span><span class="line"><span class="cl"><span class="cm">** been enabled globally using the [SQLITE_CONFIG_URI] option with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
</span></span></span><span class="line"><span class="cl"><span class="cm">** URI filename interpretation is turned off
</span></span></span><span class="line"><span class="cl"><span class="cm">** by default, but future releases of SQLite might enable URI filename
</span></span></span><span class="line"><span class="cl"><span class="cm">** interpretation by default. See &#34;[URI filenames]&#34; for additional
</span></span></span><span class="line"><span class="cl"><span class="cm">** information.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** URI filenames are parsed according to RFC 3986. ^If the URI contains an
</span></span></span><span class="line"><span class="cl"><span class="cm">** authority, then it must be either an empty string or the string
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;localhost&#34;. ^If the authority is not an empty string or &#34;localhost&#34;, an
</span></span></span><span class="line"><span class="cl"><span class="cm">** error is returned to the caller. ^The fragment component of a URI, if
</span></span></span><span class="line"><span class="cl"><span class="cm">** present, is ignored.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite uses the path component of the URI as the name of the disk file
</span></span></span><span class="line"><span class="cl"><span class="cm">** which contains the database. ^If the path begins with a &#39;/&#39; character,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then it is interpreted as an absolute path. ^If the path does not begin
</span></span></span><span class="line"><span class="cl"><span class="cm">** with a &#39;/&#39; (meaning that the authority section is omitted from the URI)
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the path is interpreted as a relative path.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(On windows, the first component of an absolute path
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a drive specification (e.g. &#34;C:&#34;).)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[core URI query parameters]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The query component of a URI may contain parameters that are interpreted
</span></span></span><span class="line"><span class="cl"><span class="cm">** either by SQLite itself, or by a [VFS | custom VFS implementation].
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite and its built-in [VFSes] interpret the
</span></span></span><span class="line"><span class="cl"><span class="cm">** following query parameters:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; &lt;b&gt;vfs&lt;/b&gt;: ^The &#34;vfs&#34; parameter may be used to specify the name of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a VFS object that provides the operating system interface that should
</span></span></span><span class="line"><span class="cl"><span class="cm">** be used to access the database file on disk. ^If this option is set to
</span></span></span><span class="line"><span class="cl"><span class="cm">** an empty string the default VFS object is used. ^Specifying an unknown
</span></span></span><span class="line"><span class="cl"><span class="cm">** VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is
</span></span></span><span class="line"><span class="cl"><span class="cm">** present, then the VFS specified by the option takes precedence over
</span></span></span><span class="line"><span class="cl"><span class="cm">** the value passed as the fourth parameter to sqlite3_open_v2().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; &lt;b&gt;mode&lt;/b&gt;: ^(The mode parameter may be set to either &#34;ro&#34;, &#34;rw&#34;,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;rwc&#34;, or &#34;memory&#34;. Attempting to set it to any other value is
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error)^.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If &#34;ro&#34; is specified, then the database is opened for read-only
</span></span></span><span class="line"><span class="cl"><span class="cm">** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** third argument to sqlite3_open_v2(). ^If the mode option is set to
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;rw&#34;, then the database is opened for read-write (but not create)
</span></span></span><span class="line"><span class="cl"><span class="cm">** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had
</span></span></span><span class="line"><span class="cl"><span class="cm">** been set. ^Value &#34;rwc&#34; is equivalent to setting both
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is
</span></span></span><span class="line"><span class="cl"><span class="cm">** set to &#34;memory&#34; then a pure [in-memory database] that never reads
</span></span></span><span class="line"><span class="cl"><span class="cm">** or writes from disk is used. ^It is an error to specify a value for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the mode parameter that is less restrictive than that specified by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the flags passed in the third parameter to sqlite3_open_v2().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; &lt;b&gt;cache&lt;/b&gt;: ^The cache parameter may be set to either &#34;shared&#34; or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;private&#34;. ^Setting it to &#34;shared&#34; is equivalent to setting the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_open_v2(). ^Setting the cache parameter to &#34;private&#34; is
</span></span></span><span class="line"><span class="cl"><span class="cm">** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If sqlite3_open_v2() is used and the &#34;cache&#34; parameter is present in
</span></span></span><span class="line"><span class="cl"><span class="cm">** a URI filename, its value overrides any behavior requested by setting
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; &lt;b&gt;psow&lt;/b&gt;: ^The psow parameter indicates whether or not the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [powersafe overwrite] property does or does not apply to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** storage media on which the database file resides.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; &lt;b&gt;nolock&lt;/b&gt;: ^The nolock parameter is a boolean query parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** which if set disables file locking in rollback journal modes. This
</span></span></span><span class="line"><span class="cl"><span class="cm">** is useful for accessing a database on a filesystem that does not
</span></span></span><span class="line"><span class="cl"><span class="cm">** support locking. Caution: Database corruption might result if two
</span></span></span><span class="line"><span class="cl"><span class="cm">** or more processes write to the same database and any one of those
</span></span></span><span class="line"><span class="cl"><span class="cm">** processes uses nolock=1.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; &lt;b&gt;immutable&lt;/b&gt;: ^The immutable parameter is a boolean query
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter that indicates that the database file is stored on
</span></span></span><span class="line"><span class="cl"><span class="cm">** read-only media. ^When immutable is set, SQLite assumes that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database file cannot be changed, even by a process with higher
</span></span></span><span class="line"><span class="cl"><span class="cm">** privilege, and so the database is opened read-only and all locking
</span></span></span><span class="line"><span class="cl"><span class="cm">** and change detection is disabled. Caution: Setting the immutable
</span></span></span><span class="line"><span class="cl"><span class="cm">** property on a database file that does in fact change can result
</span></span></span><span class="line"><span class="cl"><span class="cm">** in incorrect query results and/or [SQLITE_CORRUPT] errors.
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [SQLITE_IOCAP_IMMUTABLE].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Specifying an unknown parameter in the query component of a URI is not an
</span></span></span><span class="line"><span class="cl"><span class="cm">** error. Future versions of SQLite might understand additional query
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameters. See &#34;[query parameters with special meaning to SQLite]&#34; for
</span></span></span><span class="line"><span class="cl"><span class="cm">** additional information.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[URI filename examples]] &lt;h3&gt;URI filename examples&lt;/h3&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;table border=&#34;1&#34; align=center cellpadding=5&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;th&gt; URI filenames &lt;th&gt; Results
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; file:data.db &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Open the file &#34;data.db&#34; in the current directory.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; file:/home/fred/data.db&lt;br&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** file:///home/fred/data.db &lt;br&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** file://localhost/home/fred/data.db &lt;br&gt; &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Open the database file &#34;/home/fred/data.db&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; file://darkstar/home/fred/data.db &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** An error. &#34;darkstar&#34; is not a recognized authority.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td style=&#34;white-space:nowrap&#34;&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** file:///C:/Documents%20and%20Settings/fred/Desktop/data.db
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;td&gt; Windows only: Open the file &#34;data.db&#34; on fred&#39;s desktop on drive
</span></span></span><span class="line"><span class="cl"><span class="cm">** C:. Note that the %20 escaping in this example is not strictly
</span></span></span><span class="line"><span class="cl"><span class="cm">** necessary - space characters can be used literally
</span></span></span><span class="line"><span class="cl"><span class="cm">** in URI filenames.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; file:data.db?mode=ro&amp;cache=private &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Open file &#34;data.db&#34; in the current directory for read-only access.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Regardless of whether or not shared-cache mode is enabled by
</span></span></span><span class="line"><span class="cl"><span class="cm">** default, use a private cache.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; file:/home/fred/data.db?vfs=unix-dotfile &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Open file &#34;/home/fred/data.db&#34;. Use the special VFS &#34;unix-dotfile&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** that uses dot-files in place of posix advisory locking.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; file:data.db?mode=readonly &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** An error. &#34;readonly&#34; is not a valid option for the &#34;mode&#34; parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Use &#34;ro&#34; instead: &#34;file:data.db?mode=ro&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/table&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^URI hexadecimal escape sequences (%HH) are supported within the path and
</span></span></span><span class="line"><span class="cl"><span class="cm">** query components of a URI. A hexadecimal escape sequence consists of a
</span></span></span><span class="line"><span class="cl"><span class="cm">** percent sign - &#34;%&#34; - followed by exactly two hexadecimal digits
</span></span></span><span class="line"><span class="cl"><span class="cm">** specifying an octet value. ^Before the path or query components of a
</span></span></span><span class="line"><span class="cl"><span class="cm">** URI filename are interpreted, they are encoded using UTF-8 and all
</span></span></span><span class="line"><span class="cl"><span class="cm">** hexadecimal escape sequences replaced by a single byte containing the
</span></span></span><span class="line"><span class="cl"><span class="cm">** corresponding octet. If this process generates an invalid UTF-8 encoding,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the results are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Note to Windows users:&lt;/b&gt; The encoding used for the filename argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever
</span></span></span><span class="line"><span class="cl"><span class="cm">** codepage is currently defined. Filenames containing international
</span></span></span><span class="line"><span class="cl"><span class="cm">** characters must be converted to UTF-8 prior to passing them into
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_open() or sqlite3_open_v2().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Note to Windows Runtime users:&lt;/b&gt; The temporary directory must be set
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various
</span></span></span><span class="line"><span class="cl"><span class="cm">** features that require the use of temporary files may fail.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_temp_directory]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_open</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">filename</span><span class="p">,</span> <span class="cm">/* Database filename (UTF-8)</span> <span class="err">*/</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">**</span><span class="n">ppDb</span> <span class="cm">/* OUT: SQLite db handle */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_open16</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">filename</span><span class="p">,</span> <span class="cm">/* Database filename (UTF-16)</span> <span class="err">*/</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">**</span><span class="n">ppDb</span> <span class="cm">/* OUT: SQLite db handle */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_open_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">filename</span><span class="p">,</span> <span class="cm">/* Database filename (UTF-8)</span> <span class="err">*/</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">**</span><span class="n">ppDb</span><span class="p">,</span> <span class="cm">/* OUT: SQLite db handle */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">flags</span><span class="p">,</span> <span class="cm">/* Flags */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zVfs</span> <span class="cm">/* Name of VFS module to use */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Obtain Values For URI Parameters
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These are utility routines, useful to [VFS|custom VFS implementations],
</span></span></span><span class="line"><span class="cl"><span class="cm">** that check if a database file was a URI that contained a specific query
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter, and if so obtains the value of that query parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first parameter to these interfaces (hereafter referred to
</span></span></span><span class="line"><span class="cl"><span class="cm">** as F) must be one of:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; A database filename pointer created by the SQLite core and
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed into the xOpen() method of a VFS implementation, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; A filename obtained from [sqlite3_db_filename()], or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; A new filename constructed using [sqlite3_create_filename()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the F parameter is not one of the above, then the behavior is
</span></span></span><span class="line"><span class="cl"><span class="cm">** undefined and probably undesirable. Older versions of SQLite were
</span></span></span><span class="line"><span class="cl"><span class="cm">** more tolerant of invalid F parameters than newer versions.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If F is a suitable filename (as described in the previous paragraph)
</span></span></span><span class="line"><span class="cl"><span class="cm">** and if P is the name of the query parameter, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_uri_parameter(F,P) returns the value of the P
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter if it exists or a NULL pointer if P does not appear as a
</span></span></span><span class="line"><span class="cl"><span class="cm">** query parameter on F. If P is a query parameter of F and it
</span></span></span><span class="line"><span class="cl"><span class="cm">** has no explicit value, then sqlite3_uri_parameter(F,P) returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to an empty string.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter and returns true (1) or false (0) according to the value
</span></span></span><span class="line"><span class="cl"><span class="cm">** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** value of query parameter P is one of &#34;yes&#34;, &#34;true&#34;, or &#34;on&#34; in any
</span></span></span><span class="line"><span class="cl"><span class="cm">** case or if the value begins with a non-zero number. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of
</span></span></span><span class="line"><span class="cl"><span class="cm">** query parameter P is one of &#34;no&#34;, &#34;false&#34;, or &#34;off&#34; in any case or
</span></span></span><span class="line"><span class="cl"><span class="cm">** if the value begins with a numeric zero. If P is not a query
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter on F or if the value of P does not match any of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
</span></span></span><span class="line"><span class="cl"><span class="cm">** 64-bit signed integer and returns that integer, or D if P does not
</span></span></span><span class="line"><span class="cl"><span class="cm">** exist. If the value of P is something other than an integer, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_uri_key(F,N) returns a pointer to the name (not
</span></span></span><span class="line"><span class="cl"><span class="cm">** the value) of the N-th query parameter for filename F, or a NULL
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer if N is less than zero or greater than the number of query
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameters minus 1. The N value is zero-based so N should be 0 to obtain
</span></span></span><span class="line"><span class="cl"><span class="cm">** the name of the first query parameter, 1 for the second parameter, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** so forth.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not a database file pathname pointer that the SQLite core passed
</span></span></span><span class="line"><span class="cl"><span class="cm">** into the xOpen VFS method, then the behavior of this routine is undefined
</span></span></span><span class="line"><span class="cl"><span class="cm">** and probably undesirable.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Beginning with SQLite [version 3.31.0] ([dateof:3.31.0]) the input F
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter can also be the name of a rollback journal file or WAL file
</span></span></span><span class="line"><span class="cl"><span class="cm">** in addition to the main database file. Prior to version 3.31.0, these
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines would only work if F was the name of the main database file.
</span></span></span><span class="line"><span class="cl"><span class="cm">** When the F parameter is the name of the rollback journal or WAL file,
</span></span></span><span class="line"><span class="cl"><span class="cm">** it has access to all the same query parameters as were found on the
</span></span></span><span class="line"><span class="cl"><span class="cm">** main database file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See the [URI filename] documentation for additional information.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_uri_parameter</span><span class="p">(</span><span class="n">sqlite3_filename</span> <span class="n">z</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zParam</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_uri_boolean</span><span class="p">(</span><span class="n">sqlite3_filename</span> <span class="n">z</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zParam</span><span class="p">,</span> <span class="kt">int</span> <span class="n">bDefault</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3_uri_int64</span><span class="p">(</span><span class="n">sqlite3_filename</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_int64</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_uri_key</span><span class="p">(</span><span class="n">sqlite3_filename</span> <span class="n">z</span><span class="p">,</span> <span class="kt">int</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Translate filenames
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines are available to [VFS|custom VFS implementations] for
</span></span></span><span class="line"><span class="cl"><span class="cm">** translating filenames between the main database file, the journal file,
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the WAL file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If F is the name of an sqlite database file, journal file, or WAL file
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed by the SQLite core into the VFS, then sqlite3_filename_database(F)
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns the name of the corresponding database file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If F is the name of an sqlite database file, journal file, or WAL file
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed by the SQLite core into the VFS, or if F is a database filename
</span></span></span><span class="line"><span class="cl"><span class="cm">** obtained from [sqlite3_db_filename()], then sqlite3_filename_journal(F)
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns the name of the corresponding rollback journal file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If F is the name of an sqlite database file, journal file, or WAL file
</span></span></span><span class="line"><span class="cl"><span class="cm">** that was passed by the SQLite core into the VFS, or if F is a database
</span></span></span><span class="line"><span class="cl"><span class="cm">** filename obtained from [sqlite3_db_filename()], then
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_filename_wal(F) returns the name of the corresponding
</span></span></span><span class="line"><span class="cl"><span class="cm">** WAL file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In all of the above, if F is not the name of a database, journal or WAL
</span></span></span><span class="line"><span class="cl"><span class="cm">** filename passed into the VFS from the SQLite core and F is not the
</span></span></span><span class="line"><span class="cl"><span class="cm">** return value from [sqlite3_db_filename()], then the result is
</span></span></span><span class="line"><span class="cl"><span class="cm">** undefined and is likely a memory access violation.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_filename_database</span><span class="p">(</span><span class="n">sqlite3_filename</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_filename_journal</span><span class="p">(</span><span class="n">sqlite3_filename</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_filename_wal</span><span class="p">(</span><span class="n">sqlite3_filename</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Database File Corresponding To A Journal
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If X is the name of a rollback or WAL-mode journal file that is
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed into the xOpen method of [sqlite3_vfs], then
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_database_file_object(X) returns a pointer to the [sqlite3_file]
</span></span></span><span class="line"><span class="cl"><span class="cm">** object that represents the main database file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This routine is intended for use in custom [VFS] implementations
</span></span></span><span class="line"><span class="cl"><span class="cm">** only. It is not a general-purpose interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The argument sqlite3_file_object(X) must be a filename pointer that
</span></span></span><span class="line"><span class="cl"><span class="cm">** has been passed into [sqlite3_vfs].xOpen method where the
</span></span></span><span class="line"><span class="cl"><span class="cm">** flags parameter to xOpen contains one of the bits
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_OPEN_MAIN_JOURNAL] or [SQLITE_OPEN_WAL]. Any other use
</span></span></span><span class="line"><span class="cl"><span class="cm">** of this routine results in undefined and probably undesirable
</span></span></span><span class="line"><span class="cl"><span class="cm">** behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_file</span> <span class="o">*</span><span class="nf">sqlite3_database_file_object</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Create and Destroy VFS Filenames
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These interfaces are provided for use by [VFS shim] implementations and
</span></span></span><span class="line"><span class="cl"><span class="cm">** are not useful outside of that context.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
</span></span></span><span class="line"><span class="cl"><span class="cm">** database filename D with corresponding journal file J and WAL file W and
</span></span></span><span class="line"><span class="cl"><span class="cm">** with N URI parameters key/values pairs in the array P. The result from
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that
</span></span></span><span class="line"><span class="cl"><span class="cm">** is safe to pass to routines like:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_uri_parameter()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_uri_boolean()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_uri_int64()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_uri_key()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_filename_database()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_filename_journal()], or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_filename_wal()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a memory allocation error occurs, sqlite3_create_filename() might
</span></span></span><span class="line"><span class="cl"><span class="cm">** return a NULL pointer. The memory obtained from sqlite3_create_filename(X)
</span></span></span><span class="line"><span class="cl"><span class="cm">** must be released by a corresponding call to sqlite3_free_filename(Y).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The P parameter in sqlite3_create_filename(D,J,W,N,P) should be an array
</span></span></span><span class="line"><span class="cl"><span class="cm">** of 2*N pointers to strings. Each pair of pointers in this array corresponds
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a key and value for a query parameter. The P parameter may be a NULL
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer if N is zero. None of the 2*N pointers in the P array may be
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL pointers and key pointers should not be empty strings.
</span></span></span><span class="line"><span class="cl"><span class="cm">** None of the D, J, or W parameters to sqlite3_create_filename(D,J,W,N,P) may
</span></span></span><span class="line"><span class="cl"><span class="cm">** be NULL pointers, though they can be empty strings.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_free_filename(Y) routine releases a memory allocation
</span></span></span><span class="line"><span class="cl"><span class="cm">** previously obtained from sqlite3_create_filename(). Invoking
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the Y parameter to sqlite3_free_filename(Y) is anything other
</span></span></span><span class="line"><span class="cl"><span class="cm">** than a NULL pointer or a pointer previously acquired from
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_create_filename(), then bad things such as heap
</span></span></span><span class="line"><span class="cl"><span class="cm">** corruption or segfaults may occur. The value Y should not be
</span></span></span><span class="line"><span class="cl"><span class="cm">** used again after sqlite3_free_filename(Y) has been called. This means
</span></span></span><span class="line"><span class="cl"><span class="cm">** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the corresponding [sqlite3_module.xClose() method should also be
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked prior to calling sqlite3_free_filename(Y).
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_filename</span> <span class="nf">sqlite3_create_filename</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDatabase</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zJournal</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zWal</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nParam</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">azParam</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_free_filename</span><span class="p">(</span><span class="n">sqlite3_filename</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Error Codes And Messages
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the most recent sqlite3_* API call associated with
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] D failed, then the sqlite3_errcode(D) interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns the numeric [result code] or [extended result code] for that
</span></span></span><span class="line"><span class="cl"><span class="cm">** API call.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_extended_errcode()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface is the same except that it always returns the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [extended result code] even when extended result codes are
</span></span></span><span class="line"><span class="cl"><span class="cm">** disabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The values returned by sqlite3_errcode() and/or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_extended_errcode() might change with each API call.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Except, there are some interfaces that are guaranteed to never
</span></span></span><span class="line"><span class="cl"><span class="cm">** change the value of the error code. The error-code preserving
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces include the following:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_errcode()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_extended_errcode()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_errmsg()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_errmsg16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_error_offset()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
</span></span></span><span class="line"><span class="cl"><span class="cm">** text that describes the error, as either UTF-8 or UTF-16 respectively,
</span></span></span><span class="line"><span class="cl"><span class="cm">** or NULL if no error message is available.
</span></span></span><span class="line"><span class="cl"><span class="cm">** (See how SQLite handles [invalid UTF] for exceptions to this rule.)
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Memory to hold the error message string is managed internally.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The application does not need to worry about freeing the result.
</span></span></span><span class="line"><span class="cl"><span class="cm">** However, the error string might be overwritten or deallocated by
</span></span></span><span class="line"><span class="cl"><span class="cm">** subsequent calls to other SQLite interface functions.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_errstr(E) interface returns the English-language text
</span></span></span><span class="line"><span class="cl"><span class="cm">** that describes the [result code] E, as UTF-8, or NULL if E is not an
</span></span></span><span class="line"><span class="cl"><span class="cm">** result code for which a text error message is available.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Memory to hold the error message string is managed internally
</span></span></span><span class="line"><span class="cl"><span class="cm">** and must not be freed by the application)^.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the most recent error references a specific token in the input
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL, the sqlite3_error_offset() interface returns the byte offset
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the start of that token. ^The byte offset returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_error_offset() assumes that the input SQL is UTF8.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the most recent error does not reference a specific token in the input
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL, then the sqlite3_error_offset() function returns -1.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When the serialized [threading mode] is in use, it might be the
</span></span></span><span class="line"><span class="cl"><span class="cm">** case that a second error occurs on a separate thread in between
</span></span></span><span class="line"><span class="cl"><span class="cm">** the time of the first error and the call to these interfaces.
</span></span></span><span class="line"><span class="cl"><span class="cm">** When that happens, the second error will be reported since these
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces always report the most recent result. To avoid
</span></span></span><span class="line"><span class="cl"><span class="cm">** this, each thread can obtain exclusive use of the [database connection] D
</span></span></span><span class="line"><span class="cl"><span class="cm">** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning
</span></span></span><span class="line"><span class="cl"><span class="cm">** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after
</span></span></span><span class="line"><span class="cl"><span class="cm">** all calls to the interfaces listed here are completed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If an interface fails with SQLITE_MISUSE, that means the interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** was invoked incorrectly by the application. In that case, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** error code and message may or may not be set.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_errcode</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_extended_errcode</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_errmsg</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_errmsg16</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_errstr</span><span class="p">(</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_error_offset</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Prepared Statement Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {prepared statement} {prepared statements}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An instance of this object represents a single SQL statement that
</span></span></span><span class="line"><span class="cl"><span class="cm">** has been compiled into binary form and is ready to be evaluated.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Think of each SQL statement as a separate computer program. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** original SQL text is source code. A prepared statement object
</span></span></span><span class="line"><span class="cl"><span class="cm">** is the compiled object code. All SQL must be converted into a
</span></span></span><span class="line"><span class="cl"><span class="cm">** prepared statement before it can be run.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The life-cycle of a prepared statement object usually goes like this:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Create the prepared statement object using [sqlite3_prepare_v2()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Bind values to [parameters] using the sqlite3_bind_*()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Run the SQL by calling [sqlite3_step()] one or more times.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Reset the prepared statement using [sqlite3_reset()] then go back
</span></span></span><span class="line"><span class="cl"><span class="cm">** to step 2. Do this zero or more times.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Destroy the object using [sqlite3_finalize()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_stmt</span> <span class="n">sqlite3_stmt</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Run-time Limits
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(This interface allows the size of various constructs to be limited
</span></span></span><span class="line"><span class="cl"><span class="cm">** on a connection by connection basis. The first parameter is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] whose limit is to be set or queried. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** second parameter is one of the [limit categories] that define a
</span></span></span><span class="line"><span class="cl"><span class="cm">** class of constructs to be size limited. The third parameter is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** new limit for that construct.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the new limit is a negative number, the limit is unchanged.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(For each limit category SQLITE_LIMIT_&lt;i&gt;NAME&lt;/i&gt; there is a
</span></span></span><span class="line"><span class="cl"><span class="cm">** [limits | hard upper bound]
</span></span></span><span class="line"><span class="cl"><span class="cm">** set at compile-time by a C preprocessor macro called
</span></span></span><span class="line"><span class="cl"><span class="cm">** [limits | SQLITE_MAX_&lt;i&gt;NAME&lt;/i&gt;].
</span></span></span><span class="line"><span class="cl"><span class="cm">** (The &#34;_LIMIT_&#34; in the name is changed to &#34;_MAX_&#34;.))^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Attempts to increase a limit above its hard upper bound are
</span></span></span><span class="line"><span class="cl"><span class="cm">** silently truncated to the hard upper bound.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Regardless of whether or not the limit was changed, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_limit()] interface returns the prior value of the limit.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Hence, to find the current value of a limit without changing it,
</span></span></span><span class="line"><span class="cl"><span class="cm">** simply invoke this interface with the third parameter set to -1.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Run-time limits are intended for use in applications that manage
</span></span></span><span class="line"><span class="cl"><span class="cm">** both their own internal database and also databases that are controlled
</span></span></span><span class="line"><span class="cl"><span class="cm">** by untrusted external sources. An example application might be a
</span></span></span><span class="line"><span class="cl"><span class="cm">** web browser that has its own databases for storing history and
</span></span></span><span class="line"><span class="cl"><span class="cm">** separate databases controlled by JavaScript applications downloaded
</span></span></span><span class="line"><span class="cl"><span class="cm">** off the Internet. The internal databases can be given the
</span></span></span><span class="line"><span class="cl"><span class="cm">** large, default limits. Databases managed by external sources can
</span></span></span><span class="line"><span class="cl"><span class="cm">** be given much smaller limits designed to prevent a denial of service
</span></span></span><span class="line"><span class="cl"><span class="cm">** attack. Developers might also want to use the [sqlite3_set_authorizer()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface to further control untrusted SQL. The size of the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** created by an untrusted script can be contained using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [max_page_count] [PRAGMA].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** New run-time limit categories may be added in future releases.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_limit</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">id</span><span class="p">,</span> <span class="kt">int</span> <span class="n">newVal</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Run-Time Limit Categories
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {limit category} {*limit categories}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants define various performance limits
</span></span></span><span class="line"><span class="cl"><span class="cm">** that can be lowered at run-time using [sqlite3_limit()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The synopsis of the meanings of the various limits is shown below.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Additional information is available at [limits | Limits in SQLite].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_LENGTH]] ^(&lt;dt&gt;SQLITE_LIMIT_LENGTH&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum size of any string or BLOB or table row, in bytes.&lt;dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_SQL_LENGTH]] ^(&lt;dt&gt;SQLITE_LIMIT_SQL_LENGTH&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum length of an SQL statement, in bytes.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_COLUMN]] ^(&lt;dt&gt;SQLITE_LIMIT_COLUMN&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum number of columns in a table definition or in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** result set of a [SELECT] or the maximum number of columns in an index
</span></span></span><span class="line"><span class="cl"><span class="cm">** or in an ORDER BY or GROUP BY clause.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(&lt;dt&gt;SQLITE_LIMIT_EXPR_DEPTH&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum depth of the parse tree on any expression.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(&lt;dt&gt;SQLITE_LIMIT_COMPOUND_SELECT&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum number of terms in a compound SELECT statement.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_VDBE_OP]] ^(&lt;dt&gt;SQLITE_LIMIT_VDBE_OP&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum number of instructions in a virtual machine program
</span></span></span><span class="line"><span class="cl"><span class="cm">** used to implement an SQL statement. If [sqlite3_prepare_v2()] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** the equivalent tries to allocate space for more than this many opcodes
</span></span></span><span class="line"><span class="cl"><span class="cm">** in a single prepared statement, an SQLITE_NOMEM error is returned.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(&lt;dt&gt;SQLITE_LIMIT_FUNCTION_ARG&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum number of arguments on a function.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_ATTACHED]] ^(&lt;dt&gt;SQLITE_LIMIT_ATTACHED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum number of [ATTACH | attached databases].)^&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;SQLITE_LIMIT_LIKE_PATTERN_LENGTH&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum length of the pattern argument to the [LIKE] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [GLOB] operators.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_VARIABLE_NUMBER]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;SQLITE_LIMIT_VARIABLE_NUMBER&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum index number of any [parameter] in an SQL statement.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(&lt;dt&gt;SQLITE_LIMIT_TRIGGER_DEPTH&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum depth of recursion for triggers.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_LIMIT_WORKER_THREADS]] ^(&lt;dt&gt;SQLITE_LIMIT_WORKER_THREADS&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The maximum number of auxiliary worker threads that a single
</span></span></span><span class="line"><span class="cl"><span class="cm">** [prepared statement] may start.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_LENGTH 0
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_SQL_LENGTH 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_COLUMN 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_EXPR_DEPTH 3
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_COMPOUND_SELECT 4
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_VDBE_OP 5
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_FUNCTION_ARG 6
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_ATTACHED 7
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_VARIABLE_NUMBER 9
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_TRIGGER_DEPTH 10
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_LIMIT_WORKER_THREADS 11
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Prepare Flags
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants define various flags that can be passed into
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;prepFlags&#34; parameter of the [sqlite3_prepare_v3()] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare16_v3()] interfaces.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** New flags may be added in future releases of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_PREPARE_PERSISTENT]] ^(&lt;dt&gt;SQLITE_PREPARE_PERSISTENT&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_PREPARE_PERSISTENT flag is a hint to the query planner
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the prepared statement will be retained for a long time and
</span></span></span><span class="line"><span class="cl"><span class="cm">** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and [sqlite3_prepare16_v3()] assume that the prepared statement will
</span></span></span><span class="line"><span class="cl"><span class="cm">** be used just once or at most a few times and then destroyed using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_finalize()] relatively soon. The current implementation acts
</span></span></span><span class="line"><span class="cl"><span class="cm">** on this hint by avoiding the use of [lookaside memory] so as not to
</span></span></span><span class="line"><span class="cl"><span class="cm">** deplete the limited store of lookaside memory. Future versions of
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite may act on this hint differently.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_PREPARE_NORMALIZE]] &lt;dt&gt;SQLITE_PREPARE_NORMALIZE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_PREPARE_NORMALIZE flag is a no-op. This flag used
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be required for any prepared statement that wanted to use the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_normalized_sql()] interface. However, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_normalized_sql()] interface is now available to all
</span></span></span><span class="line"><span class="cl"><span class="cm">** prepared statements, regardless of whether or not they use this
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_PREPARE_NO_VTAB]] &lt;dt&gt;SQLITE_PREPARE_NO_VTAB&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
</span></span></span><span class="line"><span class="cl"><span class="cm">** to return an error (error code SQLITE_ERROR) if the statement uses
</span></span></span><span class="line"><span class="cl"><span class="cm">** any virtual tables.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_PREPARE_PERSISTENT 0x01
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_PREPARE_NORMALIZE 0x02
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_PREPARE_NO_VTAB 0x04
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Compiling An SQL Statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {SQL statement compiler}
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">** CONSTRUCTOR: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** To execute an SQL statement, it must first be compiled into a byte-code
</span></span></span><span class="line"><span class="cl"><span class="cm">** program using one of these routines. Or, in other words, these routines
</span></span></span><span class="line"><span class="cl"><span class="cm">** are constructors for the [prepared statement] object.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The preferred routine to use is [sqlite3_prepare_v2()]. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare()] interface is legacy and should be avoided.
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare_v3()] has an extra &#34;prepFlags&#34; option that is used
</span></span></span><span class="line"><span class="cl"><span class="cm">** for special purposes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The use of the UTF-8 interfaces is preferred, as SQLite currently
</span></span></span><span class="line"><span class="cl"><span class="cm">** does all parsing using UTF-8. The UTF-16 interfaces are provided
</span></span></span><span class="line"><span class="cl"><span class="cm">** as a convenience. The UTF-16 interfaces work by converting the
</span></span></span><span class="line"><span class="cl"><span class="cm">** input text into UTF-8, then invoking the corresponding UTF-8 interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument, &#34;db&#34;, is a [database connection] obtained from a
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_open16()]. The database connection must not have been closed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second argument, &#34;zSql&#34;, is the statement to be compiled, encoded
</span></span></span><span class="line"><span class="cl"><span class="cm">** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** and sqlite3_prepare_v3()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** and sqlite3_prepare16_v3() use UTF-16.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the nByte argument is negative, then zSql is read up to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** first zero terminator. ^If nByte is positive, then it is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** number of bytes read from zSql. ^If nByte is zero, then no prepared
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement is generated.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the caller knows that the supplied string is nul-terminated, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** there is a small performance advantage to passing an nByte parameter that
</span></span></span><span class="line"><span class="cl"><span class="cm">** is the number of bytes in the input string &lt;i&gt;including&lt;/i&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** the nul-terminator.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If pzTail is not NULL then *pzTail is made to point to the first byte
</span></span></span><span class="line"><span class="cl"><span class="cm">** past the end of the first SQL statement in zSql. These routines only
</span></span></span><span class="line"><span class="cl"><span class="cm">** compile the first statement in zSql, so *pzTail is left pointing to
</span></span></span><span class="line"><span class="cl"><span class="cm">** what remains uncompiled.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^*ppStmt is left pointing to a compiled [prepared statement] that can be
</span></span></span><span class="line"><span class="cl"><span class="cm">** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set
</span></span></span><span class="line"><span class="cl"><span class="cm">** to NULL. ^If the input text contains no SQL (if the input is an empty
</span></span></span><span class="line"><span class="cl"><span class="cm">** string or a comment) then *ppStmt is set to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The calling procedure is responsible for deleting the compiled
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL statement using [sqlite3_finalize()] after it has finished with it.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ppStmt may not be NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
</span></span></span><span class="line"><span class="cl"><span class="cm">** otherwise an [error code] is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** and sqlite3_prepare16_v3() interfaces are recommended for all new programs.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The older interfaces (sqlite3_prepare() and sqlite3_prepare16())
</span></span></span><span class="line"><span class="cl"><span class="cm">** are retained for backwards compatibility, but their use is discouraged.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^In the &#34;vX&#34; interfaces, the prepared statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** that is returned (the [sqlite3_stmt] object) contains a copy of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** original SQL text. This causes the [sqlite3_step()] interface to
</span></span></span><span class="line"><span class="cl"><span class="cm">** behave differently in three ways:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
</span></span></span><span class="line"><span class="cl"><span class="cm">** always used to do, [sqlite3_step()] will automatically recompile the SQL
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY]
</span></span></span><span class="line"><span class="cl"><span class="cm">** retries will occur before sqlite3_step() gives up and returns an error.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When an error occurs, [sqlite3_step()] will return one of the detailed
</span></span></span><span class="line"><span class="cl"><span class="cm">** [error codes] or [extended error codes]. ^The legacy behavior was that
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the application would have to make a second call to [sqlite3_reset()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** in order to find the underlying cause of the problem. With the &#34;v2&#34; prepare
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces, the underlying reason for the error is returned immediately.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the specific value bound to a [parameter | host parameter] in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** WHERE clause might influence the choice of query plan for a statement,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the statement will be automatically recompiled, as if there had been
</span></span></span><span class="line"><span class="cl"><span class="cm">** a schema change, on the first [sqlite3_step()] call following any change
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the [sqlite3_bind_text | bindings] of that [parameter].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The specific value of a WHERE-clause [parameter] might influence the
</span></span></span><span class="line"><span class="cl"><span class="cm">** choice of query plan if the parameter is the left-hand side of a [LIKE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [GLOB] operator or if the parameter is compared to an indexed column
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
</span></span></span><span class="line"><span class="cl"><span class="cm">** the extra prepFlags parameter, which is a bit array consisting of zero or
</span></span></span><span class="line"><span class="cl"><span class="cm">** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_prepare_v2() interface works exactly the same as
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_prepare_v3() with a zero prepFlags parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_prepare</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSql</span><span class="p">,</span> <span class="cm">/* SQL statement, UTF-8 encoded */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nByte</span><span class="p">,</span> <span class="cm">/* Maximum length of zSql in bytes. */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_stmt</span> <span class="o">**</span><span class="n">ppStmt</span><span class="p">,</span> <span class="cm">/* OUT: Statement handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">pzTail</span> <span class="cm">/* OUT: Pointer to unused portion of zSql */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_prepare_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSql</span><span class="p">,</span> <span class="cm">/* SQL statement, UTF-8 encoded */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nByte</span><span class="p">,</span> <span class="cm">/* Maximum length of zSql in bytes. */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_stmt</span> <span class="o">**</span><span class="n">ppStmt</span><span class="p">,</span> <span class="cm">/* OUT: Statement handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">pzTail</span> <span class="cm">/* OUT: Pointer to unused portion of zSql */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_prepare_v3</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSql</span><span class="p">,</span> <span class="cm">/* SQL statement, UTF-8 encoded */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nByte</span><span class="p">,</span> <span class="cm">/* Maximum length of zSql in bytes. */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">prepFlags</span><span class="p">,</span> <span class="cm">/* Zero or more SQLITE_PREPARE_ flags */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_stmt</span> <span class="o">**</span><span class="n">ppStmt</span><span class="p">,</span> <span class="cm">/* OUT: Statement handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">pzTail</span> <span class="cm">/* OUT: Pointer to unused portion of zSql */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_prepare16</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">zSql</span><span class="p">,</span> <span class="cm">/* SQL statement, UTF-16 encoded */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nByte</span><span class="p">,</span> <span class="cm">/* Maximum length of zSql in bytes. */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_stmt</span> <span class="o">**</span><span class="n">ppStmt</span><span class="p">,</span> <span class="cm">/* OUT: Statement handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">void</span> <span class="o">**</span><span class="n">pzTail</span> <span class="cm">/* OUT: Pointer to unused portion of zSql */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_prepare16_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">zSql</span><span class="p">,</span> <span class="cm">/* SQL statement, UTF-16 encoded */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nByte</span><span class="p">,</span> <span class="cm">/* Maximum length of zSql in bytes. */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_stmt</span> <span class="o">**</span><span class="n">ppStmt</span><span class="p">,</span> <span class="cm">/* OUT: Statement handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">void</span> <span class="o">**</span><span class="n">pzTail</span> <span class="cm">/* OUT: Pointer to unused portion of zSql */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_prepare16_v3</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">zSql</span><span class="p">,</span> <span class="cm">/* SQL statement, UTF-16 encoded */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nByte</span><span class="p">,</span> <span class="cm">/* Maximum length of zSql in bytes. */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">prepFlags</span><span class="p">,</span> <span class="cm">/* Zero or more SQLITE_PREPARE_ flags */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_stmt</span> <span class="o">**</span><span class="n">ppStmt</span><span class="p">,</span> <span class="cm">/* OUT: Statement handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">void</span> <span class="o">**</span><span class="n">pzTail</span> <span class="cm">/* OUT: Pointer to unused portion of zSql */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Retrieving Statement SQL
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL text used to create [prepared statement] P if P was
</span></span></span><span class="line"><span class="cl"><span class="cm">** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8
</span></span></span><span class="line"><span class="cl"><span class="cm">** string containing the SQL text of prepared statement P with
</span></span></span><span class="line"><span class="cl"><span class="cm">** [bound parameters] expanded.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_normalized_sql(P) interface returns a pointer to a UTF-8
</span></span></span><span class="line"><span class="cl"><span class="cm">** string containing the normalized SQL text of prepared statement P. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** semantics used to normalize a SQL statement are unspecified and subject
</span></span></span><span class="line"><span class="cl"><span class="cm">** to change. At a minimum, literal values will be replaced with suitable
</span></span></span><span class="line"><span class="cl"><span class="cm">** placeholders.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(For example, if a prepared statement is created using the SQL
</span></span></span><span class="line"><span class="cl"><span class="cm">** text &#34;SELECT $abc,:xyz&#34; and if parameter $abc is bound to integer 2345
</span></span></span><span class="line"><span class="cl"><span class="cm">** and parameter :xyz is unbound, then sqlite3_sql() will return
</span></span></span><span class="line"><span class="cl"><span class="cm">** the original string, &#34;SELECT $abc,:xyz&#34; but sqlite3_expanded_sql()
</span></span></span><span class="line"><span class="cl"><span class="cm">** will return &#34;SELECT 2345,NULL&#34;.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** is available to hold the result, or if the result would exceed the
</span></span></span><span class="line"><span class="cl"><span class="cm">** the maximum string length determined by the [SQLITE_LIMIT_LENGTH].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of
</span></span></span><span class="line"><span class="cl"><span class="cm">** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time
</span></span></span><span class="line"><span class="cl"><span class="cm">** option causes sqlite3_expanded_sql() to always return NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The strings returned by sqlite3_sql(P) and sqlite3_normalized_sql(P)
</span></span></span><span class="line"><span class="cl"><span class="cm">** are managed by SQLite and are automatically freed when the prepared
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement is finalized.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
</span></span></span><span class="line"><span class="cl"><span class="cm">** is obtained from [sqlite3_malloc()] and must be freed by the application
</span></span></span><span class="line"><span class="cl"><span class="cm">** by passing it to [sqlite3_free()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_normalized_sql() interface is only available if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [SQLITE_ENABLE_NORMALIZE] compile-time option is defined.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_sql</span><span class="p">(</span><span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_expanded_sql</span><span class="p">(</span><span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef SQLITE_ENABLE_NORMALIZE
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_normalized_sql</span><span class="p">(</span><span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Determine If An SQL Statement Writes The Database
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if
</span></span></span><span class="line"><span class="cl"><span class="cm">** and only if the [prepared statement] X makes no direct changes to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the content of the database file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that [application-defined SQL functions] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [virtual tables] might change the database indirectly as a side effect.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(For example, if an application defines a function &#34;eval()&#34; that
</span></span></span><span class="line"><span class="cl"><span class="cm">** calls [sqlite3_exec()], then the following SQL statement would
</span></span></span><span class="line"><span class="cl"><span class="cm">** change the database file through side-effects:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;&lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** SELECT eval(&#39;DELETE FROM t1&#39;) FROM t2;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;&lt;/blockquote&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** But because the [SELECT] statement does not change the database file
</span></span></span><span class="line"><span class="cl"><span class="cm">** directly, sqlite3_stmt_readonly() would still return true.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true,
</span></span></span><span class="line"><span class="cl"><span class="cm">** since the statements themselves do not actually modify the database but
</span></span></span><span class="line"><span class="cl"><span class="cm">** rather they control the timing of when other statements modify the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database. ^The [ATTACH] and [DETACH] statements also cause
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_stmt_readonly() to return true since, while those statements
</span></span></span><span class="line"><span class="cl"><span class="cm">** change the configuration of a database connection, they do not make
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes to the content of the database files on disk.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since
</span></span></span><span class="line"><span class="cl"><span class="cm">** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_stmt_readonly() returns false for those commands.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This routine returns false if there is any possibility that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement might change the database file. ^A false return does
</span></span></span><span class="line"><span class="cl"><span class="cm">** not guarantee that the statement will change the database file.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^For example, an UPDATE statement might have a WHERE clause that
</span></span></span><span class="line"><span class="cl"><span class="cm">** makes it a no-op, but the sqlite3_stmt_readonly() result would still
</span></span></span><span class="line"><span class="cl"><span class="cm">** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a
</span></span></span><span class="line"><span class="cl"><span class="cm">** read-only no-op if the table already exists, but
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_stmt_readonly() still returns false for such a statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN]
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement, then sqlite3_stmt_readonly(X) returns the same value as
</span></span></span><span class="line"><span class="cl"><span class="cm">** if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_stmt_readonly</span><span class="p">(</span><span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_stmt_isexplain(S) interface returns 1 if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** prepared statement S is an EXPLAIN statement, or 2 if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement S is an EXPLAIN QUERY PLAN.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is
</span></span></span><span class="line"><span class="cl"><span class="cm">** an ordinary statement or a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_stmt_isexplain</span><span class="p">(</span><span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Change The EXPLAIN Setting For A Prepared Statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_stmt_explain(S,E) interface changes the EXPLAIN
</span></span></span><span class="line"><span class="cl"><span class="cm">** setting for [prepared statement] S. If E is zero, then S becomes
</span></span></span><span class="line"><span class="cl"><span class="cm">** a normal prepared statement. If E is 1, then S behaves as if
</span></span></span><span class="line"><span class="cl"><span class="cm">** its SQL text began with &#34;[EXPLAIN]&#34;. If E is 2, then S behaves as if
</span></span></span><span class="line"><span class="cl"><span class="cm">** its SQL text began with &#34;[EXPLAIN QUERY PLAN]&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Calling sqlite3_stmt_explain(S,E) might cause S to be reprepared.
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite tries to avoid a reprepare, but a reprepare might be necessary
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the first transition into EXPLAIN or EXPLAIN QUERY PLAN mode.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Because of the potential need to reprepare, a call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_stmt_explain(S,E) will fail with SQLITE_ERROR if S cannot be
</span></span></span><span class="line"><span class="cl"><span class="cm">** reprepared because it was created using [sqlite3_prepare()] instead of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the newer [sqlite3_prepare_v2()] or [sqlite3_prepare_v3()] interfaces and
</span></span></span><span class="line"><span class="cl"><span class="cm">** hence has no saved SQL text with which to reprepare.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Changing the explain setting for a prepared statement does not change
</span></span></span><span class="line"><span class="cl"><span class="cm">** the original SQL text for the statement. Hence, if the SQL text originally
</span></span></span><span class="line"><span class="cl"><span class="cm">** began with EXPLAIN or EXPLAIN QUERY PLAN, but sqlite3_stmt_explain(S,0)
</span></span></span><span class="line"><span class="cl"><span class="cm">** is called to convert the statement into an ordinary statement, the EXPLAIN
</span></span></span><span class="line"><span class="cl"><span class="cm">** or EXPLAIN QUERY PLAN keywords will still appear in the sqlite3_sql(S)
</span></span></span><span class="line"><span class="cl"><span class="cm">** output, even though the statement now acts like a normal SQL statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This routine returns SQLITE_OK if the explain mode is successfully
</span></span></span><span class="line"><span class="cl"><span class="cm">** changed, or an error code if the explain mode could not be changed.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The explain mode cannot be changed while a statement is active.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Hence, it is good practice to call [sqlite3_reset(S)]
</span></span></span><span class="line"><span class="cl"><span class="cm">** immediately prior to calling sqlite3_stmt_explain(S,E).
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_stmt_explain</span><span class="p">(</span><span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">,</span> <span class="kt">int</span> <span class="n">eMode</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Determine If A Prepared Statement Has Been Reset
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [prepared statement] S has been stepped at least once using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_step(S)] but has neither run to completion (returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_DONE] from [sqlite3_step(S)]) nor
</span></span></span><span class="line"><span class="cl"><span class="cm">** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S)
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface returns false if S is a NULL pointer. If S is not a
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL pointer and is not a pointer to a valid [prepared statement]
</span></span></span><span class="line"><span class="cl"><span class="cm">** object, then the behavior is undefined and probably undesirable.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface can be used in combination [sqlite3_next_stmt()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to locate all prepared statements associated with a database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection that are in need of being reset. This can be used,
</span></span></span><span class="line"><span class="cl"><span class="cm">** for example, in diagnostic routines to search for prepared
</span></span></span><span class="line"><span class="cl"><span class="cm">** statements that are holding a transaction open.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_stmt_busy</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Dynamically Typed Value Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite uses the sqlite3_value object to represent all values
</span></span></span><span class="line"><span class="cl"><span class="cm">** that can be stored in a database table. SQLite uses dynamic typing
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the values it stores. ^Values stored in sqlite3_value objects
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be integers, floating point values, strings, BLOBs, or NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An sqlite3_value object may be either &#34;protected&#34; or &#34;unprotected&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Some interfaces require a protected sqlite3_value. Other interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** will accept either a protected or an unprotected sqlite3_value.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Every interface that accepts sqlite3_value arguments specifies
</span></span></span><span class="line"><span class="cl"><span class="cm">** whether or not it requires a protected sqlite3_value. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value_dup()] interface can be used to construct a new
</span></span></span><span class="line"><span class="cl"><span class="cm">** protected sqlite3_value from an unprotected sqlite3_value.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The terms &#34;protected&#34; and &#34;unprotected&#34; refer to whether or not
</span></span></span><span class="line"><span class="cl"><span class="cm">** a mutex is held. An internal mutex is held for a protected
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value object but no mutex is held for an unprotected
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value object. If SQLite is compiled to be single-threaded
</span></span></span><span class="line"><span class="cl"><span class="cm">** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
</span></span></span><span class="line"><span class="cl"><span class="cm">** or if SQLite is run in one of reduced mutex modes
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
</span></span></span><span class="line"><span class="cl"><span class="cm">** then there is no distinction between protected and unprotected
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value objects and they can be used interchangeably. However,
</span></span></span><span class="line"><span class="cl"><span class="cm">** for maximum code portability it is recommended that applications
</span></span></span><span class="line"><span class="cl"><span class="cm">** still make the distinction between protected and unprotected
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value objects even when not strictly required.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_value objects that are passed as parameters into the
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation of [application-defined SQL functions] are protected.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_value objects returned by [sqlite3_vtab_rhs_value()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** are protected.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_value object returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_column_value()] is unprotected.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Unprotected sqlite3_value objects may only be used as arguments
</span></span></span><span class="line"><span class="cl"><span class="cm">** to [sqlite3_result_value()], [sqlite3_bind_value()], and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value_dup()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_value_blob | sqlite3_value_type()] family of
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces require protected sqlite3_value objects.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_value</span> <span class="n">sqlite3_value</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: SQL Function Context Object
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The context in which an SQL function executes is stored in an
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_context object. ^A pointer to an sqlite3_context object
</span></span></span><span class="line"><span class="cl"><span class="cm">** is always first parameter to [application-defined SQL functions].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The application-defined SQL function implementation will pass this
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_aggregate_context()], [sqlite3_user_data()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** and/or [sqlite3_set_auxdata()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_context</span> <span class="n">sqlite3_context</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Binding Values To Prepared Statements
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {host parameter} {host parameters} {host parameter name}
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
</span></span></span><span class="line"><span class="cl"><span class="cm">** literals may be replaced by a [parameter] that matches one of following
</span></span></span><span class="line"><span class="cl"><span class="cm">** templates:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ?
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ?NNN
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; :VVV
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; @VVV
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; $VVV
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In the templates above, NNN represents an integer literal,
</span></span></span><span class="line"><span class="cl"><span class="cm">** and VVV represents an alphanumeric identifier.)^ ^The values of these
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameters (also called &#34;host parameter names&#34; or &#34;SQL parameters&#34;)
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be set using the sqlite3_bind_*() routines defined here.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first argument to the sqlite3_bind_*() routines is always
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to the [sqlite3_stmt] object returned from
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare_v2()] or its variants.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The second argument is the index of the SQL parameter to be set.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The leftmost SQL parameter has an index of 1. ^When the same named
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL parameter is used more than once, second and subsequent
</span></span></span><span class="line"><span class="cl"><span class="cm">** occurrences have the same index as the first occurrence.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The index for named parameters can be looked up using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_bind_parameter_index()] API if desired. ^The index
</span></span></span><span class="line"><span class="cl"><span class="cm">** for &#34;?NNN&#34; parameters is the value of NNN.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The NNN value must be between 1 and the [sqlite3_limit()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 32766).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The third argument is the value to bind to the parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** is ignored and the end result is the same as sqlite3_bind_null().
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the third parameter to sqlite3_bind_text() is not NULL, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** it should be a pointer to well-formed UTF8 text.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the third parameter to sqlite3_bind_text16() is not NULL, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** it should be a pointer to well-formed UTF16 text.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the third parameter to sqlite3_bind_text64() is not NULL, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** it should be a pointer to a well-formed unicode string that is
</span></span></span><span class="line"><span class="cl"><span class="cm">** either UTF8 if the sixth parameter is SQLITE_UTF8, or UTF16
</span></span></span><span class="line"><span class="cl"><span class="cm">** otherwise.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[byte-order determination rules]] ^The byte-order of
</span></span></span><span class="line"><span class="cl"><span class="cm">** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
</span></span></span><span class="line"><span class="cl"><span class="cm">** found in first character, which is removed, or in the absence of a BOM
</span></span></span><span class="line"><span class="cl"><span class="cm">** the byte order is the native byte order of the host
</span></span></span><span class="line"><span class="cl"><span class="cm">** machine for sqlite3_bind_text16() or the byte order specified in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the 6th parameter for sqlite3_bind_text64().)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If UTF16 input text contains invalid unicode
</span></span></span><span class="line"><span class="cl"><span class="cm">** characters, then SQLite might change those invalid characters
</span></span></span><span class="line"><span class="cl"><span class="cm">** into the unicode replacement character: U+FFFD.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(In those routines that have a fourth argument, its value is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** number of bytes in the parameter. To be clear: the value is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** number of &lt;u&gt;bytes&lt;/u&gt; in the value, not the number of characters.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is negative, then the length of the string is
</span></span></span><span class="line"><span class="cl"><span class="cm">** the number of bytes up to the first zero terminator.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the fourth parameter to sqlite3_bind_blob() is negative, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the behavior is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a non-negative fourth parameter is provided to sqlite3_bind_text()
</span></span></span><span class="line"><span class="cl"><span class="cm">** or sqlite3_bind_text16() or sqlite3_bind_text64() then
</span></span></span><span class="line"><span class="cl"><span class="cm">** that parameter must be the byte offset
</span></span></span><span class="line"><span class="cl"><span class="cm">** where the NUL terminator would occur assuming the string were NUL
</span></span></span><span class="line"><span class="cl"><span class="cm">** terminated. If any NUL characters occurs at byte offsets less than
</span></span></span><span class="line"><span class="cl"><span class="cm">** the value of the fourth parameter then the resulting string value will
</span></span></span><span class="line"><span class="cl"><span class="cm">** contain embedded NULs. The result of expressions involving strings
</span></span></span><span class="line"><span class="cl"><span class="cm">** with embedded NULs is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The fifth argument to the BLOB and string binding interfaces controls
</span></span></span><span class="line"><span class="cl"><span class="cm">** or indicates the lifetime of the object referenced by the third parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">** These three options exist:
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^ (1) A destructor to dispose of the BLOB or string after SQLite has finished
</span></span></span><span class="line"><span class="cl"><span class="cm">** with it may be passed. ^It is called to dispose of the BLOB or string even
</span></span></span><span class="line"><span class="cl"><span class="cm">** if the call to the bind API fails, except the destructor is not called if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the third parameter is a NULL pointer or the fourth parameter is negative.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^ (2) The special constant, [SQLITE_STATIC], may be passed to indicate that
</span></span></span><span class="line"><span class="cl"><span class="cm">** the application remains responsible for disposing of the object. ^In this
</span></span></span><span class="line"><span class="cl"><span class="cm">** case, the object and the provided pointer to it must remain valid until
</span></span></span><span class="line"><span class="cl"><span class="cm">** either the prepared statement is finalized or the same SQL parameter is
</span></span></span><span class="line"><span class="cl"><span class="cm">** bound to something else, whichever occurs sooner.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^ (3) The constant, [SQLITE_TRANSIENT], may be passed to indicate that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** object is to be copied prior to the return from sqlite3_bind_*(). ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** object and pointer to it must remain valid until then. ^SQLite will then
</span></span></span><span class="line"><span class="cl"><span class="cm">** manage the lifetime of its private copy.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sixth argument to sqlite3_bind_text64() must be one of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to specify the encoding of the text in the third parameter. If
</span></span></span><span class="line"><span class="cl"><span class="cm">** the sixth argument to sqlite3_bind_text64() is not one of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** allowed values shown above, or if the text encoding is different
</span></span></span><span class="line"><span class="cl"><span class="cm">** from the encoding specified by the sixth parameter, then the behavior
</span></span></span><span class="line"><span class="cl"><span class="cm">** is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
</span></span></span><span class="line"><span class="cl"><span class="cm">** is filled with zeroes. ^A zeroblob uses a fixed amount of memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** (just an integer to hold its size) while it is being processed.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Zeroblobs are intended to serve as placeholders for BLOBs whose
</span></span></span><span class="line"><span class="cl"><span class="cm">** content is later written using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_blob_open | incremental BLOB I/O] routines.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A negative value for the zeroblob results in a zero-length BLOB.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in
</span></span></span><span class="line"><span class="cl"><span class="cm">** [prepared statement] S to have an SQL value of NULL, but to also be
</span></span></span><span class="line"><span class="cl"><span class="cm">** associated with the pointer P of type T. ^D is either a NULL pointer or
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to a destructor function for P. ^SQLite will invoke the
</span></span></span><span class="line"><span class="cl"><span class="cm">** destructor D with a single argument of P when it is finished using
</span></span></span><span class="line"><span class="cl"><span class="cm">** P. The T parameter should be a static string, preferably a string
</span></span></span><span class="line"><span class="cl"><span class="cm">** literal. The sqlite3_bind_pointer() routine is part of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [pointer passing interface] added for SQLite 3.20.0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the [prepared statement] or with a prepared statement for which
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_step()] has been called more recently than [sqlite3_reset()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_()
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine is passed a [prepared statement] that has been finalized, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** result is undefined and probably harmful.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Bindings are not cleared by the [sqlite3_reset()] routine.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Unbound parameters are interpreted as NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [error code] if anything goes wrong.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB
</span></span></span><span class="line"><span class="cl"><span class="cm">** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_MAX_LENGTH].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^[SQLITE_RANGE] is returned if the parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_bind_parameter_count()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_blob</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">n</span><span class="p">,</span> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_blob64</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_uint64</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_double</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">double</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_int</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_int64</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="n">sqlite3_int64</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_null</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_text</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_text16</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_text64</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_uint64</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">),</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">encoding</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_value</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="k">const</span> <span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_pointer</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_zeroblob</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">int</span> <span class="n">n</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_zeroblob64</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="n">sqlite3_uint64</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Number Of SQL Parameters
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This routine can be used to find the number of [SQL parameters]
</span></span></span><span class="line"><span class="cl"><span class="cm">** in a [prepared statement]. SQL parameters are tokens of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** form &#34;?&#34;, &#34;?NNN&#34;, &#34;:AAA&#34;, &#34;$AAA&#34;, or &#34;@AAA&#34; that serve as
</span></span></span><span class="line"><span class="cl"><span class="cm">** placeholders for values that are [sqlite3_bind_blob | bound]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the parameters at a later time.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(This routine actually returns the index of the largest (rightmost)
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter. For all forms except ?NNN, this will correspond to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** number of unique parameters. If parameters of the ?NNN form are used,
</span></span></span><span class="line"><span class="cl"><span class="cm">** there may be gaps in the list.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_bind_blob|sqlite3_bind()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_bind_parameter_name()], and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_bind_parameter_index()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_parameter_count</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Name Of A Host Parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_bind_parameter_name(P,N) interface returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** the name of the N-th [SQL parameter] in the [prepared statement] P.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(SQL parameters of the form &#34;?NNN&#34; or &#34;:AAA&#34; or &#34;@AAA&#34; or &#34;$AAA&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** have a name which is the string &#34;?NNN&#34; or &#34;:AAA&#34; or &#34;@AAA&#34; or &#34;$AAA&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** respectively.
</span></span></span><span class="line"><span class="cl"><span class="cm">** In other words, the initial &#34;:&#34; or &#34;$&#34; or &#34;@&#34; or &#34;?&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** is included as part of the name.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Parameters of the form &#34;?&#34; without a following integer have no name
</span></span></span><span class="line"><span class="cl"><span class="cm">** and are referred to as &#34;nameless&#34; or &#34;anonymous parameters&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first host parameter has an index of 1, not 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the value N is out of range or if the N-th parameter is
</span></span></span><span class="line"><span class="cl"><span class="cm">** nameless, then NULL is returned. ^The returned string is
</span></span></span><span class="line"><span class="cl"><span class="cm">** always in UTF-8 encoding even if the named parameter was
</span></span></span><span class="line"><span class="cl"><span class="cm">** originally specified as UTF-16 in [sqlite3_prepare16()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_bind_blob|sqlite3_bind()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_bind_parameter_count()], and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_bind_parameter_index()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_bind_parameter_name</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Index Of A Parameter With A Given Name
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Return the index of an SQL parameter given its name. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** index value returned is suitable for use as the second
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned if no matching parameter is found. ^The parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** name must be given in UTF-8 even if the original statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare16_v3()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_bind_blob|sqlite3_bind()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_bind_parameter_count()], and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_bind_parameter_name()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_bind_parameter_index</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Reset All Bindings On A Prepared Statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3_bind_blob | bindings] on a [prepared statement].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Use this routine to reset all host parameters to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_clear_bindings</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Number Of Columns In A Result Set
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Return the number of columns in the result set returned by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [prepared statement]. ^If this routine returns 0, that means the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [prepared statement] returns no data (for example an [UPDATE]).
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^However, just because this routine returns a positive number does not
</span></span></span><span class="line"><span class="cl"><span class="cm">** mean that one or more rows of data will be returned. ^A SELECT statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** will always have a positive sqlite3_column_count() but depending on the
</span></span></span><span class="line"><span class="cl"><span class="cm">** WHERE clause constraints and the table content, it might return no rows.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_data_count()]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_column_count</span><span class="p">(</span><span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Column Names In A Result Set
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These routines return the name assigned to a particular column
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the result set of a [SELECT] statement. ^The sqlite3_column_name()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface returns a pointer to a zero-terminated UTF-8 string
</span></span></span><span class="line"><span class="cl"><span class="cm">** and sqlite3_column_name16() returns a pointer to a zero-terminated
</span></span></span><span class="line"><span class="cl"><span class="cm">** UTF-16 string. ^The first parameter is the [prepared statement]
</span></span></span><span class="line"><span class="cl"><span class="cm">** that implements the [SELECT] statement. ^The second parameter is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** column number. ^The leftmost column is number 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The returned string pointer is valid until either the [prepared statement]
</span></span></span><span class="line"><span class="cl"><span class="cm">** is destroyed by [sqlite3_finalize()] or until the statement is automatically
</span></span></span><span class="line"><span class="cl"><span class="cm">** reprepared by the first call to [sqlite3_step()] for a particular run
</span></span></span><span class="line"><span class="cl"><span class="cm">** or until the next call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_column_name() or sqlite3_column_name16() on the same column.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If sqlite3_malloc() fails during the processing of either routine
</span></span></span><span class="line"><span class="cl"><span class="cm">** (for example during a conversion from UTF-8 to UTF-16) then a
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL pointer is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The name of a result column is the value of the &#34;AS&#34; clause for
</span></span></span><span class="line"><span class="cl"><span class="cm">** that column, if there is an AS clause. If there is no AS clause
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the name of the column is unspecified and may change from
</span></span></span><span class="line"><span class="cl"><span class="cm">** one release of SQLite to the next.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_column_name</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_column_name16</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Source Of Data In A Query Result
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These routines provide a means to determine the database, table, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** table column that is the origin of a particular result column in
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SELECT] statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The name of the database or table or column can be returned as
</span></span></span><span class="line"><span class="cl"><span class="cm">** either a UTF-8 or UTF-16 string. ^The _database_ routines return
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database name, the _table_ routines return the table name, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the origin_ routines return the column name.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The returned string is valid until the [prepared statement] is destroyed
</span></span></span><span class="line"><span class="cl"><span class="cm">** using [sqlite3_finalize()] or until the statement is automatically
</span></span></span><span class="line"><span class="cl"><span class="cm">** reprepared by the first call to [sqlite3_step()] for a particular run
</span></span></span><span class="line"><span class="cl"><span class="cm">** or until the same information is requested
</span></span></span><span class="line"><span class="cl"><span class="cm">** again in a different encoding.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The names returned are the original un-aliased names of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database, table, and column.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first argument to these interfaces is a [prepared statement].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These functions return information about the Nth result column returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the statement, where N is the second function argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The left-most column is column 0 for these routines.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the Nth column returned by the statement is an expression or
</span></span></span><span class="line"><span class="cl"><span class="cm">** subquery and is not a column value, then all of these functions return
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL. ^These routines might also return NULL if a memory allocation error
</span></span></span><span class="line"><span class="cl"><span class="cm">** occurs. ^Otherwise, they return the name of the attached database, table,
</span></span></span><span class="line"><span class="cl"><span class="cm">** or column that query result column was extracted from.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^As with all other SQLite APIs, those whose names end with &#34;16&#34; return
</span></span></span><span class="line"><span class="cl"><span class="cm">** UTF-16 encoded strings and the other functions return UTF-8.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These APIs are only available if the library was compiled with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If two or more threads call one or more
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_column_database_name | column metadata interfaces]
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the same [prepared statement] and result column
</span></span></span><span class="line"><span class="cl"><span class="cm">** at the same time then the results are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_column_database_name</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_column_database_name16</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_column_table_name</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_column_table_name16</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_column_origin_name</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_column_origin_name16</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Declared Datatype Of A Query Result
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The first parameter is a [prepared statement].
</span></span></span><span class="line"><span class="cl"><span class="cm">** If this statement is a [SELECT] statement and the Nth column of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned result set of that [SELECT] is a table column (not an
</span></span></span><span class="line"><span class="cl"><span class="cm">** expression or subquery) then the declared type of the table
</span></span></span><span class="line"><span class="cl"><span class="cm">** column is returned.)^ ^If the Nth column of the result set is an
</span></span></span><span class="line"><span class="cl"><span class="cm">** expression or subquery, then a NULL pointer is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The returned string is always UTF-8 encoded.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(For example, given the database schema:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** CREATE TABLE t1(c1 VARIANT);
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the following statement to be compiled:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SELECT c1 + 1, c1 FROM t1;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** this routine would return the string &#34;VARIANT&#34; for the second result
</span></span></span><span class="line"><span class="cl"><span class="cm">** column (i==1), and a NULL pointer for the first result column (i==0).)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite uses dynamic run-time typing. ^So just because a column
</span></span></span><span class="line"><span class="cl"><span class="cm">** is declared to contain a particular type does not mean that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** data stored in that column is of the declared type. SQLite is
</span></span></span><span class="line"><span class="cl"><span class="cm">** strongly typed, but the typing is dynamic not static. ^Type
</span></span></span><span class="line"><span class="cl"><span class="cm">** is associated with individual values, not with the containers
</span></span></span><span class="line"><span class="cl"><span class="cm">** used to hold those values.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_column_decltype</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_column_decltype16</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Evaluate An SQL Statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** After a [prepared statement] has been prepared using any of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [sqlite3_prepare16_v3()] or one of the legacy
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
</span></span></span><span class="line"><span class="cl"><span class="cm">** must be called one or more times to evaluate the statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The details of the behavior of the sqlite3_step() interface depend
</span></span></span><span class="line"><span class="cl"><span class="cm">** on whether the statement was prepared using the newer &#34;vX&#34; interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_prepare16_v2()] or the older legacy
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** new &#34;vX&#34; interface is recommended for new applications but the legacy
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface will continue to be supported.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^With the &#34;v2&#34; interface, any of the other [result codes] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [extended result codes] might be returned as well.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^[SQLITE_BUSY] means that the database engine was unable to acquire the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database locks it needs to do its job. ^If the statement is a [COMMIT]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or occurs outside of an explicit transaction, then you can retry the
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement. If the statement is not a [COMMIT] and occurs within an
</span></span></span><span class="line"><span class="cl"><span class="cm">** explicit transaction then you should rollback the transaction before
</span></span></span><span class="line"><span class="cl"><span class="cm">** continuing.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^[SQLITE_DONE] means that the statement has finished executing
</span></span></span><span class="line"><span class="cl"><span class="cm">** successfully. sqlite3_step() should not be called again on this virtual
</span></span></span><span class="line"><span class="cl"><span class="cm">** machine without first calling [sqlite3_reset()] to reset the virtual
</span></span></span><span class="line"><span class="cl"><span class="cm">** machine back to its initial state.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the SQL statement being executed returns any data, then [SQLITE_ROW]
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned each time a new row of data is ready for processing by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** caller. The values may be accessed using the [column access functions].
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_step() is called again to retrieve the next row of data.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^[SQLITE_ERROR] means that a run-time error (such as a constraint
</span></span></span><span class="line"><span class="cl"><span class="cm">** violation) has occurred. sqlite3_step() should not be called again on
</span></span></span><span class="line"><span class="cl"><span class="cm">** the VM. More information may be found by calling [sqlite3_errmsg()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^With the legacy interface, a more specific error code (for example,
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be obtained by calling [sqlite3_reset()] on the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [prepared statement]. ^In the &#34;v2&#34; interface,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the more specific error code is returned directly by sqlite3_step().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_MISUSE] means that the this routine was called inappropriately.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Perhaps it was called on a [prepared statement] that has
</span></span></span><span class="line"><span class="cl"><span class="cm">** already been [sqlite3_finalize | finalized] or on one that had
</span></span></span><span class="line"><span class="cl"><span class="cm">** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could
</span></span></span><span class="line"><span class="cl"><span class="cm">** be the case that the same database connection is being used by two or
</span></span></span><span class="line"><span class="cl"><span class="cm">** more threads at the same moment in time.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For all versions of SQLite up to and including 3.6.23.1, a call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_reset()] was required after sqlite3_step() returned anything
</span></span></span><span class="line"><span class="cl"><span class="cm">** other than [SQLITE_ROW] before any subsequent invocation of
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_step(). Failure to reset the prepared statement using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_step() began
</span></span></span><span class="line"><span class="cl"><span class="cm">** calling [sqlite3_reset()] automatically in this circumstance rather
</span></span></span><span class="line"><span class="cl"><span class="cm">** than returning [SQLITE_MISUSE]. This is not considered a compatibility
</span></span></span><span class="line"><span class="cl"><span class="cm">** break because any application that ever receives an SQLITE_MISUSE error
</span></span></span><span class="line"><span class="cl"><span class="cm">** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be used to restore the legacy behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Goofy Interface Alert:&lt;/b&gt; In the legacy interface, the sqlite3_step()
</span></span></span><span class="line"><span class="cl"><span class="cm">** API always returns a generic error code, [SQLITE_ERROR], following any
</span></span></span><span class="line"><span class="cl"><span class="cm">** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** specific [error codes] that better describes the error.
</span></span></span><span class="line"><span class="cl"><span class="cm">** We admit that this is a goofy design. The problem has been fixed
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the &#34;v2&#34; interface. If you prepare all of your SQL statements
</span></span></span><span class="line"><span class="cl"><span class="cm">** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the more specific [error codes] are returned directly
</span></span></span><span class="line"><span class="cl"><span class="cm">** by sqlite3_step(). The use of the &#34;vX&#34; interfaces is recommended.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_step</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Number of columns in a result set
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_data_count(P) interface returns the number of columns in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** current row of the result set of [prepared statement] P.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If prepared statement P does not have results ready to return
</span></span></span><span class="line"><span class="cl"><span class="cm">** (via calls to the [sqlite3_column_int | sqlite3_column()] family of
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces) then sqlite3_data_count(P) returns 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_data_count(P) routine returns 0 if the previous call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P)
</span></span></span><span class="line"><span class="cl"><span class="cm">** will return non-zero if previous call to [sqlite3_step](P) returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum]
</span></span></span><span class="line"><span class="cl"><span class="cm">** where it always returns zero since each step of that multi-step
</span></span></span><span class="line"><span class="cl"><span class="cm">** pragma returns 0 columns of data.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_column_count()]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_data_count</span><span class="p">(</span><span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Fundamental Datatypes
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: SQLITE_TEXT
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Every value in SQLite has one of five fundamental datatypes:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; 64-bit signed integer
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; 64-bit IEEE floating point number
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; string
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; BLOB
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; NULL
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants are codes for each of those types.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that the SQLITE_TEXT constant was also used in SQLite version 2
</span></span></span><span class="line"><span class="cl"><span class="cm">** for a completely different meaning. Software that links against both
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_TEXT.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INTEGER 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FLOAT 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_BLOB 4
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_NULL 5
</span></span></span><span class="line"><span class="cl"><span class="cp">#ifdef SQLITE_TEXT
</span></span></span><span class="line"><span class="cl"><span class="cp"># undef SQLITE_TEXT
</span></span></span><span class="line"><span class="cl"><span class="cp">#else
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_TEXT 3
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE3_TEXT 3
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Result Values From A Query
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {column access functions}
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Summary:&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;&lt;table border=0 cellpadding=0 cellspacing=0&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_column_blob&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;BLOB result
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_column_double&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;REAL result
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_column_int&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;32-bit INTEGER result
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_column_int64&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;64-bit INTEGER result
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_column_text&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;UTF-8 TEXT result
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_column_text16&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;UTF-16 TEXT result
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_column_value&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;The result as an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value|unprotected sqlite3_value] object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;td&gt;&amp;nbsp;&lt;td&gt;&amp;nbsp;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_column_bytes&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;Size of a BLOB
</span></span></span><span class="line"><span class="cl"><span class="cm">** or a UTF-8 TEXT result in bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_column_bytes16&amp;nbsp;&amp;nbsp;&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;td&gt;&amp;rarr;&amp;nbsp;&amp;nbsp;&lt;td&gt;Size of UTF-16
</span></span></span><span class="line"><span class="cl"><span class="cm">** TEXT in bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_column_type&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;Default
</span></span></span><span class="line"><span class="cl"><span class="cm">** datatype of the result
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/table&gt;&lt;/blockquote&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Details:&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These routines return information about a single column of the current
</span></span></span><span class="line"><span class="cl"><span class="cm">** result row of a query. ^In every case the first argument is a pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
</span></span></span><span class="line"><span class="cl"><span class="cm">** that was returned from [sqlite3_prepare_v2()] or one of its variants)
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the second argument is the index of the column for which information
</span></span></span><span class="line"><span class="cl"><span class="cm">** should be returned. ^The leftmost column of the result set has the index 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The number of columns in the result can be determined using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_column_count()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the SQL statement does not currently point to a valid row, or if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** column index is out of range, the result is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines may only be called when the most recent call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_step()] has returned [SQLITE_ROW] and neither
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If any of these routines are called after [sqlite3_reset()] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_finalize()] or after [sqlite3_step()] has returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** something other than [SQLITE_ROW], the results are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** are called from a different thread while any of these routines
</span></span></span><span class="line"><span class="cl"><span class="cm">** are pending, then the results are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
</span></span></span><span class="line"><span class="cl"><span class="cm">** each return the value of a result column in a specific data format. If
</span></span></span><span class="line"><span class="cl"><span class="cm">** the result column is not initially in the requested format (for example,
</span></span></span><span class="line"><span class="cl"><span class="cm">** if the query returns an integer but the sqlite3_column_text() interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** is used to extract the value) then an automatic type conversion is performed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_column_type() routine returns the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_INTEGER | datatype code] for the initial data type
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the result column. ^The returned value is one of [SQLITE_INTEGER],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The return value of sqlite3_column_type() can be used to decide which
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the first six interface should be used to extract the column value.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The value returned by sqlite3_column_type() is only meaningful if no
</span></span></span><span class="line"><span class="cl"><span class="cm">** automatic type conversions have occurred for the value in question.
</span></span></span><span class="line"><span class="cl"><span class="cm">** After a type conversion, the result of calling sqlite3_column_type()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is undefined, though harmless. Future
</span></span></span><span class="line"><span class="cl"><span class="cm">** versions of SQLite may change the behavior of sqlite3_column_type()
</span></span></span><span class="line"><span class="cl"><span class="cm">** following a type conversion.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
</span></span></span><span class="line"><span class="cl"><span class="cm">** or sqlite3_column_bytes16() interfaces can be used to determine the size
</span></span></span><span class="line"><span class="cl"><span class="cm">** of that BLOB or string.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine returns the number of bytes in that BLOB or string.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
</span></span></span><span class="line"><span class="cl"><span class="cm">** the string to UTF-8 and then returns the number of bytes.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the result is a numeric value then sqlite3_column_bytes() uses
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** the number of bytes in that string.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the result is NULL, then sqlite3_column_bytes() returns zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine returns the number of bytes in that BLOB or string.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts
</span></span></span><span class="line"><span class="cl"><span class="cm">** the string to UTF-16 and then returns the number of bytes.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the result is a numeric value then sqlite3_column_bytes16() uses
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** the number of bytes in that string.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the result is NULL, then sqlite3_column_bytes16() returns zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The values returned by [sqlite3_column_bytes()] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_column_bytes16()] do not include the zero terminators at the end
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the string. ^For clarity: the values returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of
</span></span></span><span class="line"><span class="cl"><span class="cm">** bytes in the string, not the number of characters.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** even empty strings, are always zero-terminated. ^The return
</span></span></span><span class="line"><span class="cl"><span class="cm">** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Strings returned by sqlite3_column_text16() always have the endianness
</span></span></span><span class="line"><span class="cl"><span class="cm">** which is native to the platform, regardless of the text encoding set
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the database.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Warning:&lt;/b&gt; ^The object returned by [sqlite3_column_value()] is an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [unprotected sqlite3_value] object. In a multithreaded environment,
</span></span></span><span class="line"><span class="cl"><span class="cm">** an unprotected sqlite3_value object may only be used safely with
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_bind_value()] and [sqlite3_result_value()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the [unprotected sqlite3_value] object returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_column_value()] is used in any other way, including calls
</span></span></span><span class="line"><span class="cl"><span class="cm">** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [sqlite3_value_bytes()], the behavior is not threadsafe.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Hence, the sqlite3_column_value() interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** is normally only useful within the implementation of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [application-defined SQL functions] or [virtual tables], not within
</span></span></span><span class="line"><span class="cl"><span class="cm">** top-level application code.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines may attempt to convert the datatype of the result.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^For example, if the internal representation is FLOAT and a text result
</span></span></span><span class="line"><span class="cl"><span class="cm">** is requested, [sqlite3_snprintf()] is used internally to perform the
</span></span></span><span class="line"><span class="cl"><span class="cm">** conversion automatically. ^(The following table details the conversions
</span></span></span><span class="line"><span class="cl"><span class="cm">** that are applied:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;table border=&#34;1&#34;&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;th&gt; Internal&lt;br&gt;Type &lt;th&gt; Requested&lt;br&gt;Type &lt;th&gt; Conversion
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; NULL &lt;td&gt; INTEGER &lt;td&gt; Result is 0
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; NULL &lt;td&gt; FLOAT &lt;td&gt; Result is 0.0
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; NULL &lt;td&gt; TEXT &lt;td&gt; Result is a NULL pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; NULL &lt;td&gt; BLOB &lt;td&gt; Result is a NULL pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; INTEGER &lt;td&gt; FLOAT &lt;td&gt; Convert from integer to float
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; INTEGER &lt;td&gt; TEXT &lt;td&gt; ASCII rendering of the integer
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; INTEGER &lt;td&gt; BLOB &lt;td&gt; Same as INTEGER-&gt;TEXT
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; FLOAT &lt;td&gt; INTEGER &lt;td&gt; [CAST] to INTEGER
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; FLOAT &lt;td&gt; TEXT &lt;td&gt; ASCII rendering of the float
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; FLOAT &lt;td&gt; BLOB &lt;td&gt; [CAST] to BLOB
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; TEXT &lt;td&gt; INTEGER &lt;td&gt; [CAST] to INTEGER
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; TEXT &lt;td&gt; FLOAT &lt;td&gt; [CAST] to REAL
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; TEXT &lt;td&gt; BLOB &lt;td&gt; No change
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; BLOB &lt;td&gt; INTEGER &lt;td&gt; [CAST] to INTEGER
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; BLOB &lt;td&gt; FLOAT &lt;td&gt; [CAST] to REAL
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; BLOB &lt;td&gt; TEXT &lt;td&gt; [CAST] to TEXT, ensure zero terminator
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/table&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/blockquote&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that when type conversions occur, pointers returned by prior
</span></span></span><span class="line"><span class="cl"><span class="cm">** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_column_text16() may be invalidated.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Type conversions and pointer invalidations might occur
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the following cases:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The initial content is a BLOB and sqlite3_column_text() or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_column_text16() is called. A zero-terminator might
</span></span></span><span class="line"><span class="cl"><span class="cm">** need to be added to the string.&lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The initial content is UTF-8 text and sqlite3_column_bytes16() or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_column_text16() is called. The content must be converted
</span></span></span><span class="line"><span class="cl"><span class="cm">** to UTF-16.&lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The initial content is UTF-16 text and sqlite3_column_bytes() or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_column_text() is called. The content must be converted
</span></span></span><span class="line"><span class="cl"><span class="cm">** to UTF-8.&lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Conversions between UTF-16be and UTF-16le are always done in place and do
</span></span></span><span class="line"><span class="cl"><span class="cm">** not invalidate a prior pointer, though of course the content of the buffer
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the prior pointer references will have been modified. Other kinds
</span></span></span><span class="line"><span class="cl"><span class="cm">** of conversion are done in place when it is possible, but sometimes they
</span></span></span><span class="line"><span class="cl"><span class="cm">** are not possible and in those cases prior pointers are invalidated.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The safest policy is to invoke these routines
</span></span></span><span class="line"><span class="cl"><span class="cm">** in one of the following ways:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;sqlite3_column_text() followed by sqlite3_column_bytes()&lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;sqlite3_column_blob() followed by sqlite3_column_bytes()&lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;sqlite3_column_text16() followed by sqlite3_column_bytes16()&lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In other words, you should call sqlite3_column_text(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result
</span></span></span><span class="line"><span class="cl"><span class="cm">** into the desired format, then invoke sqlite3_column_bytes() or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_column_bytes16() to find the size of the result. Do not mix calls
</span></span></span><span class="line"><span class="cl"><span class="cm">** to sqlite3_column_text() or sqlite3_column_blob() with calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** with calls to sqlite3_column_bytes().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The pointers returned are valid until a type conversion occurs as
</span></span></span><span class="line"><span class="cl"><span class="cm">** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_finalize()] is called. ^The memory space used to hold strings
</span></span></span><span class="line"><span class="cl"><span class="cm">** and BLOBs is freed automatically. Do not pass the pointers returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_free()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** As long as the input parameters are correct, these routines will only
</span></span></span><span class="line"><span class="cl"><span class="cm">** fail if an out-of-memory error occurs during a format conversion.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Only the following subset of interfaces are subject to out-of-memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** errors:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_column_blob()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_column_text()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_column_text16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_column_bytes()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_column_bytes16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If an out-of-memory error occurs, then the return value from these
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines is the same as if the column had contained an SQL NULL value.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Valid SQL NULL returns can be distinguished from out-of-memory errors
</span></span></span><span class="line"><span class="cl"><span class="cm">** by invoking the [sqlite3_errcode()] immediately after the suspect
</span></span></span><span class="line"><span class="cl"><span class="cm">** return value is obtained and before any
</span></span></span><span class="line"><span class="cl"><span class="cm">** other SQLite interface is called on the same [database connection].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_column_blob</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">double</span> <span class="nf">sqlite3_column_double</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_column_int</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3_column_int64</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_column_text</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_column_text16</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_value</span> <span class="o">*</span><span class="nf">sqlite3_column_value</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_column_bytes</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_column_bytes16</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_column_type</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Destroy A Prepared Statement Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** DESTRUCTOR: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_finalize() function is called to delete a [prepared statement].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the most recent evaluation of the statement encountered no errors
</span></span></span><span class="line"><span class="cl"><span class="cm">** or if the statement is never been evaluated, then sqlite3_finalize() returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_finalize(S) returns the appropriate [error code] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [extended error code].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_finalize(S) routine can be called at any point during
</span></span></span><span class="line"><span class="cl"><span class="cm">** the life cycle of [prepared statement] S:
</span></span></span><span class="line"><span class="cl"><span class="cm">** before statement S is ever evaluated, after
</span></span></span><span class="line"><span class="cl"><span class="cm">** one or more calls to [sqlite3_reset()], or after any call
</span></span></span><span class="line"><span class="cl"><span class="cm">** to [sqlite3_step()] regardless of whether or not the statement has
</span></span></span><span class="line"><span class="cl"><span class="cm">** completed execution.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The application must finalize every [prepared statement] in order to avoid
</span></span></span><span class="line"><span class="cl"><span class="cm">** resource leaks. It is a grievous error for the application to try to use
</span></span></span><span class="line"><span class="cl"><span class="cm">** a prepared statement after it has been finalized. Any use of a prepared
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement after it has been finalized can result in undefined and
</span></span></span><span class="line"><span class="cl"><span class="cm">** undesirable behavior such as segfaults and heap corruption.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_finalize</span><span class="p">(</span><span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Reset A Prepared Statement Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_reset() function is called to reset a [prepared statement]
</span></span></span><span class="line"><span class="cl"><span class="cm">** object back to its initial state, ready to be re-executed.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Any SQL statement variables that had values bound to them using
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Use [sqlite3_clear_bindings()] to reset the bindings.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
</span></span></span><span class="line"><span class="cl"><span class="cm">** back to the beginning of its program.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The return code from [sqlite3_reset(S)] indicates whether or not
</span></span></span><span class="line"><span class="cl"><span class="cm">** the previous evaluation of prepared statement S completed successfully.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If [sqlite3_step(S)] has never before been called on S or if
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_step(S)] has not been called since the previous call
</span></span></span><span class="line"><span class="cl"><span class="cm">** to [sqlite3_reset(S)], then [sqlite3_reset(S)] will return
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_OK].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the most recent call to [sqlite3_step(S)] for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [prepared statement] S indicated an error, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_reset(S)] returns an appropriate [error code].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_reset(S)] interface might also return an [error code]
</span></span></span><span class="line"><span class="cl"><span class="cm">** if there were no prior errors but the process of resetting
</span></span></span><span class="line"><span class="cl"><span class="cm">** the prepared statement caused a new error. ^For example, if an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [INSERT] statement with a [RETURNING] clause is only stepped one time,
</span></span></span><span class="line"><span class="cl"><span class="cm">** that one call to [sqlite3_step(S)] might return SQLITE_ROW but
</span></span></span><span class="line"><span class="cl"><span class="cm">** the overall statement might still fail and the [sqlite3_reset(S)] call
</span></span></span><span class="line"><span class="cl"><span class="cm">** might return SQLITE_BUSY if locking constraints prevent the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database change from committing. Therefore, it is important that
</span></span></span><span class="line"><span class="cl"><span class="cm">** applications check the return code from [sqlite3_reset(S)] even if
</span></span></span><span class="line"><span class="cl"><span class="cm">** no prior call to [sqlite3_step(S)] indicated a problem.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_reset(S)] interface does not change the values
</span></span></span><span class="line"><span class="cl"><span class="cm">** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_reset</span><span class="p">(</span><span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Create Or Redefine SQL Functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {function creation routines}
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These functions (collectively known as &#34;function creation routines&#34;)
</span></span></span><span class="line"><span class="cl"><span class="cm">** are used to add SQL functions or aggregates or to redefine the behavior
</span></span></span><span class="line"><span class="cl"><span class="cm">** of existing SQL functions or aggregates. The only differences between
</span></span></span><span class="line"><span class="cl"><span class="cm">** the three &#34;sqlite3_create_function*&#34; routines are the text encoding
</span></span></span><span class="line"><span class="cl"><span class="cm">** expected for the second parameter (the name of the function being
</span></span></span><span class="line"><span class="cl"><span class="cm">** created) and the presence or absence of a destructor callback for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the application data pointer. Function sqlite3_create_window_function()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is similar, but allows the user to supply the extra callback functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** needed by [aggregate window functions].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first parameter is the [database connection] to which the SQL
</span></span></span><span class="line"><span class="cl"><span class="cm">** function is to be added. ^If an application uses more than one database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection then application-defined SQL functions must be added
</span></span></span><span class="line"><span class="cl"><span class="cm">** to each database connection separately.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The second parameter is the name of the SQL function to be created or
</span></span></span><span class="line"><span class="cl"><span class="cm">** redefined. ^The length of the name is limited to 255 bytes in a UTF-8
</span></span></span><span class="line"><span class="cl"><span class="cm">** representation, exclusive of the zero-terminator. ^Note that the name
</span></span></span><span class="line"><span class="cl"><span class="cm">** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Any attempt to create a function with a longer name
</span></span></span><span class="line"><span class="cl"><span class="cm">** will result in [SQLITE_MISUSE] being returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The third parameter (nArg)
</span></span></span><span class="line"><span class="cl"><span class="cm">** is the number of arguments that the SQL function or
</span></span></span><span class="line"><span class="cl"><span class="cm">** aggregate takes. ^If this parameter is -1, then the SQL function or
</span></span></span><span class="line"><span class="cl"><span class="cm">** aggregate may take any number of arguments between 0 and the limit
</span></span></span><span class="line"><span class="cl"><span class="cm">** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter is less than -1 or greater than 127 then the behavior is
</span></span></span><span class="line"><span class="cl"><span class="cm">** undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The fourth parameter, eTextRep, specifies what
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_UTF8 | text encoding] this SQL function prefers for
</span></span></span><span class="line"><span class="cl"><span class="cm">** its parameters. The application should set this parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_UTF16LE] if the function implementation invokes
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation invokes [sqlite3_value_text16be()] on an input, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8]
</span></span></span><span class="line"><span class="cl"><span class="cm">** otherwise. ^The same SQL function may be registered multiple times using
</span></span></span><span class="line"><span class="cl"><span class="cm">** different preferred text encodings, with different implementations for
</span></span></span><span class="line"><span class="cl"><span class="cm">** each encoding.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When multiple implementations of the same function are available, SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** will pick the one that involves the least amount of data conversion.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to signal that the function will always return the same result given
</span></span></span><span class="line"><span class="cl"><span class="cm">** the same inputs within a single SQL statement. Most SQL functions are
</span></span></span><span class="line"><span class="cl"><span class="cm">** deterministic. The built-in [random()] SQL function is an example of a
</span></span></span><span class="line"><span class="cl"><span class="cm">** function that is not deterministic. The SQLite query planner is able to
</span></span></span><span class="line"><span class="cl"><span class="cm">** perform additional optimizations on deterministic functions, so use
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the [SQLITE_DETERMINISTIC] flag is recommended where possible.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag, which if present prevents the function from being invoked from
</span></span></span><span class="line"><span class="cl"><span class="cm">** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
</span></span></span><span class="line"><span class="cl"><span class="cm">** index expressions, or the WHERE clause of partial indexes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
</span></span></span><span class="line"><span class="cl"><span class="cm">** all application-defined SQL functions that do not need to be
</span></span></span><span class="line"><span class="cl"><span class="cm">** used inside of triggers, view, CHECK constraints, or other elements of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database schema. This flags is especially recommended for SQL
</span></span></span><span class="line"><span class="cl"><span class="cm">** functions that have side effects or reveal internal application state.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Without this flag, an attacker might be able to modify the schema of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a database file to include invocations of the function with parameters
</span></span></span><span class="line"><span class="cl"><span class="cm">** chosen by the attacker, which the application will then execute when
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database file is opened and read.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The fifth parameter is an arbitrary pointer. The implementation of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** function can gain access to this pointer using [sqlite3_user_data()].)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sixth, seventh and eighth parameters passed to the three
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;sqlite3_create_function*&#34; functions, xFunc, xStep and xFinal, are
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointers to C-language functions that implement the SQL function or
</span></span></span><span class="line"><span class="cl"><span class="cm">** aggregate. ^A scalar SQL function requires an implementation of the xFunc
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback only; NULL pointers must be passed as the xStep and xFinal
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameters. ^An aggregate SQL function requires an implementation of xStep
</span></span></span><span class="line"><span class="cl"><span class="cm">** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL function or aggregate, pass NULL pointers for all three function
</span></span></span><span class="line"><span class="cl"><span class="cm">** callbacks.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sixth, seventh, eighth and ninth parameters (xStep, xFinal, xValue
</span></span></span><span class="line"><span class="cl"><span class="cm">** and xInverse) passed to sqlite3_create_window_function are pointers to
</span></span></span><span class="line"><span class="cl"><span class="cm">** C-language callbacks that implement the new function. xStep and xFinal
</span></span></span><span class="line"><span class="cl"><span class="cm">** must both be non-NULL. xValue and xInverse may either both be NULL, in
</span></span></span><span class="line"><span class="cl"><span class="cm">** which case a regular aggregate function is created, or must both be
</span></span></span><span class="line"><span class="cl"><span class="cm">** non-NULL, in which case the new function may be used as either an aggregate
</span></span></span><span class="line"><span class="cl"><span class="cm">** or aggregate window function. More details regarding the implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** of aggregate window functions are
</span></span></span><span class="line"><span class="cl"><span class="cm">** [user-defined window functions|available here].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If the final parameter to sqlite3_create_function_v2() or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_create_window_function() is not NULL, then it is destructor for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the application data pointer. The destructor is invoked when the function
</span></span></span><span class="line"><span class="cl"><span class="cm">** is deleted, either by being overloaded or when the database connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** closes.)^ ^The destructor is also invoked if the call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_create_function_v2() fails. ^When the destructor callback is
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked, it is passed a single argument which is a copy of the application
</span></span></span><span class="line"><span class="cl"><span class="cm">** data pointer which was the fifth parameter to sqlite3_create_function_v2().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^It is permitted to register multiple implementations of the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** functions with the same name but with either differing numbers of
</span></span></span><span class="line"><span class="cl"><span class="cm">** arguments or differing preferred text encodings. ^SQLite will use
</span></span></span><span class="line"><span class="cl"><span class="cm">** the implementation that most closely matches the way in which the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL function is used. ^A function implementation with a non-negative
</span></span></span><span class="line"><span class="cl"><span class="cm">** nArg parameter is a better match than a function implementation with
</span></span></span><span class="line"><span class="cl"><span class="cm">** a negative nArg. ^A function where the preferred text encoding
</span></span></span><span class="line"><span class="cl"><span class="cm">** matches the database encoding is a better
</span></span></span><span class="line"><span class="cl"><span class="cm">** match than a function where the encoding is different.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A function where the encoding difference is between UTF16le and UTF16be
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a closer match than a function where the encoding difference is
</span></span></span><span class="line"><span class="cl"><span class="cm">** between UTF8 and UTF16.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Built-in functions may be overloaded by new application-defined functions.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^An application-defined function is permitted to call other
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite interfaces. However, such calls must not
</span></span></span><span class="line"><span class="cl"><span class="cm">** close the database connection nor finalize or reset the prepared
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement in which the function is running.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_create_function</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zFunctionName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nArg</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eTextRep</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pApp</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xFunc</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="n">sqlite3_value</span><span class="o">**</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xStep</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="n">sqlite3_value</span><span class="o">**</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xFinal</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_create_function16</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">zFunctionName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nArg</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eTextRep</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pApp</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xFunc</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="n">sqlite3_value</span><span class="o">**</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xStep</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="n">sqlite3_value</span><span class="o">**</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xFinal</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_create_function_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zFunctionName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nArg</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eTextRep</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pApp</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xFunc</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="n">sqlite3_value</span><span class="o">**</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xStep</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="n">sqlite3_value</span><span class="o">**</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xFinal</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="n">xDestroy</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_create_window_function</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zFunctionName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nArg</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eTextRep</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pApp</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xStep</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="n">sqlite3_value</span><span class="o">**</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xFinal</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xValue</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xInverse</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="n">sqlite3_value</span><span class="o">**</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="n">xDestroy</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Text Encodings
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constant define integer codes that represent the various
</span></span></span><span class="line"><span class="cl"><span class="cm">** text encodings supported by SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_UTF8 1 </span><span class="cm">/* IMP: R-37514-35566 */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_UTF16LE 2 </span><span class="cm">/* IMP: R-03371-37637 */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_UTF16BE 3 </span><span class="cm">/* IMP: R-51971-34154 */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_UTF16 4 </span><span class="cm">/* Use native byte order */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ANY 5 </span><span class="cm">/* Deprecated */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_UTF16_ALIGNED 8 </span><span class="cm">/* sqlite3_create_collation only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Function Flags
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants may be ORed together with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_UTF8 | preferred text encoding] as the fourth argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** to [sqlite3_create_function()], [sqlite3_create_function16()], or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_create_function_v2()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DETERMINISTIC]] &lt;dt&gt;SQLITE_DETERMINISTIC&lt;/dt&gt;&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_DETERMINISTIC flag means that the new function always gives
</span></span></span><span class="line"><span class="cl"><span class="cm">** the same output when the input parameters are the same.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [abs|abs() function] is deterministic, for example, but
</span></span></span><span class="line"><span class="cl"><span class="cm">** [randomblob|randomblob()] is not. Functions must
</span></span></span><span class="line"><span class="cl"><span class="cm">** be deterministic in order to be used in certain contexts such as
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the WHERE clause of [partial indexes] or in [generated columns].
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite might also optimize deterministic functions by factoring them
</span></span></span><span class="line"><span class="cl"><span class="cm">** out of inner loops.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DIRECTONLY]] &lt;dt&gt;SQLITE_DIRECTONLY&lt;/dt&gt;&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_DIRECTONLY flag means that the function may only be invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** from top-level SQL, and cannot be used in VIEWs or TRIGGERs nor in
</span></span></span><span class="line"><span class="cl"><span class="cm">** schema structures such as [CHECK constraints], [DEFAULT clauses],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [expression indexes], [partial indexes], or [generated columns].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_DIRECTONLY flag is recommended for any
</span></span></span><span class="line"><span class="cl"><span class="cm">** [application-defined SQL function]
</span></span></span><span class="line"><span class="cl"><span class="cm">** that has side-effects or that could potentially leak sensitive information.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This will prevent attacks in which an application is tricked
</span></span></span><span class="line"><span class="cl"><span class="cm">** into using a database file that has had its schema surreptitiously
</span></span></span><span class="line"><span class="cl"><span class="cm">** modified to invoke the application-defined function in ways that are
</span></span></span><span class="line"><span class="cl"><span class="cm">** harmful.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Some people say it is good practice to set SQLITE_DIRECTONLY on all
</span></span></span><span class="line"><span class="cl"><span class="cm">** [application-defined SQL functions], regardless of whether or not they
</span></span></span><span class="line"><span class="cl"><span class="cm">** are security sensitive, as doing so prevents those functions from being used
</span></span></span><span class="line"><span class="cl"><span class="cm">** inside of the database schema, and thus ensures that the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be inspected and modified using generic tools (such as the [CLI])
</span></span></span><span class="line"><span class="cl"><span class="cm">** that do not have access to the application-defined functions.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_INNOCUOUS]] &lt;dt&gt;SQLITE_INNOCUOUS&lt;/dt&gt;&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_INNOCUOUS flag means that the function is unlikely
</span></span></span><span class="line"><span class="cl"><span class="cm">** to cause problems even if misused. An innocuous function should have
</span></span></span><span class="line"><span class="cl"><span class="cm">** no side effects and should not depend on any values other than its
</span></span></span><span class="line"><span class="cl"><span class="cm">** input parameters. The [abs|abs() function] is an example of an
</span></span></span><span class="line"><span class="cl"><span class="cm">** innocuous function.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [load_extension() SQL function] is not innocuous because of its
</span></span></span><span class="line"><span class="cl"><span class="cm">** side effects.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt; SQLITE_INNOCUOUS is similar to SQLITE_DETERMINISTIC, but is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** exactly the same. The [random|random() function] is an example of a
</span></span></span><span class="line"><span class="cl"><span class="cm">** function that is innocuous but not deterministic.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;Some heightened security settings
</span></span></span><span class="line"><span class="cl"><span class="cm">** ([SQLITE_DBCONFIG_TRUSTED_SCHEMA] and [PRAGMA trusted_schema=OFF])
</span></span></span><span class="line"><span class="cl"><span class="cm">** disable the use of SQL functions inside views and triggers and in
</span></span></span><span class="line"><span class="cl"><span class="cm">** schema structures such as [CHECK constraints], [DEFAULT clauses],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [expression indexes], [partial indexes], and [generated columns] unless
</span></span></span><span class="line"><span class="cl"><span class="cm">** the function is tagged with SQLITE_INNOCUOUS. Most built-in functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** are innocuous. Developers are advised to avoid using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_INNOCUOUS flag for application-defined functions unless the
</span></span></span><span class="line"><span class="cl"><span class="cm">** function has been carefully audited and found to be free of potentially
</span></span></span><span class="line"><span class="cl"><span class="cm">** security-adverse side-effects and information-leaks.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_SUBTYPE]] &lt;dt&gt;SQLITE_SUBTYPE&lt;/dt&gt;&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This flag instructs SQLite to omit some corner-case optimizations that
</span></span></span><span class="line"><span class="cl"><span class="cm">** might disrupt the operation of the [sqlite3_value_subtype()] function,
</span></span></span><span class="line"><span class="cl"><span class="cm">** causing it to return zero rather than the correct subtype().
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL functions that invokes [sqlite3_value_subtype()] should have this
</span></span></span><span class="line"><span class="cl"><span class="cm">** property. If the SQLITE_SUBTYPE property is omitted, then the return
</span></span></span><span class="line"><span class="cl"><span class="cm">** value from [sqlite3_value_subtype()] might sometimes be zero even though
</span></span></span><span class="line"><span class="cl"><span class="cm">** a non-zero subtype was specified by the function argument expression.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_RESULT_SUBTYPE]] &lt;dt&gt;SQLITE_RESULT_SUBTYPE&lt;/dt&gt;&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_result_subtype()] to cause a sub-type to be associated with its
</span></span></span><span class="line"><span class="cl"><span class="cm">** result.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Every function that invokes [sqlite3_result_subtype()] should have this
</span></span></span><span class="line"><span class="cl"><span class="cm">** property. If it does not, then the call to [sqlite3_result_subtype()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** might become a no-op if the function is used as term in an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [expression index]. On the other hand, SQL functions that never invoke
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_result_subtype()] should avoid setting this property, as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** purpose of this property is to disable certain optimizations that are
</span></span></span><span class="line"><span class="cl"><span class="cm">** incompatible with subtypes.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DETERMINISTIC 0x000000800
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DIRECTONLY 0x000080000
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SUBTYPE 0x000100000
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INNOCUOUS 0x000200000
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_RESULT_SUBTYPE 0x001000000
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Deprecated Functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** DEPRECATED
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These functions are [deprecated]. In order to maintain
</span></span></span><span class="line"><span class="cl"><span class="cm">** backwards compatibility with older code, these functions continue
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be supported. However, new applications should avoid
</span></span></span><span class="line"><span class="cl"><span class="cm">** the use of these functions. To encourage programmers to avoid
</span></span></span><span class="line"><span class="cl"><span class="cm">** these functions, we will not explain what they do.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifndef SQLITE_OMIT_DEPRECATED
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="n">SQLITE_API</span> <span class="n">SQLITE_DEPRECATED</span> <span class="kt">int</span> <span class="nf">sqlite3_aggregate_count</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_DEPRECATED</span> <span class="kt">int</span> <span class="nf">sqlite3_expired</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_DEPRECATED</span> <span class="kt">int</span> <span class="nf">sqlite3_transfer_bindings</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_DEPRECATED</span> <span class="kt">int</span> <span class="nf">sqlite3_global_recover</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_DEPRECATED</span> <span class="kt">void</span> <span class="nf">sqlite3_thread_cleanup</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_DEPRECATED</span> <span class="kt">int</span> <span class="nf">sqlite3_memory_alarm</span><span class="p">(</span><span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="n">sqlite3_int64</span><span class="p">,</span><span class="kt">int</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="n">sqlite3_int64</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Obtaining SQL Values
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_value
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Summary:&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;&lt;table border=0 cellpadding=0 cellspacing=0&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_blob&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;BLOB value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_double&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;REAL value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_int&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;32-bit INTEGER value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_int64&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;64-bit INTEGER value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_pointer&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;Pointer value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_text&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;UTF-8 TEXT value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_text16&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;UTF-16 TEXT value in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the native byteorder
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_text16be&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;UTF-16be TEXT value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_text16le&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;UTF-16le TEXT value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;td&gt;&amp;nbsp;&lt;td&gt;&amp;nbsp;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_bytes&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;Size of a BLOB
</span></span></span><span class="line"><span class="cl"><span class="cm">** or a UTF-8 TEXT in bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_bytes16&amp;nbsp;&amp;nbsp;&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;td&gt;&amp;rarr;&amp;nbsp;&amp;nbsp;&lt;td&gt;Size of UTF-16
</span></span></span><span class="line"><span class="cl"><span class="cm">** TEXT in bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_type&lt;/b&gt;&lt;td&gt;&amp;rarr;&lt;td&gt;Default
</span></span></span><span class="line"><span class="cl"><span class="cm">** datatype of the value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_numeric_type&amp;nbsp;&amp;nbsp;&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;td&gt;&amp;rarr;&amp;nbsp;&amp;nbsp;&lt;td&gt;Best numeric datatype of the value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_nochange&amp;nbsp;&amp;nbsp;&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;td&gt;&amp;rarr;&amp;nbsp;&amp;nbsp;&lt;td&gt;True if the column is unchanged in an UPDATE
</span></span></span><span class="line"><span class="cl"><span class="cm">** against a virtual table.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;&lt;b&gt;sqlite3_value_frombind&amp;nbsp;&amp;nbsp;&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;td&gt;&amp;rarr;&amp;nbsp;&amp;nbsp;&lt;td&gt;True if value originated from a [bound parameter]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/table&gt;&lt;/blockquote&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Details:&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines extract type, size, and content information from
</span></span></span><span class="line"><span class="cl"><span class="cm">** [protected sqlite3_value] objects. Protected sqlite3_value objects
</span></span></span><span class="line"><span class="cl"><span class="cm">** are used to pass parameter information into the functions that
</span></span></span><span class="line"><span class="cl"><span class="cm">** implement [application-defined SQL functions] and [virtual tables].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines work only with [protected sqlite3_value] objects.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Any attempt to use these routines on an [unprotected sqlite3_value]
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not threadsafe.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These routines work just like the corresponding [column access functions]
</span></span></span><span class="line"><span class="cl"><span class="cm">** except that these routines take a single [protected sqlite3_value] object
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_value_text16() interface extracts a UTF-16 string
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the native byte-order of the host machine. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** extract UTF-16 strings as big-endian and little-endian respectively.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If [sqlite3_value] object V was initialized
</span></span></span><span class="line"><span class="cl"><span class="cm">** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and if X and Y are strings that compare equal according to strcmp(X,Y),
</span></span></span><span class="line"><span class="cl"><span class="cm">** then sqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise,
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer()
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The sqlite3_value_type(V) interface returns the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_INTEGER | datatype code] for the initial datatype of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** Other interfaces might change the datatype for an sqlite3_value object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** For example, if the datatype is initially SQLITE_INTEGER and
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value_text(V) is called to extract a text value for that
</span></span></span><span class="line"><span class="cl"><span class="cm">** integer, then subsequent calls to sqlite3_value_type(V) might return
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_TEXT. Whether or not a persistent internal datatype conversion
</span></span></span><span class="line"><span class="cl"><span class="cm">** occurs is undefined and may change from one release of SQLite to the next.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The sqlite3_value_numeric_type() interface attempts to apply
</span></span></span><span class="line"><span class="cl"><span class="cm">** numeric affinity to the value. This means that an attempt is
</span></span></span><span class="line"><span class="cl"><span class="cm">** made to convert the value to an integer or floating point. If
</span></span></span><span class="line"><span class="cl"><span class="cm">** such a conversion is possible without loss of information (in other
</span></span></span><span class="line"><span class="cl"><span class="cm">** words, if the value is a string that looks like a number)
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the conversion is performed. Otherwise no conversion occurs.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Within the [xUpdate] method of a [virtual table], the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value_nochange(X) interface returns true if and only if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the column corresponding to X is unchanged by the UPDATE operation
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the xUpdate method call was invoked to implement and if
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the prior [xColumn] method call that was invoked to extracted
</span></span></span><span class="line"><span class="cl"><span class="cm">** the value for that column returned without setting a result (probably
</span></span></span><span class="line"><span class="cl"><span class="cm">** because it queried [sqlite3_vtab_nochange()] and found that the column
</span></span></span><span class="line"><span class="cl"><span class="cm">** was unchanging). ^Within an [xUpdate] method, any value for which
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value_nochange(X) is true will in all other respects appear
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other
</span></span></span><span class="line"><span class="cl"><span class="cm">** than within an [xUpdate] method call for an UPDATE statement, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the return value is arbitrary and meaningless.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_value_frombind(X) interface returns non-zero if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces. ^If X comes from an SQL literal value, or a table column,
</span></span></span><span class="line"><span class="cl"><span class="cm">** or an expression, then sqlite3_value_frombind(X) returns zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Please pay particular attention to the fact that the pointer returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** from [sqlite3_value_blob()], [sqlite3_value_text()], or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value_text16()] can be invalidated by a subsequent call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [sqlite3_value_text16()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines must be called from the same thread as
</span></span></span><span class="line"><span class="cl"><span class="cm">** the SQL function that supplied the [sqlite3_value*] parameters.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** As long as the input parameter is correct, these routines can only
</span></span></span><span class="line"><span class="cl"><span class="cm">** fail if an out-of-memory error occurs during a format conversion.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Only the following subset of interfaces are subject to out-of-memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** errors:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_value_blob()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_value_text()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_value_text16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_value_text16le()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_value_text16be()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_value_bytes()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; sqlite3_value_bytes16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If an out-of-memory error occurs, then the return value from these
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines is the same as if the column had contained an SQL NULL value.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Valid SQL NULL returns can be distinguished from out-of-memory errors
</span></span></span><span class="line"><span class="cl"><span class="cm">** by invoking the [sqlite3_errcode()] immediately after the suspect
</span></span></span><span class="line"><span class="cl"><span class="cm">** return value is obtained and before any
</span></span></span><span class="line"><span class="cl"><span class="cm">** other SQLite interface is called on the same [database connection].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_value_blob</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">double</span> <span class="nf">sqlite3_value_double</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_value_int</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3_value_int64</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_value_pointer</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_value_text</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_value_text16</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_value_text16le</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_value_text16be</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_value_bytes</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_value_bytes16</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_value_type</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_value_numeric_type</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_value_nochange</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_value_frombind</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Report the internal text encoding state of an sqlite3_value object
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_value
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The sqlite3_value_encoding(X) interface returns one of [SQLITE_UTF8],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_UTF16BE], or [SQLITE_UTF16LE] according to the current text encoding
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the value X, assuming that X has type TEXT.)^ If sqlite3_value_type(X)
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns something other than SQLITE_TEXT, then the return value from
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value_encoding(X) is meaningless. ^Calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value_text(X)], [sqlite3_value_text16(X)], [sqlite3_value_text16be(X)],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value_text16le(X)], [sqlite3_value_bytes(X)], or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_value_bytes16(X)] might change the encoding of the value X and
</span></span></span><span class="line"><span class="cl"><span class="cm">** thus change the return from subsequent calls to sqlite3_value_encoding(X).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This routine is intended for used by applications that test and validate
</span></span></span><span class="line"><span class="cl"><span class="cm">** the SQLite implementation. This routine is inquiring about the opaque
</span></span></span><span class="line"><span class="cl"><span class="cm">** internal state of an [sqlite3_value] object. Ordinary applications should
</span></span></span><span class="line"><span class="cl"><span class="cm">** not need to know what the internal state of an sqlite3_value object is and
</span></span></span><span class="line"><span class="cl"><span class="cm">** hence should not need to use this interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_value_encoding</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Finding The Subtype Of SQL Values
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_value
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_value_subtype(V) function returns the subtype for
</span></span></span><span class="line"><span class="cl"><span class="cm">** an [application-defined SQL function] argument V. The subtype
</span></span></span><span class="line"><span class="cl"><span class="cm">** information can be used to pass a limited amount of context from
</span></span></span><span class="line"><span class="cl"><span class="cm">** one SQL function to another. Use the [sqlite3_result_subtype()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine to set the subtype for the return value of an SQL function.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Every [application-defined SQL function] that invoke this interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** should include the [SQLITE_SUBTYPE] property in the text
</span></span></span><span class="line"><span class="cl"><span class="cm">** encoding argument when the function is [sqlite3_create_function|registered].
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
</span></span></span><span class="line"><span class="cl"><span class="cm">** might return zero instead of the upstream subtype in some corner cases.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="nf">sqlite3_value_subtype</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Copy And Free SQL Values
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_value
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
</span></span></span><span class="line"><span class="cl"><span class="cm">** object D and returns a pointer to that copy. ^The [sqlite3_value] returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a [protected sqlite3_value] object even if the input is not.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory allocation fails. ^If V is a [pointer value], then the result
</span></span></span><span class="line"><span class="cl"><span class="cm">** of sqlite3_value_dup(V) is a NULL value.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
</span></span></span><span class="line"><span class="cl"><span class="cm">** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** then sqlite3_value_free(V) is a harmless no-op.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_value</span> <span class="o">*</span><span class="nf">sqlite3_value_dup</span><span class="p">(</span><span class="k">const</span> <span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_value_free</span><span class="p">(</span><span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Obtain Aggregate Function Context
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_context
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Implementations of aggregate SQL functions use this
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine to allocate memory for storing their state.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first time the sqlite3_aggregate_context(C,N) routine is called
</span></span></span><span class="line"><span class="cl"><span class="cm">** for a particular aggregate function, SQLite allocates
</span></span></span><span class="line"><span class="cl"><span class="cm">** N bytes of memory, zeroes out that memory, and returns a pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the new memory. ^On second and subsequent calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_aggregate_context() for the same aggregate function instance,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the same buffer is returned. Sqlite3_aggregate_context() is normally
</span></span></span><span class="line"><span class="cl"><span class="cm">** called once for each invocation of the xStep callback and then one
</span></span></span><span class="line"><span class="cl"><span class="cm">** last time when the xFinal callback is invoked. ^(When no rows match
</span></span></span><span class="line"><span class="cl"><span class="cm">** an aggregate query, the xStep() callback of the aggregate function
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation is never called and xFinal() is called exactly once.
</span></span></span><span class="line"><span class="cl"><span class="cm">** In those cases, sqlite3_aggregate_context() might be called for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** first time from within xFinal().)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** when first called if N is less than or equal to zero or if a memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocation error occurs.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
</span></span></span><span class="line"><span class="cl"><span class="cm">** determined by the N parameter on first successful call. Changing the
</span></span></span><span class="line"><span class="cl"><span class="cm">** value of N in any subsequent call to sqlite3_aggregate_context() within
</span></span></span><span class="line"><span class="cl"><span class="cm">** the same aggregate function instance will not resize the memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocation.)^ Within the xFinal callback, it is customary to set
</span></span></span><span class="line"><span class="cl"><span class="cm">** N=0 in calls to sqlite3_aggregate_context(C,N) so that no
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointless memory allocations occur.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite automatically frees the memory allocated by
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_aggregate_context() when the aggregate query concludes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first parameter must be a copy of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_context | SQL function context] that is the first parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the xStep or xFinal callback routine that implements the aggregate
</span></span></span><span class="line"><span class="cl"><span class="cm">** function.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This routine must be called from the same thread in which
</span></span></span><span class="line"><span class="cl"><span class="cm">** the aggregate SQL function is running.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_aggregate_context</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nBytes</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: User Data For Functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_context
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_user_data() interface returns a copy of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the pointer that was the pUserData parameter (the 5th parameter)
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the [sqlite3_create_function()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and [sqlite3_create_function16()] routines that originally
</span></span></span><span class="line"><span class="cl"><span class="cm">** registered the application defined function.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This routine must be called from the same thread in which
</span></span></span><span class="line"><span class="cl"><span class="cm">** the application-defined function is running.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_user_data</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Database Connection For Functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_context
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_context_db_handle() interface returns a copy of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the pointer to the [database connection] (the 1st parameter)
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the [sqlite3_create_function()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and [sqlite3_create_function16()] routines that originally
</span></span></span><span class="line"><span class="cl"><span class="cm">** registered the application defined function.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3</span> <span class="o">*</span><span class="nf">sqlite3_context_db_handle</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Function Auxiliary Data
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_context
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These functions may be used by (non-aggregate) SQL functions to
</span></span></span><span class="line"><span class="cl"><span class="cm">** associate auxiliary data with argument values. If the same argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** value is passed to multiple invocations of the same SQL function during
</span></span></span><span class="line"><span class="cl"><span class="cm">** query execution, under some circumstances the associated auxiliary data
</span></span></span><span class="line"><span class="cl"><span class="cm">** might be preserved. An example of where this might be useful is in a
</span></span></span><span class="line"><span class="cl"><span class="cm">** regular-expression matching function. The compiled version of the regular
</span></span></span><span class="line"><span class="cl"><span class="cm">** expression can be stored as auxiliary data associated with the pattern string.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Then as long as the pattern string remains the same,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the compiled regular expression can be reused on multiple
</span></span></span><span class="line"><span class="cl"><span class="cm">** invocations of the same function.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary data
</span></span></span><span class="line"><span class="cl"><span class="cm">** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** value to the application-defined function. ^N is zero for the left-most
</span></span></span><span class="line"><span class="cl"><span class="cm">** function argument. ^If there is no auxiliary data
</span></span></span><span class="line"><span class="cl"><span class="cm">** associated with the function argument, the sqlite3_get_auxdata(C,N) interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** N-th argument of the application-defined function. ^Subsequent
</span></span></span><span class="line"><span class="cl"><span class="cm">** calls to sqlite3_get_auxdata(C,N) return P from the most recent
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_set_auxdata(C,N,P,X) call if the auxiliary data is still valid or
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL if the auxiliary data has been discarded.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL,
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite will invoke the destructor function X with parameter P exactly
</span></span></span><span class="line"><span class="cl"><span class="cm">** once, when the auxiliary data is discarded.
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite is free to discard the auxiliary data at any time, including: &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(when the corresponding function parameter changes)^, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL statement)^, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(when sqlite3_set_auxdata() is invoked again on the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter)^, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(during the original sqlite3_set_auxdata() call when a memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocation error occurs.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(during the original sqlite3_set_auxdata() call if the function
</span></span></span><span class="line"><span class="cl"><span class="cm">** is evaluated during query planning instead of during query execution,
</span></span></span><span class="line"><span class="cl"><span class="cm">** as sometimes happens with [SQLITE_ENABLE_STAT4].)^ &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note the last two bullets in particular. The destructor X in
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata()
</span></span></span><span class="line"><span class="cl"><span class="cm">** should be called near the end of the function implementation and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** function implementation should not make any use of P after
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_set_auxdata() has been called. Furthermore, a call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_get_auxdata() that occurs immediately after a corresponding call
</span></span></span><span class="line"><span class="cl"><span class="cm">** to sqlite3_set_auxdata() might still return NULL if an out-of-memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** condition occurred during the sqlite3_set_auxdata() call or if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** function is being evaluated during query planning rather than during
</span></span></span><span class="line"><span class="cl"><span class="cm">** query execution.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(In practice, auxiliary data is preserved between function calls for
</span></span></span><span class="line"><span class="cl"><span class="cm">** function parameters that are compile-time constants, including literal
</span></span></span><span class="line"><span class="cl"><span class="cm">** values and [parameters] and expressions composed from the same.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The value of the N parameter to these interfaces should be non-negative.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Future enhancements may make use of negative N values to define new
</span></span></span><span class="line"><span class="cl"><span class="cm">** kinds of function caching behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines must be called from the same thread in which
</span></span></span><span class="line"><span class="cl"><span class="cm">** the SQL function is running.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_get_clientdata()] and [sqlite3_set_clientdata()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_get_auxdata</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_set_auxdata</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">N</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Database Connection Client Data
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These functions are used to associate one or more named pointers
</span></span></span><span class="line"><span class="cl"><span class="cm">** with a [database connection].
</span></span></span><span class="line"><span class="cl"><span class="cm">** A call to sqlite3_set_clientdata(D,N,P,X) causes the pointer P
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be attached to [database connection] D using name N. Subsequent
</span></span></span><span class="line"><span class="cl"><span class="cm">** calls to sqlite3_get_clientdata(D,N) will return a copy of pointer P
</span></span></span><span class="line"><span class="cl"><span class="cm">** or a NULL pointer if there were no prior calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_set_clientdata() with the same values of D and N.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Names are compared using strcmp() and are thus case sensitive.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If P and X are both non-NULL, then the destructor X is invoked with
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument P on the first of the following occurrences:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; An out-of-memory error occurs during the call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_set_clientdata() which attempts to register pointer P.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; A subsequent call to sqlite3_set_clientdata(D,N,P,X) is made
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the same D and N parameters.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The database connection closes. SQLite does not make any guarantees
</span></span></span><span class="line"><span class="cl"><span class="cm">** about the order in which destructors are called, only that all
</span></span></span><span class="line"><span class="cl"><span class="cm">** destructors will be called exactly once at some point during the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connection closing process.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite does not do anything with client data other than invoke
</span></span></span><span class="line"><span class="cl"><span class="cm">** destructors on the client data at the appropriate time. The intended
</span></span></span><span class="line"><span class="cl"><span class="cm">** use for client data is to provide a mechanism for wrapper libraries
</span></span></span><span class="line"><span class="cl"><span class="cm">** to store additional information about an SQLite database connection.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** There is no limit (other than available memory) on the number of different
</span></span></span><span class="line"><span class="cl"><span class="cm">** client data pointers (with different names) that can be attached to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** single database connection. However, the implementation is optimized
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the case of having only one or two different client data names.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Applications and wrapper libraries are discouraged from using more than
</span></span></span><span class="line"><span class="cl"><span class="cm">** one client data name each.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** There is no way to enumerate the client data pointers
</span></span></span><span class="line"><span class="cl"><span class="cm">** associated with a database connection. The N parameter can be thought
</span></span></span><span class="line"><span class="cl"><span class="cm">** of as a secret key such that only code that knows the secret key is able
</span></span></span><span class="line"><span class="cl"><span class="cm">** to access the associated data.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Security Warning: These interfaces should not be exposed in scripting
</span></span></span><span class="line"><span class="cl"><span class="cm">** languages or in other circumstances where it might be possible for an
</span></span></span><span class="line"><span class="cl"><span class="cm">** an attacker to invoke them. Any agent that can invoke these interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** can probably also take control of the process.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Database connection client data is only available for SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** version 3.44.0 ([dateof:3.44.0]) and later.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_set_auxdata()] and [sqlite3_get_auxdata()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_get_clientdata</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_set_clientdata</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Constants Defining Special Destructor Behavior
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These are special values for the destructor that is passed in as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** final argument to routines like [sqlite3_result_blob()]. ^If the destructor
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument is SQLITE_STATIC, it means that the content pointer is constant
</span></span></span><span class="line"><span class="cl"><span class="cm">** and will never change. It does not need to be destroyed. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_TRANSIENT value means that the content will likely change in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the near future and that SQLite should make its own private copy of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the content before returning.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The typedef is necessary to work around problems in certain
</span></span></span><span class="line"><span class="cl"><span class="cm">** C++ compilers.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="nf">void</span> <span class="p">(</span><span class="o">*</span><span class="n">sqlite3_destructor_type</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATIC ((sqlite3_destructor_type)0)
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1)
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Setting The Result Of An SQL Function
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_context
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines are used by the xFunc or xFinal callbacks that
</span></span></span><span class="line"><span class="cl"><span class="cm">** implement SQL functions and aggregates. See
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_create_function()] and [sqlite3_create_function16()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** for additional information.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These functions work very much like the [parameter binding] family of
</span></span></span><span class="line"><span class="cl"><span class="cm">** functions used to bind values to host parameters in prepared statements.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Refer to the [SQL parameter] documentation for additional information.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_blob() interface sets the result from
</span></span></span><span class="line"><span class="cl"><span class="cm">** an application-defined function to be the BLOB whose content is pointed
</span></span></span><span class="line"><span class="cl"><span class="cm">** to by the second parameter and which is N bytes long where N is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** third parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N)
</span></span></span><span class="line"><span class="cl"><span class="cm">** interfaces set the result of the application-defined function to be
</span></span></span><span class="line"><span class="cl"><span class="cm">** a BLOB containing all zero bytes and N bytes in size.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_double() interface sets the result from
</span></span></span><span class="line"><span class="cl"><span class="cm">** an application-defined function to be a floating point value specified
</span></span></span><span class="line"><span class="cl"><span class="cm">** by its 2nd argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_error() and sqlite3_result_error16() functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** cause the implemented SQL function to throw an exception.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite uses the string pointed to by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** as the text of an error message. ^SQLite interprets the error
</span></span></span><span class="line"><span class="cl"><span class="cm">** message string from sqlite3_result_error() as UTF-8. ^SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** interprets the string from sqlite3_result_error16() as UTF-16 using
</span></span></span><span class="line"><span class="cl"><span class="cm">** the same [byte-order determination rules] as [sqlite3_bind_text16()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the third parameter to sqlite3_result_error()
</span></span></span><span class="line"><span class="cl"><span class="cm">** or sqlite3_result_error16() is negative then SQLite takes as the error
</span></span></span><span class="line"><span class="cl"><span class="cm">** message all text up through the first zero character.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the third parameter to sqlite3_result_error() or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_result_error16() is non-negative then SQLite takes that many
</span></span></span><span class="line"><span class="cl"><span class="cm">** bytes (not characters) from the 2nd parameter as the error message.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_error() and sqlite3_result_error16()
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines make a private copy of the error message text before
</span></span></span><span class="line"><span class="cl"><span class="cm">** they return. Hence, the calling function can deallocate or
</span></span></span><span class="line"><span class="cl"><span class="cm">** modify the text after they return without harm.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_error_code() function changes the error code
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned by SQLite as a result of an error in a function. ^By default,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error()
</span></span></span><span class="line"><span class="cl"><span class="cm">** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an
</span></span></span><span class="line"><span class="cl"><span class="cm">** error indicating that a string or BLOB is too long to represent.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an
</span></span></span><span class="line"><span class="cl"><span class="cm">** error indicating that a memory allocation failed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_int() interface sets the return value
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the application-defined function to be the 32-bit signed integer
</span></span></span><span class="line"><span class="cl"><span class="cm">** value given in the 2nd argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_int64() interface sets the return value
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the application-defined function to be the 64-bit signed integer
</span></span></span><span class="line"><span class="cl"><span class="cm">** value given in the 2nd argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_null() interface sets the return value
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the application-defined function to be NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_text(), sqlite3_result_text16(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** set the return value of the application-defined function to be
</span></span></span><span class="line"><span class="cl"><span class="cm">** a text string which is represented as UTF-8, UTF-16 native byte order,
</span></span></span><span class="line"><span class="cl"><span class="cm">** UTF-16 little endian, or UTF-16 big endian, respectively.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_text64() interface sets the return value of an
</span></span></span><span class="line"><span class="cl"><span class="cm">** application-defined function to be a text string in an encoding
</span></span></span><span class="line"><span class="cl"><span class="cm">** specified by the fifth (and last) parameter, which must be one
</span></span></span><span class="line"><span class="cl"><span class="cm">** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite takes the text result from the application from
</span></span></span><span class="line"><span class="cl"><span class="cm">** the 2nd parameter of the sqlite3_result_text* interfaces.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the 3rd parameter to any of the sqlite3_result_text* interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** other than sqlite3_result_text64() is negative, then SQLite computes
</span></span></span><span class="line"><span class="cl"><span class="cm">** the string length itself by searching the 2nd parameter for the first
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero character.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the 3rd parameter to the sqlite3_result_text* interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** is non-negative, then as many bytes (not characters) of the text
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointed to by the 2nd parameter are taken as the application-defined
</span></span></span><span class="line"><span class="cl"><span class="cm">** function result. If the 3rd parameter is non-negative, then it
</span></span></span><span class="line"><span class="cl"><span class="cm">** must be the byte offset into the string where the NUL terminator would
</span></span></span><span class="line"><span class="cl"><span class="cm">** appear if the string where NUL terminated. If any NUL characters occur
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the string at a byte offset that is less than the value of the 3rd
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter, then the resulting string will contain embedded NULs and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** result of expressions operating on strings with embedded NULs is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the 4th parameter to the sqlite3_result_text* interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that
</span></span></span><span class="line"><span class="cl"><span class="cm">** function as the destructor on the text or BLOB result when it has
</span></span></span><span class="line"><span class="cl"><span class="cm">** finished using that result.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the 4th parameter to the sqlite3_result_text* interfaces or to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** assumes that the text or BLOB result is in constant space and does not
</span></span></span><span class="line"><span class="cl"><span class="cm">** copy the content of the parameter nor call a destructor on the content
</span></span></span><span class="line"><span class="cl"><span class="cm">** when it has finished using that result.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the 4th parameter to the sqlite3_result_text* interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
</span></span></span><span class="line"><span class="cl"><span class="cm">** then SQLite makes a copy of the result into space obtained
</span></span></span><span class="line"><span class="cl"><span class="cm">** from [sqlite3_malloc()] before it returns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^For the sqlite3_result_text16(), sqlite3_result_text16le(), and
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_result_text16be() routines, and for sqlite3_result_text64()
</span></span></span><span class="line"><span class="cl"><span class="cm">** when the encoding is not UTF8, if the input UTF16 begins with a
</span></span></span><span class="line"><span class="cl"><span class="cm">** byte-order mark (BOM, U+FEFF) then the BOM is removed from the
</span></span></span><span class="line"><span class="cl"><span class="cm">** string and the rest of the string is interpreted according to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** byte-order specified by the BOM. ^The byte-order specified by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the BOM at the beginning of the text overrides the byte-order
</span></span></span><span class="line"><span class="cl"><span class="cm">** specified by the interface procedure. ^So, for example, if
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_result_text16le() is invoked with text that begins
</span></span></span><span class="line"><span class="cl"><span class="cm">** with bytes 0xfe, 0xff (a big-endian byte-order mark) then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** first two bytes of input are skipped and the remaining input
</span></span></span><span class="line"><span class="cl"><span class="cm">** is interpreted as UTF16BE text.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^For UTF16 input text to the sqlite3_result_text16(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_result_text16be(), sqlite3_result_text16le(), and
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_result_text64() routines, if the text contains invalid
</span></span></span><span class="line"><span class="cl"><span class="cm">** UTF16 characters, the invalid characters might be converted
</span></span></span><span class="line"><span class="cl"><span class="cm">** into the unicode replacement character, U+FFFD.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_value() interface sets the result of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the application-defined function to be a copy of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
</span></span></span><span class="line"><span class="cl"><span class="cm">** so that the [sqlite3_value] specified in the parameter may change or
</span></span></span><span class="line"><span class="cl"><span class="cm">** be deallocated after sqlite3_result_value() returns without harm.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A [protected sqlite3_value] object may always be used where an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [unprotected sqlite3_value] object is required, so either
</span></span></span><span class="line"><span class="cl"><span class="cm">** kind of [sqlite3_value] object can be used with this interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL NULL value, just like [sqlite3_result_null(C)], except that it
</span></span></span><span class="line"><span class="cl"><span class="cm">** also associates the host-language pointer P or type T with that
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL value such that the pointer can be retrieved within an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [application-defined SQL function] using [sqlite3_value_pointer()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the D parameter is not NULL, then it is a pointer to a destructor
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the P parameter. ^SQLite invokes D with P as its only argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** when SQLite is finished with P. The T parameter should be a static
</span></span></span><span class="line"><span class="cl"><span class="cm">** string and preferably a string literal. The sqlite3_result_pointer()
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If these routines are called from within the different thread
</span></span></span><span class="line"><span class="cl"><span class="cm">** than the one containing the application-defined function that received
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3_context] pointer, the results are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_blob</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_blob64</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_uint64</span><span class="p">,</span><span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_double</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="kt">double</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_error</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_error16</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_error_toobig</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_error_nomem</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_error_code</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_int</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_int64</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_int64</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_null</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_text</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_text64</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="n">sqlite3_uint64</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">),</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">encoding</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_text16</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_text16le</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span><span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_text16be</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span><span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_value</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_value</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_pointer</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_zeroblob</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">n</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_result_zeroblob64</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_uint64</span> <span class="n">n</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Setting The Subtype Of An SQL Function
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_context
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_result_subtype(C,T) function causes the subtype of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the result from the [application-defined SQL function] with
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_context] C to be the value T. Only the lower 8 bits
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the subtype T are preserved in current versions of SQLite;
</span></span></span><span class="line"><span class="cl"><span class="cm">** higher order bits are discarded.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The number of subtype bytes preserved by SQLite might increase
</span></span></span><span class="line"><span class="cl"><span class="cm">** in future releases of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Every [application-defined SQL function] that invokes this interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** should include the [SQLITE_RESULT_SUBTYPE] property in its
</span></span></span><span class="line"><span class="cl"><span class="cm">** text encoding argument when the SQL function is
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** property is omitted from the function that invokes sqlite3_result_subtype(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** then in some cases the sqlite3_result_subtype() might fail to set
</span></span></span><span class="line"><span class="cl"><span class="cm">** the result subtype.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL function that invokes the sqlite3_result_subtype() interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** and that does not have the SQLITE_RESULT_SUBTYPE property will raise
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1
</span></span></span><span class="line"><span class="cl"><span class="cm">** by default.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_result_subtype</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Define New Collating Sequences
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These functions add, remove, or modify a [collation] associated
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the [database connection] specified as the first argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The name of the collation is a UTF-8 string
</span></span></span><span class="line"><span class="cl"><span class="cm">** for sqlite3_create_collation() and sqlite3_create_collation_v2()
</span></span></span><span class="line"><span class="cl"><span class="cm">** and a UTF-16 string in native byte order for sqlite3_create_collation16().
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Collation names that compare equal according to [sqlite3_strnicmp()] are
</span></span></span><span class="line"><span class="cl"><span class="cm">** considered to be the same name.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The third argument (eTextRep) must be one of the constants:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_UTF8],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_UTF16LE],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_UTF16BE],
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_UTF16], or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [SQLITE_UTF16_ALIGNED].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The eTextRep argument determines the encoding of strings passed
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the collating function callback, xCompare.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
</span></span></span><span class="line"><span class="cl"><span class="cm">** force strings to be UTF16 with native byte order.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
</span></span></span><span class="line"><span class="cl"><span class="cm">** on an even byte address.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The fourth argument, pArg, is an application data pointer that is passed
</span></span></span><span class="line"><span class="cl"><span class="cm">** through as the first argument to the collating function callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The fifth argument, xCompare, is a pointer to the collating function.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Multiple collating functions can be registered using the same name but
</span></span></span><span class="line"><span class="cl"><span class="cm">** with different eTextRep parameters and SQLite will use whichever
</span></span></span><span class="line"><span class="cl"><span class="cm">** function requires the least amount of data transformation.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the xCompare argument is NULL then the collating function is
</span></span></span><span class="line"><span class="cl"><span class="cm">** deleted. ^When all collating functions having the same name are deleted,
</span></span></span><span class="line"><span class="cl"><span class="cm">** that collation is no longer usable.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The collating function callback is invoked with a copy of the pArg
</span></span></span><span class="line"><span class="cl"><span class="cm">** application data pointer and with two strings in the encoding specified
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the eTextRep argument. The two integer parameters to the collating
</span></span></span><span class="line"><span class="cl"><span class="cm">** function callback are the length of the two strings, in bytes. The collating
</span></span></span><span class="line"><span class="cl"><span class="cm">** function must return an integer that is negative, zero, or positive
</span></span></span><span class="line"><span class="cl"><span class="cm">** if the first string is less than, equal to, or greater than the second,
</span></span></span><span class="line"><span class="cl"><span class="cm">** respectively. A collating function must always return the same answer
</span></span></span><span class="line"><span class="cl"><span class="cm">** given the same inputs. If two or more collating functions are registered
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the same collation name (using different eTextRep values) then all
</span></span></span><span class="line"><span class="cl"><span class="cm">** must give an equivalent answer when invoked with equivalent strings.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The collating function must obey the following properties for all
</span></span></span><span class="line"><span class="cl"><span class="cm">** strings A, B, and C:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; If A==B then B==A.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; If A==B and B==C then A==C.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; If A&amp;lt;B THEN B&amp;gt;A.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; If A&amp;lt;B and B&amp;lt;C then A&amp;lt;C.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a collating function fails any of the above constraints and that
</span></span></span><span class="line"><span class="cl"><span class="cm">** collating function is registered and used, then the behavior of SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the addition that the xDestroy callback is invoked on pArg when
</span></span></span><span class="line"><span class="cl"><span class="cm">** the collating function is deleted.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Collating functions are deleted when they are overridden by later
</span></span></span><span class="line"><span class="cl"><span class="cm">** calls to the collation creation functions or when the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] is closed using [sqlite3_close()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The xDestroy callback is &lt;u&gt;not&lt;/u&gt; called if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_create_collation_v2() function fails. Applications that invoke
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should
</span></span></span><span class="line"><span class="cl"><span class="cm">** check the return code and dispose of the application data pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** themselves rather than expecting SQLite to deal with it for them.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This is different from every other SQLite interface. The inconsistency
</span></span></span><span class="line"><span class="cl"><span class="cm">** is unfortunate but cannot be changed without breaking backwards
</span></span></span><span class="line"><span class="cl"><span class="cm">** compatibility.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_create_collation</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eTextRep</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pArg</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xCompare</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_create_collation_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eTextRep</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pArg</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xCompare</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="n">xDestroy</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_create_collation16</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eTextRep</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pArg</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xCompare</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Collation Needed Callbacks
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^To avoid having to register all collation sequences before a database
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be used, a single callback function may be registered with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] to be invoked whenever an undefined collation
</span></span></span><span class="line"><span class="cl"><span class="cm">** sequence is required.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the function is registered using the sqlite3_collation_needed() API,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then it is passed the names of undefined collation sequences as strings
</span></span></span><span class="line"><span class="cl"><span class="cm">** encoded in UTF-8. ^If sqlite3_collation_needed16() is used,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the names are passed as UTF-16 in machine native byte order.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A call to either function replaces the existing collation-needed callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(When the callback is invoked, the first argument passed is a copy
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the second argument to sqlite3_collation_needed() or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_collation_needed16(). The second argument is the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [SQLITE_UTF16LE], indicating the most desirable form of the collation
</span></span></span><span class="line"><span class="cl"><span class="cm">** sequence function required. The fourth parameter is the name of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** required collation sequence.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The callback function should register the desired collation using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_create_collation_v2()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_collation_needed</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span> <span class="n">eTextRep</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_collation_needed16</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span> <span class="n">eTextRep</span><span class="p">,</span><span class="k">const</span> <span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef SQLITE_ENABLE_CEROD
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Specify the activation key for a CEROD database. Unless
</span></span></span><span class="line"><span class="cl"><span class="cm">** activated, none of the CEROD routines will work.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_activate_cerod</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zPassPhrase</span> <span class="cm">/* Activation phrase */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Suspend Execution For A Short Time
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_sleep() function causes the current thread to suspend execution
</span></span></span><span class="line"><span class="cl"><span class="cm">** for at least a number of milliseconds specified in its parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the operating system does not support sleep requests with
</span></span></span><span class="line"><span class="cl"><span class="cm">** millisecond time resolution, then the time will be rounded up to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the nearest second. The number of milliseconds of sleep actually
</span></span></span><span class="line"><span class="cl"><span class="cm">** requested from the operating system is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite implements this interface by calling the xSleep()
</span></span></span><span class="line"><span class="cl"><span class="cm">** method of the default [sqlite3_vfs] object. If the xSleep() method
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the default VFS is not implemented correctly, or not implemented at
</span></span></span><span class="line"><span class="cl"><span class="cm">** all, then the behavior of sqlite3_sleep() may deviate from the description
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the previous paragraphs.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a negative argument is passed to sqlite3_sleep() the results vary by
</span></span></span><span class="line"><span class="cl"><span class="cm">** VFS and operating system. Some system treat a negative argument as an
</span></span></span><span class="line"><span class="cl"><span class="cm">** instruction to sleep forever. Others understand it to mean do not sleep
</span></span></span><span class="line"><span class="cl"><span class="cm">** at all. ^In SQLite version 3.42.0 and later, a negative
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument passed into sqlite3_sleep() is changed to zero before it is relayed
</span></span></span><span class="line"><span class="cl"><span class="cm">** down into the xSleep method of the VFS.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_sleep</span><span class="p">(</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Name Of The Folder Holding Temporary Files
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If this global variable is made to point to a string which is
</span></span></span><span class="line"><span class="cl"><span class="cm">** the name of a folder (a.k.a. directory), then all temporary files
</span></span></span><span class="line"><span class="cl"><span class="cm">** created by SQLite when using a built-in [sqlite3_vfs | VFS]
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be placed in that directory.)^ ^If this variable
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a NULL pointer, then SQLite performs a search for an appropriate
</span></span></span><span class="line"><span class="cl"><span class="cm">** temporary file directory.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Applications are strongly discouraged from using this global variable.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is required to set a temporary folder on Windows Runtime (WinRT).
</span></span></span><span class="line"><span class="cl"><span class="cm">** But for all other platforms, it is highly recommended that applications
</span></span></span><span class="line"><span class="cl"><span class="cm">** neither read nor write this variable. This global variable is a relic
</span></span></span><span class="line"><span class="cl"><span class="cm">** that exists for backwards compatibility of legacy applications and should
</span></span></span><span class="line"><span class="cl"><span class="cm">** be avoided in new projects.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is not safe to read or modify this variable in more than one
</span></span></span><span class="line"><span class="cl"><span class="cm">** thread at a time. It is not safe to read or modify this variable
</span></span></span><span class="line"><span class="cl"><span class="cm">** if a [database connection] is being used at the same time in a separate
</span></span></span><span class="line"><span class="cl"><span class="cm">** thread.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is intended that this variable be set once
</span></span></span><span class="line"><span class="cl"><span class="cm">** as part of process initialization and before any SQLite interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines have been called and that this variable remain unchanged
</span></span></span><span class="line"><span class="cl"><span class="cm">** thereafter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [temp_store_directory pragma] may modify this variable and cause
</span></span></span><span class="line"><span class="cl"><span class="cm">** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [temp_store_directory pragma] always assumes that any string
</span></span></span><span class="line"><span class="cl"><span class="cm">** that this variable points to is held in memory obtained from
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_malloc] and the pragma may attempt to free that memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** using [sqlite3_free].
</span></span></span><span class="line"><span class="cl"><span class="cm">** Hence, if this variable is modified directly, either it should be
</span></span></span><span class="line"><span class="cl"><span class="cm">** made NULL or made to point to memory obtained from [sqlite3_malloc]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or else the use of the [temp_store_directory pragma] should be avoided.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Except when requested by the [temp_store_directory pragma], SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** does not free the memory that sqlite3_temp_directory points to. If
</span></span></span><span class="line"><span class="cl"><span class="cm">** the application wants that memory to be freed, it must do
</span></span></span><span class="line"><span class="cl"><span class="cm">** so itself, taking care to only do so after all [database connection]
</span></span></span><span class="line"><span class="cl"><span class="cm">** objects have been destroyed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Note to Windows Runtime users:&lt;/b&gt; The temporary directory must be set
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior to calling [sqlite3_open] or [sqlite3_open_v2]. Otherwise, various
</span></span></span><span class="line"><span class="cl"><span class="cm">** features that require the use of temporary files may fail. Here is an
</span></span></span><span class="line"><span class="cl"><span class="cm">** example of how to do this using C++ with the Windows Runtime:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;&lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** LPCWSTR zPath = Windows::Storage::ApplicationData::Current-&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; TemporaryFolder-&gt;Path-&gt;Data();
</span></span></span><span class="line"><span class="cl"><span class="cm">** char zPathBuf&amp;#91;MAX_PATH + 1&amp;#93;;
</span></span></span><span class="line"><span class="cl"><span class="cm">** memset(zPathBuf, 0, sizeof(zPathBuf));
</span></span></span><span class="line"><span class="cl"><span class="cm">** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf),
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; NULL, NULL);
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_temp_directory = sqlite3_mprintf(&#34;%s&#34;, zPathBuf);
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;&lt;/blockquote&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_EXTERN</span> <span class="kt">char</span> <span class="o">*</span><span class="n">sqlite3_temp_directory</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Name Of The Folder Holding Database Files
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If this global variable is made to point to a string which is
</span></span></span><span class="line"><span class="cl"><span class="cm">** the name of a folder (a.k.a. directory), then all database files
</span></span></span><span class="line"><span class="cl"><span class="cm">** specified with a relative pathname and created or accessed by
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite when using a built-in windows [sqlite3_vfs | VFS] will be assumed
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be relative to that directory.)^ ^If this variable is a NULL
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer, then SQLite assumes that all database files specified
</span></span></span><span class="line"><span class="cl"><span class="cm">** with a relative pathname are relative to the current directory
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the process. Only the windows VFS makes use of this global
</span></span></span><span class="line"><span class="cl"><span class="cm">** variable; it is ignored by the unix VFS.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Changing the value of this variable while a database connection is
</span></span></span><span class="line"><span class="cl"><span class="cm">** open can result in a corrupt database.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is not safe to read or modify this variable in more than one
</span></span></span><span class="line"><span class="cl"><span class="cm">** thread at a time. It is not safe to read or modify this variable
</span></span></span><span class="line"><span class="cl"><span class="cm">** if a [database connection] is being used at the same time in a separate
</span></span></span><span class="line"><span class="cl"><span class="cm">** thread.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is intended that this variable be set once
</span></span></span><span class="line"><span class="cl"><span class="cm">** as part of process initialization and before any SQLite interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines have been called and that this variable remain unchanged
</span></span></span><span class="line"><span class="cl"><span class="cm">** thereafter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [data_store_directory pragma] may modify this variable and cause
</span></span></span><span class="line"><span class="cl"><span class="cm">** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [data_store_directory pragma] always assumes that any string
</span></span></span><span class="line"><span class="cl"><span class="cm">** that this variable points to is held in memory obtained from
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_malloc] and the pragma may attempt to free that memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** using [sqlite3_free].
</span></span></span><span class="line"><span class="cl"><span class="cm">** Hence, if this variable is modified directly, either it should be
</span></span></span><span class="line"><span class="cl"><span class="cm">** made NULL or made to point to memory obtained from [sqlite3_malloc]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or else the use of the [data_store_directory pragma] should be avoided.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_EXTERN</span> <span class="kt">char</span> <span class="o">*</span><span class="n">sqlite3_data_directory</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Win32 Specific Interface
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These interfaces are available only on Windows. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_win32_set_directory] interface is used to set the value associated
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the [sqlite3_temp_directory] or [sqlite3_data_directory] variable, to
</span></span></span><span class="line"><span class="cl"><span class="cm">** zValue, depending on the value of the type parameter. The zValue parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** should be NULL to cause the previous value to be freed via [sqlite3_free];
</span></span></span><span class="line"><span class="cl"><span class="cm">** a non-NULL value will be copied into memory obtained from [sqlite3_malloc]
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior to being used. The [sqlite3_win32_set_directory] interface returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_OK] to indicate success, [SQLITE_ERROR] if the type is unsupported,
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [SQLITE_NOMEM] if memory could not be allocated. The value of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_data_directory] variable is intended to act as a replacement for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the current directory on the sub-platforms of Win32 where that concept is
</span></span></span><span class="line"><span class="cl"><span class="cm">** not present, e.g. WinRT and UWP. The [sqlite3_win32_set_directory8] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_win32_set_directory16] interfaces behave exactly the same as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_win32_set_directory interface except the string parameter must be
</span></span></span><span class="line"><span class="cl"><span class="cm">** UTF-8 or UTF-16, respectively.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_win32_set_directory</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">long</span> <span class="n">type</span><span class="p">,</span> <span class="cm">/* Identifier for directory being set or reset */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">zValue</span> <span class="cm">/* New value for directory being set or reset */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_win32_set_directory8</span><span class="p">(</span><span class="kt">unsigned</span> <span class="kt">long</span> <span class="n">type</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zValue</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_win32_set_directory16</span><span class="p">(</span><span class="kt">unsigned</span> <span class="kt">long</span> <span class="n">type</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">zValue</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Win32 Directory Types
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These macros are only available on Windows. They define the allowed values
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the type argument to the [sqlite3_win32_set_directory] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_WIN32_DATA_DIRECTORY_TYPE 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_WIN32_TEMP_DIRECTORY_TYPE 2
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Test For Auto-Commit Mode
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {autocommit mode}
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_get_autocommit() interface returns non-zero or
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero if the given database connection is or is not in autocommit mode,
</span></span></span><span class="line"><span class="cl"><span class="cm">** respectively. ^Autocommit mode is on by default.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Autocommit mode is disabled by a [BEGIN] statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If certain kinds of errors occur on a statement within a multi-statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** transaction might be rolled back automatically. The only way to
</span></span></span><span class="line"><span class="cl"><span class="cm">** find out whether SQLite automatically rolled back the transaction after
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error is to use this function.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If another thread changes the autocommit status of the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection while this routine is running, then the return value
</span></span></span><span class="line"><span class="cl"><span class="cm">** is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_get_autocommit</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Find The Database Handle Of A Prepared Statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_db_handle interface returns the [database connection] handle
</span></span></span><span class="line"><span class="cl"><span class="cm">** to which a [prepared statement] belongs. ^The [database connection]
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned by sqlite3_db_handle is the same [database connection]
</span></span></span><span class="line"><span class="cl"><span class="cm">** that was the first argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
</span></span></span><span class="line"><span class="cl"><span class="cm">** create the statement in the first place.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3</span> <span class="o">*</span><span class="nf">sqlite3_db_handle</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Return The Schema Name For A Database Connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the N-th database on database connection D, or a NULL pointer of N is
</span></span></span><span class="line"><span class="cl"><span class="cm">** out of range. An N value of 0 means the main database file. An N of 1 is
</span></span></span><span class="line"><span class="cl"><span class="cm">** the &#34;temp&#34; schema. Larger values of N correspond to various ATTACH-ed
</span></span></span><span class="line"><span class="cl"><span class="cm">** databases.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Space to hold the string that is returned by sqlite3_db_name() is managed
</span></span></span><span class="line"><span class="cl"><span class="cm">** by SQLite itself. The string might be deallocated by any operation that
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes the schema, including [ATTACH] or [DETACH] or calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_serialize()] or [sqlite3_deserialize()], even operations that
</span></span></span><span class="line"><span class="cl"><span class="cm">** occur on a different thread. Applications that need to
</span></span></span><span class="line"><span class="cl"><span class="cm">** remember the string long-term should make their own copy. Applications that
</span></span></span><span class="line"><span class="cl"><span class="cm">** are accessing the same database connection simultaneously on multiple
</span></span></span><span class="line"><span class="cl"><span class="cm">** threads should mutex-protect calls to this API and should make their own
</span></span></span><span class="line"><span class="cl"><span class="cm">** private copy of the result prior to releasing the mutex.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_db_name</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="kt">int</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Return The Filename For A Database Connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_db_filename(D,N) interface returns a pointer to the filename
</span></span></span><span class="line"><span class="cl"><span class="cm">** associated with database N of connection D.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If there is no attached database N on the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection D, or if database N is a temporary or in-memory database, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** this function will return either a NULL pointer or an empty string.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The string value returned by this routine is owned and managed by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database connection. ^The value will be valid until the database N
</span></span></span><span class="line"><span class="cl"><span class="cm">** is [DETACH]-ed or until the database connection closes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The filename returned by this function is the output of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xFullPathname method of the [VFS]. ^In other words, the filename
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be an absolute pathname, even if the filename used
</span></span></span><span class="line"><span class="cl"><span class="cm">** to open the database originally was a URI or relative pathname.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the filename pointer returned by this routine is not NULL, then it
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be used as the filename input parameter to these routines:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_uri_parameter()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_uri_boolean()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_uri_int64()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_filename_database()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_filename_journal()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_filename_wal()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_filename</span> <span class="nf">sqlite3_db_filename</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDbName</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Determine if a database is read-only
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
</span></span></span><span class="line"><span class="cl"><span class="cm">** of connection D is read-only, 0 if it is read/write, or -1 if N is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** the name of a database on connection D.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_db_readonly</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDbName</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Determine the transaction state of a database
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_txn_state(D,S) interface returns the current
</span></span></span><span class="line"><span class="cl"><span class="cm">** [transaction state] of schema S in database connection D. ^If S is NULL,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the highest transaction state of any schema on database connection D
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned. Transaction states are (in order of lowest to highest):
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li value=&#34;0&#34;&gt; SQLITE_TXN_NONE
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li value=&#34;1&#34;&gt; SQLITE_TXN_READ
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li value=&#34;2&#34;&gt; SQLITE_TXN_WRITE
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a valid schema, then -1 is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_txn_state</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSchema</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Allowed return values from sqlite3_txn_state()
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {transaction state}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants define the current transaction state of a database file.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_txn_state(D,S)] interface returns one of these
</span></span></span><span class="line"><span class="cl"><span class="cm">** constants in order to describe the transaction state of schema S
</span></span></span><span class="line"><span class="cl"><span class="cm">** in [database connection] D.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_TXN_NONE]] &lt;dt&gt;SQLITE_TXN_NONE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_TXN_NONE state means that no transaction is currently
</span></span></span><span class="line"><span class="cl"><span class="cm">** pending.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_TXN_READ]] &lt;dt&gt;SQLITE_TXN_READ&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_TXN_READ state means that the database is currently
</span></span></span><span class="line"><span class="cl"><span class="cm">** in a read transaction. Content has been read from the database file
</span></span></span><span class="line"><span class="cl"><span class="cm">** but nothing in the database file has changed. The transaction state
</span></span></span><span class="line"><span class="cl"><span class="cm">** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
</span></span></span><span class="line"><span class="cl"><span class="cm">** no other conflicting concurrent write transactions. The transaction
</span></span></span><span class="line"><span class="cl"><span class="cm">** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [COMMIT].&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_TXN_WRITE]] &lt;dt&gt;SQLITE_TXN_WRITE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The SQLITE_TXN_WRITE state means that the database is currently
</span></span></span><span class="line"><span class="cl"><span class="cm">** in a write transaction. Content has been written to the database file
</span></span></span><span class="line"><span class="cl"><span class="cm">** but has not yet committed. The transaction state will change to
</span></span></span><span class="line"><span class="cl"><span class="cm">** to SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TXN_NONE 0
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TXN_READ 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TXN_WRITE 2
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Find the next prepared statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This interface returns a pointer to the next [prepared statement] after
</span></span></span><span class="line"><span class="cl"><span class="cm">** pStmt associated with the [database connection] pDb. ^If pStmt is NULL
</span></span></span><span class="line"><span class="cl"><span class="cm">** then this interface returns a pointer to the first prepared statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** associated with the database connection pDb. ^If no prepared statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** satisfies the conditions of this routine, it returns NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [database connection] pointer D in a call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_next_stmt(D,S)] must refer to an open database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection and in particular must not be a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="nf">sqlite3_next_stmt</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">pDb</span><span class="p">,</span> <span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Commit And Rollback Notification Callbacks
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_commit_hook() interface registers a callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** function to be invoked whenever a transaction is [COMMIT | committed].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Any callback set by a previous call to sqlite3_commit_hook()
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the same database connection is overridden.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_rollback_hook() interface registers a callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** function to be invoked whenever a transaction is [ROLLBACK | rolled back].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Any callback set by a previous call to sqlite3_rollback_hook()
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the same database connection is overridden.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The pArg argument is passed through to the callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the callback on a commit hook function returns non-zero,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the commit is converted into a rollback.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** return the P argument from the previous call of the same function
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the same [database connection] D, or NULL for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the first call for each function on D.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The commit and rollback hook callbacks are not reentrant.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The callback implementation must not do anything that will modify
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database connection that invoked the callback. Any actions
</span></span></span><span class="line"><span class="cl"><span class="cm">** to modify the database connection must be deferred until after the
</span></span></span><span class="line"><span class="cl"><span class="cm">** completion of the [sqlite3_step()] call that triggered the commit
</span></span></span><span class="line"><span class="cl"><span class="cm">** or rollback hook in the first place.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that running any other SQL statements, including SELECT statements,
</span></span></span><span class="line"><span class="cl"><span class="cm">** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database connections for the meaning of &#34;modify&#34; in this paragraph.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Registering a NULL function disables the callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When the commit hook callback routine returns zero, the [COMMIT]
</span></span></span><span class="line"><span class="cl"><span class="cm">** operation is allowed to continue normally. ^If the commit hook
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The rollback hook is invoked on a rollback that results from a commit
</span></span></span><span class="line"><span class="cl"><span class="cm">** hook returning non-zero, just as it would be with any other rollback.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^For the purposes of this API, a transaction is said to have been
</span></span></span><span class="line"><span class="cl"><span class="cm">** rolled back if an explicit &#34;ROLLBACK&#34; statement is executed, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error or constraint causes an implicit rollback to occur.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The rollback callback is not invoked if a transaction is
</span></span></span><span class="line"><span class="cl"><span class="cm">** automatically rolled back because the database connection is closed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also the [sqlite3_update_hook()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_commit_hook</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">),</span> <span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_rollback_hook</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="p">),</span> <span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Autovacuum Compaction Amount Callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_autovacuum_pages(D,C,P,X) interface registers a callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** function C that is invoked prior to each autovacuum of the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** file. ^The callback is passed a copy of the generic data pointer (P),
</span></span></span><span class="line"><span class="cl"><span class="cm">** the schema-name of the attached database that is being autovacuumed,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the size of the database file in pages, the number of free pages,
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the number of bytes per page, respectively. The callback should
</span></span></span><span class="line"><span class="cl"><span class="cm">** return the number of free pages that should be removed by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** autovacuum. ^If the callback returns zero, then no autovacuum happens.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the value returned is greater than or equal to the number of
</span></span></span><span class="line"><span class="cl"><span class="cm">** free pages, then a complete autovacuum happens.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;^If there are multiple ATTACH-ed database files that are being
</span></span></span><span class="line"><span class="cl"><span class="cm">** modified as part of a transaction commit, then the autovacuum pages
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback is invoked separately for each file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;&lt;b&gt;The callback is not reentrant.&lt;/b&gt; The callback function should
</span></span></span><span class="line"><span class="cl"><span class="cm">** not attempt to invoke any other SQLite interface. If it does, bad
</span></span></span><span class="line"><span class="cl"><span class="cm">** things may happen, including segmentation faults and corrupt database
</span></span></span><span class="line"><span class="cl"><span class="cm">** files. The callback function should be a simple function that
</span></span></span><span class="line"><span class="cl"><span class="cm">** does some arithmetic on its input parameters and returns a result.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The X parameter to sqlite3_autovacuum_pages(D,C,P,X) is an optional
</span></span></span><span class="line"><span class="cl"><span class="cm">** destructor for the P parameter. ^If X is not NULL, then X(P) is
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked whenever the database connection closes or when the callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** is overwritten by another invocation of sqlite3_autovacuum_pages().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;^There is only one autovacuum pages callback per database connection.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Each call to the sqlite3_autovacuum_pages() interface overrides all
</span></span></span><span class="line"><span class="cl"><span class="cm">** previous invocations for that database connection. ^If the callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the autovacuum steps callback is canceled. The return value
</span></span></span><span class="line"><span class="cl"><span class="cm">** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might
</span></span></span><span class="line"><span class="cl"><span class="cm">** be some other error code if something goes wrong. The current
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other
</span></span></span><span class="line"><span class="cl"><span class="cm">** return codes might be added in future releases.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;If no autovacuum pages callback is specified (the usual case) or
</span></span></span><span class="line"><span class="cl"><span class="cm">** a NULL pointer is provided for the callback,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the default behavior is to vacuum all free pages. So, in other
</span></span></span><span class="line"><span class="cl"><span class="cm">** words, the default behavior is the same as if the callback function
</span></span></span><span class="line"><span class="cl"><span class="cm">** were something like this:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;&lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; unsigned int demonstration_autovac_pages_callback(
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; void *pClientData,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; const char *zSchema,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; unsigned int nDbPage,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; unsigned int nFreePage,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; unsigned int nBytePerPage
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; ){
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; return nFreePage;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; }
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;&lt;/blockquote&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_autovacuum_pages</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="p">,</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="p">,</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Data Change Notification Callbacks
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_update_hook() interface registers a callback function
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the [database connection] identified by the first argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be invoked whenever a row is updated, inserted or deleted in
</span></span></span><span class="line"><span class="cl"><span class="cm">** a [rowid table].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Any callback set by a previous call to this function
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the same database connection is overridden.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The second argument is a pointer to the function to invoke when a
</span></span></span><span class="line"><span class="cl"><span class="cm">** row is updated, inserted or deleted in a rowid table.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first argument to the callback is a copy of the third argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** to sqlite3_update_hook().
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [SQLITE_UPDATE], depending on the operation that caused the callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be invoked.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The third and fourth arguments to the callback contain pointers to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database and table name containing the affected row.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The final callback parameter is the [rowid] of the row.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^In the case of an update, this is the [rowid] after the update takes place.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The update hook is not invoked when internal system tables are
</span></span></span><span class="line"><span class="cl"><span class="cm">** modified (i.e. sqlite_sequence).)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^In the current implementation, the update hook
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not invoked when conflicting rows are deleted because of an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked when rows are deleted using the [truncate optimization].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The exceptions defined in this paragraph might change in a future
</span></span></span><span class="line"><span class="cl"><span class="cm">** release of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Whether the update hook is invoked before or after the
</span></span></span><span class="line"><span class="cl"><span class="cm">** corresponding change is currently unspecified and may differ
</span></span></span><span class="line"><span class="cl"><span class="cm">** depending on the type of change. Do not rely on the order of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** hook call with regards to the final result of the operation which
</span></span></span><span class="line"><span class="cl"><span class="cm">** triggers the hook.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The update hook implementation must not do anything that will modify
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database connection that invoked the update hook. Any actions
</span></span></span><span class="line"><span class="cl"><span class="cm">** to modify the database connection must be deferred until after the
</span></span></span><span class="line"><span class="cl"><span class="cm">** completion of the [sqlite3_step()] call that triggered the update hook.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connections for the meaning of &#34;modify&#34; in this paragraph.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_update_hook(D,C,P) function
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns the P argument from the previous call
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the same [database connection] D, or NULL for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the first call on D.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** and [sqlite3_preupdate_hook()] interfaces.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_update_hook</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="p">,</span><span class="kt">int</span> <span class="p">,</span><span class="kt">char</span> <span class="k">const</span> <span class="o">*</span><span class="p">,</span><span class="kt">char</span> <span class="k">const</span> <span class="o">*</span><span class="p">,</span><span class="n">sqlite3_int64</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="o">*</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Enable Or Disable Shared Pager Cache
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(This routine enables or disables the sharing of the database cache
</span></span></span><span class="line"><span class="cl"><span class="cm">** and schema data structures between [database connection | connections]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the same database. Sharing is enabled if the argument is true
</span></span></span><span class="line"><span class="cl"><span class="cm">** and disabled if the argument is false.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface is omitted if SQLite is compiled with
</span></span></span><span class="line"><span class="cl"><span class="cm">** [-DSQLITE_OMIT_SHARED_CACHE]. The [-DSQLITE_OMIT_SHARED_CACHE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** compile-time option is recommended because the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [use of shared cache mode is discouraged].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Cache sharing is enabled and disabled for an entire process.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
</span></span></span><span class="line"><span class="cl"><span class="cm">** In prior versions of SQLite,
</span></span></span><span class="line"><span class="cl"><span class="cm">** sharing was enabled or disabled for each thread separately.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The cache sharing mode set by this interface effects all subsequent
</span></span></span><span class="line"><span class="cl"><span class="cm">** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** Existing database connections continue to use the sharing mode
</span></span></span><span class="line"><span class="cl"><span class="cm">** that was in effect at the time they were opened.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled
</span></span></span><span class="line"><span class="cl"><span class="cm">** successfully. An [error code] is returned otherwise.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Shared cache is disabled by default. It is recommended that it stay
</span></span></span><span class="line"><span class="cl"><span class="cm">** that way. In other words, do not use this routine. This interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** continues to be provided for historical compatibility, but its use is
</span></span></span><span class="line"><span class="cl"><span class="cm">** discouraged. Any use of shared cache is discouraged. If shared cache
</span></span></span><span class="line"><span class="cl"><span class="cm">** must be used, it is recommended that shared cache only be enabled for
</span></span></span><span class="line"><span class="cl"><span class="cm">** individual database connections using the [sqlite3_open_v2()] interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the [SQLITE_OPEN_SHAREDCACHE] flag.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0
</span></span></span><span class="line"><span class="cl"><span class="cm">** and will always return SQLITE_MISUSE. On those systems,
</span></span></span><span class="line"><span class="cl"><span class="cm">** shared cache mode should be enabled per-database connection via
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface is threadsafe on processors where writing a
</span></span></span><span class="line"><span class="cl"><span class="cm">** 32-bit integer is atomic.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See Also: [SQLite Shared-Cache Mode]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_enable_shared_cache</span><span class="p">(</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Attempt To Free Heap Memory
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_release_memory() interface attempts to free N bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** of heap memory by deallocating non-essential memory allocations
</span></span></span><span class="line"><span class="cl"><span class="cm">** held by the database library. Memory used to cache database
</span></span></span><span class="line"><span class="cl"><span class="cm">** pages to improve performance is an example of non-essential memory.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^sqlite3_release_memory() returns the number of bytes actually freed,
</span></span></span><span class="line"><span class="cl"><span class="cm">** which might be more or less than the amount requested.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_release_memory() routine is a no-op returning zero
</span></span></span><span class="line"><span class="cl"><span class="cm">** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_db_release_memory()]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_release_memory</span><span class="p">(</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Free Memory Used By A Database Connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory as possible from database connection D. Unlike the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_release_memory()] interface, this interface is in effect even
</span></span></span><span class="line"><span class="cl"><span class="cm">** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
</span></span></span><span class="line"><span class="cl"><span class="cm">** omitted.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_release_memory()]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_db_release_memory</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Impose A Limit On Heap Size
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These interfaces impose limits on the amount of heap memory that will be
</span></span></span><span class="line"><span class="cl"><span class="cm">** by all database connections within a single process.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
</span></span></span><span class="line"><span class="cl"><span class="cm">** soft limit on the amount of heap memory that may be allocated by SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite strives to keep heap memory utilization below the soft heap
</span></span></span><span class="line"><span class="cl"><span class="cm">** limit by reducing the number of pages held in the page cache
</span></span></span><span class="line"><span class="cl"><span class="cm">** as heap memory usages approaches the limit.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The soft heap limit is &#34;soft&#34; because even though SQLite strives to stay
</span></span></span><span class="line"><span class="cl"><span class="cm">** below the limit, it will exceed the limit rather than generate
</span></span></span><span class="line"><span class="cl"><span class="cm">** an [SQLITE_NOMEM] error. In other words, the soft heap limit
</span></span></span><span class="line"><span class="cl"><span class="cm">** is advisory only.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_hard_heap_limit64(N) interface sets a hard upper bound of
</span></span></span><span class="line"><span class="cl"><span class="cm">** N bytes on the amount of memory that will be allocated. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_hard_heap_limit64(N) interface is similar to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_soft_heap_limit64(N) except that memory allocations will fail
</span></span></span><span class="line"><span class="cl"><span class="cm">** when the hard heap limit is reached.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The return value from both sqlite3_soft_heap_limit64() and
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_hard_heap_limit64() is the size of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the heap limit prior to the call, or negative in the case of an
</span></span></span><span class="line"><span class="cl"><span class="cm">** error. ^If the argument N is negative
</span></span></span><span class="line"><span class="cl"><span class="cm">** then no change is made to the heap limit. Hence, the current
</span></span></span><span class="line"><span class="cl"><span class="cm">** size of heap limits can be determined by invoking
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_soft_heap_limit64(-1) or sqlite3_hard_heap_limit(-1).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Setting the heap limits to zero disables the heap limiter mechanism.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The soft heap limit may not be greater than the hard heap limit.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N)
</span></span></span><span class="line"><span class="cl"><span class="cm">** is invoked with a value of N that is greater than the hard heap limit,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the soft heap limit is set to the value of the hard heap limit.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The soft heap limit is automatically enabled whenever the hard heap
</span></span></span><span class="line"><span class="cl"><span class="cm">** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the soft heap limit is outside the range of 1..N, then the soft heap
</span></span></span><span class="line"><span class="cl"><span class="cm">** limit is set to N. ^Invoking sqlite3_soft_heap_limit64(0) when the
</span></span></span><span class="line"><span class="cl"><span class="cm">** hard heap limit is enabled makes the soft heap limit equal to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** hard heap limit.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The memory allocation limits can also be adjusted using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [PRAGMA soft_heap_limit] and [PRAGMA hard_heap_limit].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The heap limits are not enforced in the current implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** if one or more of following conditions are true:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The limit value is set to zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Memory accounting is disabled using a combination of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; An alternative page cache implementation is specified using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...).
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The page cache allocates from its own memory pool supplied
</span></span></span><span class="line"><span class="cl"><span class="cm">** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
</span></span></span><span class="line"><span class="cl"><span class="cm">** from the heap.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The circumstances under which SQLite will enforce the heap limits may
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes in future releases of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3_soft_heap_limit64</span><span class="p">(</span><span class="n">sqlite3_int64</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3_hard_heap_limit64</span><span class="p">(</span><span class="n">sqlite3_int64</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Deprecated Soft Heap Limit Interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** DEPRECATED
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface. This routine is provided for historical compatibility
</span></span></span><span class="line"><span class="cl"><span class="cm">** only. All new applications should use the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_soft_heap_limit64()] interface rather than this one.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_DEPRECATED</span> <span class="kt">void</span> <span class="nf">sqlite3_soft_heap_limit</span><span class="p">(</span><span class="kt">int</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Extract Metadata About A Column Of A Table
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** information about column C of table T in database D
</span></span></span><span class="line"><span class="cl"><span class="cm">** on [database connection] X.)^ ^The sqlite3_table_column_metadata()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface returns SQLITE_OK and fills in the non-NULL pointers in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the final five arguments with appropriate values if the specified
</span></span></span><span class="line"><span class="cl"><span class="cm">** column exists. ^The sqlite3_table_column_metadata() interface returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_ERROR if the specified column does not exist.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the column-name parameter to sqlite3_table_column_metadata() is a
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL pointer, then this routine simply checks for the existence of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
</span></span></span><span class="line"><span class="cl"><span class="cm">** does not. If the table name parameter T in a call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is
</span></span></span><span class="line"><span class="cl"><span class="cm">** undefined behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The column is identified by the second, third and fourth parameters to
</span></span></span><span class="line"><span class="cl"><span class="cm">** this function. ^(The second parameter is either the name of the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** (i.e. &#34;main&#34;, &#34;temp&#34;, or an attached database) containing the specified
</span></span></span><span class="line"><span class="cl"><span class="cm">** table or NULL.)^ ^If it is NULL, then all attached databases are searched
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the table using the same algorithm used by the database engine to
</span></span></span><span class="line"><span class="cl"><span class="cm">** resolve unqualified table references.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The third and fourth parameters to this function are the table and column
</span></span></span><span class="line"><span class="cl"><span class="cm">** name of the desired column, respectively.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Metadata is returned by writing to the memory locations passed as the 5th
</span></span></span><span class="line"><span class="cl"><span class="cm">** and subsequent parameters to this function. ^Any of these arguments may be
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL, in which case the corresponding element of metadata is omitted.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;blockquote&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;table border=&#34;1&#34;&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;th&gt; Parameter &lt;th&gt; Output&lt;br&gt;Type &lt;th&gt; Description
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; 5th &lt;td&gt; const char* &lt;td&gt; Data type
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; 6th &lt;td&gt; const char* &lt;td&gt; Name of default collation sequence
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; 7th &lt;td&gt; int &lt;td&gt; True if column has a NOT NULL constraint
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; 8th &lt;td&gt; int &lt;td&gt; True if column is part of the PRIMARY KEY
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; 9th &lt;td&gt; int &lt;td&gt; True if column is [AUTOINCREMENT]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/table&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/blockquote&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The memory pointed to by the character pointers returned for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** declaration type and collation sequence is valid until the next
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to any SQLite API function.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the specified table is actually a view, an [error code] is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the specified column is &#34;rowid&#34;, &#34;oid&#34; or &#34;_rowid_&#34; and the table
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not a [WITHOUT ROWID] table and an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameters are set for the explicitly declared column. ^(If there is no
</span></span></span><span class="line"><span class="cl"><span class="cm">** [INTEGER PRIMARY KEY] column, then the outputs
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the [rowid] are set as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** data type: &#34;INTEGER&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** collation sequence: &#34;BINARY&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** not null: 0
</span></span></span><span class="line"><span class="cl"><span class="cm">** primary key: 1
</span></span></span><span class="line"><span class="cl"><span class="cm">** auto increment: 0
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This function causes all database schemas to be read from disk and
</span></span></span><span class="line"><span class="cl"><span class="cm">** parsed, if that has not already been done, and returns an error if
</span></span></span><span class="line"><span class="cl"><span class="cm">** any errors are encountered while loading the schema.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_table_column_metadata</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Connection handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDbName</span><span class="p">,</span> <span class="cm">/* Database name or NULL */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zTableName</span><span class="p">,</span> <span class="cm">/* Table name */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zColumnName</span><span class="p">,</span> <span class="cm">/* Column name */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="k">const</span> <span class="o">**</span><span class="n">pzDataType</span><span class="p">,</span> <span class="cm">/* OUTPUT: Declared data type */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="k">const</span> <span class="o">**</span><span class="n">pzCollSeq</span><span class="p">,</span> <span class="cm">/* OUTPUT: Collation sequence name */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pNotNull</span><span class="p">,</span> <span class="cm">/* OUTPUT: True if NOT NULL constraint exists */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pPrimaryKey</span><span class="p">,</span> <span class="cm">/* OUTPUT: True if column part of PK */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pAutoinc</span> <span class="cm">/* OUTPUT: True if column is auto-increment */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Load An Extension
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This interface loads an SQLite extension library from the named file.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_load_extension() interface attempts to load an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLite extension] library contained in the file zFile. If
</span></span></span><span class="line"><span class="cl"><span class="cm">** the file cannot be loaded directly, attempts are made to load
</span></span></span><span class="line"><span class="cl"><span class="cm">** with various operating-system specific extensions added.
</span></span></span><span class="line"><span class="cl"><span class="cm">** So for example, if &#34;samplelib&#34; cannot be loaded, then names like
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;samplelib.so&#34; or &#34;samplelib.dylib&#34; or &#34;samplelib.dll&#34; might
</span></span></span><span class="line"><span class="cl"><span class="cm">** be tried also.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The entry point is zProc.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(zProc may be 0, in which case SQLite will try to come up with an
</span></span></span><span class="line"><span class="cl"><span class="cm">** entry point name on its own. It first tries &#34;sqlite3_extension_init&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If that does not work, it constructs a name &#34;sqlite3_X_init&#34; where the
</span></span></span><span class="line"><span class="cl"><span class="cm">** X is consists of the lower-case equivalent of all ASCII alphabetic
</span></span></span><span class="line"><span class="cl"><span class="cm">** characters in the filename from the last &#34;/&#34; to the first following
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;.&#34; and omitting any initial &#34;lib&#34;.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_load_extension() interface returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If an error occurs and pzErrMsg is not 0, then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_load_extension()] interface shall attempt to
</span></span></span><span class="line"><span class="cl"><span class="cm">** fill *pzErrMsg with error message text stored in memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** obtained from [sqlite3_malloc()]. The calling function
</span></span></span><span class="line"><span class="cl"><span class="cm">** should free this memory by calling [sqlite3_free()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Extension loading must be enabled using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_enable_load_extension()] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],1,NULL)
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior to calling this API,
</span></span></span><span class="line"><span class="cl"><span class="cm">** otherwise an error will be returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Security warning:&lt;/b&gt; It is recommended that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method be used to enable only this
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface. The use of the [sqlite3_enable_load_extension()] interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** should be avoided. This will keep the SQL function [load_extension()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** disabled and prevent SQL injections from giving attackers
</span></span></span><span class="line"><span class="cl"><span class="cm">** access to extension loading capabilities.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also the [load_extension() SQL function].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_load_extension</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Load the extension into this database connection */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zFile</span><span class="p">,</span> <span class="cm">/* Name of the shared library containing extension */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zProc</span><span class="p">,</span> <span class="cm">/* Entry point. Derived from zFile if 0 */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="o">**</span><span class="n">pzErrMsg</span> <span class="cm">/* Put error message here if not 0 */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Enable Or Disable Extension Loading
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^So as not to open security holes in older applications that are
</span></span></span><span class="line"><span class="cl"><span class="cm">** unprepared to deal with [extension loading], and as a means of disabling
</span></span></span><span class="line"><span class="cl"><span class="cm">** [extension loading] while evaluating user-entered SQL, the following API
</span></span></span><span class="line"><span class="cl"><span class="cm">** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Extension loading is off by default.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Call the sqlite3_enable_load_extension() routine with onoff==1
</span></span></span><span class="line"><span class="cl"><span class="cm">** to turn extension loading on and call it with onoff==0 to turn
</span></span></span><span class="line"><span class="cl"><span class="cm">** it back off again.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This interface enables or disables both the C-API
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_load_extension()] and the SQL function [load_extension()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)
</span></span></span><span class="line"><span class="cl"><span class="cm">** to enable or disable only the C-API.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Security warning:&lt;/b&gt; It is recommended that extension loading
</span></span></span><span class="line"><span class="cl"><span class="cm">** be enabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
</span></span></span><span class="line"><span class="cl"><span class="cm">** rather than this interface, so the [load_extension()] SQL function
</span></span></span><span class="line"><span class="cl"><span class="cm">** remains disabled. This will prevent SQL injections from giving attackers
</span></span></span><span class="line"><span class="cl"><span class="cm">** access to extension loading capabilities.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_enable_load_extension</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="kt">int</span> <span class="n">onoff</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Automatically Load Statically Linked Extensions
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This interface causes the xEntryPoint() function to be invoked for
</span></span></span><span class="line"><span class="cl"><span class="cm">** each new [database connection] that is created. The idea here is that
</span></span></span><span class="line"><span class="cl"><span class="cm">** xEntryPoint() is the entry point for a statically linked [SQLite extension]
</span></span></span><span class="line"><span class="cl"><span class="cm">** that is to be automatically loaded into all new database connections.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Even though the function prototype shows that xEntryPoint() takes
</span></span></span><span class="line"><span class="cl"><span class="cm">** no arguments and returns void, SQLite invokes xEntryPoint() with three
</span></span></span><span class="line"><span class="cl"><span class="cm">** arguments and expects an integer result as if the signature of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** entry point where as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;&lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; int xEntryPoint(
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; sqlite3 *db,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; const char **pzErrMsg,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; const struct sqlite3_api_routines *pThunk
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; );
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;&lt;/blockquote&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the xEntryPoint routine encounters an error, it should make *pzErrMsg
</span></span></span><span class="line"><span class="cl"><span class="cm">** point to an appropriate error message (obtained from [sqlite3_mprintf()])
</span></span></span><span class="line"><span class="cl"><span class="cm">** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg
</span></span></span><span class="line"><span class="cl"><span class="cm">** is NULL before calling the xEntryPoint(). ^SQLite will invoke
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any
</span></span></span><span class="line"><span class="cl"><span class="cm">** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Calling sqlite3_auto_extension(X) with an entry point X that is already
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the list of automatic extensions is a harmless no-op. ^No entry point
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be called more than once for each database connection that is opened.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_reset_auto_extension()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and [sqlite3_cancel_auto_extension()]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_auto_extension</span><span class="p">(</span><span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="n">xEntryPoint</span><span class="p">)(</span><span class="kt">void</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Cancel Automatic Extension Loading
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
</span></span></span><span class="line"><span class="cl"><span class="cm">** initialization routine X that was registered using a prior call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)]
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine returns 1 if initialization routine X was successfully
</span></span></span><span class="line"><span class="cl"><span class="cm">** unregistered and it returns 0 if X was not on the list of initialization
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_cancel_auto_extension</span><span class="p">(</span><span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="n">xEntryPoint</span><span class="p">)(</span><span class="kt">void</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Reset Automatic Extension Loading
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This interface disables all automatic extensions previously
</span></span></span><span class="line"><span class="cl"><span class="cm">** registered using [sqlite3_auto_extension()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_reset_auto_extension</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Structures used by the virtual table interface
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_vtab</span> <span class="n">sqlite3_vtab</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_index_info</span> <span class="n">sqlite3_index_info</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_vtab_cursor</span> <span class="n">sqlite3_vtab_cursor</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_module</span> <span class="n">sqlite3_module</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Virtual Table Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: sqlite3_module {virtual table module}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This structure, sometimes called a &#34;virtual table module&#34;,
</span></span></span><span class="line"><span class="cl"><span class="cm">** defines the implementation of a [virtual table].
</span></span></span><span class="line"><span class="cl"><span class="cm">** This structure consists mostly of methods for the module.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A virtual table module is created by filling in a persistent
</span></span></span><span class="line"><span class="cl"><span class="cm">** instance of this structure and passing a pointer to that instance
</span></span></span><span class="line"><span class="cl"><span class="cm">** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The registration remains valid until it is replaced by a different
</span></span></span><span class="line"><span class="cl"><span class="cm">** module or until the [database connection] closes. The content
</span></span></span><span class="line"><span class="cl"><span class="cm">** of this structure must not change while it is registered with
</span></span></span><span class="line"><span class="cl"><span class="cm">** any database connection.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_module</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iVersion</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xCreate</span><span class="p">)(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pAux</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="k">const</span><span class="o">*</span><span class="n">argv</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_vtab</span> <span class="o">**</span><span class="n">ppVTab</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xConnect</span><span class="p">)(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pAux</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="k">const</span><span class="o">*</span><span class="n">argv</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_vtab</span> <span class="o">**</span><span class="n">ppVTab</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xBestIndex</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">,</span> <span class="n">sqlite3_index_info</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xDisconnect</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xDestroy</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xOpen</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">,</span> <span class="n">sqlite3_vtab_cursor</span> <span class="o">**</span><span class="n">ppCursor</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xClose</span><span class="p">)(</span><span class="n">sqlite3_vtab_cursor</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xFilter</span><span class="p">)(</span><span class="n">sqlite3_vtab_cursor</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">idxNum</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">idxStr</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="n">argv</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xNext</span><span class="p">)(</span><span class="n">sqlite3_vtab_cursor</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xEof</span><span class="p">)(</span><span class="n">sqlite3_vtab_cursor</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xColumn</span><span class="p">)(</span><span class="n">sqlite3_vtab_cursor</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xRowid</span><span class="p">)(</span><span class="n">sqlite3_vtab_cursor</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_int64</span> <span class="o">*</span><span class="n">pRowid</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xUpdate</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="p">,</span> <span class="n">sqlite3_int64</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xBegin</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xSync</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xCommit</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xRollback</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xFindFunction</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVtab</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nArg</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">**</span><span class="n">pxFunc</span><span class="p">)(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">,</span><span class="n">sqlite3_value</span><span class="o">**</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">**</span><span class="n">ppArg</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xRename</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVtab</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zNew</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* The methods above are in version 1 of the sqlite_module object. Those
</span></span></span><span class="line"><span class="cl"><span class="cm"> ** below are for version 2 and greater. */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xSavepoint</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xRelease</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xRollbackTo</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* The methods above are in versions 1 and 2 of the sqlite_module object.
</span></span></span><span class="line"><span class="cl"><span class="cm"> ** Those below are for version 3 and greater. */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xShadowName</span><span class="p">)(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* The methods above are in versions 1 through 3 of the sqlite_module object.
</span></span></span><span class="line"><span class="cl"><span class="cm"> ** Those below are for version 4 and greater. */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xIntegrity</span><span class="p">)(</span><span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVTab</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSchema</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zTabName</span><span class="p">,</span> <span class="kt">int</span> <span class="n">mFlags</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">pzErr</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Virtual Table Indexing Information
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: sqlite3_index_info
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_index_info structure and its substructures is used as part
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the [virtual table] interface to
</span></span></span><span class="line"><span class="cl"><span class="cm">** pass information into and receive the reply from the [xBestIndex]
</span></span></span><span class="line"><span class="cl"><span class="cm">** method of a [virtual table module]. The fields under **Inputs** are the
</span></span></span><span class="line"><span class="cl"><span class="cm">** inputs to xBestIndex and are read-only. xBestIndex inserts its
</span></span></span><span class="line"><span class="cl"><span class="cm">** results into the **Outputs** fields.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The aConstraint[] array records WHERE clause constraints of the form:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;column OP expr&lt;/blockquote&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** where OP is =, &amp;lt;, &amp;lt;=, &amp;gt;, or &amp;gt;=.)^ ^(The particular operator is
</span></span></span><span class="line"><span class="cl"><span class="cm">** stored in aConstraint[].op using one of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The index of the column is stored in
</span></span></span><span class="line"><span class="cl"><span class="cm">** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** expr on the right-hand side can be evaluated (and thus the constraint
</span></span></span><span class="line"><span class="cl"><span class="cm">** is usable) and false if it cannot.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The optimizer automatically inverts terms of the form &#34;expr OP column&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** and makes other simplifications to the WHERE clause in an attempt to
</span></span></span><span class="line"><span class="cl"><span class="cm">** get as many WHERE clause terms into the form shown above as possible.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The aConstraint[] array only reports WHERE clause terms that are
</span></span></span><span class="line"><span class="cl"><span class="cm">** relevant to the particular virtual table being queried.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Information about the ORDER BY clause is stored in aOrderBy[].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Each term of aOrderBy records a column of the ORDER BY clause.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The colUsed field indicates which columns of the virtual table may be
</span></span></span><span class="line"><span class="cl"><span class="cm">** required by the current scan. Virtual table columns are numbered from
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero in the order in which they appear within the CREATE TABLE statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
</span></span></span><span class="line"><span class="cl"><span class="cm">** the corresponding bit is set within the colUsed mask if the column may be
</span></span></span><span class="line"><span class="cl"><span class="cm">** required by SQLite. If the table has at least 64 columns and any column
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the right of the first 63 is required, then bit 63 of colUsed is also
</span></span></span><span class="line"><span class="cl"><span class="cm">** set. In other words, column iCol may be required if the expression
</span></span></span><span class="line"><span class="cl"><span class="cm">** (colUsed &amp; ((sqlite3_uint64)1 &lt;&lt; (iCol&gt;=63 ? 63 : iCol))) evaluates to
</span></span></span><span class="line"><span class="cl"><span class="cm">** non-zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [xBestIndex] method must fill aConstraintUsage[] with information
</span></span></span><span class="line"><span class="cl"><span class="cm">** about what parameters to pass to xFilter. ^If argvIndex&gt;0 then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the right-hand side of the corresponding aConstraint[] is evaluated
</span></span></span><span class="line"><span class="cl"><span class="cm">** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit
</span></span></span><span class="line"><span class="cl"><span class="cm">** is true, then the constraint is assumed to be fully handled by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** virtual table and might not be checked again by the byte code.)^ ^(The
</span></span></span><span class="line"><span class="cl"><span class="cm">** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
</span></span></span><span class="line"><span class="cl"><span class="cm">** is left in its default setting of false, the constraint will always be
</span></span></span><span class="line"><span class="cl"><span class="cm">** checked separately in byte code. If the omit flag is change to true, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the constraint may or may not be checked in byte code. In other words,
</span></span></span><span class="line"><span class="cl"><span class="cm">** when the omit flag is true there is no guarantee that the constraint will
</span></span></span><span class="line"><span class="cl"><span class="cm">** not be checked again using byte code.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The idxNum and idxStr values are recorded and passed into the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [xFilter] method.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^[sqlite3_free()] is used to free idxStr if and only if
</span></span></span><span class="line"><span class="cl"><span class="cm">** needToFreeIdxStr is true.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the correct order to satisfy the ORDER BY clause so that no separate
</span></span></span><span class="line"><span class="cl"><span class="cm">** sorting step is required.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The estimatedCost value is an estimate of the cost of a particular
</span></span></span><span class="line"><span class="cl"><span class="cm">** strategy. A cost of N indicates that the cost of the strategy is similar
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a linear scan of an SQLite table with N rows. A cost of log(N)
</span></span></span><span class="line"><span class="cl"><span class="cm">** indicates that the expense of the operation is similar to that of a
</span></span></span><span class="line"><span class="cl"><span class="cm">** binary search on a unique indexed field of an SQLite table with N rows.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The estimatedRows value is an estimate of the number of rows that
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be returned by the strategy.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xBestIndex method may optionally populate the idxFlags field with a
</span></span></span><span class="line"><span class="cl"><span class="cm">** mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** assumes that the strategy may visit at most one row.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite also assumes that if a call to the xUpdate() method is made as
</span></span></span><span class="line"><span class="cl"><span class="cm">** part of the same statement to delete or update a virtual table row and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
</span></span></span><span class="line"><span class="cl"><span class="cm">** any database changes. In other words, if the xUpdate() returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_CONSTRAINT, the database contents must be exactly as they were
</span></span></span><span class="line"><span class="cl"><span class="cm">** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the xUpdate method are automatically rolled back by SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
</span></span></span><span class="line"><span class="cl"><span class="cm">** structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a virtual table extension is
</span></span></span><span class="line"><span class="cl"><span class="cm">** used with an SQLite version earlier than 3.8.2, the results of attempting
</span></span></span><span class="line"><span class="cl"><span class="cm">** to read or write the estimatedRows field are undefined (but are likely
</span></span></span><span class="line"><span class="cl"><span class="cm">** to include crashing the application). The estimatedRows field should
</span></span></span><span class="line"><span class="cl"><span class="cm">** therefore only be used if [sqlite3_libversion_number()] returns a
</span></span></span><span class="line"><span class="cl"><span class="cm">** value greater than or equal to 3008002. Similarly, the idxFlags field
</span></span></span><span class="line"><span class="cl"><span class="cm">** was added for [version 3.9.0] ([dateof:3.9.0]).
</span></span></span><span class="line"><span class="cl"><span class="cm">** It may therefore only be used if
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_libversion_number() returns a value greater than or equal to
</span></span></span><span class="line"><span class="cl"><span class="cm">** 3009000.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_index_info</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Inputs */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nConstraint</span><span class="p">;</span> <span class="cm">/* Number of entries in aConstraint */</span>
</span></span><span class="line"><span class="cl"> <span class="k">struct</span> <span class="n">sqlite3_index_constraint</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iColumn</span><span class="p">;</span> <span class="cm">/* Column constrained. -1 for ROWID */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">op</span><span class="p">;</span> <span class="cm">/* Constraint operator */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">usable</span><span class="p">;</span> <span class="cm">/* True if this constraint is usable */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iTermOffset</span><span class="p">;</span> <span class="cm">/* Used internally - xBestIndex should ignore */</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span> <span class="o">*</span><span class="n">aConstraint</span><span class="p">;</span> <span class="cm">/* Table of WHERE clause constraints */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nOrderBy</span><span class="p">;</span> <span class="cm">/* Number of terms in the ORDER BY clause */</span>
</span></span><span class="line"><span class="cl"> <span class="k">struct</span> <span class="n">sqlite3_index_orderby</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iColumn</span><span class="p">;</span> <span class="cm">/* Column number */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">desc</span><span class="p">;</span> <span class="cm">/* True for DESC. False for ASC. */</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span> <span class="o">*</span><span class="n">aOrderBy</span><span class="p">;</span> <span class="cm">/* The ORDER BY clause */</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Outputs */</span>
</span></span><span class="line"><span class="cl"> <span class="k">struct</span> <span class="n">sqlite3_index_constraint_usage</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">argvIndex</span><span class="p">;</span> <span class="cm">/* if &gt;0, constraint is part of argv to xFilter */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">omit</span><span class="p">;</span> <span class="cm">/* Do not code a test for this constraint */</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span> <span class="o">*</span><span class="n">aConstraintUsage</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">idxNum</span><span class="p">;</span> <span class="cm">/* Number used to identify the index */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="o">*</span><span class="n">idxStr</span><span class="p">;</span> <span class="cm">/* String, possibly obtained from sqlite3_malloc */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">needToFreeIdxStr</span><span class="p">;</span> <span class="cm">/* Free idxStr using sqlite3_free() if true */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">orderByConsumed</span><span class="p">;</span> <span class="cm">/* True if output is already ordered */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">double</span> <span class="n">estimatedCost</span><span class="p">;</span> <span class="cm">/* Estimated cost of using this index */</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Fields below are only available in SQLite 3.8.2 and later */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_int64</span> <span class="n">estimatedRows</span><span class="p">;</span> <span class="cm">/* Estimated number of rows returned */</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Fields below are only available in SQLite 3.9.0 and later */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">idxFlags</span><span class="p">;</span> <span class="cm">/* Mask of SQLITE_INDEX_SCAN_* flags */</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Fields below are only available in SQLite 3.10.0 and later */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_uint64</span> <span class="n">colUsed</span><span class="p">;</span> <span class="cm">/* Input: Mask of columns used by statement */</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Virtual Table Scan Flags
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Virtual table implementations are allowed to set the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_index_info].idxFlags field to some combination of
</span></span></span><span class="line"><span class="cl"><span class="cm">** these bits.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_SCAN_UNIQUE 1 </span><span class="cm">/* Scan visits at most 1 row */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Virtual Table Constraint Operator Codes
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These macros define the allowed values for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_index_info].aConstraint[].op field. Each value represents
</span></span></span><span class="line"><span class="cl"><span class="cm">** an operator that is part of a constraint term in the WHERE clause of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a query that uses a [virtual table].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The left-hand operand of the operator is given by the corresponding
</span></span></span><span class="line"><span class="cl"><span class="cm">** aConstraint[].iColumn field. ^An iColumn of -1 indicates the left-hand
</span></span></span><span class="line"><span class="cl"><span class="cm">** operand is the rowid.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET
</span></span></span><span class="line"><span class="cl"><span class="cm">** operators have no left-hand operand, and so for those operators the
</span></span></span><span class="line"><span class="cl"><span class="cm">** corresponding aConstraint[].iColumn is meaningless and should not be
</span></span></span><span class="line"><span class="cl"><span class="cm">** used.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** All operator values from SQLITE_INDEX_CONSTRAINT_FUNCTION through
</span></span></span><span class="line"><span class="cl"><span class="cm">** value 255 are reserved to represent functions that are overloaded
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the [xFindFunction|xFindFunction method] of the virtual table
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The right-hand operands for each constraint might be accessible using
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3_vtab_rhs_value()] interface. Usually the right-hand
</span></span></span><span class="line"><span class="cl"><span class="cm">** operand is only available if it appears as a single constant literal
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the input SQL. If the right-hand operand is another column or an
</span></span></span><span class="line"><span class="cl"><span class="cm">** expression (even a constant expression) or a parameter, then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_vtab_rhs_value() probably will not be able to extract it.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The SQLITE_INDEX_CONSTRAINT_ISNULL and
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_INDEX_CONSTRAINT_ISNOTNULL operators have no right-hand operand
</span></span></span><span class="line"><span class="cl"><span class="cm">** and hence calls to sqlite3_vtab_rhs_value() for those operators will
</span></span></span><span class="line"><span class="cl"><span class="cm">** always return SQLITE_NOTFOUND.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The collating sequence to be used for comparison can be found using
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3_vtab_collation()] interface. For most real-world virtual
</span></span></span><span class="line"><span class="cl"><span class="cm">** tables, the collating sequence of constraints does not matter (for example
</span></span></span><span class="line"><span class="cl"><span class="cm">** because the constraints are numeric) and so the sqlite3_vtab_collation()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface is not commonly needed.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_EQ 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_GT 4
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_LE 8
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_LT 16
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_GE 32
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_MATCH 64
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_LIKE 65
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_GLOB 66
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_NE 68
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_ISNOT 69
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_ISNULL 71
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_IS 72
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_LIMIT 73
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_OFFSET 74
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Register A Virtual Table Implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These routines are used to register a new [virtual table module] name.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Module names must be registered before
</span></span></span><span class="line"><span class="cl"><span class="cm">** creating a new [virtual table] using the module and before using a
</span></span></span><span class="line"><span class="cl"><span class="cm">** preexisting [virtual table] for the module.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The module name is registered on the [database connection] specified
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the first parameter. ^The name of the module is given by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** second parameter. ^The third parameter is a pointer to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the implementation of the [virtual table module]. ^The fourth
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter is an arbitrary client data pointer that is passed through
</span></span></span><span class="line"><span class="cl"><span class="cm">** into the [xCreate] and [xConnect] methods of the virtual table module
</span></span></span><span class="line"><span class="cl"><span class="cm">** when a new virtual table is be being created or reinitialized.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_create_module_v2() interface has a fifth parameter which
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a pointer to a destructor for the pClientData. ^SQLite will
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoke the destructor function (if it is not NULL) when SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** no longer needs the pClientData pointer. ^The destructor will also
</span></span></span><span class="line"><span class="cl"><span class="cm">** be invoked if the call to sqlite3_create_module_v2() fails.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_create_module()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface is equivalent to sqlite3_create_module_v2() with a NULL
</span></span></span><span class="line"><span class="cl"><span class="cm">** destructor.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the third parameter (the pointer to the sqlite3_module object) is
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL then no new module is created and any existing modules with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** same name are dropped.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_drop_modules()]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_create_module</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* SQLite connection to register module with */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span> <span class="cm">/* Name of the module */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="n">sqlite3_module</span> <span class="o">*</span><span class="n">p</span><span class="p">,</span> <span class="cm">/* Methods for the module */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pClientData</span> <span class="cm">/* Client data for xCreate/xConnect */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_create_module_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* SQLite connection to register module with */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span> <span class="cm">/* Name of the module */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="n">sqlite3_module</span> <span class="o">*</span><span class="n">p</span><span class="p">,</span> <span class="cm">/* Methods for the module */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pClientData</span><span class="p">,</span> <span class="cm">/* Client data for xCreate/xConnect */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="n">xDestroy</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">)</span> <span class="cm">/* Module destructor function */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Remove Unnecessary Virtual Table Implementations
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_drop_modules(D,L) interface removes all virtual
</span></span></span><span class="line"><span class="cl"><span class="cm">** table modules from database connection D except those named on list L.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The L parameter must be either NULL or a pointer to an array of pointers
</span></span></span><span class="line"><span class="cl"><span class="cm">** to strings where the array is terminated by a single NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the L parameter is NULL, then all virtual table modules are removed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_create_module()]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_drop_modules</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Remove modules from this connection */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">azKeep</span> <span class="cm">/* Except, do not remove the ones named here */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Virtual Table Instance Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: sqlite3_vtab
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Every [virtual table module] implementation uses a subclass
</span></span></span><span class="line"><span class="cl"><span class="cm">** of this object to describe a particular instance
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the [virtual table]. Each subclass will
</span></span></span><span class="line"><span class="cl"><span class="cm">** be tailored to the specific needs of the module implementation.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The purpose of this superclass is to define certain fields that are
</span></span></span><span class="line"><span class="cl"><span class="cm">** common to all module implementations.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Virtual tables methods can set an error message by assigning a
</span></span></span><span class="line"><span class="cl"><span class="cm">** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should
</span></span></span><span class="line"><span class="cl"><span class="cm">** take care that any prior string is freed by a call to [sqlite3_free()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior to assigning a new string to zErrMsg. ^After the error message
</span></span></span><span class="line"><span class="cl"><span class="cm">** is delivered up to the client application, the string will be automatically
</span></span></span><span class="line"><span class="cl"><span class="cm">** freed by sqlite3_free() and the zErrMsg field will be zeroed.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_vtab</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="n">sqlite3_module</span> <span class="o">*</span><span class="n">pModule</span><span class="p">;</span> <span class="cm">/* The module for this virtual table */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nRef</span><span class="p">;</span> <span class="cm">/* Number of open cursors */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="o">*</span><span class="n">zErrMsg</span><span class="p">;</span> <span class="cm">/* Error message from sqlite3_mprintf() */</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Virtual table implementations will typically add additional fields */</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Virtual Table Cursor Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Every [virtual table module] implementation uses a subclass of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** following structure to describe cursors that point into the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [virtual table] and are used
</span></span></span><span class="line"><span class="cl"><span class="cm">** to loop through the virtual table. Cursors are created using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the [sqlite3_module.xClose | xClose] method. Cursors are used
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the module. Each module implementation will define
</span></span></span><span class="line"><span class="cl"><span class="cm">** the content of a cursor structure to suit its own needs.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This superclass exists in order to define fields of the cursor that
</span></span></span><span class="line"><span class="cl"><span class="cm">** are common to all implementations.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_vtab_cursor</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_vtab</span> <span class="o">*</span><span class="n">pVtab</span><span class="p">;</span> <span class="cm">/* Virtual table of this cursor */</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* Virtual table implementations will typically add additional fields */</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Declare The Schema Of A Virtual Table
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [xCreate] and [xConnect] methods of a
</span></span></span><span class="line"><span class="cl"><span class="cm">** [virtual table module] call this interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** to declare the format (the names and datatypes of the columns) of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the virtual tables they implement.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_declare_vtab</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSQL</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Overload A Function For A Virtual Table
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Virtual tables can provide alternative implementations of functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** using the [xFindFunction] method of the [virtual table module].
</span></span></span><span class="line"><span class="cl"><span class="cm">** But global versions of those functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** must exist in order to be overloaded.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(This API makes sure a global version of a function with a particular
</span></span></span><span class="line"><span class="cl"><span class="cm">** name and number of parameters exists. If no such function exists
</span></span></span><span class="line"><span class="cl"><span class="cm">** before this API is called, a new function is created.)^ ^The implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the new function always causes an exception to be thrown. So
</span></span></span><span class="line"><span class="cl"><span class="cm">** the new function is not good for anything by itself. Its only
</span></span></span><span class="line"><span class="cl"><span class="cm">** purpose is to be a placeholder function that can be overloaded
</span></span></span><span class="line"><span class="cl"><span class="cm">** by a [virtual table].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_overload_function</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zFuncName</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nArg</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: A Handle To An Open BLOB
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {BLOB handle} {BLOB handles}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An instance of this object represents an open BLOB on which
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_blob_open | incremental BLOB I/O] can be performed.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Objects of this type are created by [sqlite3_blob_open()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and destroyed by [sqlite3_blob_close()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be used to read or write small subsections of the BLOB.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_blob</span> <span class="n">sqlite3_blob</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Open A BLOB For Incremental I/O
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">** CONSTRUCTOR: sqlite3_blob
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located
</span></span></span><span class="line"><span class="cl"><span class="cm">** in row iRow, column zColumn, table zTable in database zDb;
</span></span></span><span class="line"><span class="cl"><span class="cm">** in other words, the same BLOB that would be selected by:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Parameter zDb is not the filename that contains the database, but
</span></span></span><span class="line"><span class="cl"><span class="cm">** rather the symbolic name of the database. For attached databases, this is
</span></span></span><span class="line"><span class="cl"><span class="cm">** the name that appears after the AS keyword in the [ATTACH] statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">** For the main database file, the database name is &#34;main&#34;. For TEMP
</span></span></span><span class="line"><span class="cl"><span class="cm">** tables, the database name is &#34;temp&#34;.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the flags parameter is non-zero, then the BLOB is opened for read
</span></span></span><span class="line"><span class="cl"><span class="cm">** and write access. ^If the flags parameter is zero, the BLOB is opened for
</span></span></span><span class="line"><span class="cl"><span class="cm">** read-only access.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored
</span></span></span><span class="line"><span class="cl"><span class="cm">** in *ppBlob. Otherwise an [error code] is returned and, unless the error
</span></span></span><span class="line"><span class="cl"><span class="cm">** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
</span></span></span><span class="line"><span class="cl"><span class="cm">** the API is not misused, it is always safe to call [sqlite3_blob_close()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** on *ppBlob after this function it returns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function fails with SQLITE_ERROR if any of the following are true:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(Database zDb does not exist)^,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(Table zTable does not exist within database zDb)^,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(Table zTable is a WITHOUT ROWID table)^,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(Column zColumn does not exist)^,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(Row iRow is not present in the table)^,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(The specified column of row iRow contains a value that is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** a TEXT or BLOB value)^,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE
</span></span></span><span class="line"><span class="cl"><span class="cm">** constraint and the blob is being opened for read/write access)^,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^([foreign key constraints | Foreign key constraints] are enabled,
</span></span></span><span class="line"><span class="cl"><span class="cm">** column zColumn is part of a [child key] definition and the blob is
</span></span></span><span class="line"><span class="cl"><span class="cm">** being opened for read/write access)^.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Unless it returns SQLITE_MISUSE, this function sets the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] error code and message accessible via
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A BLOB referenced by sqlite3_blob_open() may be read using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_blob_read()] interface and modified by using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_blob_write()]. The [BLOB handle] can be moved to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** different row of the same table using the [sqlite3_blob_reopen()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface. However, the column, table, or database of a [BLOB handle]
</span></span></span><span class="line"><span class="cl"><span class="cm">** cannot be changed after the [BLOB handle] is opened.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If the row that a BLOB handle points to is modified by an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the BLOB handle is marked as &#34;expired&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This is true if any column of the row is changed, even a column
</span></span></span><span class="line"><span class="cl"><span class="cm">** other than the one the BLOB handle is open on.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
</span></span></span><span class="line"><span class="cl"><span class="cm">** an expired BLOB handle fail with a return code of [SQLITE_ABORT].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Changes written into a BLOB prior to the BLOB expiring are not
</span></span></span><span class="line"><span class="cl"><span class="cm">** rolled back by the expiration of the BLOB. Such changes will eventually
</span></span></span><span class="line"><span class="cl"><span class="cm">** commit if the transaction continues to completion.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the opened blob. ^The size of a blob may not be changed by this
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface. Use the [UPDATE] SQL command to change the size of a
</span></span></span><span class="line"><span class="cl"><span class="cm">** blob.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the built-in [zeroblob] SQL function may be used to create a
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero-filled blob to read or write using the incremental-blob interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** To avoid a resource leak, every open [BLOB handle] should eventually
</span></span></span><span class="line"><span class="cl"><span class="cm">** be released by a call to [sqlite3_blob_close()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_blob_close()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_blob_reopen()], [sqlite3_blob_read()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_blob_bytes()], [sqlite3_blob_write()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_blob_open</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDb</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zTable</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zColumn</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_int64</span> <span class="n">iRow</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">flags</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_blob</span> <span class="o">**</span><span class="n">ppBlob</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Move a BLOB Handle to a New Row
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_blob
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This function is used to move an existing [BLOB handle] so that it points
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a different row of the same database table. ^The new row is identified
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the rowid value passed as the second argument. Only the row can be
</span></span></span><span class="line"><span class="cl"><span class="cm">** changed. ^The database, table and column on which the blob handle is open
</span></span></span><span class="line"><span class="cl"><span class="cm">** remain the same. Moving an existing [BLOB handle] to a new row is
</span></span></span><span class="line"><span class="cl"><span class="cm">** faster than closing the existing handle and opening a new one.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] -
</span></span></span><span class="line"><span class="cl"><span class="cm">** it must exist and there must be either a blob or text value stored in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the nominated column.)^ ^If the new row is not present in the table, or if
</span></span></span><span class="line"><span class="cl"><span class="cm">** it does not contain a blob or text value, or if another error occurs, an
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite error code is returned and the blob handle is considered aborted.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_blob_reopen()] on an aborted blob handle immediately return
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
</span></span></span><span class="line"><span class="cl"><span class="cm">** always returns zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This function sets the database handle error code and message.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_blob_reopen</span><span class="p">(</span><span class="n">sqlite3_blob</span> <span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_int64</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Close A BLOB Handle
</span></span></span><span class="line"><span class="cl"><span class="cm">** DESTRUCTOR: sqlite3_blob
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed
</span></span></span><span class="line"><span class="cl"><span class="cm">** unconditionally. Even if this routine returns an error code, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** handle is still closed.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the blob handle being closed was opened for read-write access, and if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database is in auto-commit mode and there are no other open read-write
</span></span></span><span class="line"><span class="cl"><span class="cm">** blob handles or active write statements, the current transaction is
</span></span></span><span class="line"><span class="cl"><span class="cm">** committed. ^If an error occurs while committing the transaction, an error
</span></span></span><span class="line"><span class="cl"><span class="cm">** code is returned and the transaction rolled back.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Calling this function with an argument that is not a NULL pointer or an
</span></span></span><span class="line"><span class="cl"><span class="cm">** open blob handle results in undefined behavior. ^Calling this routine
</span></span></span><span class="line"><span class="cl"><span class="cm">** with a null pointer (such as would be returned by a failed call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
</span></span></span><span class="line"><span class="cl"><span class="cm">** is passed a valid open blob handle, the values returned by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_blob_close</span><span class="p">(</span><span class="n">sqlite3_blob</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Return The Size Of An Open BLOB
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_blob
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Returns the size in bytes of the BLOB accessible via the
</span></span></span><span class="line"><span class="cl"><span class="cm">** successfully opened [BLOB handle] in its only argument. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** incremental blob I/O routines can only read or overwriting existing
</span></span></span><span class="line"><span class="cl"><span class="cm">** blob content; they cannot change the size of a blob.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This routine only works on a [BLOB handle] which has been created
</span></span></span><span class="line"><span class="cl"><span class="cm">** by a prior successful call to [sqlite3_blob_open()] and which has not
</span></span></span><span class="line"><span class="cl"><span class="cm">** been closed by [sqlite3_blob_close()]. Passing any other pointer in
</span></span></span><span class="line"><span class="cl"><span class="cm">** to this routine results in undefined and probably undesirable behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_blob_bytes</span><span class="p">(</span><span class="n">sqlite3_blob</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Read Data From A BLOB Incrementally
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_blob
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(This function is used to read data from an open [BLOB handle] into a
</span></span></span><span class="line"><span class="cl"><span class="cm">** caller-supplied buffer. N bytes of data are copied into buffer Z
</span></span></span><span class="line"><span class="cl"><span class="cm">** from the open BLOB, starting at offset iOffset.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If offset iOffset is less than N bytes from the end of the BLOB,
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is
</span></span></span><span class="line"><span class="cl"><span class="cm">** less than zero, [SQLITE_ERROR] is returned and no data is read.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The size of the blob (and hence the maximum value of N+iOffset)
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be determined using the [sqlite3_blob_bytes()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^An attempt to read from an expired [BLOB handle] fails with an
</span></span></span><span class="line"><span class="cl"><span class="cm">** error code of [SQLITE_ABORT].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(On success, sqlite3_blob_read() returns SQLITE_OK.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Otherwise, an [error code] or an [extended error code] is returned.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This routine only works on a [BLOB handle] which has been created
</span></span></span><span class="line"><span class="cl"><span class="cm">** by a prior successful call to [sqlite3_blob_open()] and which has not
</span></span></span><span class="line"><span class="cl"><span class="cm">** been closed by [sqlite3_blob_close()]. Passing any other pointer in
</span></span></span><span class="line"><span class="cl"><span class="cm">** to this routine results in undefined and probably undesirable behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_blob_write()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_blob_read</span><span class="p">(</span><span class="n">sqlite3_blob</span> <span class="o">*</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">Z</span><span class="p">,</span> <span class="kt">int</span> <span class="n">N</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iOffset</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Write Data Into A BLOB Incrementally
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_blob
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(This function is used to write data into an open [BLOB handle] from a
</span></span></span><span class="line"><span class="cl"><span class="cm">** caller-supplied buffer. N bytes of data are copied from the buffer Z
</span></span></span><span class="line"><span class="cl"><span class="cm">** into the open BLOB, starting at offset iOffset.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Otherwise, an [error code] or an [extended error code] is returned.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Unless SQLITE_MISUSE is returned, this function sets the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] error code and message accessible via
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the [BLOB handle] passed as the first argument was not opened for
</span></span></span><span class="line"><span class="cl"><span class="cm">** writing (the flags parameter to [sqlite3_blob_open()] was zero),
</span></span></span><span class="line"><span class="cl"><span class="cm">** this function returns [SQLITE_READONLY].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function may only modify the contents of the BLOB; it is
</span></span></span><span class="line"><span class="cl"><span class="cm">** not possible to increase the size of a BLOB using this API.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If offset iOffset is less than N bytes from the end of the BLOB,
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ERROR] is returned and no data is written. The size of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** BLOB (and hence the maximum value of N+iOffset) can be determined
</span></span></span><span class="line"><span class="cl"><span class="cm">** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less
</span></span></span><span class="line"><span class="cl"><span class="cm">** than zero [SQLITE_ERROR] is returned and no data is written.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^An attempt to write to an expired [BLOB handle] fails with an
</span></span></span><span class="line"><span class="cl"><span class="cm">** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
</span></span></span><span class="line"><span class="cl"><span class="cm">** before the [BLOB handle] expired are not rolled back by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** expiration of the handle, though of course those changes might
</span></span></span><span class="line"><span class="cl"><span class="cm">** have been overwritten by the statement that expired the BLOB handle
</span></span></span><span class="line"><span class="cl"><span class="cm">** or by other independent statements.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This routine only works on a [BLOB handle] which has been created
</span></span></span><span class="line"><span class="cl"><span class="cm">** by a prior successful call to [sqlite3_blob_open()] and which has not
</span></span></span><span class="line"><span class="cl"><span class="cm">** been closed by [sqlite3_blob_close()]. Passing any other pointer in
</span></span></span><span class="line"><span class="cl"><span class="cm">** to this routine results in undefined and probably undesirable behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_blob_read()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_blob_write</span><span class="p">(</span><span class="n">sqlite3_blob</span> <span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">z</span><span class="p">,</span> <span class="kt">int</span> <span class="n">n</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iOffset</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Virtual File System Objects
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A virtual filesystem (VFS) is an [sqlite3_vfs] object
</span></span></span><span class="line"><span class="cl"><span class="cm">** that SQLite uses to interact
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the underlying operating system. Most SQLite builds come with a
</span></span></span><span class="line"><span class="cl"><span class="cm">** single default VFS that is appropriate for the host computer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** New VFSes can be registered and existing VFSes can be unregistered.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The following interfaces are provided.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Names are case sensitive.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Names are zero-terminated UTF-8 strings.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If there is no match, a NULL pointer is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If zVfsName is NULL then the default VFS is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^New VFSes are registered with sqlite3_vfs_register().
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Each new VFS becomes the default VFS if the makeDflt flag is set.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The same VFS can be registered multiple times without injury.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^To make an existing VFS into the default VFS, register it again
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the makeDflt flag set. If two different VFSes with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** same name are registered, the behavior is undefined. If a
</span></span></span><span class="line"><span class="cl"><span class="cm">** VFS is registered with a name that is NULL or an empty string,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the behavior is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If the default VFS is unregistered, another VFS is chosen as
</span></span></span><span class="line"><span class="cl"><span class="cm">** the default. The choice for the new VFS is arbitrary.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_vfs</span> <span class="o">*</span><span class="nf">sqlite3_vfs_find</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zVfsName</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_vfs_register</span><span class="p">(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">makeDflt</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_vfs_unregister</span><span class="p">(</span><span class="n">sqlite3_vfs</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Mutexes
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLite core uses these routines for thread
</span></span></span><span class="line"><span class="cl"><span class="cm">** synchronization. Though they are intended for internal
</span></span></span><span class="line"><span class="cl"><span class="cm">** use by SQLite, code that links against SQLite is
</span></span></span><span class="line"><span class="cl"><span class="cm">** permitted to use any of these routines.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLite source code contains multiple implementations
</span></span></span><span class="line"><span class="cl"><span class="cm">** of these mutex routines. An appropriate implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** is selected automatically at compile-time. The following
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementations are available in the SQLite core:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_PTHREADS
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_W32
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_NOOP
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_MUTEX_NOOP implementation is a set of routines
</span></span></span><span class="line"><span class="cl"><span class="cm">** that does no real locking and is appropriate for use in
</span></span></span><span class="line"><span class="cl"><span class="cm">** a single-threaded application. The SQLITE_MUTEX_PTHREADS and
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
</span></span></span><span class="line"><span class="cl"><span class="cm">** and Windows.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
</span></span></span><span class="line"><span class="cl"><span class="cm">** macro defined (with &#34;-DSQLITE_MUTEX_APPDEF=1&#34;), then no mutex
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation is included with the library. In this case the
</span></span></span><span class="line"><span class="cl"><span class="cm">** application must supply a custom mutex implementation using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
</span></span></span><span class="line"><span class="cl"><span class="cm">** before calling sqlite3_initialize() or any other public sqlite3_
</span></span></span><span class="line"><span class="cl"><span class="cm">** function that calls sqlite3_initialize().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_mutex_alloc() routine allocates a new
</span></span></span><span class="line"><span class="cl"><span class="cm">** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine returns NULL if it is unable to allocate the requested
</span></span></span><span class="line"><span class="cl"><span class="cm">** mutex. The argument to sqlite3_mutex_alloc() must one of these
</span></span></span><span class="line"><span class="cl"><span class="cm">** integer constants:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_FAST
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_RECURSIVE
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_MAIN
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_MEM
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_OPEN
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_PRNG
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_LRU
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_PMEM
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_APP1
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_APP2
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_APP3
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_VFS1
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_VFS2
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; SQLITE_MUTEX_STATIC_VFS3
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
</span></span></span><span class="line"><span class="cl"><span class="cm">** cause sqlite3_mutex_alloc() to create
</span></span></span><span class="line"><span class="cl"><span class="cm">** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
</span></span></span><span class="line"><span class="cl"><span class="cm">** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The mutex implementation does not need to make a distinction
</span></span></span><span class="line"><span class="cl"><span class="cm">** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
</span></span></span><span class="line"><span class="cl"><span class="cm">** not want to. SQLite will only request a recursive mutex in
</span></span></span><span class="line"><span class="cl"><span class="cm">** cases where it really needs one. If a faster non-recursive mutex
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation is available on the host platform, the mutex subsystem
</span></span></span><span class="line"><span class="cl"><span class="cm">** might return such a mutex in response to SQLITE_MUTEX_FAST.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
</span></span></span><span class="line"><span class="cl"><span class="cm">** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to a static preexisting mutex. ^Nine static mutexes are
</span></span></span><span class="line"><span class="cl"><span class="cm">** used by the current version of SQLite. Future versions of SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** may add additional static mutexes. Static mutexes are for internal
</span></span></span><span class="line"><span class="cl"><span class="cm">** use by SQLite only. Applications that use SQLite mutexes should
</span></span></span><span class="line"><span class="cl"><span class="cm">** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_MUTEX_RECURSIVE.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
</span></span></span><span class="line"><span class="cl"><span class="cm">** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns a different mutex on every call. ^For the static
</span></span></span><span class="line"><span class="cl"><span class="cm">** mutex types, the same mutex is returned on every call that has
</span></span></span><span class="line"><span class="cl"><span class="cm">** the same type number.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_mutex_free() routine deallocates a previously
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocated dynamic mutex. Attempting to deallocate a static
</span></span></span><span class="line"><span class="cl"><span class="cm">** mutex results in undefined behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
</span></span></span><span class="line"><span class="cl"><span class="cm">** to enter a mutex. ^If another thread is already within the mutex,
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
</span></span></span><span class="line"><span class="cl"><span class="cm">** upon successful entry. ^(Mutexes created using
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
</span></span></span><span class="line"><span class="cl"><span class="cm">** In such cases, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** mutex must be exited an equal number of times before another thread
</span></span></span><span class="line"><span class="cl"><span class="cm">** can enter.)^ If the same thread tries to enter any mutex other
</span></span></span><span class="line"><span class="cl"><span class="cm">** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Some systems (for example, Windows 95) do not support the operation
</span></span></span><span class="line"><span class="cl"><span class="cm">** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
</span></span></span><span class="line"><span class="cl"><span class="cm">** will always return SQLITE_BUSY. In most cases the SQLite core only uses
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_mutex_try() as an optimization, so this is acceptable
</span></span></span><span class="line"><span class="cl"><span class="cm">** behavior. The exceptions are unix builds that set the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_mutex_try() is required.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_mutex_leave() routine exits a mutex that was
</span></span></span><span class="line"><span class="cl"><span class="cm">** previously entered by the same thread. The behavior
</span></span></span><span class="line"><span class="cl"><span class="cm">** is undefined if the mutex is not currently entered by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** calling thread or is not currently allocated.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_mutex_leave(), or sqlite3_mutex_free() is a NULL pointer,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then any of the four routines behaves as a no-op.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_mutex</span> <span class="o">*</span><span class="nf">sqlite3_mutex_alloc</span><span class="p">(</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_mutex_free</span><span class="p">(</span><span class="n">sqlite3_mutex</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_mutex_enter</span><span class="p">(</span><span class="n">sqlite3_mutex</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_mutex_try</span><span class="p">(</span><span class="n">sqlite3_mutex</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_mutex_leave</span><span class="p">(</span><span class="n">sqlite3_mutex</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Mutex Methods Object
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An instance of this structure defines the low-level routines
</span></span></span><span class="line"><span class="cl"><span class="cm">** used to allocate and use mutexes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Usually, the default mutex implementations provided by SQLite are
</span></span></span><span class="line"><span class="cl"><span class="cm">** sufficient, however the application has the option of substituting a custom
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation for specialized deployments or systems for which SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** does not provide a suitable implementation. In this case, the application
</span></span></span><span class="line"><span class="cl"><span class="cm">** creates and populates an instance of this structure to pass
</span></span></span><span class="line"><span class="cl"><span class="cm">** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Additionally, an instance of this structure can be used as an
</span></span></span><span class="line"><span class="cl"><span class="cm">** output variable when querying the system for the current mutex
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The xMutexInit method defined by this structure is invoked as
</span></span></span><span class="line"><span class="cl"><span class="cm">** part of system initialization by the sqlite3_initialize() function.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The xMutexInit routine is called by SQLite exactly once for each
</span></span></span><span class="line"><span class="cl"><span class="cm">** effective call to [sqlite3_initialize()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The xMutexEnd method defined by this structure is invoked as
</span></span></span><span class="line"><span class="cl"><span class="cm">** part of system shutdown by the sqlite3_shutdown() function. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation of this method is expected to release all outstanding
</span></span></span><span class="line"><span class="cl"><span class="cm">** resources obtained by the mutex methods implementation, especially
</span></span></span><span class="line"><span class="cl"><span class="cm">** those obtained by the xMutexInit method. ^The xMutexEnd()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface is invoked exactly once for each call to [sqlite3_shutdown()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The remaining seven methods defined by this structure (xMutexAlloc,
</span></span></span><span class="line"><span class="cl"><span class="cm">** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
</span></span></span><span class="line"><span class="cl"><span class="cm">** xMutexNotheld) implement the following interfaces (respectively):
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_mutex_alloc()] &lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_mutex_free()] &lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_mutex_enter()] &lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_mutex_try()] &lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_mutex_leave()] &lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_mutex_held()] &lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3_mutex_notheld()] &lt;/li&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The only difference is that the public sqlite3_XXX functions enumerated
</span></span></span><span class="line"><span class="cl"><span class="cm">** above silently ignore any invocations that pass a NULL pointer instead
</span></span></span><span class="line"><span class="cl"><span class="cm">** of a valid mutex handle. The implementations of the methods defined
</span></span></span><span class="line"><span class="cl"><span class="cm">** by this structure are not required to handle this case. The results
</span></span></span><span class="line"><span class="cl"><span class="cm">** of passing a NULL pointer instead of a valid mutex handle are undefined
</span></span></span><span class="line"><span class="cl"><span class="cm">** (i.e. it is acceptable to provide an implementation that segfaults if
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is passed a NULL pointer).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xMutexInit() method must be threadsafe. It must be harmless to
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoke xMutexInit() multiple times within the same process and without
</span></span></span><span class="line"><span class="cl"><span class="cm">** intervening calls to xMutexEnd(). Second and subsequent calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** xMutexInit() must be no-ops.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and its associates). Similarly, xMutexAlloc() must not use SQLite memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory allocation for a fast or recursive mutex.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
</span></span></span><span class="line"><span class="cl"><span class="cm">** called, but only if the prior call to xMutexInit returned SQLITE_OK.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If xMutexInit fails in any way, it is expected to clean up after itself
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior to returning.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_mutex_methods</span> <span class="n">sqlite3_mutex_methods</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_mutex_methods</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xMutexInit</span><span class="p">)(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xMutexEnd</span><span class="p">)(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_mutex</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xMutexAlloc</span><span class="p">)(</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xMutexFree</span><span class="p">)(</span><span class="n">sqlite3_mutex</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xMutexEnter</span><span class="p">)(</span><span class="n">sqlite3_mutex</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xMutexTry</span><span class="p">)(</span><span class="n">sqlite3_mutex</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xMutexLeave</span><span class="p">)(</span><span class="n">sqlite3_mutex</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xMutexHeld</span><span class="p">)(</span><span class="n">sqlite3_mutex</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xMutexNotheld</span><span class="p">)(</span><span class="n">sqlite3_mutex</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Mutex Verification Routines
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
</span></span></span><span class="line"><span class="cl"><span class="cm">** are intended for use inside assert() statements. The SQLite core
</span></span></span><span class="line"><span class="cl"><span class="cm">** never uses these routines except inside an assert() and applications
</span></span></span><span class="line"><span class="cl"><span class="cm">** are advised to follow the lead of the core. The SQLite core only
</span></span></span><span class="line"><span class="cl"><span class="cm">** provides implementations for these routines when it is compiled
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the SQLITE_DEBUG flag. External mutex implementations
</span></span></span><span class="line"><span class="cl"><span class="cm">** are only required to provide these routines if SQLITE_DEBUG is
</span></span></span><span class="line"><span class="cl"><span class="cm">** defined and if NDEBUG is not defined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines should return true if the mutex in their argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** is held or not held, respectively, by the calling thread.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The implementation is not required to provide versions of these
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines that actually work. If the implementation does not provide working
</span></span></span><span class="line"><span class="cl"><span class="cm">** versions of these routines, it should at least provide stubs that always
</span></span></span><span class="line"><span class="cl"><span class="cm">** return true so that one does not get spurious assertion failures.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the argument to sqlite3_mutex_held() is a NULL pointer then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the routine should return 1. This seems counter-intuitive since
</span></span></span><span class="line"><span class="cl"><span class="cm">** clearly the mutex cannot be held if it does not exist. But
</span></span></span><span class="line"><span class="cl"><span class="cm">** the reason the mutex does not exist is because the build is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** using mutexes. And we do not want the assert() containing the
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to sqlite3_mutex_held() to fail, so a non-zero return is
</span></span></span><span class="line"><span class="cl"><span class="cm">** the appropriate thing to do. The sqlite3_mutex_notheld()
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface should also return 1 when given a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifndef NDEBUG
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_mutex_held</span><span class="p">(</span><span class="n">sqlite3_mutex</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_mutex_notheld</span><span class="p">(</span><span class="n">sqlite3_mutex</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Mutex Types
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_mutex_alloc()] interface takes a single argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** which is one of these integer constants.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The set of static mutexes may change from one SQLite release to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** next. Applications that override the built-in mutex logic must be
</span></span></span><span class="line"><span class="cl"><span class="cm">** prepared to accommodate additional static mutexes.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_FAST 0
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_RECURSIVE 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_MAIN 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_MEM 3 </span><span class="cm">/* sqlite3_malloc() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_MEM2 4 </span><span class="cm">/* NOT USED */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_OPEN 4 </span><span class="cm">/* sqlite3BtreeOpen() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_PRNG 5 </span><span class="cm">/* sqlite3_randomness() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_LRU 6 </span><span class="cm">/* lru page list */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_LRU2 7 </span><span class="cm">/* NOT USED */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_PMEM 7 </span><span class="cm">/* sqlite3PageMalloc() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_APP1 8 </span><span class="cm">/* For use by application */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_APP2 9 </span><span class="cm">/* For use by application */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_APP3 10 </span><span class="cm">/* For use by application */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_VFS1 11 </span><span class="cm">/* For use by built-in VFS */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_VFS2 12 </span><span class="cm">/* For use by extension VFS */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_VFS3 13 </span><span class="cm">/* For use by application VFS */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/* Legacy compatibility: */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_MUTEX_STATIC_MASTER 2
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Retrieve the mutex for a database connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This interface returns a pointer the [sqlite3_mutex] object that
</span></span></span><span class="line"><span class="cl"><span class="cm">** serializes access to the [database connection] given in the argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** when the [threading mode] is Serialized.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the [threading mode] is Single-thread or Multi-thread then this
</span></span></span><span class="line"><span class="cl"><span class="cm">** routine returns a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_mutex</span> <span class="o">*</span><span class="nf">sqlite3_db_mutex</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Low-Level Control Of Database Files
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {file control}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_file_control()] interface makes a direct call to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xFileControl method for the [sqlite3_io_methods] object associated
</span></span></span><span class="line"><span class="cl"><span class="cm">** with a particular database identified by the second argument. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** name of the database is &#34;main&#34; for the main database or &#34;temp&#34; for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** TEMP database, or the name that appears after the AS keyword for
</span></span></span><span class="line"><span class="cl"><span class="cm">** databases that are added using the [ATTACH] SQL command.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A NULL pointer can be used in place of &#34;main&#34; to refer to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** main database file.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The third and fourth parameters to this routine
</span></span></span><span class="line"><span class="cl"><span class="cm">** are passed directly through to the second and third parameters of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the xFileControl method. ^The return value of the xFileControl
</span></span></span><span class="line"><span class="cl"><span class="cm">** method becomes the return value of this routine.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A few opcodes for [sqlite3_file_control()] are handled directly
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the SQLite core and never invoke the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_io_methods.xFileControl method.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to the underlying [sqlite3_file] object to be written into
</span></span></span><span class="line"><span class="cl"><span class="cm">** the space pointed to by the 4th parameter. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3_file] object associated with the journal file instead of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the main database. The [SQLITE_FCNTL_VFS_POINTER] opcode returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to the underlying [sqlite3_vfs] object for the file.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [SQLITE_FCNTL_DATA_VERSION] returns the data version counter
</span></span></span><span class="line"><span class="cl"><span class="cm">** from the pager.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the second parameter (zDbName) does not match the name of any
</span></span></span><span class="line"><span class="cl"><span class="cm">** open database file, then SQLITE_ERROR is returned. ^This error
</span></span></span><span class="line"><span class="cl"><span class="cm">** code is not remembered and will not be recalled by [sqlite3_errcode()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or [sqlite3_errmsg()]. The underlying xFileControl method might
</span></span></span><span class="line"><span class="cl"><span class="cm">** also return SQLITE_ERROR. There is no way to distinguish between
</span></span></span><span class="line"><span class="cl"><span class="cm">** an incorrect zDbName and an SQLITE_ERROR return from the underlying
</span></span></span><span class="line"><span class="cl"><span class="cm">** xFileControl method.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [file control opcodes]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_file_control</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDbName</span><span class="p">,</span> <span class="kt">int</span> <span class="n">op</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Testing Interface
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_test_control() interface is used to read out internal
</span></span></span><span class="line"><span class="cl"><span class="cm">** state of SQLite and to inject faults into SQLite for testing
</span></span></span><span class="line"><span class="cl"><span class="cm">** purposes. ^The first parameter is an operation code that determines
</span></span></span><span class="line"><span class="cl"><span class="cm">** the number, meaning, and operation of all subsequent parameters.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface is not for use by applications. It exists solely
</span></span></span><span class="line"><span class="cl"><span class="cm">** for verifying the correct operation of the SQLite library. Depending
</span></span></span><span class="line"><span class="cl"><span class="cm">** on how the SQLite library is compiled, this interface might not exist.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The details of the operation codes, their meanings, the parameters
</span></span></span><span class="line"><span class="cl"><span class="cm">** they take, and what they do are all subject to change without notice.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Unlike most of the SQLite API, this function is not guaranteed to
</span></span></span><span class="line"><span class="cl"><span class="cm">** operate consistently from one release to the next.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_test_control</span><span class="p">(</span><span class="kt">int</span> <span class="n">op</span><span class="p">,</span> <span class="p">...);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Testing Interface Operation Codes
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants are the valid operation code parameters used
</span></span></span><span class="line"><span class="cl"><span class="cm">** as the first argument to [sqlite3_test_control()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These parameters and their meanings are subject to change
</span></span></span><span class="line"><span class="cl"><span class="cm">** without notice. These values are for testing purposes only.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Applications should not use any of these parameters or the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_test_control()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_FIRST 5
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_PRNG_SAVE 5
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_PRNG_RESTORE 6
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_PRNG_RESET 7 </span><span class="cm">/* NOT USED */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_FK_NO_ACTION 7
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_BITVEC_TEST 8
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_FAULT_INSTALL 9
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_PENDING_BYTE 11
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_ASSERT 12
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_ALWAYS 13
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_RESERVE 14 </span><span class="cm">/* NOT USED */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_ISKEYWORD 16 </span><span class="cm">/* NOT USED */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 </span><span class="cm">/* NOT USED */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 </span><span class="cm">/* NOT USED */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_VDBE_COVERAGE 21
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_BYTEORDER 22
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_ISINIT 23
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_SORTER_MMAP 24
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_IMPOSTER 25
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_PARSER_COVERAGE 26
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_RESULT_INTREAL 27
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_PRNG_SEED 28
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_SEEK_COUNT 30
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_TRACEFLAGS 31
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_TUNE 32
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_LOGEST 33
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_USELONGDOUBLE 34
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_TESTCTRL_LAST 34 </span><span class="cm">/* Largest TESTCTRL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: SQL Keyword Checking
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These routines provide access to the set of SQL language keywords
</span></span></span><span class="line"><span class="cl"><span class="cm">** recognized by SQLite. Applications can uses these routines to determine
</span></span></span><span class="line"><span class="cl"><span class="cm">** whether or not a specific identifier needs to be escaped (for example,
</span></span></span><span class="line"><span class="cl"><span class="cm">** by enclosing in double-quotes) so as not to confuse the parser.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_keyword_count() interface returns the number of distinct
</span></span></span><span class="line"><span class="cl"><span class="cm">** keywords understood by SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and
</span></span></span><span class="line"><span class="cl"><span class="cm">** makes *Z point to that keyword expressed as UTF8 and writes the number
</span></span></span><span class="line"><span class="cl"><span class="cm">** of bytes in the keyword into *L. The string that *Z points to is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OK if N is within bounds and SQLITE_ERROR if not. If either Z
</span></span></span><span class="line"><span class="cl"><span class="cm">** or L are NULL or invalid pointers then calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_keyword_name(N,Z,L) result in undefined behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_keyword_check(Z,L) interface checks to see whether or not
</span></span></span><span class="line"><span class="cl"><span class="cm">** the L-byte UTF8 identifier that Z points to is a keyword, returning non-zero
</span></span></span><span class="line"><span class="cl"><span class="cm">** if it is and zero if not.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The parser used by SQLite is forgiving. It is often possible to use
</span></span></span><span class="line"><span class="cl"><span class="cm">** a keyword as an identifier as long as such use does not result in a
</span></span></span><span class="line"><span class="cl"><span class="cm">** parsing ambiguity. For example, the statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;CREATE TABLE BEGIN(REPLACE,PRAGMA,END);&#34; is accepted by SQLite, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** creates a new table named &#34;BEGIN&#34; with three columns named
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;REPLACE&#34;, &#34;PRAGMA&#34;, and &#34;END&#34;. Nevertheless, best practice is to avoid
</span></span></span><span class="line"><span class="cl"><span class="cm">** using keywords as identifiers. Common techniques used to avoid keyword
</span></span></span><span class="line"><span class="cl"><span class="cm">** name collisions include:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Put all identifier names inside double-quotes. This is the official
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL way to escape identifier names.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Put identifier names inside &amp;#91;...&amp;#93;. This is not standard SQL,
</span></span></span><span class="line"><span class="cl"><span class="cm">** but it is what SQL Server does and so lots of programmers use this
</span></span></span><span class="line"><span class="cl"><span class="cm">** technique.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Begin every identifier with the letter &#34;Z&#34; as no SQL keywords start
</span></span></span><span class="line"><span class="cl"><span class="cm">** with &#34;Z&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Include a digit somewhere in every identifier name.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that the number of keywords understood by SQLite can depend on
</span></span></span><span class="line"><span class="cl"><span class="cm">** compile-time options. For example, &#34;VACUUM&#34; is not a keyword if
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite is compiled with the [-DSQLITE_OMIT_VACUUM] option. Also,
</span></span></span><span class="line"><span class="cl"><span class="cm">** new keywords may be added to future releases of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_keyword_count</span><span class="p">(</span><span class="kt">void</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_keyword_name</span><span class="p">(</span><span class="kt">int</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">**</span><span class="p">,</span><span class="kt">int</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_keyword_check</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Dynamic String Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {dynamic string}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An instance of the sqlite3_str object contains a dynamically-sized
</span></span></span><span class="line"><span class="cl"><span class="cm">** string under construction.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The lifecycle of an sqlite3_str object is as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^The sqlite3_str object is created using [sqlite3_str_new()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^Text is appended to the sqlite3_str object using various
</span></span></span><span class="line"><span class="cl"><span class="cm">** methods, such as [sqlite3_str_appendf()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; ^The sqlite3_str object is destroyed and the string it created
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned using the [sqlite3_str_finish()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_str</span> <span class="n">sqlite3_str</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Create A New Dynamic String Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** CONSTRUCTOR: sqlite3_str
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_new(D)] interface allocates and initializes
</span></span></span><span class="line"><span class="cl"><span class="cm">** a new [sqlite3_str] object. To avoid memory leaks, the object returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_str_new()] must be freed by a subsequent call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_str_finish(X)].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_new(D)] interface always returns a pointer to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** valid [sqlite3_str] object, though in the event of an out-of-memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** error the returned object might be a special singleton that will
</span></span></span><span class="line"><span class="cl"><span class="cm">** silently reject new text, always return SQLITE_NOMEM from
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_str_errcode()], always return 0 for
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_str_length()], and always return NULL from
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_str_finish(X)]. It is always safe to use the value
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned by [sqlite3_str_new(D)] as the sqlite3_str parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** to any of the other [sqlite3_str] methods.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The D parameter to [sqlite3_str_new(D)] may be NULL. If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** D parameter in [sqlite3_str_new(D)] is not NULL, then the maximum
</span></span></span><span class="line"><span class="cl"><span class="cm">** length of the string contained in the [sqlite3_str] object will be
</span></span></span><span class="line"><span class="cl"><span class="cm">** the value set for [sqlite3_limit](D,[SQLITE_LIMIT_LENGTH]) instead
</span></span></span><span class="line"><span class="cl"><span class="cm">** of [SQLITE_MAX_LENGTH].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_str</span> <span class="o">*</span><span class="nf">sqlite3_str_new</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Finalize A Dynamic String
</span></span></span><span class="line"><span class="cl"><span class="cm">** DESTRUCTOR: sqlite3_str
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_finish(X)] interface destroys the sqlite3_str object X
</span></span></span><span class="line"><span class="cl"><span class="cm">** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** that contains the constructed string. The calling application should
</span></span></span><span class="line"><span class="cl"><span class="cm">** pass the returned value to [sqlite3_free()] to avoid a memory leak.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
</span></span></span><span class="line"><span class="cl"><span class="cm">** errors were encountered during construction of the string. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** string in [sqlite3_str] object X is zero bytes long.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_str_finish</span><span class="p">(</span><span class="n">sqlite3_str</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Add Content To A Dynamic String
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_str
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These interfaces add content to an sqlite3_str object previously obtained
</span></span></span><span class="line"><span class="cl"><span class="cm">** from [sqlite3_str_new()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_appendf(X,F,...)] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf]
</span></span></span><span class="line"><span class="cl"><span class="cm">** functionality of SQLite to append formatted text onto the end of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_str] object X.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_append(X,S,N)] method appends exactly N bytes from string S
</span></span></span><span class="line"><span class="cl"><span class="cm">** onto the end of the [sqlite3_str] object X. N must be non-negative.
</span></span></span><span class="line"><span class="cl"><span class="cm">** S must contain at least N non-zero bytes of content. To append a
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero-terminated string in its entirety, use the [sqlite3_str_appendall()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** method instead.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_appendall(X,S)] method appends the complete content of
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero-terminated string S onto the end of [sqlite3_str] object X.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_appendchar(X,N,C)] method appends N copies of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** single-byte character C onto the end of [sqlite3_str] object X.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This method can be used, for example, to add whitespace indentation.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_reset(X)] method resets the string under construction
</span></span></span><span class="line"><span class="cl"><span class="cm">** inside [sqlite3_str] object X back to zero bytes in length.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These methods do not return a result code. ^If an error occurs, that fact
</span></span></span><span class="line"><span class="cl"><span class="cm">** is recorded in the [sqlite3_str] object and can be recovered by a
</span></span></span><span class="line"><span class="cl"><span class="cm">** subsequent call to [sqlite3_str_errcode(X)].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_str_appendf</span><span class="p">(</span><span class="n">sqlite3_str</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zFormat</span><span class="p">,</span> <span class="p">...);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_str_vappendf</span><span class="p">(</span><span class="n">sqlite3_str</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zFormat</span><span class="p">,</span> <span class="n">va_list</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_str_append</span><span class="p">(</span><span class="n">sqlite3_str</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zIn</span><span class="p">,</span> <span class="kt">int</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_str_appendall</span><span class="p">(</span><span class="n">sqlite3_str</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zIn</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_str_appendchar</span><span class="p">(</span><span class="n">sqlite3_str</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">N</span><span class="p">,</span> <span class="kt">char</span> <span class="n">C</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_str_reset</span><span class="p">(</span><span class="n">sqlite3_str</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Status Of A Dynamic String
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_str
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These interfaces return the current status of an [sqlite3_str] object.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If any prior errors have occurred while constructing the dynamic string
</span></span></span><span class="line"><span class="cl"><span class="cm">** in sqlite3_str X, then the [sqlite3_str_errcode(X)] method will return
</span></span></span><span class="line"><span class="cl"><span class="cm">** an appropriate error code. ^The [sqlite3_str_errcode(X)] method returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_NOMEM] following any out-of-memory error, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_TOOBIG] if the size of the dynamic string exceeds
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_MAX_LENGTH], or [SQLITE_OK] if there have been no errors.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_length(X)] method returns the current length, in bytes,
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the dynamic string under construction in [sqlite3_str] object X.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The length returned by [sqlite3_str_length(X)] does not include the
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero-termination byte.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_str_value(X)] method returns a pointer to the current
</span></span></span><span class="line"><span class="cl"><span class="cm">** content of the dynamic string under construction in X. The value
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X
</span></span></span><span class="line"><span class="cl"><span class="cm">** and might be freed or altered by any subsequent method on the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_str] object. Applications must not used the pointer returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_str_value(X)] after any subsequent method call on the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** object. ^Applications may change the content of the string returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** by [sqlite3_str_value(X)] as long as they do not write into any bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** outside the range of 0 to [sqlite3_str_length(X)] and do not read or
</span></span></span><span class="line"><span class="cl"><span class="cm">** write any byte after any subsequent sqlite3_str method call.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_str_errcode</span><span class="p">(</span><span class="n">sqlite3_str</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_str_length</span><span class="p">(</span><span class="n">sqlite3_str</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_str_value</span><span class="p">(</span><span class="n">sqlite3_str</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: SQLite Runtime Status
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These interfaces are used to retrieve runtime status information
</span></span></span><span class="line"><span class="cl"><span class="cm">** about the performance of SQLite, and optionally to reset various
</span></span></span><span class="line"><span class="cl"><span class="cm">** highwater marks. ^The first argument is an integer code for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the specific parameter to measure. ^(Recognized integer codes
</span></span></span><span class="line"><span class="cl"><span class="cm">** are of the form [status parameters | SQLITE_STATUS_...].)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The current value of the parameter is returned into *pCurrent.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The highest recorded value is returned in *pHighwater. ^If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** resetFlag is true, then the highest record value is reset after
</span></span></span><span class="line"><span class="cl"><span class="cm">** *pHighwater is written. ^(Some parameters do not record the highest
</span></span></span><span class="line"><span class="cl"><span class="cm">** value. For those parameters
</span></span></span><span class="line"><span class="cl"><span class="cm">** nothing is written into *pHighwater and the resetFlag is ignored.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Other parameters record only the highwater mark and not the current
</span></span></span><span class="line"><span class="cl"><span class="cm">** value. For these latter parameters nothing is written into *pCurrent.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_status() and sqlite3_status64() routines return
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OK on success and a non-zero [error code] on failure.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If either the current value or the highwater mark is too large to
</span></span></span><span class="line"><span class="cl"><span class="cm">** be represented by a 32-bit integer, then the values returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_status() are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_db_status()]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_status</span><span class="p">(</span><span class="kt">int</span> <span class="n">op</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pCurrent</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pHighwater</span><span class="p">,</span> <span class="kt">int</span> <span class="n">resetFlag</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_status64</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">op</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_int64</span> <span class="o">*</span><span class="n">pCurrent</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_int64</span> <span class="o">*</span><span class="n">pHighwater</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">resetFlag</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Status Parameters
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {status parameters}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These integer constants designate various run-time status parameters
</span></span></span><span class="line"><span class="cl"><span class="cm">** that can be returned by [sqlite3_status()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STATUS_MEMORY_USED]] ^(&lt;dt&gt;SQLITE_STATUS_MEMORY_USED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter is the current amount of memory checked out
</span></span></span><span class="line"><span class="cl"><span class="cm">** using [sqlite3_malloc()], either directly or indirectly. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** figure includes calls made to [sqlite3_malloc()] by the application
</span></span></span><span class="line"><span class="cl"><span class="cm">** and internal memory usage by the SQLite library. Auxiliary page-cache
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
</span></span></span><span class="line"><span class="cl"><span class="cm">** this parameter. The amount returned is the sum of the allocation
</span></span></span><span class="line"><span class="cl"><span class="cm">** sizes as reported by the xSize method in [sqlite3_mem_methods].&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STATUS_MALLOC_SIZE]] ^(&lt;dt&gt;SQLITE_STATUS_MALLOC_SIZE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter records the largest memory allocation request
</span></span></span><span class="line"><span class="cl"><span class="cm">** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their
</span></span></span><span class="line"><span class="cl"><span class="cm">** internal equivalents). Only the value returned in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** *pHighwater parameter to [sqlite3_status()] is of interest.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The value written into the *pCurrent parameter is undefined.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STATUS_MALLOC_COUNT]] ^(&lt;dt&gt;SQLITE_STATUS_MALLOC_COUNT&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter records the number of separate memory allocations
</span></span></span><span class="line"><span class="cl"><span class="cm">** currently checked out.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STATUS_PAGECACHE_USED]] ^(&lt;dt&gt;SQLITE_STATUS_PAGECACHE_USED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the number of pages used out of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [pagecache memory allocator] that was configured using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CONFIG_PAGECACHE]. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** value returned is in pages, not in bytes.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;SQLITE_STATUS_PAGECACHE_OVERFLOW&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the number of bytes of page cache
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
</span></span></span><span class="line"><span class="cl"><span class="cm">** buffer and where forced to overflow to [sqlite3_malloc()]. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned value includes allocations that overflowed because they
</span></span></span><span class="line"><span class="cl"><span class="cm">** where too large (they were larger than the &#34;sz&#34; parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
</span></span></span><span class="line"><span class="cl"><span class="cm">** no space was left in the page cache.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(&lt;dt&gt;SQLITE_STATUS_PAGECACHE_SIZE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter records the largest memory allocation request
</span></span></span><span class="line"><span class="cl"><span class="cm">** handed to the [pagecache memory allocator]. Only the value returned in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** *pHighwater parameter to [sqlite3_status()] is of interest.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The value written into the *pCurrent parameter is undefined.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STATUS_SCRATCH_USED]] &lt;dt&gt;SQLITE_STATUS_SCRATCH_USED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;No longer used.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(&lt;dt&gt;SQLITE_STATUS_SCRATCH_OVERFLOW&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;No longer used.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STATUS_SCRATCH_SIZE]] &lt;dt&gt;SQLITE_STATUS_SCRATCH_SIZE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;No longer used.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STATUS_PARSER_STACK]] ^(&lt;dt&gt;SQLITE_STATUS_PARSER_STACK&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The *pHighwater parameter records the deepest parser stack.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The *pCurrent value is undefined. The *pHighwater value is only
</span></span></span><span class="line"><span class="cl"><span class="cm">** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** New status parameters may be added from time to time.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATUS_MEMORY_USED 0
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATUS_PAGECACHE_USED 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATUS_PAGECACHE_OVERFLOW 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATUS_SCRATCH_USED 3 </span><span class="cm">/* NOT USED */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATUS_SCRATCH_OVERFLOW 4 </span><span class="cm">/* NOT USED */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATUS_MALLOC_SIZE 5
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATUS_PARSER_STACK 6
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATUS_PAGECACHE_SIZE 7
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATUS_SCRATCH_SIZE 8 </span><span class="cm">/* NOT USED */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STATUS_MALLOC_COUNT 9
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Database Connection Status
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This interface is used to retrieve runtime status information
</span></span></span><span class="line"><span class="cl"><span class="cm">** about a single [database connection]. ^The first argument is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connection object to be interrogated. ^The second argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** is an integer constant, taken from the set of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_DBSTATUS options], that
</span></span></span><span class="line"><span class="cl"><span class="cm">** determines the parameter to interrogate. The set of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_DBSTATUS options] is likely
</span></span></span><span class="line"><span class="cl"><span class="cm">** to grow in future releases of SQLite.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The current value of the requested parameter is written into *pCur
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the highest instantaneous value is written into *pHiwtr. ^If
</span></span></span><span class="line"><span class="cl"><span class="cm">** the resetFlg is true, then the highest instantaneous value is
</span></span></span><span class="line"><span class="cl"><span class="cm">** reset back down to the current value.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
</span></span></span><span class="line"><span class="cl"><span class="cm">** non-zero [error code] on failure.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_db_status</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">op</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pCur</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pHiwtr</span><span class="p">,</span> <span class="kt">int</span> <span class="n">resetFlg</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Status Parameters for database connections
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {SQLITE_DBSTATUS options}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants are the available integer &#34;verbs&#34; that can be passed as
</span></span></span><span class="line"><span class="cl"><span class="cm">** the second argument to the [sqlite3_db_status()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** New verbs may be added in future releases of SQLite. Existing verbs
</span></span></span><span class="line"><span class="cl"><span class="cm">** might be discontinued. Applications should check the return code from
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_db_status()] to make sure that the call worked.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_db_status()] interface will return a non-zero error code
</span></span></span><span class="line"><span class="cl"><span class="cm">** if a discontinued or unsupported verb is invoked.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(&lt;dt&gt;SQLITE_DBSTATUS_LOOKASIDE_USED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the number of lookaside memory slots currently
</span></span></span><span class="line"><span class="cl"><span class="cm">** checked out.&lt;/dd&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(&lt;dt&gt;SQLITE_DBSTATUS_LOOKASIDE_HIT&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the number of malloc attempts that were
</span></span></span><span class="line"><span class="cl"><span class="cm">** satisfied using lookaside memory. Only the high-water value is meaningful;
</span></span></span><span class="line"><span class="cl"><span class="cm">** the current value is always zero.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the number malloc attempts that might have
</span></span></span><span class="line"><span class="cl"><span class="cm">** been satisfied using lookaside memory but failed due to the amount of
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory requested being larger than the lookaside slot size.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Only the high-water value is meaningful;
</span></span></span><span class="line"><span class="cl"><span class="cm">** the current value is always zero.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the number malloc attempts that might have
</span></span></span><span class="line"><span class="cl"><span class="cm">** been satisfied using lookaside memory but failed due to all lookaside
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory already being in use.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Only the high-water value is meaningful;
</span></span></span><span class="line"><span class="cl"><span class="cm">** the current value is always zero.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_CACHE_USED]] ^(&lt;dt&gt;SQLITE_DBSTATUS_CACHE_USED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the approximate number of bytes of heap
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory used by all pager caches associated with the database connection.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(&lt;dt&gt;SQLITE_DBSTATUS_CACHE_USED_SHARED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter is similar to DBSTATUS_CACHE_USED, except that if a
</span></span></span><span class="line"><span class="cl"><span class="cm">** pager cache is shared between two or more connections the bytes of heap
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory used by that pager cache is divided evenly between the attached
</span></span></span><span class="line"><span class="cl"><span class="cm">** connections.)^ In other words, if none of the pager caches associated
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the database connection are shared, this request returns the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are
</span></span></span><span class="line"><span class="cl"><span class="cm">** shared, the value returned by this call will be smaller than that returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(&lt;dt&gt;SQLITE_DBSTATUS_SCHEMA_USED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the approximate number of bytes of heap
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory used to store the schema for all databases associated
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the connection - main, temp, and any [ATTACH]-ed databases.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The full amount of memory used by the schemas is reported, even if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** schema memory is shared with other database connections due to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [shared cache mode] being enabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_STMT_USED]] ^(&lt;dt&gt;SQLITE_DBSTATUS_STMT_USED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the approximate number of bytes of heap
</span></span></span><span class="line"><span class="cl"><span class="cm">** and lookaside memory used by all prepared statements associated with
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database connection.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(&lt;dt&gt;SQLITE_DBSTATUS_CACHE_HIT&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the number of pager cache hits that have
</span></span></span><span class="line"><span class="cl"><span class="cm">** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT
</span></span></span><span class="line"><span class="cl"><span class="cm">** is always 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(&lt;dt&gt;SQLITE_DBSTATUS_CACHE_MISS&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the number of pager cache misses that have
</span></span></span><span class="line"><span class="cl"><span class="cm">** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS
</span></span></span><span class="line"><span class="cl"><span class="cm">** is always 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_CACHE_WRITE]] ^(&lt;dt&gt;SQLITE_DBSTATUS_CACHE_WRITE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the number of dirty cache entries that have
</span></span></span><span class="line"><span class="cl"><span class="cm">** been written to disk. Specifically, the number of pages written to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** wal file in wal mode databases, or the number of pages written to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database file in rollback mode databases. Any pages written as part of
</span></span></span><span class="line"><span class="cl"><span class="cm">** transaction rollback or database recovery operations are not included.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If an IO or other error occurs while writing a page to disk, the effect
</span></span></span><span class="line"><span class="cl"><span class="cm">** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(&lt;dt&gt;SQLITE_DBSTATUS_CACHE_SPILL&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns the number of dirty cache entries that have
</span></span></span><span class="line"><span class="cl"><span class="cm">** been written to disk in the middle of a transaction due to the page
</span></span></span><span class="line"><span class="cl"><span class="cm">** cache overflowing. Transactions are more efficient if they are written
</span></span></span><span class="line"><span class="cl"><span class="cm">** to disk all at once. When pages spill mid-transaction, that introduces
</span></span></span><span class="line"><span class="cl"><span class="cm">** additional overhead. This parameter can be used help identify
</span></span></span><span class="line"><span class="cl"><span class="cm">** inefficiencies that can be resolved by increasing the cache size.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(&lt;dt&gt;SQLITE_DBSTATUS_DEFERRED_FKS&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;This parameter returns zero for the current value if and only if
</span></span></span><span class="line"><span class="cl"><span class="cm">** all foreign key constraints (deferred or immediate) have been
</span></span></span><span class="line"><span class="cl"><span class="cm">** resolved.)^ ^The highwater mark is always 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_LOOKASIDE_USED 0
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_CACHE_USED 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_SCHEMA_USED 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_STMT_USED 3
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_LOOKASIDE_HIT 4
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_CACHE_HIT 7
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_CACHE_MISS 8
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_CACHE_WRITE 9
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_DEFERRED_FKS 10
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_CACHE_SPILL 12
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DBSTATUS_MAX 12 </span><span class="cm">/* Largest defined DBSTATUS */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Prepared Statement Status
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Each prepared statement maintains various
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_STMTSTATUS counters] that measure the number
</span></span></span><span class="line"><span class="cl"><span class="cm">** of times it has performed specific operations.)^ These counters can
</span></span></span><span class="line"><span class="cl"><span class="cm">** be used to monitor the performance characteristics of the prepared
</span></span></span><span class="line"><span class="cl"><span class="cm">** statements. For example, if the number of table steps greatly exceeds
</span></span></span><span class="line"><span class="cl"><span class="cm">** the number of table searches or result rows, that would tend to indicate
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the prepared statement is using a full table scan rather than
</span></span></span><span class="line"><span class="cl"><span class="cm">** an index.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(This interface is used to retrieve and reset counter values from
</span></span></span><span class="line"><span class="cl"><span class="cm">** a [prepared statement]. The first argument is the prepared statement
</span></span></span><span class="line"><span class="cl"><span class="cm">** object to be interrogated. The second argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** is an integer code for a specific [SQLITE_STMTSTATUS counter]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be interrogated.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The current value of the requested counter is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the resetFlg is true, then the counter is reset to zero after this
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface call returns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_status()] and [sqlite3_db_status()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_stmt_status</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">op</span><span class="p">,</span><span class="kt">int</span> <span class="n">resetFlg</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Status Parameters for prepared statements
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These preprocessor macros define integer codes that name counter
</span></span></span><span class="line"><span class="cl"><span class="cm">** values associated with the [sqlite3_stmt_status()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The meanings of the various counters are as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]] &lt;dt&gt;SQLITE_STMTSTATUS_FULLSCAN_STEP&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^This is the number of times that SQLite has stepped forward in
</span></span></span><span class="line"><span class="cl"><span class="cm">** a table as part of a full table scan. Large numbers for this counter
</span></span></span><span class="line"><span class="cl"><span class="cm">** may indicate opportunities for performance improvement through
</span></span></span><span class="line"><span class="cl"><span class="cm">** careful use of indices.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STMTSTATUS_SORT]] &lt;dt&gt;SQLITE_STMTSTATUS_SORT&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^This is the number of sort operations that have occurred.
</span></span></span><span class="line"><span class="cl"><span class="cm">** A non-zero value in this counter may indicate an opportunity to
</span></span></span><span class="line"><span class="cl"><span class="cm">** improvement performance through careful use of indices.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STMTSTATUS_AUTOINDEX]] &lt;dt&gt;SQLITE_STMTSTATUS_AUTOINDEX&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^This is the number of rows inserted into transient indices that
</span></span></span><span class="line"><span class="cl"><span class="cm">** were created automatically in order to help joins run faster.
</span></span></span><span class="line"><span class="cl"><span class="cm">** A non-zero value in this counter may indicate an opportunity to
</span></span></span><span class="line"><span class="cl"><span class="cm">** improvement performance by adding permanent indices that do not
</span></span></span><span class="line"><span class="cl"><span class="cm">** need to be reinitialized each time the statement is run.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STMTSTATUS_VM_STEP]] &lt;dt&gt;SQLITE_STMTSTATUS_VM_STEP&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^This is the number of virtual machine operations executed
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the prepared statement if that number is less than or equal
</span></span></span><span class="line"><span class="cl"><span class="cm">** to 2147483647. The number of virtual machine operations can be
</span></span></span><span class="line"><span class="cl"><span class="cm">** used as a proxy for the total work done by the prepared statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the number of virtual machine operations exceeds 2147483647
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the value returned by this statement status code is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STMTSTATUS_REPREPARE]] &lt;dt&gt;SQLITE_STMTSTATUS_REPREPARE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^This is the number of times that the prepare statement has been
</span></span></span><span class="line"><span class="cl"><span class="cm">** automatically regenerated due to schema changes or changes to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [bound parameters] that might affect the query plan.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STMTSTATUS_RUN]] &lt;dt&gt;SQLITE_STMTSTATUS_RUN&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^This is the number of times that the prepared statement has
</span></span></span><span class="line"><span class="cl"><span class="cm">** been run. A single &#34;run&#34; for the purposes of this counter is one
</span></span></span><span class="line"><span class="cl"><span class="cm">** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** The counter is incremented on the first [sqlite3_step()] call of each
</span></span></span><span class="line"><span class="cl"><span class="cm">** cycle.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STMTSTATUS_FILTER_MISS]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STMTSTATUS_FILTER HIT]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_STMTSTATUS_FILTER_HIT&lt;br&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_STMTSTATUS_FILTER_MISS&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
</span></span></span><span class="line"><span class="cl"><span class="cm">** step was bypassed because a Bloom filter returned not-found. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
</span></span></span><span class="line"><span class="cl"><span class="cm">** times that the Bloom filter returned a find, and thus the join step
</span></span></span><span class="line"><span class="cl"><span class="cm">** had to be processed as normal.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_STMTSTATUS_MEMUSED]] &lt;dt&gt;SQLITE_STMTSTATUS_MEMUSED&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^This is the approximate number of bytes of heap memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** used to store the prepared statement. ^This value is not actually
</span></span></span><span class="line"><span class="cl"><span class="cm">** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STMTSTATUS_FULLSCAN_STEP 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STMTSTATUS_SORT 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STMTSTATUS_AUTOINDEX 3
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STMTSTATUS_VM_STEP 4
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STMTSTATUS_REPREPARE 5
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STMTSTATUS_RUN 6
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STMTSTATUS_FILTER_MISS 7
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STMTSTATUS_FILTER_HIT 8
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_STMTSTATUS_MEMUSED 99
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Custom Page Cache Object
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_pcache type is opaque. It is implemented by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the pluggable module. The SQLite core has no knowledge of
</span></span></span><span class="line"><span class="cl"><span class="cm">** its size or internal structure and never deals with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_pcache object except by holding and passing pointers
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the object.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See [sqlite3_pcache_methods2] for additional information.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_pcache</span> <span class="n">sqlite3_pcache</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Custom Page Cache Object
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_pcache_page object represents a single page in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** page cache. The page cache will allocate instances of this
</span></span></span><span class="line"><span class="cl"><span class="cm">** object. Various methods of the page cache use pointers to instances
</span></span></span><span class="line"><span class="cl"><span class="cm">** of this object as parameters or as their return value.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See [sqlite3_pcache_methods2] for additional information.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_pcache_page</span> <span class="n">sqlite3_pcache_page</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_pcache_page</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pBuf</span><span class="p">;</span> <span class="cm">/* The content of the page */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pExtra</span><span class="p">;</span> <span class="cm">/* Extra information associated with the page */</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Application Defined Page Cache.
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {page cache}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
</span></span></span><span class="line"><span class="cl"><span class="cm">** register an alternative page cache implementation by passing in an
</span></span></span><span class="line"><span class="cl"><span class="cm">** instance of the sqlite3_pcache_methods2 structure.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** In many applications, most of the heap memory allocated by
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite is used for the page cache.
</span></span></span><span class="line"><span class="cl"><span class="cm">** By implementing a
</span></span></span><span class="line"><span class="cl"><span class="cm">** custom page cache using this API, an application can better control
</span></span></span><span class="line"><span class="cl"><span class="cm">** the amount of memory consumed by SQLite, the way in which
</span></span></span><span class="line"><span class="cl"><span class="cm">** that memory is allocated and released, and the policies used to
</span></span></span><span class="line"><span class="cl"><span class="cm">** determine exactly which parts of a database file are cached and for
</span></span></span><span class="line"><span class="cl"><span class="cm">** how long.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The alternative page cache mechanism is an
</span></span></span><span class="line"><span class="cl"><span class="cm">** extreme measure that is only needed by the most demanding applications.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The built-in page cache is recommended for most uses.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
</span></span></span><span class="line"><span class="cl"><span class="cm">** internal buffer by SQLite within the call to [sqlite3_config]. Hence
</span></span></span><span class="line"><span class="cl"><span class="cm">** the application may discard the parameter after the call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_config()] returns.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[the xInit() page cache method]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The xInit() method is called once for each effective
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to [sqlite3_initialize()])^
</span></span></span><span class="line"><span class="cl"><span class="cm">** (usually only once during the lifetime of the process). ^(The xInit()
</span></span></span><span class="line"><span class="cl"><span class="cm">** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** The intent of the xInit() method is to set up global data structures
</span></span></span><span class="line"><span class="cl"><span class="cm">** required by the custom page cache implementation.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If the xInit() method is NULL, then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** built-in default page cache is used instead of the application defined
</span></span></span><span class="line"><span class="cl"><span class="cm">** page cache.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[the xShutdown() page cache method]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The xShutdown() method is called by [sqlite3_shutdown()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** It can be used to clean up
</span></span></span><span class="line"><span class="cl"><span class="cm">** any outstanding resources before process shutdown, if required.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The xShutdown() method may be NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite automatically serializes calls to the xInit method,
</span></span></span><span class="line"><span class="cl"><span class="cm">** so the xInit method need not be threadsafe. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** xShutdown method is only called from [sqlite3_shutdown()] so it does
</span></span></span><span class="line"><span class="cl"><span class="cm">** not need to be threadsafe either. All other methods must be threadsafe
</span></span></span><span class="line"><span class="cl"><span class="cm">** in multithreaded applications.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite will never invoke xInit() more than once without an intervening
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to xShutdown().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[the xCreate() page cache methods]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite invokes the xCreate() method to construct a new cache instance.
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite will typically create one cache instance for each open database file,
</span></span></span><span class="line"><span class="cl"><span class="cm">** though this is not guaranteed. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** first parameter, szPage, is the size in bytes of the pages that must
</span></span></span><span class="line"><span class="cl"><span class="cm">** be allocated by the cache. ^szPage will always a power of two. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** second parameter szExtra is a number of bytes of extra storage
</span></span></span><span class="line"><span class="cl"><span class="cm">** associated with each page cache entry. ^The szExtra parameter will
</span></span></span><span class="line"><span class="cl"><span class="cm">** a number less than 250. SQLite will use the
</span></span></span><span class="line"><span class="cl"><span class="cm">** extra szExtra bytes on each page to store metadata about the underlying
</span></span></span><span class="line"><span class="cl"><span class="cm">** database page on disk. The value passed into szExtra depends
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the SQLite version, the target platform, and how SQLite was compiled.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The third argument to xCreate(), bPurgeable, is true if the cache being
</span></span></span><span class="line"><span class="cl"><span class="cm">** created will be used to cache database pages of a file stored on disk, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** false if it is used for an in-memory database. The cache implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** does not have to do anything special based with the value of bPurgeable;
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
</span></span></span><span class="line"><span class="cl"><span class="cm">** never invoke xUnpin() except to deliberately delete a page.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
</span></span></span><span class="line"><span class="cl"><span class="cm">** false will always have the &#34;discard&#34; flag set to true.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Hence, a cache created with bPurgeable false will
</span></span></span><span class="line"><span class="cl"><span class="cm">** never contain any unpinned pages.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[the xCachesize() page cache method]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The xCachesize() method may be called at any time by SQLite to set the
</span></span></span><span class="line"><span class="cl"><span class="cm">** suggested maximum cache-size (number of pages stored by) the cache
</span></span></span><span class="line"><span class="cl"><span class="cm">** instance passed as the first argument. This is the value configured using
</span></span></span><span class="line"><span class="cl"><span class="cm">** the SQLite &#34;[PRAGMA cache_size]&#34; command.)^ As with the bPurgeable
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter, the implementation is not required to do anything with this
</span></span></span><span class="line"><span class="cl"><span class="cm">** value; it is advisory only.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[the xPagecount() page cache methods]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xPagecount() method must return the number of pages currently
</span></span></span><span class="line"><span class="cl"><span class="cm">** stored in the cache, both pinned and unpinned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[the xFetch() page cache methods]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xFetch() method locates a page in the cache and returns a pointer to
</span></span></span><span class="line"><span class="cl"><span class="cm">** an sqlite3_pcache_page object associated with that page, or a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The pBuf element of the returned sqlite3_pcache_page object will be a
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer to a buffer of szPage bytes used to store the content of a
</span></span></span><span class="line"><span class="cl"><span class="cm">** single database page. The pExtra element of sqlite3_pcache_page will be
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to the szExtra bytes of extra storage that SQLite has requested
</span></span></span><span class="line"><span class="cl"><span class="cm">** for each entry in the page cache.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The page to be fetched is determined by the key. ^The minimum key value
</span></span></span><span class="line"><span class="cl"><span class="cm">** is 1. After it has been retrieved using xFetch, the page is considered
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be &#34;pinned&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the requested page is already in the page cache, then the page cache
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation must return a pointer to the page buffer with its content
</span></span></span><span class="line"><span class="cl"><span class="cm">** intact. If the requested page is not already in the cache, then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** cache implementation should use the value of the createFlag
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter to help it determined what action to take:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;table border=1 width=85% align=center&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;th&gt; createFlag &lt;th&gt; Behavior when page is not already in cache
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; 0 &lt;td&gt; Do not allocate a new page. Return NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; 1 &lt;td&gt; Allocate a new page if it easy and convenient to do so.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Otherwise return NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt; 2 &lt;td&gt; Make every effort to allocate a new page. Only return
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL if allocating a new page is effectively impossible.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/table&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** will only use a createFlag of 2 after a prior call with a createFlag of 1
</span></span></span><span class="line"><span class="cl"><span class="cm">** failed.)^ In between the xFetch() calls, SQLite may
</span></span></span><span class="line"><span class="cl"><span class="cm">** attempt to unpin one or more cache pages by spilling the content of
</span></span></span><span class="line"><span class="cl"><span class="cm">** pinned pages to disk and synching the operating system disk cache.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[the xUnpin() page cache method]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
</span></span></span><span class="line"><span class="cl"><span class="cm">** as its second argument. If the third parameter, discard, is non-zero,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the page must be evicted from the cache.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the discard parameter is
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero, then the page may be discarded or retained at the discretion of
</span></span></span><span class="line"><span class="cl"><span class="cm">** page cache implementation. ^The page cache implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** may choose to evict unpinned pages at any time.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The cache must not perform any reference counting. A single
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to xUnpin() unpins the page regardless of the number of prior calls
</span></span></span><span class="line"><span class="cl"><span class="cm">** to xFetch().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[the xRekey() page cache methods]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xRekey() method is used to change the key value associated with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** page passed as the second argument. If the cache
</span></span></span><span class="line"><span class="cl"><span class="cm">** previously contains an entry associated with newKey, it must be
</span></span></span><span class="line"><span class="cl"><span class="cm">** discarded. ^Any prior cache entry associated with newKey is guaranteed not
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be pinned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When SQLite calls the xTruncate() method, the cache must discard all
</span></span></span><span class="line"><span class="cl"><span class="cm">** existing cache entries with page numbers (keys) greater than or equal
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the value of the iLimit parameter passed to xTruncate(). If any
</span></span></span><span class="line"><span class="cl"><span class="cm">** of these pages are pinned, they are implicitly unpinned, meaning that
</span></span></span><span class="line"><span class="cl"><span class="cm">** they can be safely discarded.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[the xDestroy() page cache method]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The xDestroy() method is used to delete a cache allocated by xCreate().
</span></span></span><span class="line"><span class="cl"><span class="cm">** All resources associated with the specified cache should be freed. ^After
</span></span></span><span class="line"><span class="cl"><span class="cm">** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
</span></span></span><span class="line"><span class="cl"><span class="cm">** handle invalid, and will not use it with any other sqlite3_pcache_methods2
</span></span></span><span class="line"><span class="cl"><span class="cm">** functions.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[the xShrink() page cache method]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite invokes the xShrink() method when it wants the page cache to
</span></span></span><span class="line"><span class="cl"><span class="cm">** free up as much of heap memory as possible. The page cache implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not obligated to free any memory, but well-behaved implementations should
</span></span></span><span class="line"><span class="cl"><span class="cm">** do their best.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_pcache_methods2</span> <span class="n">sqlite3_pcache_methods2</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_pcache_methods2</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iVersion</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pArg</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInit</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xShutdown</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_pcache</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xCreate</span><span class="p">)(</span><span class="kt">int</span> <span class="n">szPage</span><span class="p">,</span> <span class="kt">int</span> <span class="n">szExtra</span><span class="p">,</span> <span class="kt">int</span> <span class="n">bPurgeable</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xCachesize</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nCachesize</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xPagecount</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_pcache_page</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xFetch</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">key</span><span class="p">,</span> <span class="kt">int</span> <span class="n">createFlag</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xUnpin</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_pcache_page</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">discard</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xRekey</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_pcache_page</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="n">oldKey</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">newKey</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xTruncate</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">iLimit</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xDestroy</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xShrink</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** This is the obsolete pcache_methods object that has now been replaced
</span></span></span><span class="line"><span class="cl"><span class="cm">** by sqlite3_pcache_methods2. This object is not used by SQLite. It is
</span></span></span><span class="line"><span class="cl"><span class="cm">** retained in the header file for backwards compatibility only.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_pcache_methods</span> <span class="n">sqlite3_pcache_methods</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_pcache_methods</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pArg</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInit</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xShutdown</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_pcache</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xCreate</span><span class="p">)(</span><span class="kt">int</span> <span class="n">szPage</span><span class="p">,</span> <span class="kt">int</span> <span class="n">bPurgeable</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xCachesize</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nCachesize</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xPagecount</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xFetch</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">key</span><span class="p">,</span> <span class="kt">int</span> <span class="n">createFlag</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xUnpin</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">discard</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xRekey</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">oldKey</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">newKey</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xTruncate</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">iLimit</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xDestroy</span><span class="p">)(</span><span class="n">sqlite3_pcache</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Online Backup Object
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_backup object records state information about an ongoing
</span></span></span><span class="line"><span class="cl"><span class="cm">** online backup operation. ^The sqlite3_backup object is created by
</span></span></span><span class="line"><span class="cl"><span class="cm">** a call to [sqlite3_backup_init()] and is destroyed by a call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_backup_finish()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See Also: [Using the SQLite Online Backup API]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_backup</span> <span class="n">sqlite3_backup</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Online Backup API.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The backup API copies the content of one database into another.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is useful either for creating backups of databases or
</span></span></span><span class="line"><span class="cl"><span class="cm">** for copying in-memory databases to or from persistent files.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See Also: [Using the SQLite Online Backup API]
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^SQLite holds a write transaction open on the destination database file
</span></span></span><span class="line"><span class="cl"><span class="cm">** for the duration of the backup operation.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The source database is read-locked only while it is being read;
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is not locked continuously for the entire backup operation.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Thus, the backup may be performed on a live source database without
</span></span></span><span class="line"><span class="cl"><span class="cm">** preventing other database connections from
</span></span></span><span class="line"><span class="cl"><span class="cm">** reading or writing to the source database while the backup is underway.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(To perform a backup operation:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;&lt;b&gt;sqlite3_backup_init()&lt;/b&gt; is called once to initialize the
</span></span></span><span class="line"><span class="cl"><span class="cm">** backup,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;&lt;b&gt;sqlite3_backup_step()&lt;/b&gt; is called one or more times to transfer
</span></span></span><span class="line"><span class="cl"><span class="cm">** the data between the two databases, and finally
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;&lt;b&gt;sqlite3_backup_finish()&lt;/b&gt; is called to release all resources
</span></span></span><span class="line"><span class="cl"><span class="cm">** associated with the backup operation.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** There should be exactly one call to sqlite3_backup_finish() for each
</span></span></span><span class="line"><span class="cl"><span class="cm">** successful call to sqlite3_backup_init().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[sqlite3_backup_init()]] &lt;b&gt;sqlite3_backup_init()&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] associated with the destination database
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the database name, respectively.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The database name is &#34;main&#34; for the main database, &#34;temp&#34; for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** temporary database, or the name specified after the AS keyword in
</span></span></span><span class="line"><span class="cl"><span class="cm">** an [ATTACH] statement for an attached database.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The S and M arguments passed to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_init(D,N,S,M) identify the [database connection]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and database name of the source database, respectively.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The source and destination [database connections] (parameters S and D)
</span></span></span><span class="line"><span class="cl"><span class="cm">** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A call to sqlite3_backup_init() will fail, returning NULL, if
</span></span></span><span class="line"><span class="cl"><span class="cm">** there is already a read or read-write transaction open on the
</span></span></span><span class="line"><span class="cl"><span class="cm">** destination database.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned and an error code and error message are stored in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** destination [database connection] D.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The error code and message for the failed call to sqlite3_backup_init()
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_errmsg16()] functions.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A successful call to sqlite3_backup_init() returns a pointer to an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_backup] object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_finish() functions to perform the specified backup
</span></span></span><span class="line"><span class="cl"><span class="cm">** operation.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[sqlite3_backup_step()]] &lt;b&gt;sqlite3_backup_step()&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Function sqlite3_backup_step(B,N) will copy up to N pages between
</span></span></span><span class="line"><span class="cl"><span class="cm">** the source and destination databases specified by [sqlite3_backup] object B.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If N is negative, all remaining source pages are copied.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If sqlite3_backup_step(B,N) successfully copies N pages and there
</span></span></span><span class="line"><span class="cl"><span class="cm">** are still more pages to be copied, then the function returns [SQLITE_OK].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages
</span></span></span><span class="line"><span class="cl"><span class="cm">** from source to destination, then it returns [SQLITE_DONE].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If an error occurs while running sqlite3_backup_step(B,N),
</span></span></span><span class="line"><span class="cl"><span class="cm">** then an [error code] is returned. ^As well as [SQLITE_OK] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the destination database was opened read-only, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the destination database is using write-ahead-log journaling
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the destination and source page sizes differ, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the destination database is an in-memory database and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** destination and source page sizes differ.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3_busy_handler | busy-handler function]
</span></span></span><span class="line"><span class="cl"><span class="cm">** is invoked (if one is specified). ^If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** busy-handler returns non-zero before the lock is available, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_BUSY] is returned to the caller. ^In this case the call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_step() can be retried later. ^If the source
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection]
</span></span></span><span class="line"><span class="cl"><span class="cm">** is being used to write to the source database when sqlite3_backup_step()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this
</span></span></span><span class="line"><span class="cl"><span class="cm">** case the call to sqlite3_backup_step() can be retried later on. ^(If
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_READONLY] is returned, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** there is no point in retrying the call to sqlite3_backup_step(). These
</span></span></span><span class="line"><span class="cl"><span class="cm">** errors are considered fatal.)^ The application must accept
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the backup operation has failed and pass the backup operation handle
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the sqlite3_backup_finish() to release associated resources.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first call to sqlite3_backup_step() obtains an exclusive lock
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the destination file. ^The exclusive lock is not released until either
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_finish() is called or the backup operation is complete
</span></span></span><span class="line"><span class="cl"><span class="cm">** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_step() obtains a [shared lock] on the source database that
</span></span></span><span class="line"><span class="cl"><span class="cm">** lasts for the duration of the sqlite3_backup_step() call.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Because the source database is not locked between calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_step(), the source database may be modified mid-way
</span></span></span><span class="line"><span class="cl"><span class="cm">** through the backup process. ^If the source database is modified by an
</span></span></span><span class="line"><span class="cl"><span class="cm">** external process or via a database connection other than the one being
</span></span></span><span class="line"><span class="cl"><span class="cm">** used by the backup operation, then the backup will be automatically
</span></span></span><span class="line"><span class="cl"><span class="cm">** restarted by the next call to sqlite3_backup_step(). ^If the source
</span></span></span><span class="line"><span class="cl"><span class="cm">** database is modified by the using the same database connection as is used
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the backup operation, then the backup database is automatically
</span></span></span><span class="line"><span class="cl"><span class="cm">** updated at the same time.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[sqlite3_backup_finish()]] &lt;b&gt;sqlite3_backup_finish()&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the
</span></span></span><span class="line"><span class="cl"><span class="cm">** application wishes to abandon the backup operation, the application
</span></span></span><span class="line"><span class="cl"><span class="cm">** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_backup_finish() interfaces releases all
</span></span></span><span class="line"><span class="cl"><span class="cm">** resources associated with the [sqlite3_backup] object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any
</span></span></span><span class="line"><span class="cl"><span class="cm">** active write-transaction on the destination database is rolled back.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_backup] object is invalid
</span></span></span><span class="line"><span class="cl"><span class="cm">** and may not be used following a call to sqlite3_backup_finish().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_step() errors occurred, regardless or whether or not
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_step() completed.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If an out-of-memory condition or IO error occurred during any prior
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_finish() returns the corresponding [error code].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not a permanent error and does not affect the return value of
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_finish().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;sqlite3_backup_remaining() and sqlite3_backup_pagecount()&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_backup_remaining() routine returns the number of pages still
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be backed up at the conclusion of the most recent sqlite3_backup_step().
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_backup_pagecount() routine returns the total number of pages
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the source database at the conclusion of the most recent
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_step().
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The values returned by these functions are only updated by
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_step(). If the source database is modified in a way that
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes the size of the source database or the number of pages remaining,
</span></span></span><span class="line"><span class="cl"><span class="cm">** those changes are not reflected in the output of sqlite3_backup_pagecount()
</span></span></span><span class="line"><span class="cl"><span class="cm">** and sqlite3_backup_remaining() until after the next
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_step().)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Concurrent Usage of Database Handles&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The source [database connection] may be used by the application for other
</span></span></span><span class="line"><span class="cl"><span class="cm">** purposes while a backup operation is underway or being initialized.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If SQLite is compiled and configured to support threadsafe database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connections, then the source database connection may be used concurrently
</span></span></span><span class="line"><span class="cl"><span class="cm">** from within other threads.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** However, the application must guarantee that the destination
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] is not passed to any other API (by any thread) after
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_init() is called and before the corresponding call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_backup_finish(). SQLite does not currently check to see
</span></span></span><span class="line"><span class="cl"><span class="cm">** if the application incorrectly accesses the destination [database connection]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and so no error code is reported, but the operations may malfunction
</span></span></span><span class="line"><span class="cl"><span class="cm">** nevertheless. Use of the destination database connection while a
</span></span></span><span class="line"><span class="cl"><span class="cm">** backup is in progress might also cause a mutex deadlock.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If running in [shared cache mode], the application must
</span></span></span><span class="line"><span class="cl"><span class="cm">** guarantee that the shared cache used by the destination database
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not accessed while the backup is running. In practice this means
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the application must guarantee that the disk file being
</span></span></span><span class="line"><span class="cl"><span class="cm">** backed up to is not accessed by any connection within the process,
</span></span></span><span class="line"><span class="cl"><span class="cm">** not just the specific connection that was passed to sqlite3_backup_init().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_backup] object itself is partially threadsafe. Multiple
</span></span></span><span class="line"><span class="cl"><span class="cm">** threads may safely make multiple concurrent calls to sqlite3_backup_step().
</span></span></span><span class="line"><span class="cl"><span class="cm">** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
</span></span></span><span class="line"><span class="cl"><span class="cm">** APIs are not strictly speaking threadsafe. If they are invoked at the
</span></span></span><span class="line"><span class="cl"><span class="cm">** same time as another thread is invoking sqlite3_backup_step() it is
</span></span></span><span class="line"><span class="cl"><span class="cm">** possible that they return invalid values.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_backup</span> <span class="o">*</span><span class="nf">sqlite3_backup_init</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">pDest</span><span class="p">,</span> <span class="cm">/* Destination database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDestName</span><span class="p">,</span> <span class="cm">/* Destination database name */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">pSource</span><span class="p">,</span> <span class="cm">/* Source database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSourceName</span> <span class="cm">/* Source database name */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_backup_step</span><span class="p">(</span><span class="n">sqlite3_backup</span> <span class="o">*</span><span class="n">p</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nPage</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_backup_finish</span><span class="p">(</span><span class="n">sqlite3_backup</span> <span class="o">*</span><span class="n">p</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_backup_remaining</span><span class="p">(</span><span class="n">sqlite3_backup</span> <span class="o">*</span><span class="n">p</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_backup_pagecount</span><span class="p">(</span><span class="n">sqlite3_backup</span> <span class="o">*</span><span class="n">p</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Unlock Notification
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When running in shared-cache mode, a database operation may fail with
</span></span></span><span class="line"><span class="cl"><span class="cm">** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
</span></span></span><span class="line"><span class="cl"><span class="cm">** individual tables within the shared-cache cannot be obtained. See
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLite Shared-Cache Mode] for a description of shared-cache locking.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This API may be used to register a callback that SQLite will invoke
</span></span></span><span class="line"><span class="cl"><span class="cm">** when the connection currently holding the required lock relinquishes it.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This API is only available if the library was compiled with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See Also: [Using the SQLite Unlock Notification Feature].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Shared-cache locks are released when a database connection concludes
</span></span></span><span class="line"><span class="cl"><span class="cm">** its current transaction, either by committing it or rolling it back.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When a connection (known as the blocked connection) fails to obtain a
</span></span></span><span class="line"><span class="cl"><span class="cm">** shared-cache lock and SQLITE_LOCKED is returned to the caller, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** identity of the database connection (the blocking connection) that
</span></span></span><span class="line"><span class="cl"><span class="cm">** has locked the required resource is stored internally. ^After an
</span></span></span><span class="line"><span class="cl"><span class="cm">** application receives an SQLITE_LOCKED error, it may call the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_unlock_notify() method with the blocked connection handle as
</span></span></span><span class="line"><span class="cl"><span class="cm">** the first argument to register for a callback that will be invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** when the blocking connections current transaction is concluded. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
</span></span></span><span class="line"><span class="cl"><span class="cm">** call that concludes the blocking connection&#39;s transaction.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
</span></span></span><span class="line"><span class="cl"><span class="cm">** there is a chance that the blocking connection will have already
</span></span></span><span class="line"><span class="cl"><span class="cm">** concluded its transaction by the time sqlite3_unlock_notify() is invoked.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If this happens, then the specified callback is invoked immediately,
</span></span></span><span class="line"><span class="cl"><span class="cm">** from within the call to sqlite3_unlock_notify().)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the blocked connection is attempting to obtain a write-lock on a
</span></span></span><span class="line"><span class="cl"><span class="cm">** shared-cache table, and more than one other connection currently holds
</span></span></span><span class="line"><span class="cl"><span class="cm">** a read-lock on the same table, then SQLite arbitrarily selects one of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the other connections to use as the blocking connection.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(There may be at most one unlock-notify callback registered by a
</span></span></span><span class="line"><span class="cl"><span class="cm">** blocked connection. If sqlite3_unlock_notify() is called when the
</span></span></span><span class="line"><span class="cl"><span class="cm">** blocked connection already has a registered unlock-notify callback,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
</span></span></span><span class="line"><span class="cl"><span class="cm">** called with a NULL pointer as its second argument, then any existing
</span></span></span><span class="line"><span class="cl"><span class="cm">** unlock-notify callback is canceled. ^The blocked connections
</span></span></span><span class="line"><span class="cl"><span class="cm">** unlock-notify callback may also be canceled by closing the blocked
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection using [sqlite3_close()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The unlock-notify callback is not reentrant. If an application invokes
</span></span></span><span class="line"><span class="cl"><span class="cm">** any sqlite3_xxx API functions from within an unlock-notify callback, a
</span></span></span><span class="line"><span class="cl"><span class="cm">** crash or deadlock may be the result.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns SQLITE_OK.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Callback Invocation Details&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When an unlock-notify callback is registered, the application provides a
</span></span></span><span class="line"><span class="cl"><span class="cm">** single void* pointer that is passed to the callback when it is invoked.
</span></span></span><span class="line"><span class="cl"><span class="cm">** However, the signature of the callback function allows SQLite to pass
</span></span></span><span class="line"><span class="cl"><span class="cm">** it an array of void* context pointers. The first argument passed to
</span></span></span><span class="line"><span class="cl"><span class="cm">** an unlock-notify callback is a pointer to an array of void* pointers,
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the second is the number of entries in the array.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When a blocking connection&#39;s transaction is concluded, there may be
</span></span></span><span class="line"><span class="cl"><span class="cm">** more than one blocked connection that has registered for an unlock-notify
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback. ^If two or more such blocked connections have specified the
</span></span></span><span class="line"><span class="cl"><span class="cm">** same callback function, then instead of invoking the callback function
</span></span></span><span class="line"><span class="cl"><span class="cm">** multiple times, it is invoked once with the set of void* context pointers
</span></span></span><span class="line"><span class="cl"><span class="cm">** specified by the blocked connections bundled together into an array.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This gives the application an opportunity to prioritize any actions
</span></span></span><span class="line"><span class="cl"><span class="cm">** related to the set of unblocked database connections.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;Deadlock Detection&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Assuming that after registering for an unlock-notify callback a
</span></span></span><span class="line"><span class="cl"><span class="cm">** database waits for the callback to be issued before taking any further
</span></span></span><span class="line"><span class="cl"><span class="cm">** action (a reasonable assumption), then using this API may cause the
</span></span></span><span class="line"><span class="cl"><span class="cm">** application to deadlock. For example, if connection X is waiting for
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection Y&#39;s transaction to be concluded, and similarly connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** Y is waiting on connection X&#39;s transaction, then neither connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** will proceed and the system may remain deadlocked indefinitely.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock
</span></span></span><span class="line"><span class="cl"><span class="cm">** detection. ^If a given call to sqlite3_unlock_notify() would put the
</span></span></span><span class="line"><span class="cl"><span class="cm">** system in a deadlocked state, then SQLITE_LOCKED is returned and no
</span></span></span><span class="line"><span class="cl"><span class="cm">** unlock-notify callback is registered. The system is said to be in
</span></span></span><span class="line"><span class="cl"><span class="cm">** a deadlocked state if connection A has registered for an unlock-notify
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback on the conclusion of connection B&#39;s transaction, and connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** B has itself registered for an unlock-notify callback when connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** A&#39;s transaction is concluded. ^Indirect deadlock is also detected, so
</span></span></span><span class="line"><span class="cl"><span class="cm">** the system is also considered to be deadlocked if connection B has
</span></span></span><span class="line"><span class="cl"><span class="cm">** registered for an unlock-notify callback on the conclusion of connection
</span></span></span><span class="line"><span class="cl"><span class="cm">** C&#39;s transaction, where connection C is waiting on connection A. ^Any
</span></span></span><span class="line"><span class="cl"><span class="cm">** number of levels of indirection are allowed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;b&gt;The &#34;DROP TABLE&#34; Exception&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost
</span></span></span><span class="line"><span class="cl"><span class="cm">** always appropriate to call sqlite3_unlock_notify(). There is however,
</span></span></span><span class="line"><span class="cl"><span class="cm">** one exception. When executing a &#34;DROP TABLE&#34; or &#34;DROP INDEX&#34; statement,
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite checks if there are any currently executing SELECT statements
</span></span></span><span class="line"><span class="cl"><span class="cm">** that belong to the same connection. If there are, SQLITE_LOCKED is
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned. In this case there is no &#34;blocking connection&#34;, so invoking
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_unlock_notify() results in the unlock-notify callback being
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked immediately. If the application then re-attempts the &#34;DROP TABLE&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** or &#34;DROP INDEX&#34; query, an infinite loop might be the result.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** One way around this problem is to check the extended error code returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** by an sqlite3_step() call. ^(If there is a blocking connection, then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the special &#34;DROP TABLE/INDEX&#34; case, the extended error code is just
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_LOCKED.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_unlock_notify</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">pBlocked</span><span class="p">,</span> <span class="cm">/* Waiting connection */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xNotify</span><span class="p">)(</span><span class="kt">void</span> <span class="o">**</span><span class="n">apArg</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nArg</span><span class="p">),</span> <span class="cm">/* Callback function to invoke */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pNotifyArg</span> <span class="cm">/* Argument to pass to xNotify */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: String Comparison
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
</span></span></span><span class="line"><span class="cl"><span class="cm">** and extensions to compare the contents of two buffers containing UTF-8
</span></span></span><span class="line"><span class="cl"><span class="cm">** strings in a case-independent fashion, using the same definition of &#34;case
</span></span></span><span class="line"><span class="cl"><span class="cm">** independence&#34; that SQLite uses internally when comparing identifiers.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_stricmp</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_strnicmp</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: String Globbing
</span></span></span><span class="line"><span class="cl"><span class="cm">*
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
</span></span></span><span class="line"><span class="cl"><span class="cm">** string X matches the [GLOB] pattern P.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The definition of [GLOB] pattern matching used in
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_strglob(P,X)] is the same as for the &#34;X GLOB P&#34; operator in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL dialect understood by SQLite. ^The [sqlite3_strglob(P,X)] function
</span></span></span><span class="line"><span class="cl"><span class="cm">** is case sensitive.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that this routine returns zero on a match and non-zero if the strings
</span></span></span><span class="line"><span class="cl"><span class="cm">** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_strlike()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_strglob</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zGlob</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zStr</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: String LIKE Matching
</span></span></span><span class="line"><span class="cl"><span class="cm">*
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
</span></span></span><span class="line"><span class="cl"><span class="cm">** string X matches the [LIKE] pattern P with escape character E.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The definition of [LIKE] pattern matching used in
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_strlike(P,X,E)] is the same as for the &#34;X LIKE P ESCAPE E&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** operator in the SQL dialect understood by SQLite. ^For &#34;X LIKE P&#34; without
</span></span></span><span class="line"><span class="cl"><span class="cm">** the ESCAPE clause, set the E parameter of [sqlite3_strlike(P,X,E)] to 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^As with the LIKE operator, the [sqlite3_strlike(P,X,E)] function is case
</span></span></span><span class="line"><span class="cl"><span class="cm">** insensitive - equivalent upper and lower case ASCII characters match
</span></span></span><span class="line"><span class="cl"><span class="cm">** one another.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_strlike(P,X,E)] function matches Unicode characters, though
</span></span></span><span class="line"><span class="cl"><span class="cm">** only ASCII characters are case folded.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that this routine returns zero on a match and non-zero if the strings
</span></span></span><span class="line"><span class="cl"><span class="cm">** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_strglob()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_strlike</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zGlob</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zStr</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">cEsc</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Error Logging Interface
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_log()] interface writes a message into the [error log]
</span></span></span><span class="line"><span class="cl"><span class="cm">** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If logging is enabled, the zFormat string and subsequent arguments are
</span></span></span><span class="line"><span class="cl"><span class="cm">** used with [sqlite3_snprintf()] to generate the final output string.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_log() interface is intended for use by extensions such as
</span></span></span><span class="line"><span class="cl"><span class="cm">** virtual tables, collating functions, and SQL functions. While there is
</span></span></span><span class="line"><span class="cl"><span class="cm">** nothing to prevent an application from calling sqlite3_log(), doing so
</span></span></span><span class="line"><span class="cl"><span class="cm">** is considered bad form.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The zFormat string must not be NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** To avoid deadlocks and other threading problems, the sqlite3_log() routine
</span></span></span><span class="line"><span class="cl"><span class="cm">** will not use dynamically allocated memory. The log message is stored in
</span></span></span><span class="line"><span class="cl"><span class="cm">** a fixed-length buffer on the stack. If the log message is longer than
</span></span></span><span class="line"><span class="cl"><span class="cm">** a few hundred characters, it will be truncated to the length of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** buffer.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_log</span><span class="p">(</span><span class="kt">int</span> <span class="n">iErrCode</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zFormat</span><span class="p">,</span> <span class="p">...);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Write-Ahead Log Commit Hook
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_wal_hook()] function is used to register a callback that
</span></span></span><span class="line"><span class="cl"><span class="cm">** is invoked each time data is committed to a database in wal mode.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The callback is invoked by SQLite after the commit has taken place and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the associated write-lock on the database released)^, so the implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** may read, write or [checkpoint] the database as required.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The first parameter passed to the callback function when it is invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** is a copy of the third parameter passed to sqlite3_wal_hook() when
</span></span></span><span class="line"><span class="cl"><span class="cm">** registering the callback. ^The second is a copy of the database handle.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The third parameter is the name of the database that was written to -
</span></span></span><span class="line"><span class="cl"><span class="cm">** either &#34;main&#34; or the name of an [ATTACH]-ed database. ^The fourth parameter
</span></span></span><span class="line"><span class="cl"><span class="cm">** is the number of pages currently in the write-ahead log file,
</span></span></span><span class="line"><span class="cl"><span class="cm">** including those that were just committed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The callback function should normally return [SQLITE_OK]. ^If an error
</span></span></span><span class="line"><span class="cl"><span class="cm">** code is returned, that error will propagate back up through the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite code base to cause the statement that provoked the callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** to report an error, though the commit will have still occurred. If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value
</span></span></span><span class="line"><span class="cl"><span class="cm">** that does not correspond to any valid SQLite error code, the results
</span></span></span><span class="line"><span class="cl"><span class="cm">** are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A single database handle may have at most a single write-ahead log callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
</span></span></span><span class="line"><span class="cl"><span class="cm">** previously registered write-ahead log callback. ^The return value is
</span></span></span><span class="line"><span class="cl"><span class="cm">** a copy of the third parameter from the previous call, if any, or 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Note that the [sqlite3_wal_autocheckpoint()] interface and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
</span></span></span><span class="line"><span class="cl"><span class="cm">** overwrite any prior [sqlite3_wal_hook()] settings.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_wal_hook</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="p">,</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="o">*</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Configure an auto-checkpoint
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_wal_hook()] that causes any database on [database connection] D
</span></span></span><span class="line"><span class="cl"><span class="cm">** to automatically [checkpoint]
</span></span></span><span class="line"><span class="cl"><span class="cm">** after committing a transaction if there are N or
</span></span></span><span class="line"><span class="cl"><span class="cm">** more frames in the [write-ahead log] file. ^Passing zero or
</span></span></span><span class="line"><span class="cl"><span class="cm">** a negative value as the nFrame parameter disables automatic
</span></span></span><span class="line"><span class="cl"><span class="cm">** checkpoints entirely.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The callback registered by this function replaces any existing callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism
</span></span></span><span class="line"><span class="cl"><span class="cm">** configured by this function.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [wal_autocheckpoint pragma] can be used to invoke this interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** from SQL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Checkpoints initiated by this mechanism are
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_wal_checkpoint_v2|PASSIVE].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Every new [database connection] defaults to having the auto-checkpoint
</span></span></span><span class="line"><span class="cl"><span class="cm">** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
</span></span></span><span class="line"><span class="cl"><span class="cm">** pages. The use of this interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** is only necessary if the default setting is found to be suboptimal
</span></span></span><span class="line"><span class="cl"><span class="cm">** for a particular application.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_wal_autocheckpoint</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="kt">int</span> <span class="n">N</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Checkpoint a database
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [write-ahead log] for database X on [database connection] D to be
</span></span></span><span class="line"><span class="cl"><span class="cm">** transferred into the database file and for the write-ahead log to
</span></span></span><span class="line"><span class="cl"><span class="cm">** be reset. See the [checkpointing] documentation for addition
</span></span></span><span class="line"><span class="cl"><span class="cm">** information.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface used to be the only way to cause a checkpoint to
</span></span></span><span class="line"><span class="cl"><span class="cm">** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface was added. This interface is retained for backwards
</span></span></span><span class="line"><span class="cl"><span class="cm">** compatibility and as a convenience for applications that need to manually
</span></span></span><span class="line"><span class="cl"><span class="cm">** start a callback but which do not need the full power (and corresponding
</span></span></span><span class="line"><span class="cl"><span class="cm">** complication) of [sqlite3_wal_checkpoint_v2()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_wal_checkpoint</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDb</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Checkpoint a database
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint
</span></span></span><span class="line"><span class="cl"><span class="cm">** operation on database X of [database connection] D in mode M. Status
</span></span></span><span class="line"><span class="cl"><span class="cm">** information is written back into integers pointed to by L and C.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The M parameter must be a valid [checkpoint mode]:)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHECKPOINT_PASSIVE&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Checkpoint as many frames as possible without waiting for any database
</span></span></span><span class="line"><span class="cl"><span class="cm">** readers or writers to finish, then sync the database file if all frames
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the log were checkpointed. ^The [busy-handler callback]
</span></span></span><span class="line"><span class="cl"><span class="cm">** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^On the other hand, passive mode might leave the checkpoint unfinished
</span></span></span><span class="line"><span class="cl"><span class="cm">** if there are concurrent readers or writers.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHECKPOINT_FULL&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This mode blocks (it invokes the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_busy_handler|busy-handler callback]) until there is no
</span></span></span><span class="line"><span class="cl"><span class="cm">** database writer and all readers are reading from the most recent database
</span></span></span><span class="line"><span class="cl"><span class="cm">** snapshot. ^It then checkpoints all frames in the log file and syncs the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database file. ^This mode blocks new database writers while it is pending,
</span></span></span><span class="line"><span class="cl"><span class="cm">** but new database readers are allowed to continue unimpeded.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHECKPOINT_RESTART&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition
</span></span></span><span class="line"><span class="cl"><span class="cm">** that after checkpointing the log file it blocks (calls the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [busy-handler callback])
</span></span></span><span class="line"><span class="cl"><span class="cm">** until all readers are reading from the database file only. ^This ensures
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the next writer will restart the log file from the beginning.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new
</span></span></span><span class="line"><span class="cl"><span class="cm">** database writer attempts while it is pending, but does not impede readers.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHECKPOINT_TRUNCATE&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** addition that it also truncates the log file to zero bytes just prior
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a successful return.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the log file or to -1 if the checkpoint could not run because
</span></span></span><span class="line"><span class="cl"><span class="cm">** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL,then *pnCkpt is set to the total number of checkpointed frames in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** log file (including any that were already checkpointed before the function
</span></span></span><span class="line"><span class="cl"><span class="cm">** was called) or to -1 if the checkpoint could not run due to an error or
</span></span></span><span class="line"><span class="cl"><span class="cm">** because the database is not in WAL mode. ^Note that upon successful
</span></span></span><span class="line"><span class="cl"><span class="cm">** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been
</span></span></span><span class="line"><span class="cl"><span class="cm">** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^All calls obtain an exclusive &#34;checkpoint&#34; lock on the database file. ^If
</span></span></span><span class="line"><span class="cl"><span class="cm">** any other process is running a checkpoint operation at the same time, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a
</span></span></span><span class="line"><span class="cl"><span class="cm">** busy-handler configured, it will not be invoked in this case.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
</span></span></span><span class="line"><span class="cl"><span class="cm">** exclusive &#34;writer&#34; lock on the database file. ^If the writer lock cannot be
</span></span></span><span class="line"><span class="cl"><span class="cm">** obtained immediately, and a busy-handler is configured, it is invoked and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the writer lock retried until either the busy-handler returns 0 or the lock
</span></span></span><span class="line"><span class="cl"><span class="cm">** is successfully obtained. ^The busy-handler is also invoked while waiting for
</span></span></span><span class="line"><span class="cl"><span class="cm">** database readers as described above. ^If the busy-handler returns 0 before
</span></span></span><span class="line"><span class="cl"><span class="cm">** the writer lock is obtained or while waiting for database readers, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** checkpoint operation proceeds from that point in the same way as
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
</span></span></span><span class="line"><span class="cl"><span class="cm">** without blocking any further. ^SQLITE_BUSY is returned in this case.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If parameter zDb is NULL or points to a zero length string, then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** specified operation is attempted on all WAL databases [attached] to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] db. In this case the
</span></span></span><span class="line"><span class="cl"><span class="cm">** values written to output parameters *pnLog and *pnCkpt are undefined. ^If
</span></span></span><span class="line"><span class="cl"><span class="cm">** an SQLITE_BUSY error is encountered when processing one or more of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** attached WAL databases, the operation is still attempted on any remaining
</span></span></span><span class="line"><span class="cl"><span class="cm">** attached databases and SQLITE_BUSY is returned at the end. ^If any other
</span></span></span><span class="line"><span class="cl"><span class="cm">** error occurs while processing an attached database, processing is abandoned
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the error code is returned to the caller immediately. ^If no error
</span></span></span><span class="line"><span class="cl"><span class="cm">** (SQLITE_BUSY or otherwise) is encountered while processing the attached
</span></span></span><span class="line"><span class="cl"><span class="cm">** databases, SQLITE_OK is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If database zDb is the name of an attached database that is not in WAL
</span></span></span><span class="line"><span class="cl"><span class="cm">** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If
</span></span></span><span class="line"><span class="cl"><span class="cm">** zDb is not NULL (or a zero length string) and is not the name of any
</span></span></span><span class="line"><span class="cl"><span class="cm">** attached database, SQLITE_ERROR is returned to the caller.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Unless it returns SQLITE_MISUSE,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the sqlite3_wal_checkpoint_v2() interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** sets the error information that is queried by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_errcode()] and [sqlite3_errmsg()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** from SQL.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_wal_checkpoint_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDb</span><span class="p">,</span> <span class="cm">/* Name of attached database (or NULL)</span> <span class="err">*/</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eMode</span><span class="p">,</span> <span class="cm">/* SQLITE_CHECKPOINT_* value */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnLog</span><span class="p">,</span> <span class="cm">/* OUT: Size of WAL log in frames */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnCkpt</span> <span class="cm">/* OUT: Total number of frames checkpointed */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Checkpoint Mode Values
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {checkpoint mode}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants define all valid values for the &#34;checkpoint mode&#34; passed
</span></span></span><span class="line"><span class="cl"><span class="cm">** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
</span></span></span><span class="line"><span class="cl"><span class="cm">** meaning of each of these checkpoint modes.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHECKPOINT_PASSIVE 0 </span><span class="cm">/* Do as much as possible w/o blocking */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHECKPOINT_FULL 1 </span><span class="cm">/* Wait for writers, then checkpoint */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHECKPOINT_RESTART 2 </span><span class="cm">/* Like FULL but wait for readers */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHECKPOINT_TRUNCATE 3 </span><span class="cm">/* Like RESTART but also truncate WAL */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Virtual Table Interface Configuration
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function may be called by either the [xConnect] or [xCreate] method
</span></span></span><span class="line"><span class="cl"><span class="cm">** of a [virtual table] implementation to configure
</span></span></span><span class="line"><span class="cl"><span class="cm">** various facets of the virtual table interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If this interface is invoked outside the context of an xConnect or
</span></span></span><span class="line"><span class="cl"><span class="cm">** xCreate virtual table method then the behavior is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In the call sqlite3_vtab_config(D,C,...) the D parameter is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] in which the virtual table is being created and
</span></span></span><span class="line"><span class="cl"><span class="cm">** which is passed in as the first argument to the [xConnect] or [xCreate]
</span></span></span><span class="line"><span class="cl"><span class="cm">** method that is invoking sqlite3_vtab_config(). The C parameter is one
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the [virtual table configuration options]. The presence and meaning
</span></span></span><span class="line"><span class="cl"><span class="cm">** of parameters after C depend on which [virtual table configuration option]
</span></span></span><span class="line"><span class="cl"><span class="cm">** is used.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_vtab_config</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">op</span><span class="p">,</span> <span class="p">...);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Virtual Table Configuration Options
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {virtual table configuration options}
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {virtual table configuration option}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These macros define the various options to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_vtab_config()] interface that [virtual table] implementations
</span></span></span><span class="line"><span class="cl"><span class="cm">** can use to customize and optimize their behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_VTAB_CONSTRAINT_SUPPORT]]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_VTAB_CONSTRAINT_SUPPORT&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;Calls of the form
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported,
</span></span></span><span class="line"><span class="cl"><span class="cm">** where X is an integer. If X is zero, then the [virtual table] whose
</span></span></span><span class="line"><span class="cl"><span class="cm">** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
</span></span></span><span class="line"><span class="cl"><span class="cm">** support constraints. In this configuration (which is the default) if
</span></span></span><span class="line"><span class="cl"><span class="cm">** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
</span></span></span><span class="line"><span class="cl"><span class="cm">** specified as part of the users SQL statement, regardless of the actual
</span></span></span><span class="line"><span class="cl"><span class="cm">** ON CONFLICT mode specified.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If X is non-zero, then the virtual table implementation guarantees
</span></span></span><span class="line"><span class="cl"><span class="cm">** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
</span></span></span><span class="line"><span class="cl"><span class="cm">** any modifications to internal or persistent data structures have been made.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** is able to roll back a statement or database transaction, and abandon
</span></span></span><span class="line"><span class="cl"><span class="cm">** or continue processing the current SQL statement as appropriate.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode
</span></span></span><span class="line"><span class="cl"><span class="cm">** had been ABORT.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Virtual table implementations that are required to handle OR REPLACE
</span></span></span><span class="line"><span class="cl"><span class="cm">** must do so within the [xUpdate] method. If a call to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_vtab_on_conflict()] function indicates that the current ON
</span></span></span><span class="line"><span class="cl"><span class="cm">** CONFLICT policy is REPLACE, the virtual table implementation should
</span></span></span><span class="line"><span class="cl"><span class="cm">** silently replace the appropriate rows within the xUpdate callback and
</span></span></span><span class="line"><span class="cl"><span class="cm">** return SQLITE_OK. Or, if this is not possible, it may return
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT
</span></span></span><span class="line"><span class="cl"><span class="cm">** constraint handling.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_VTAB_DIRECTONLY]]&lt;dt&gt;SQLITE_VTAB_DIRECTONLY&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;Calls of the form
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [xConnect] or [xCreate] methods of a [virtual table] implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** prohibits that virtual table from being used from within triggers and
</span></span></span><span class="line"><span class="cl"><span class="cm">** views.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_VTAB_INNOCUOUS]]&lt;dt&gt;SQLITE_VTAB_INNOCUOUS&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;Calls of the form
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [xConnect] or [xCreate] methods of a [virtual table] implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** identify that virtual table as being safe to use from within triggers
</span></span></span><span class="line"><span class="cl"><span class="cm">** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
</span></span></span><span class="line"><span class="cl"><span class="cm">** virtual table can do no serious harm even if it is controlled by a
</span></span></span><span class="line"><span class="cl"><span class="cm">** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag unless absolutely necessary.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_VTAB_USES_ALL_SCHEMAS]]&lt;dt&gt;SQLITE_VTAB_USES_ALL_SCHEMAS&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;Calls of the form
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_vtab_config](db,SQLITE_VTAB_USES_ALL_SCHEMA) from within the
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [xConnect] or [xCreate] methods of a [virtual table] implementation
</span></span></span><span class="line"><span class="cl"><span class="cm">** instruct the query planner to begin at least a read transaction on
</span></span></span><span class="line"><span class="cl"><span class="cm">** all schemas (&#34;main&#34;, &#34;temp&#34;, and any ATTACH-ed databases) whenever the
</span></span></span><span class="line"><span class="cl"><span class="cm">** virtual table is used.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_VTAB_INNOCUOUS 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_VTAB_DIRECTONLY 3
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_VTAB_USES_ALL_SCHEMAS 4
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Determine The Virtual Table Conflict Policy
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function may only be called from within a call to the [xUpdate] method
</span></span></span><span class="line"><span class="cl"><span class="cm">** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The
</span></span></span><span class="line"><span class="cl"><span class="cm">** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the SQL statement that triggered the call to the [xUpdate] method of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [virtual table].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_vtab_on_conflict</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn]
</span></span></span><span class="line"><span class="cl"><span class="cm">** method of a [virtual table], then it might return true if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** column is being fetched as part of an UPDATE operation during which the
</span></span></span><span class="line"><span class="cl"><span class="cm">** column value will not change. The virtual table implementation can use
</span></span></span><span class="line"><span class="cl"><span class="cm">** this hint as permission to substitute a return value that is less
</span></span></span><span class="line"><span class="cl"><span class="cm">** expensive to compute and that the corresponding
</span></span></span><span class="line"><span class="cl"><span class="cm">** [xUpdate] method understands as a &#34;no-change&#34; value.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that
</span></span></span><span class="line"><span class="cl"><span class="cm">** the column is not changed by the UPDATE statement, then the xColumn
</span></span></span><span class="line"><span class="cl"><span class="cm">** method can optionally return without setting a result, without calling
</span></span></span><span class="line"><span class="cl"><span class="cm">** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces].
</span></span></span><span class="line"><span class="cl"><span class="cm">** In that case, [sqlite3_value_nochange(X)] will return true for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** same column in the [xUpdate] method.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_vtab_nochange() routine is an optimization. Virtual table
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementations should continue to give a correct answer even if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_vtab_nochange() interface were to always return false. In the
</span></span></span><span class="line"><span class="cl"><span class="cm">** current implementation, the sqlite3_vtab_nochange() interface does always
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns false for the enhanced [UPDATE FROM] statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_vtab_nochange</span><span class="p">(</span><span class="n">sqlite3_context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Determine The Collation For a Virtual Table Constraint
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_index_info
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function may only be called from within a call to the [xBestIndex]
</span></span></span><span class="line"><span class="cl"><span class="cm">** method of a [virtual table]. This function returns a pointer to a string
</span></span></span><span class="line"><span class="cl"><span class="cm">** that is the name of the appropriate collation sequence to use for text
</span></span></span><span class="line"><span class="cl"><span class="cm">** comparisons on the constraint identified by its arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument must be the pointer to the [sqlite3_index_info] object
</span></span></span><span class="line"><span class="cl"><span class="cm">** that is the first parameter to the xBestIndex() method. The second argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** must be an index into the aConstraint[] array belonging to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_index_info structure passed to xBestIndex.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Important:
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first parameter must be the same pointer that is passed into the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xBestMethod() method. The first parameter may not be a pointer to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** different [sqlite3_index_info] object, even an exact copy.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The return value is computed as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;&lt;p&gt; If the constraint comes from a WHERE clause expression that contains
</span></span></span><span class="line"><span class="cl"><span class="cm">** a [COLLATE operator], then the name of the collation specified by
</span></span></span><span class="line"><span class="cl"><span class="cm">** that COLLATE operator is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;&lt;p&gt; If there is no COLLATE operator, but the column that is the subject
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the constraint specifies an alternative collating sequence via
</span></span></span><span class="line"><span class="cl"><span class="cm">** a [COLLATE clause] on the column definition within the CREATE TABLE
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement that was passed into [sqlite3_declare_vtab()], then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** name of that alternative collating sequence is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;&lt;p&gt; Otherwise, &#34;BINARY&#34; is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_vtab_collation</span><span class="p">(</span><span class="n">sqlite3_index_info</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Determine if a virtual table query is DISTINCT
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_index_info
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This API may only be used from within an [xBestIndex|xBestIndex method]
</span></span></span><span class="line"><span class="cl"><span class="cm">** of a [virtual table] implementation. The result of calling this
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface from outside of xBestIndex() is undefined and probably harmful.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_vtab_distinct() interface returns an integer between 0 and
</span></span></span><span class="line"><span class="cl"><span class="cm">** 3. The integer returned by sqlite3_vtab_distinct()
</span></span></span><span class="line"><span class="cl"><span class="cm">** gives the virtual table additional information about how the query
</span></span></span><span class="line"><span class="cl"><span class="cm">** planner wants the output to be ordered. As long as the virtual table
</span></span></span><span class="line"><span class="cl"><span class="cm">** can meet the ordering requirements of the query planner, it may set
</span></span></span><span class="line"><span class="cl"><span class="cm">** the &#34;orderByConsumed&#34; flag.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;&lt;li value=&#34;0&#34;&gt;&lt;p&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If the sqlite3_vtab_distinct() interface returns 0, that means
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the query planner needs the virtual table to return all rows in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sort order defined by the &#34;nOrderBy&#34; and &#34;aOrderBy&#34; fields of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_index_info] object. This is the default expectation. If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** virtual table outputs all rows in sorted order, then it is always safe for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the xBestIndex method to set the &#34;orderByConsumed&#34; flag, regardless of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the return value from sqlite3_vtab_distinct().
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li value=&#34;1&#34;&gt;&lt;p&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If the sqlite3_vtab_distinct() interface returns 1, that means
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the query planner does not need the rows to be returned in sorted order
</span></span></span><span class="line"><span class="cl"><span class="cm">** as long as all rows with the same values in all columns identified by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;aOrderBy&#34; field are adjacent.)^ This mode is used when the query planner
</span></span></span><span class="line"><span class="cl"><span class="cm">** is doing a GROUP BY.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li value=&#34;2&#34;&gt;&lt;p&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the query planner does not need the rows returned in any particular
</span></span></span><span class="line"><span class="cl"><span class="cm">** order, as long as rows with the same values in all columns identified
</span></span></span><span class="line"><span class="cl"><span class="cm">** by &#34;aOrderBy&#34; are adjacent.)^ ^(Furthermore, when two or more rows
</span></span></span><span class="line"><span class="cl"><span class="cm">** contain the same values for all columns identified by &#34;colUsed&#34;, all but
</span></span></span><span class="line"><span class="cl"><span class="cm">** one such row may optionally be omitted from the result.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** The virtual table is not required to omit rows that are duplicates
</span></span></span><span class="line"><span class="cl"><span class="cm">** over the &#34;colUsed&#34; columns, but if the virtual table can do that without
</span></span></span><span class="line"><span class="cl"><span class="cm">** too much extra effort, it could potentially help the query to run faster.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This mode is used for a DISTINCT query.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li value=&#34;3&#34;&gt;&lt;p&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the
</span></span></span><span class="line"><span class="cl"><span class="cm">** virtual table must return rows in the order defined by &#34;aOrderBy&#34; as
</span></span></span><span class="line"><span class="cl"><span class="cm">** if the sqlite3_vtab_distinct() interface had returned 0. However if
</span></span></span><span class="line"><span class="cl"><span class="cm">** two or more rows in the result have the same values for all columns
</span></span></span><span class="line"><span class="cl"><span class="cm">** identified by &#34;colUsed&#34;, then all but one such row may optionally be
</span></span></span><span class="line"><span class="cl"><span class="cm">** omitted.)^ Like when the return value is 2, the virtual table
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not required to omit rows that are duplicates over the &#34;colUsed&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** columns, but if the virtual table can do that without
</span></span></span><span class="line"><span class="cl"><span class="cm">** too much extra effort, it could potentially help the query to run faster.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This mode is used for queries
</span></span></span><span class="line"><span class="cl"><span class="cm">** that have both DISTINCT and ORDER BY clauses.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;p&gt;The following table summarizes the conditions under which the
</span></span></span><span class="line"><span class="cl"><span class="cm">** virtual table is allowed to set the &#34;orderByConsumed&#34; flag based on
</span></span></span><span class="line"><span class="cl"><span class="cm">** the value returned by sqlite3_vtab_distinct(). This table is a
</span></span></span><span class="line"><span class="cl"><span class="cm">** restatement of the previous four paragraphs:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;table border=1 cellspacing=0 cellpadding=10 width=&#34;90%&#34;&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;td valign=&#34;top&#34;&gt;sqlite3_vtab_distinct() return value
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;td valign=&#34;top&#34;&gt;Rows are returned in aOrderBy order
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;td valign=&#34;top&#34;&gt;Rows with the same value in all aOrderBy columns are adjacent
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;td valign=&#34;top&#34;&gt;Duplicates over all colUsed columns may be omitted
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;0&lt;td&gt;yes&lt;td&gt;yes&lt;td&gt;no
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;1&lt;td&gt;no&lt;td&gt;yes&lt;td&gt;no
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;2&lt;td&gt;no&lt;td&gt;yes&lt;td&gt;yes
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;3&lt;td&gt;yes&lt;td&gt;yes&lt;td&gt;yes
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/table&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^For the purposes of comparing virtual table output values to see if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** values are same value for sorting purposes, two NULL values are considered
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be the same. In other words, the comparison operator is &#34;IS&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** (or &#34;IS NOT DISTINCT FROM&#34;) and not &#34;==&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a virtual table implementation is unable to meet the requirements
</span></span></span><span class="line"><span class="cl"><span class="cm">** specified above, then it must not set the &#34;orderByConsumed&#34; flag in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_index_info] object or an incorrect answer may result.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A virtual table implementation is always free to return rows in any order
</span></span></span><span class="line"><span class="cl"><span class="cm">** it wants, as long as the &#34;orderByConsumed&#34; flag is not set. ^When the
</span></span></span><span class="line"><span class="cl"><span class="cm">** the &#34;orderByConsumed&#34; flag is unset, the query planner will add extra
</span></span></span><span class="line"><span class="cl"><span class="cm">** [bytecode] to ensure that the final results returned by the SQL query are
</span></span></span><span class="line"><span class="cl"><span class="cm">** ordered correctly. The use of the &#34;orderByConsumed&#34; flag and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
</span></span></span><span class="line"><span class="cl"><span class="cm">** use of the sqlite3_vtab_distinct() interface and the &#34;orderByConsumed&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag might help queries against a virtual table to run faster. Being
</span></span></span><span class="line"><span class="cl"><span class="cm">** overly aggressive and setting the &#34;orderByConsumed&#34; flag when it is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** valid to do so, on the other hand, might cause SQLite to return incorrect
</span></span></span><span class="line"><span class="cl"><span class="cm">** results.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_vtab_distinct</span><span class="p">(</span><span class="n">sqlite3_index_info</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Identify and handle IN constraints in xBestIndex
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface may only be used from within an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [xBestIndex|xBestIndex() method] of a [virtual table] implementation.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The result of invoking this interface from any other context is
</span></span></span><span class="line"><span class="cl"><span class="cm">** undefined and probably harmful.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(A constraint on a virtual table of the form
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;[IN operator|column IN (...)]&#34; is
</span></span></span><span class="line"><span class="cl"><span class="cm">** communicated to the xBestIndex method as a
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use
</span></span></span><span class="line"><span class="cl"><span class="cm">** this constraint, it must set the corresponding
</span></span></span><span class="line"><span class="cl"><span class="cm">** aConstraintUsage[].argvIndex to a positive integer. ^(Then, under
</span></span></span><span class="line"><span class="cl"><span class="cm">** the usual mode of handling IN operators, SQLite generates [bytecode]
</span></span></span><span class="line"><span class="cl"><span class="cm">** that invokes the [xFilter|xFilter() method] once for each value
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the right-hand side of the IN operator.)^ Thus the virtual table
</span></span></span><span class="line"><span class="cl"><span class="cm">** only sees a single value from the right-hand side of the IN operator
</span></span></span><span class="line"><span class="cl"><span class="cm">** at a time.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In some cases, however, it would be advantageous for the virtual
</span></span></span><span class="line"><span class="cl"><span class="cm">** table to see all values on the right-hand of the IN operator all at
</span></span></span><span class="line"><span class="cl"><span class="cm">** once. The sqlite3_vtab_in() interfaces facilitates this in two ways:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;&lt;p&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero)
</span></span></span><span class="line"><span class="cl"><span class="cm">** if and only if the [sqlite3_index_info|P-&gt;aConstraint][N] constraint
</span></span></span><span class="line"><span class="cl"><span class="cm">** is an [IN operator] that can be processed all at once. ^In other words,
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_vtab_in() with -1 in the third argument is a mechanism
</span></span></span><span class="line"><span class="cl"><span class="cm">** by which the virtual table can ask SQLite if all-at-once processing
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the IN operator is even possible.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;&lt;p&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A call to sqlite3_vtab_in(P,N,F) with F==1 or F==0 indicates
</span></span></span><span class="line"><span class="cl"><span class="cm">** to SQLite that the virtual table does or does not want to process
</span></span></span><span class="line"><span class="cl"><span class="cm">** the IN operator all-at-once, respectively. ^Thus when the third
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter (F) is non-negative, this interface is the mechanism by
</span></span></span><span class="line"><span class="cl"><span class="cm">** which the virtual table tells SQLite how it wants to process the
</span></span></span><span class="line"><span class="cl"><span class="cm">** IN operator.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_vtab_in(P,N,F) interface can be invoked multiple times
</span></span></span><span class="line"><span class="cl"><span class="cm">** within the same xBestIndex method call. ^For any given P,N pair,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the return value from sqlite3_vtab_in(P,N,F) will always be the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** within the same xBestIndex call. ^If the interface returns true
</span></span></span><span class="line"><span class="cl"><span class="cm">** (non-zero), that means that the constraint is an IN operator
</span></span></span><span class="line"><span class="cl"><span class="cm">** that can be processed all-at-once. ^If the constraint is not an IN
</span></span></span><span class="line"><span class="cl"><span class="cm">** operator or cannot be processed all-at-once, then the interface returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** false.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(All-at-once processing of the IN operator is selected if both of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** following conditions are met:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;&lt;p&gt; The P-&gt;aConstraintUsage[N].argvIndex value is set to a positive
</span></span></span><span class="line"><span class="cl"><span class="cm">** integer. This is how the virtual table tells SQLite that it wants to
</span></span></span><span class="line"><span class="cl"><span class="cm">** use the N-th constraint.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;&lt;p&gt; The last call to sqlite3_vtab_in(P,N,F) for which F was
</span></span></span><span class="line"><span class="cl"><span class="cm">** non-negative had F&gt;=1.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If either or both of the conditions above are false, then SQLite uses
</span></span></span><span class="line"><span class="cl"><span class="cm">** the traditional one-at-a-time processing strategy for the IN constraint.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If both conditions are true, then the argvIndex-th parameter to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xFilter method will be an [sqlite3_value] that appears to be NULL,
</span></span></span><span class="line"><span class="cl"><span class="cm">** but which can be passed to [sqlite3_vtab_in_first()] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_vtab_in_next()] to find all values on the right-hand side
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the IN constraint.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_vtab_in</span><span class="p">(</span><span class="n">sqlite3_index_info</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCons</span><span class="p">,</span> <span class="kt">int</span> <span class="n">bHandle</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Find all elements on the right-hand side of an IN constraint.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These interfaces are only useful from within the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [xFilter|xFilter() method] of a [virtual table] implementation.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The result of invoking these interfaces from any other context
</span></span></span><span class="line"><span class="cl"><span class="cm">** is undefined and probably harmful.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xFilter method which invokes these routines, and specifically
</span></span></span><span class="line"><span class="cl"><span class="cm">** a parameter that was previously selected for all-at-once IN constraint
</span></span></span><span class="line"><span class="cl"><span class="cm">** processing use the [sqlite3_vtab_in()] interface in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
</span></span></span><span class="line"><span class="cl"><span class="cm">** an xFilter argument that was selected for all-at-once IN constraint
</span></span></span><span class="line"><span class="cl"><span class="cm">** processing, then these routines return [SQLITE_ERROR].)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Use these routines to access all values on the right-hand side
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the IN constraint using code like the following:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;blockquote&gt;&lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; for(rc=sqlite3_vtab_in_first(pList, &amp;pVal);
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; rc==SQLITE_OK &amp;&amp; pVal;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; rc=sqlite3_vtab_in_next(pList, &amp;pVal)
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; ){
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; // do something with pVal
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; }
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; if( rc!=SQLITE_OK ){
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; // an error has occurred
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; }
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;&lt;/blockquote&gt;)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^On success, the sqlite3_vtab_in_first(X,P) and sqlite3_vtab_in_next(X,P)
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines return SQLITE_OK and set *P to point to the first or next value
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the RHS of the IN constraint. ^If there are no more values on the
</span></span></span><span class="line"><span class="cl"><span class="cm">** right hand side of the IN constraint, then *P is set to NULL and these
</span></span></span><span class="line"><span class="cl"><span class="cm">** routines return [SQLITE_DONE]. ^The return value might be
</span></span></span><span class="line"><span class="cl"><span class="cm">** some other value, such as SQLITE_NOMEM, in the event of a malfunction.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The *ppOut values returned by these routines are only valid until the
</span></span></span><span class="line"><span class="cl"><span class="cm">** next call to either of these routines or until the end of the xFilter
</span></span></span><span class="line"><span class="cl"><span class="cm">** method from which these routines were called. If the virtual table
</span></span></span><span class="line"><span class="cl"><span class="cm">** implementation needs to retain the *ppOut values for longer, it must make
</span></span></span><span class="line"><span class="cl"><span class="cm">** copies. The *ppOut values are [protected sqlite3_value|protected].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_vtab_in_first</span><span class="p">(</span><span class="n">sqlite3_value</span> <span class="o">*</span><span class="n">pVal</span><span class="p">,</span> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="n">ppOut</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_vtab_in_next</span><span class="p">(</span><span class="n">sqlite3_value</span> <span class="o">*</span><span class="n">pVal</span><span class="p">,</span> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="n">ppOut</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Constraint values in xBestIndex()
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_index_info
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This API may only be used from within the [xBestIndex|xBestIndex method]
</span></span></span><span class="line"><span class="cl"><span class="cm">** of a [virtual table] implementation. The result of calling this interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** from outside of an xBestIndex method are undefined and probably harmful.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [xBestIndex] method of a [virtual table] implementation, with P being
</span></span></span><span class="line"><span class="cl"><span class="cm">** a copy of the [sqlite3_index_info] object pointer passed into xBestIndex and
</span></span></span><span class="line"><span class="cl"><span class="cm">** J being a 0-based index into P-&gt;aConstraint[], then this routine
</span></span></span><span class="line"><span class="cl"><span class="cm">** attempts to set *V to the value of the right-hand operand of
</span></span></span><span class="line"><span class="cl"><span class="cm">** that constraint if the right-hand operand is known. ^If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** right-hand operand is not known, then *V is set to a NULL pointer.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if
</span></span></span><span class="line"><span class="cl"><span class="cm">** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
</span></span></span><span class="line"><span class="cl"><span class="cm">** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
</span></span></span><span class="line"><span class="cl"><span class="cm">** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
</span></span></span><span class="line"><span class="cl"><span class="cm">** something goes wrong.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_vtab_rhs_value() interface is usually only successful if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the right-hand operand of a constraint is a literal value in the original
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQL statement. If the right-hand operand is an expression or a reference
</span></span></span><span class="line"><span class="cl"><span class="cm">** to some other column or a [host parameter], then sqlite3_vtab_rhs_value()
</span></span></span><span class="line"><span class="cl"><span class="cm">** will probably return [SQLITE_NOTFOUND].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(Some constraints, such as [SQLITE_INDEX_CONSTRAINT_ISNULL] and
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such
</span></span></span><span class="line"><span class="cl"><span class="cm">** constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_value] object returned in *V is a protected sqlite3_value
</span></span></span><span class="line"><span class="cl"><span class="cm">** and remains valid for the duration of the xBestIndex method call.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^When xBestIndex returns, the sqlite3_value object returned by
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_vtab_rhs_value() is automatically deallocated.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The &#34;_rhs_&#34; in the name of this routine is an abbreviation for
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;Right-Hand Side&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_vtab_rhs_value</span><span class="p">(</span><span class="n">sqlite3_index_info</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="n">ppVal</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Conflict resolution modes
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {conflict resolution mode}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These constants are returned by [sqlite3_vtab_on_conflict()] to
</span></span></span><span class="line"><span class="cl"><span class="cm">** inform a [virtual table] implementation what the [ON CONFLICT] mode
</span></span></span><span class="line"><span class="cl"><span class="cm">** is for the SQL statement being evaluated.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that the [SQLITE_IGNORE] constant is also used as a potential
</span></span></span><span class="line"><span class="cl"><span class="cm">** return value from the [sqlite3_set_authorizer()] callback and that
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ABORT] is also a [result code].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_ROLLBACK 1
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="cm">/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_FAIL 3
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="cm">/* #define SQLITE_ABORT 4 // Also an error code */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_REPLACE 5
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Prepared Statement Scan Status Opcodes
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {scanstatus options}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The following constants can be used for the T parameter to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a
</span></span></span><span class="line"><span class="cl"><span class="cm">** different metric for sqlite3_stmt_scanstatus() to return.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When the value returned to V is a string, space to hold that string is
</span></span></span><span class="line"><span class="cl"><span class="cm">** managed by the prepared statement S and will be automatically freed when
</span></span></span><span class="line"><span class="cl"><span class="cm">** S is finalized.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Not all values are available for all query elements. When a value is
</span></span></span><span class="line"><span class="cl"><span class="cm">** not available, the output variable is set to -1 if the value is numeric,
</span></span></span><span class="line"><span class="cl"><span class="cm">** or to NULL if it is a string (SQLITE_SCANSTAT_NAME).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_SCANSTAT_NLOOP]] &lt;dt&gt;SQLITE_SCANSTAT_NLOOP&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The [sqlite3_int64] variable pointed to by the V parameter will be
</span></span></span><span class="line"><span class="cl"><span class="cm">** set to the total number of times that the X-th loop has run.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_SCANSTAT_NVISIT]] &lt;dt&gt;SQLITE_SCANSTAT_NVISIT&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The [sqlite3_int64] variable pointed to by the V parameter will be set
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the total number of rows examined by all iterations of the X-th loop.&lt;/dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_SCANSTAT_EST]] &lt;dt&gt;SQLITE_SCANSTAT_EST&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The &#34;double&#34; variable pointed to by the V parameter will be set to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** query planner&#39;s estimate for the average number of rows output from each
</span></span></span><span class="line"><span class="cl"><span class="cm">** iteration of the X-th loop. If the query planner&#39;s estimates was accurate,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then this value will approximate the quotient NVISIT/NLOOP and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** product of this value for all prior loops with the same SELECTID will
</span></span></span><span class="line"><span class="cl"><span class="cm">** be the NLOOP value for the current loop.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_SCANSTAT_NAME]] &lt;dt&gt;SQLITE_SCANSTAT_NAME&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The &#34;const char *&#34; variable pointed to by the V parameter will be set
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a zero-terminated UTF-8 string containing the name of the index or table
</span></span></span><span class="line"><span class="cl"><span class="cm">** used for the X-th loop.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_SCANSTAT_EXPLAIN]] &lt;dt&gt;SQLITE_SCANSTAT_EXPLAIN&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The &#34;const char *&#34; variable pointed to by the V parameter will be set
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
</span></span></span><span class="line"><span class="cl"><span class="cm">** description for the X-th loop.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_SCANSTAT_SELECTID]] &lt;dt&gt;SQLITE_SCANSTAT_SELECTID&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;^The &#34;int&#34; variable pointed to by the V parameter will be set to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** id for the X-th query plan element. The id value is unique within the
</span></span></span><span class="line"><span class="cl"><span class="cm">** statement. The select-id is the same value as is output in the first
</span></span></span><span class="line"><span class="cl"><span class="cm">** column of an [EXPLAIN QUERY PLAN] query.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_SCANSTAT_PARENTID]] &lt;dt&gt;SQLITE_SCANSTAT_PARENTID&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The &#34;int&#34; variable pointed to by the V parameter will be set to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** the id of the parent of the current query element, if applicable, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** to zero if the query element has no parent. This is the same value as
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned in the second column of an [EXPLAIN QUERY PLAN] query.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** [[SQLITE_SCANSTAT_NCYCLE]] &lt;dt&gt;SQLITE_SCANSTAT_NCYCLE&lt;/dt&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dd&gt;The sqlite3_int64 output value is set to the number of cycles,
</span></span></span><span class="line"><span class="cl"><span class="cm">** according to the processor time-stamp counter, that elapsed while the
</span></span></span><span class="line"><span class="cl"><span class="cm">** query element was being processed. This value is not available for
</span></span></span><span class="line"><span class="cl"><span class="cm">** all query elements - if it is unavailable the output variable is
</span></span></span><span class="line"><span class="cl"><span class="cm">** set to -1.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SCANSTAT_NLOOP 0
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SCANSTAT_NVISIT 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SCANSTAT_EST 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SCANSTAT_NAME 3
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SCANSTAT_EXPLAIN 4
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SCANSTAT_SELECTID 5
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SCANSTAT_PARENTID 6
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SCANSTAT_NCYCLE 7
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Prepared Statement Scan Status
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** These interfaces return information about the predicted and measured
</span></span></span><span class="line"><span class="cl"><span class="cm">** performance for pStmt. Advanced applications can use this
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface to compare the predicted and the measured performance and
</span></span></span><span class="line"><span class="cl"><span class="cm">** issue warnings and/or rerun [ANALYZE] if discrepancies are found.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Since this interface is expected to be rarely used, it is only
</span></span></span><span class="line"><span class="cl"><span class="cm">** available if SQLite is compiled using the [SQLITE_ENABLE_STMT_SCANSTATUS]
</span></span></span><span class="line"><span class="cl"><span class="cm">** compile-time option.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The &#34;iScanStatusOp&#34; parameter determines which status information to return.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The &#34;iScanStatusOp&#34; must be one of the [scanstatus options] or the behavior
</span></span></span><span class="line"><span class="cl"><span class="cm">** of this interface is undefined. ^The requested measurement is written into
</span></span></span><span class="line"><span class="cl"><span class="cm">** a variable pointed to by the &#34;pOut&#34; parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The &#34;flags&#34; parameter must be passed a mask of flags. At present only
</span></span></span><span class="line"><span class="cl"><span class="cm">** one flag is defined - SQLITE_SCANSTAT_COMPLEX. If SQLITE_SCANSTAT_COMPLEX
</span></span></span><span class="line"><span class="cl"><span class="cm">** is specified, then status information is available for all elements
</span></span></span><span class="line"><span class="cl"><span class="cm">** of a query plan that are reported by &#34;EXPLAIN QUERY PLAN&#34; output. If
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_SCANSTAT_COMPLEX is not specified, then only query plan elements
</span></span></span><span class="line"><span class="cl"><span class="cm">** that correspond to query loops (the &#34;SCAN...&#34; and &#34;SEARCH...&#34; elements of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the EXPLAIN QUERY PLAN output) are available. Invoking API
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_stmt_scanstatus() is equivalent to calling
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Parameter &#34;idx&#34; identifies the specific query element to retrieve statistics
</span></span></span><span class="line"><span class="cl"><span class="cm">** for. Query elements are numbered starting from zero. A value of -1 may be
</span></span></span><span class="line"><span class="cl"><span class="cm">** to query for statistics regarding the entire query. ^If idx is out of range
</span></span></span><span class="line"><span class="cl"><span class="cm">** - less than -1 or greater than or equal to the total number of query
</span></span></span><span class="line"><span class="cl"><span class="cm">** elements used to implement the statement - a non-zero value is returned and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the variable that pOut points to is unchanged.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_stmt_scanstatus_reset()]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_stmt_scanstatus</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">,</span> <span class="cm">/* Prepared statement for which info desired */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">idx</span><span class="p">,</span> <span class="cm">/* Index of loop to report on */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iScanStatusOp</span><span class="p">,</span> <span class="cm">/* Information desired. SQLITE_SCANSTAT_* */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span> <span class="cm">/* Result written here */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_stmt_scanstatus_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_stmt</span> <span class="o">*</span><span class="n">pStmt</span><span class="p">,</span> <span class="cm">/* Prepared statement for which info desired */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">idx</span><span class="p">,</span> <span class="cm">/* Index of loop to report on */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iScanStatusOp</span><span class="p">,</span> <span class="cm">/* Information desired. SQLITE_SCANSTAT_* */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">flags</span><span class="p">,</span> <span class="cm">/* Mask of flags defined below */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span> <span class="cm">/* Result written here */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Prepared Statement Scan Status
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {scan status flags}
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SCANSTAT_COMPLEX 0x0001
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Zero Scan-Status Counters
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_stmt
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This API is only available if the library is built with pre-processor
</span></span></span><span class="line"><span class="cl"><span class="cm">** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3_stmt_scanstatus_reset</span><span class="p">(</span><span class="n">sqlite3_stmt</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Flush caches to disk mid-transaction
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If a write-transaction is open on [database connection] D when the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
</span></span></span><span class="line"><span class="cl"><span class="cm">** pages in the pager-cache that are not currently in use are written out
</span></span></span><span class="line"><span class="cl"><span class="cm">** to disk. A dirty page may be in use if a database cursor created by an
</span></span></span><span class="line"><span class="cl"><span class="cm">** active SQL statement is reading from it, or if it is page 1 of a database
</span></span></span><span class="line"><span class="cl"><span class="cm">** file (page 1 is always &#34;in use&#34;). ^The [sqlite3_db_cacheflush(D)]
</span></span></span><span class="line"><span class="cl"><span class="cm">** interface flushes caches for all schemas - &#34;main&#34;, &#34;temp&#34;, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** any [attached] databases.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If this function needs to obtain extra database locks before dirty pages
</span></span></span><span class="line"><span class="cl"><span class="cm">** can be flushed to disk, it does so. ^If those locks cannot be obtained
</span></span></span><span class="line"><span class="cl"><span class="cm">** immediately and there is a busy-handler callback configured, it is invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the usual manner. ^If the required lock still cannot be obtained, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database is skipped and an attempt made to flush any dirty pages
</span></span></span><span class="line"><span class="cl"><span class="cm">** belonging to the next (if any) database. ^If any databases are skipped
</span></span></span><span class="line"><span class="cl"><span class="cm">** because locks cannot be obtained, but no other error occurs, this
</span></span></span><span class="line"><span class="cl"><span class="cm">** function returns SQLITE_BUSY.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^If any other error occurs while flushing dirty pages to disk (for
</span></span></span><span class="line"><span class="cl"><span class="cm">** example an IO error or out-of-memory condition), then processing is
</span></span></span><span class="line"><span class="cl"><span class="cm">** abandoned and an SQLite [error code] is returned to the caller immediately.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^This function does not set the database handle error code or message
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_db_cacheflush</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: The pre-update hook.
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^These interfaces are only available if SQLite is compiled using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ENABLE_PREUPDATE_HOOK] compile-time option.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_preupdate_hook()] interface registers a callback function
</span></span></span><span class="line"><span class="cl"><span class="cm">** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation
</span></span></span><span class="line"><span class="cl"><span class="cm">** on a database table.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^At most one preupdate hook may be registered at a time on a single
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection]; each call to [sqlite3_preupdate_hook()] overrides
</span></span></span><span class="line"><span class="cl"><span class="cm">** the previous setting.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The preupdate hook is disabled by invoking [sqlite3_preupdate_hook()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** with a NULL pointer as the second parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as
</span></span></span><span class="line"><span class="cl"><span class="cm">** the first parameter to callbacks.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The preupdate hook only fires for changes to real database tables; the
</span></span></span><span class="line"><span class="cl"><span class="cm">** preupdate hook is not invoked for changes to [virtual tables] or to
</span></span></span><span class="line"><span class="cl"><span class="cm">** system tables like sqlite_sequence or sqlite_stat1.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The second parameter to the preupdate callback is a pointer to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [database connection] that registered the preupdate hook.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The third parameter to the preupdate callback is one of the constants
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify the
</span></span></span><span class="line"><span class="cl"><span class="cm">** kind of update operation that is about to occur.
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(The fourth parameter to the preupdate callback is the name of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database within the database connection that is being modified. This
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be &#34;main&#34; for the main database or &#34;temp&#34; for TEMP tables or
</span></span></span><span class="line"><span class="cl"><span class="cm">** the name given after the AS keyword in the [ATTACH] statement for attached
</span></span></span><span class="line"><span class="cl"><span class="cm">** databases.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The fifth parameter to the preupdate callback is the name of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** table that is being modified.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For an UPDATE or DELETE operation on a [rowid table], the sixth
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter passed to the preupdate callback is the initial [rowid] of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** row being modified or deleted. For an INSERT operation on a rowid table,
</span></span></span><span class="line"><span class="cl"><span class="cm">** or any operation on a WITHOUT ROWID table, the value of the sixth
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter is undefined. For an INSERT or UPDATE on a rowid table the
</span></span></span><span class="line"><span class="cl"><span class="cm">** seventh parameter is the final rowid value of the row being inserted
</span></span></span><span class="line"><span class="cl"><span class="cm">** or updated. The value of the seventh parameter passed to the callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** function is not defined for operations on WITHOUT ROWID tables, or for
</span></span></span><span class="line"><span class="cl"><span class="cm">** DELETE operations on rowid tables.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The sqlite3_preupdate_hook(D,C,P) function returns the P argument from
</span></span></span><span class="line"><span class="cl"><span class="cm">** the previous call on the same [database connection] D, or NULL for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the first call on D.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces
</span></span></span><span class="line"><span class="cl"><span class="cm">** provide additional information about a preupdate event. These routines
</span></span></span><span class="line"><span class="cl"><span class="cm">** may only be called from within a preupdate callback. Invoking any of
</span></span></span><span class="line"><span class="cl"><span class="cm">** these routines from outside of a preupdate callback or with a
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] pointer that is different from the one supplied
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the preupdate callback results in undefined and probably undesirable
</span></span></span><span class="line"><span class="cl"><span class="cm">** behavior.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_preupdate_count(D)] interface returns the number of columns
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the row that is being inserted, updated, or deleted.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_preupdate_old(D,N,P)] interface writes into P a pointer to
</span></span></span><span class="line"><span class="cl"><span class="cm">** a [protected sqlite3_value] that contains the value of the Nth column of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the table row before it is updated. The N parameter must be between 0
</span></span></span><span class="line"><span class="cl"><span class="cm">** and one less than the number of columns or the behavior will be
</span></span></span><span class="line"><span class="cl"><span class="cm">** undefined. This must only be used within SQLITE_UPDATE and SQLITE_DELETE
</span></span></span><span class="line"><span class="cl"><span class="cm">** preupdate callbacks; if it is used by an SQLITE_INSERT callback then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** behavior is undefined. The [sqlite3_value] that P points to
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be destroyed when the preupdate callback returns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_preupdate_new(D,N,P)] interface writes into P a pointer to
</span></span></span><span class="line"><span class="cl"><span class="cm">** a [protected sqlite3_value] that contains the value of the Nth column of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the table row after it is updated. The N parameter must be between 0
</span></span></span><span class="line"><span class="cl"><span class="cm">** and one less than the number of columns or the behavior will be
</span></span></span><span class="line"><span class="cl"><span class="cm">** undefined. This must only be used within SQLITE_INSERT and SQLITE_UPDATE
</span></span></span><span class="line"><span class="cl"><span class="cm">** preupdate callbacks; if it is used by an SQLITE_DELETE callback then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** behavior is undefined. The [sqlite3_value] that P points to
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be destroyed when the preupdate callback returns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_preupdate_depth(D)] interface returns 0 if the preupdate
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback was invoked as a result of a direct insert, update, or delete
</span></span></span><span class="line"><span class="cl"><span class="cm">** operation; or 1 for inserts, updates, or deletes invoked by top-level
</span></span></span><span class="line"><span class="cl"><span class="cm">** triggers; or 2 for changes resulting from triggers called by top-level
</span></span></span><span class="line"><span class="cl"><span class="cm">** triggers; and so forth.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When the [sqlite3_blob_write()] API is used to update a blob column,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the pre-update hook is invoked with SQLITE_DELETE. This is because the
</span></span></span><span class="line"><span class="cl"><span class="cm">** in this case the new values are not available. In this case, when a
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback made with op==SQLITE_DELETE is actually a write using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** the index of the column being written. In other cases, where the
</span></span></span><span class="line"><span class="cl"><span class="cm">** pre-update hook is being invoked for some other reason, including a
</span></span></span><span class="line"><span class="cl"><span class="cm">** regular DELETE, sqlite3_preupdate_blobwrite() returns -1.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** See also: [sqlite3_update_hook()]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#if defined(SQLITE_ENABLE_PREUPDATE_HOOK)
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="o">*</span><span class="nf">sqlite3_preupdate_hook</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="n">xPreUpdate</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of third arg to preupdate_hook() */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">op</span><span class="p">,</span> <span class="cm">/* SQLITE_UPDATE, DELETE or INSERT */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="k">const</span> <span class="o">*</span><span class="n">zDb</span><span class="p">,</span> <span class="cm">/* Database name */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="k">const</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span> <span class="cm">/* Table name */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_int64</span> <span class="n">iKey1</span><span class="p">,</span> <span class="cm">/* Rowid of row about to be deleted/updated */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_int64</span> <span class="n">iKey2</span> <span class="cm">/* New rowid value (for a rowid UPDATE) */</span>
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span><span class="o">*</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_preupdate_old</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_preupdate_count</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_preupdate_depth</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_preupdate_new</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_preupdate_blobwrite</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Low-level system error code
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^Attempt to return the underlying operating system error code or error
</span></span></span><span class="line"><span class="cl"><span class="cm">** number that caused the most recent I/O error or failure to open a file.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The return value is OS-dependent. For example, on unix systems, after
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
</span></span></span><span class="line"><span class="cl"><span class="cm">** called to get back the underlying &#34;errno&#34; that caused the problem, such
</span></span></span><span class="line"><span class="cl"><span class="cm">** as ENOSPC, EAUTH, EISDIR, and so forth.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_system_errno</span><span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Database Snapshot
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEYWORDS: {snapshot} {sqlite3_snapshot}
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An instance of the snapshot object records the state of a [WAL mode]
</span></span></span><span class="line"><span class="cl"><span class="cm">** database for some specific point in history.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In [WAL mode], multiple [database connections] that are open on the
</span></span></span><span class="line"><span class="cl"><span class="cm">** same database file can each be reading a different historical version
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the database file. When a [database connection] begins a read
</span></span></span><span class="line"><span class="cl"><span class="cm">** transaction, that connection sees an unchanging copy of the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** as it existed for the point in time when the transaction first started.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Subsequent changes to the database from other connections are not seen
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the reader until a new read transaction is started.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_snapshot object records state information about an historical
</span></span></span><span class="line"><span class="cl"><span class="cm">** version of the database file so that it is possible to later open a new read
</span></span></span><span class="line"><span class="cl"><span class="cm">** transaction that sees that historical version of the database rather than
</span></span></span><span class="line"><span class="cl"><span class="cm">** the most recent version.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_snapshot</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">hidden</span><span class="p">[</span><span class="mi">48</span><span class="p">];</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="n">sqlite3_snapshot</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Record A Database Snapshot
</span></span></span><span class="line"><span class="cl"><span class="cm">** CONSTRUCTOR: sqlite3_snapshot
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a
</span></span></span><span class="line"><span class="cl"><span class="cm">** new [sqlite3_snapshot] object that records the current state of
</span></span></span><span class="line"><span class="cl"><span class="cm">** schema S in database connection D. ^On success, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly
</span></span></span><span class="line"><span class="cl"><span class="cm">** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If there is not already a read-transaction open on schema S when
</span></span></span><span class="line"><span class="cl"><span class="cm">** this function is called, one is opened automatically.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The following must be true for this function to succeed. If any of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the following statements are false when sqlite3_snapshot_get() is
</span></span></span><span class="line"><span class="cl"><span class="cm">** called, SQLITE_ERROR is returned. The final value of *P is undefined
</span></span></span><span class="line"><span class="cl"><span class="cm">** in this case.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The database handle must not be in [autocommit mode].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Schema S of [database connection] D must be a [WAL mode] database.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; There must not be a write transaction open on schema S of database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection D.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; One or more transactions must have been written to the current wal
</span></span></span><span class="line"><span class="cl"><span class="cm">** file since it was created on disk (by any connection). This means
</span></span></span><span class="line"><span class="cl"><span class="cm">** that a snapshot cannot be taken on a wal mode database with no wal
</span></span></span><span class="line"><span class="cl"><span class="cm">** file immediately after it is first opened. At least one transaction
</span></span></span><span class="line"><span class="cl"><span class="cm">** must be written to it first.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function may also return SQLITE_NOMEM. If it is called with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database handle in autocommit mode but fails for some other reason,
</span></span></span><span class="line"><span class="cl"><span class="cm">** whether or not a read transaction is opened on schema S is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_snapshot] object returned from a successful call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** to avoid a memory leak.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_snapshot_get()] interface is only available when the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_EXPERIMENTAL</span> <span class="kt">int</span> <span class="nf">sqlite3_snapshot_get</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSchema</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_snapshot</span> <span class="o">**</span><span class="n">ppSnapshot</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Start a read transaction on an historical snapshot
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_snapshot
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read
</span></span></span><span class="line"><span class="cl"><span class="cm">** transaction or upgrades an existing one for schema S of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] D such that the read transaction refers to
</span></span></span><span class="line"><span class="cl"><span class="cm">** historical [snapshot] P, rather than the most recent change to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK
</span></span></span><span class="line"><span class="cl"><span class="cm">** on success or an appropriate [error code] if it fails.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^In order to succeed, the database connection must not be in
</span></span></span><span class="line"><span class="cl"><span class="cm">** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there
</span></span></span><span class="line"><span class="cl"><span class="cm">** is already a read transaction open on schema S, then the database handle
</span></span></span><span class="line"><span class="cl"><span class="cm">** must have no active statements (SELECT statements that have been passed
</span></span></span><span class="line"><span class="cl"><span class="cm">** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()).
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_ERROR is returned if either of these conditions is violated, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** if schema S does not exist, or if the snapshot object is invalid.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^A call to sqlite3_snapshot_open() will fail to open if the specified
</span></span></span><span class="line"><span class="cl"><span class="cm">** snapshot has been overwritten by a [checkpoint]. In this case
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_ERROR_SNAPSHOT is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If there is already a read transaction open when this function is
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked, then the same read transaction remains open (on the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_ERROR_SNAPSHOT
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned. If another error code - for example SQLITE_PROTOCOL or an
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_IOERR error code - is returned, then the final state of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** read transaction is undefined. If SQLITE_OK is returned, then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** read transaction is now open on database snapshot P.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connection D does not know that the database file for
</span></span></span><span class="line"><span class="cl"><span class="cm">** schema S is in [WAL mode]. A database connection might not know
</span></span></span><span class="line"><span class="cl"><span class="cm">** that the database file is in [WAL mode] if there has been no prior
</span></span></span><span class="line"><span class="cl"><span class="cm">** I/O on that database connection, or if the database entered [WAL mode]
</span></span></span><span class="line"><span class="cl"><span class="cm">** after the most recent I/O on the database connection.)^
</span></span></span><span class="line"><span class="cl"><span class="cm">** (Hint: Run &#34;[PRAGMA application_id]&#34; against a newly opened
</span></span></span><span class="line"><span class="cl"><span class="cm">** database connection in order to make it ready to use snapshots.)
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_snapshot_open()] interface is only available when the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_EXPERIMENTAL</span> <span class="kt">int</span> <span class="nf">sqlite3_snapshot_open</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSchema</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_snapshot</span> <span class="o">*</span><span class="n">pSnapshot</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Destroy a snapshot
</span></span></span><span class="line"><span class="cl"><span class="cm">** DESTRUCTOR: sqlite3_snapshot
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The application must eventually free every [sqlite3_snapshot] object
</span></span></span><span class="line"><span class="cl"><span class="cm">** using this routine to avoid a memory leak.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The [sqlite3_snapshot_free()] interface is only available when the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_EXPERIMENTAL</span> <span class="kt">void</span> <span class="nf">sqlite3_snapshot_free</span><span class="p">(</span><span class="n">sqlite3_snapshot</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Compare the ages of two snapshot handles.
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_snapshot
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages
</span></span></span><span class="line"><span class="cl"><span class="cm">** of two valid snapshot handles.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the two snapshot handles are not associated with the same database
</span></span></span><span class="line"><span class="cl"><span class="cm">** file, the result of the comparison is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Additionally, the result of the comparison is only valid if both of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** snapshot handles were obtained by calling sqlite3_snapshot_get() since the
</span></span></span><span class="line"><span class="cl"><span class="cm">** last time the wal file was deleted. The wal file is deleted when the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database is changed back to rollback mode or when the number of database
</span></span></span><span class="line"><span class="cl"><span class="cm">** clients drops to zero. If either snapshot handle was obtained before the
</span></span></span><span class="line"><span class="cl"><span class="cm">** wal file was last deleted, the value returned by this function
</span></span></span><span class="line"><span class="cl"><span class="cm">** is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Otherwise, this API returns a negative value if P1 refers to an older
</span></span></span><span class="line"><span class="cl"><span class="cm">** snapshot than P2, zero if the two handles refer to the same database
</span></span></span><span class="line"><span class="cl"><span class="cm">** snapshot, and a positive value if P1 is a newer snapshot than P2.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface is only available if SQLite is compiled with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ENABLE_SNAPSHOT] option.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_EXPERIMENTAL</span> <span class="kt">int</span> <span class="nf">sqlite3_snapshot_cmp</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_snapshot</span> <span class="o">*</span><span class="n">p1</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_snapshot</span> <span class="o">*</span><span class="n">p2</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Recover snapshots from a wal file
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_snapshot
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a [WAL file] remains on disk after all database connections close
</span></span></span><span class="line"><span class="cl"><span class="cm">** (either through the use of the [SQLITE_FCNTL_PERSIST_WAL] [file control]
</span></span></span><span class="line"><span class="cl"><span class="cm">** or because the last process to have the database opened exited without
</span></span></span><span class="line"><span class="cl"><span class="cm">** calling [sqlite3_close()]) and a new connection is subsequently opened
</span></span></span><span class="line"><span class="cl"><span class="cm">** on that database and [WAL file], the [sqlite3_snapshot_open()] interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** will only be able to open the last transaction added to the WAL file
</span></span></span><span class="line"><span class="cl"><span class="cm">** even though the WAL file contains other valid transactions.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function attempts to scan the WAL file associated with database zDb
</span></span></span><span class="line"><span class="cl"><span class="cm">** of database handle db and make all valid snapshots available to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_snapshot_open(). It is an error if there is already a read
</span></span></span><span class="line"><span class="cl"><span class="cm">** transaction open on the database, or if the database is not a WAL mode
</span></span></span><span class="line"><span class="cl"><span class="cm">** database.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface is only available if SQLite is compiled with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_ENABLE_SNAPSHOT] option.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">SQLITE_EXPERIMENTAL</span> <span class="kt">int</span> <span class="nf">sqlite3_snapshot_recover</span><span class="p">(</span><span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDb</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Serialize a database
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** that is a serialization of the S database on [database connection] D.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If P is not a NULL pointer, then the size of the database in bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** is written into *P.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For an ordinary on-disk database file, the serialization is just a
</span></span></span><span class="line"><span class="cl"><span class="cm">** copy of the disk file. For an in-memory database or a &#34;TEMP&#34; database,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the serialization is the same sequence of bytes which would be written
</span></span></span><span class="line"><span class="cl"><span class="cm">** to disk if that database where backed up to disk.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The usual case is that sqlite3_serialize() copies the serialization of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database into memory obtained from [sqlite3_malloc64()] and returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to that memory. The caller is responsible for freeing the
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned value to avoid a memory leak. However, if the F argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
</span></span></span><span class="line"><span class="cl"><span class="cm">** are made, and the sqlite3_serialize() function will return a pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the contiguous memory representation of the database that SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** is currently using for that database, or NULL if the no such contiguous
</span></span></span><span class="line"><span class="cl"><span class="cm">** memory representation of the database exists. A contiguous memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** representation of the database will usually only exist if there has
</span></span></span><span class="line"><span class="cl"><span class="cm">** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** values of D and S.
</span></span></span><span class="line"><span class="cl"><span class="cm">** The size of the database is written into *P even if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the database exists.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** After the call, if the SQLITE_SERIALIZE_NOCOPY bit had been set,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the returned buffer content will remain accessible and unchanged
</span></span></span><span class="line"><span class="cl"><span class="cm">** until either the next write operation on the connection or when
</span></span></span><span class="line"><span class="cl"><span class="cm">** the connection is closed, and applications must not modify the
</span></span></span><span class="line"><span class="cl"><span class="cm">** buffer. If the bit had been clear, the returned buffer will not
</span></span></span><span class="line"><span class="cl"><span class="cm">** be accessed by SQLite after the call.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocation error occurs.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface is omitted if SQLite is compiled with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_OMIT_DESERIALIZE] option.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="nf">sqlite3_serialize</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* The database connection */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSchema</span><span class="p">,</span> <span class="cm">/* Which DB to serialize. ex: &#34;main&#34;, &#34;temp&#34;, ... */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_int64</span> <span class="o">*</span><span class="n">piSize</span><span class="p">,</span> <span class="cm">/* Write size of the DB here, if not NULL */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">mFlags</span> <span class="cm">/* Zero or more SQLITE_SERIALIZE_* flags */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Flags for sqlite3_serialize
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Zero or more of the following constants can be OR-ed together for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the F argument to [sqlite3_serialize(D,S,P,F)].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_SERIALIZE_NOCOPY means that [sqlite3_serialize()] will return
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to contiguous in-memory database that it is currently using,
</span></span></span><span class="line"><span class="cl"><span class="cm">** without making a copy of the database. If SQLite is not currently using
</span></span></span><span class="line"><span class="cl"><span class="cm">** a contiguous in-memory database, then this option causes
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_serialize()] to return a NULL pointer. SQLite will only be
</span></span></span><span class="line"><span class="cl"><span class="cm">** using a contiguous in-memory database if it has been initialized by a
</span></span></span><span class="line"><span class="cl"><span class="cm">** prior call to [sqlite3_deserialize()].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SERIALIZE_NOCOPY 0x001 </span><span class="cm">/* Do no memory allocations */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Deserialize a database
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [database connection] D to disconnect from database S and then
</span></span></span><span class="line"><span class="cl"><span class="cm">** reopen S as an in-memory database based on the serialization contained
</span></span></span><span class="line"><span class="cl"><span class="cm">** in P. The serialized database P is N bytes in size. M is the size of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the buffer P, which might be larger than N. If M is larger than N, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the SQLITE_DESERIALIZE_READONLY bit is not set in F, then SQLite is
</span></span></span><span class="line"><span class="cl"><span class="cm">** permitted to add content to the in-memory database as long as the total
</span></span></span><span class="line"><span class="cl"><span class="cm">** size does not exceed M bytes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoke sqlite3_free() on the serialization buffer when the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** connection closes. If the SQLITE_DESERIALIZE_RESIZEABLE bit is set, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite will try to increase the buffer size using sqlite3_realloc64()
</span></span></span><span class="line"><span class="cl"><span class="cm">** if writes on the database cause it to grow larger than M bytes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Applications must not modify the buffer P or invalidate it before
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database connection D is closed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database is currently in a read transaction or is involved in a backup
</span></span></span><span class="line"><span class="cl"><span class="cm">** operation.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is not possible to deserialized into the TEMP database. If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** S argument to sqlite3_deserialize(D,S,P,N,M,F) is &#34;temp&#34; then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** function returns SQLITE_ERROR.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The deserialized database should not be in [WAL mode]. If the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** is in WAL mode, then any attempt to use the database file will result
</span></span></span><span class="line"><span class="cl"><span class="cm">** in an [SQLITE_CANTOPEN] error. The application can set the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [file format version numbers] (bytes 18 and 19) of the input database P
</span></span></span><span class="line"><span class="cl"><span class="cm">** to 0x01 prior to invoking sqlite3_deserialize(D,S,P,N,M,F) to force the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database file into rollback mode and work around this limitation.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_free()] is invoked on argument P prior to returning.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This interface is omitted if SQLite is compiled with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_OMIT_DESERIALIZE] option.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_deserialize</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* The database connection */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zSchema</span><span class="p">,</span> <span class="cm">/* Which DB to reopen with the deserialization */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="cm">/* The serialized database content */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_int64</span> <span class="n">szDb</span><span class="p">,</span> <span class="cm">/* Number bytes in the deserialization */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_int64</span> <span class="n">szBuf</span><span class="p">,</span> <span class="cm">/* Total size of buffer pData[] */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="n">mFlags</span> <span class="cm">/* Zero or more SQLITE_DESERIALIZE_* flags */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Flags for sqlite3_deserialize()
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The following are allowed values for 6th argument (the F argument) to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the P argument is held in memory obtained from [sqlite3_malloc64()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** and that SQLite should take ownership of this memory and automatically
</span></span></span><span class="line"><span class="cl"><span class="cm">** free it when it has finished using it. Without this flag, the caller
</span></span></span><span class="line"><span class="cl"><span class="cm">** is responsible for freeing any dynamically allocated memory.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
</span></span></span><span class="line"><span class="cl"><span class="cm">** grow the size of the database using calls to [sqlite3_realloc64()]. This
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Without this flag, the deserialized database cannot increase in size beyond
</span></span></span><span class="line"><span class="cl"><span class="cm">** the number of bytes specified by the M parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database
</span></span></span><span class="line"><span class="cl"><span class="cm">** should be treated as read-only.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DESERIALIZE_FREEONCLOSE 1 </span><span class="cm">/* Call sqlite3_free() on close */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DESERIALIZE_RESIZEABLE 2 </span><span class="cm">/* Resize using sqlite3_realloc64() */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_DESERIALIZE_READONLY 4 </span><span class="cm">/* Database is read-only */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Undo the hack that converts floating point types to integer for
</span></span></span><span class="line"><span class="cl"><span class="cm">** builds on processors without floating point support.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef SQLITE_OMIT_FLOATING_POINT
</span></span></span><span class="line"><span class="cl"><span class="cp"># undef double
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cp">#if defined(__wasi__)
</span></span></span><span class="line"><span class="cl"><span class="cp"># undef SQLITE_WASI
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_WASI 1
</span></span></span><span class="line"><span class="cl"><span class="cp"># undef SQLITE_OMIT_WAL
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_OMIT_WAL 1</span><span class="cm">/* because it requires shared memory APIs */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"># ifndef SQLITE_OMIT_LOAD_EXTENSION
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_OMIT_LOAD_EXTENSION
</span></span></span><span class="line"><span class="cl"><span class="cp"># endif
</span></span></span><span class="line"><span class="cl"><span class="cp"># ifndef SQLITE_THREADSAFE
</span></span></span><span class="line"><span class="cl"><span class="cp"># define SQLITE_THREADSAFE 0
</span></span></span><span class="line"><span class="cl"><span class="cp"># endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef __cplusplus
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="p">}</span> <span class="cm">/* End of the &#39;extern &#34;C&#34;&#39; block */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp">#endif </span><span class="cm">/* SQLITE3_H */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/******** Begin file sqlite3rtree.h *********/</span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** 2010 August 30
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The author disclaims copyright to this source code. In place of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a legal notice, here is a blessing:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** May you do good and not evil.
</span></span></span><span class="line"><span class="cl"><span class="cm">** May you find forgiveness for yourself and forgive others.
</span></span></span><span class="line"><span class="cl"><span class="cm">** May you share freely, never taking more than you give.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">*************************************************************************
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cp">#ifndef _SQLITE3RTREE_H_
</span></span></span><span class="line"><span class="cl"><span class="cp">#define _SQLITE3RTREE_H_
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef __cplusplus
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="k">extern</span> <span class="s">&#34;C&#34;</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_rtree_geometry</span> <span class="n">sqlite3_rtree_geometry</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_rtree_query_info</span> <span class="n">sqlite3_rtree_query_info</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/* The double-precision datatype used by RTree depends on the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_RTREE_INT_ONLY compile-time option.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef SQLITE_RTREE_INT_ONLY
</span></span></span><span class="line"><span class="cl"><span class="cp"></span> <span class="k">typedef</span> <span class="n">sqlite3_int64</span> <span class="n">sqlite3_rtree_dbl</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="cp">#else
</span></span></span><span class="line"><span class="cl"><span class="cp"></span> <span class="k">typedef</span> <span class="kt">double</span> <span class="n">sqlite3_rtree_dbl</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Register a geometry callback named zGeom that can be used as part of an
</span></span></span><span class="line"><span class="cl"><span class="cm">** R-Tree geometry query as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SELECT ... FROM &lt;rtree&gt; WHERE &lt;rtree col&gt; MATCH $zGeom(... params ...)
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_rtree_geometry_callback</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zGeom</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xGeom</span><span class="p">)(</span><span class="n">sqlite3_rtree_geometry</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="n">sqlite3_rtree_dbl</span><span class="o">*</span><span class="p">,</span><span class="kt">int</span><span class="o">*</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pContext</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** A pointer to a structure of the following type is passed as the first
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument to callbacks registered using rtree_geometry_callback().
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_rtree_geometry</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pContext</span><span class="p">;</span> <span class="cm">/* Copy of pContext passed to s_r_g_c() */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nParam</span><span class="p">;</span> <span class="cm">/* Size of array aParam[] */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_rtree_dbl</span> <span class="o">*</span><span class="n">aParam</span><span class="p">;</span> <span class="cm">/* Parameters passed to SQL geom function */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pUser</span><span class="p">;</span> <span class="cm">/* Callback implementation user data */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xDelUser</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="p">);</span> <span class="cm">/* Called by SQLite to clean up pUser */</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Register a 2nd-generation geometry callback named zScore that can be
</span></span></span><span class="line"><span class="cl"><span class="cm">** used as part of an R-Tree geometry query as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SELECT ... FROM &lt;rtree&gt; WHERE &lt;rtree col&gt; MATCH $zQueryFunc(... params ...)
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3_rtree_query_callback</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zQueryFunc</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xQueryFunc</span><span class="p">)(</span><span class="n">sqlite3_rtree_query_info</span><span class="o">*</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pContext</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xDestructor</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** A pointer to a structure of the following type is passed as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument to scored geometry callback registered using
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_rtree_query_callback().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that the first 5 fields of this structure are identical to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_rtree_geometry. This structure is a subclass of
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_rtree_geometry.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">sqlite3_rtree_query_info</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pContext</span><span class="p">;</span> <span class="cm">/* pContext from when function registered */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nParam</span><span class="p">;</span> <span class="cm">/* Number of function parameters */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_rtree_dbl</span> <span class="o">*</span><span class="n">aParam</span><span class="p">;</span> <span class="cm">/* value of function parameters */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pUser</span><span class="p">;</span> <span class="cm">/* callback can use this, if desired */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xDelUser</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">);</span> <span class="cm">/* function to free pUser */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_rtree_dbl</span> <span class="o">*</span><span class="n">aCoord</span><span class="p">;</span> <span class="cm">/* Coordinates of node or entry to check */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="o">*</span><span class="n">anQueue</span><span class="p">;</span> <span class="cm">/* Number of pending entries in the queue */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nCoord</span><span class="p">;</span> <span class="cm">/* Number of coordinates */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iLevel</span><span class="p">;</span> <span class="cm">/* Level of current node or entry */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">mxLevel</span><span class="p">;</span> <span class="cm">/* The largest iLevel value in the tree */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_int64</span> <span class="n">iRowid</span><span class="p">;</span> <span class="cm">/* Rowid for current entry */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_rtree_dbl</span> <span class="n">rParentScore</span><span class="p">;</span> <span class="cm">/* Score of parent node */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eParentWithin</span><span class="p">;</span> <span class="cm">/* Visibility of parent node */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eWithin</span><span class="p">;</span> <span class="cm">/* OUT: Visibility */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_rtree_dbl</span> <span class="n">rScore</span><span class="p">;</span> <span class="cm">/* OUT: Write the score here */</span>
</span></span><span class="line"><span class="cl"> <span class="cm">/* The following fields are only available in 3.8.11 and later */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="n">apSqlParam</span><span class="p">;</span> <span class="cm">/* Original SQL values of parameters */</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define NOT_WITHIN 0 </span><span class="cm">/* Object completely outside of query region */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define PARTLY_WITHIN 1 </span><span class="cm">/* Object partially overlaps query region */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#define FULLY_WITHIN 2 </span><span class="cm">/* Object fully contained within query region */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef __cplusplus
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="p">}</span> <span class="cm">/* end of the &#39;extern &#34;C&#34;&#39; block */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif </span><span class="cm">/* ifndef _SQLITE3RTREE_H_ */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/******** End of sqlite3rtree.h *********/</span>
</span></span><span class="line"><span class="cl"><span class="cm">/******** Begin file sqlite3session.h *********/</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cp">#if !defined(__SQLITESESSION_H_) &amp;&amp; defined(SQLITE_ENABLE_SESSION)
</span></span></span><span class="line"><span class="cl"><span class="cp">#define __SQLITESESSION_H_ 1
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Make sure we can call this stuff from C++.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef __cplusplus
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="k">extern</span> <span class="s">&#34;C&#34;</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Session Object Handle
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An instance of this object is a [session] that can be used to
</span></span></span><span class="line"><span class="cl"><span class="cm">** record changes to a database.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_session</span> <span class="n">sqlite3_session</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Changeset Iterator Handle
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An instance of this object acts as a cursor for iterating
</span></span></span><span class="line"><span class="cl"><span class="cm">** over the elements of a [changeset] or [patchset].
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_changeset_iter</span> <span class="n">sqlite3_changeset_iter</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Create A New Session Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** CONSTRUCTOR: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Create a new session object attached to database handle db. If successful,
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to the new object is written to *ppSession and SQLITE_OK is
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned. If an error occurs, *ppSession is set to NULL and an SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** error code (e.g. SQLITE_NOMEM) is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is possible to create multiple session objects attached to a single
</span></span></span><span class="line"><span class="cl"><span class="cm">** database handle.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Session objects created using this function should be deleted using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3session_delete()] function before the database handle that they
</span></span></span><span class="line"><span class="cl"><span class="cm">** are attached to is itself closed. If the database handle is closed before
</span></span></span><span class="line"><span class="cl"><span class="cm">** the session object is deleted, then the results of calling any session
</span></span></span><span class="line"><span class="cl"><span class="cm">** module function, including [sqlite3session_delete()] on the session object
</span></span></span><span class="line"><span class="cl"><span class="cm">** are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Because the session module uses the [sqlite3_preupdate_hook()] API, it
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not possible for an application to register a pre-update hook on a
</span></span></span><span class="line"><span class="cl"><span class="cm">** database handle that has one or more session objects attached. Nor is
</span></span></span><span class="line"><span class="cl"><span class="cm">** it possible to create a session object attached to a database handle for
</span></span></span><span class="line"><span class="cl"><span class="cm">** which a pre-update hook is already defined. The results of attempting
</span></span></span><span class="line"><span class="cl"><span class="cm">** either of these things are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The session object will be used to create changesets for tables in
</span></span></span><span class="line"><span class="cl"><span class="cm">** database zDb, where zDb is either &#34;main&#34;, or &#34;temp&#34;, or the name of an
</span></span></span><span class="line"><span class="cl"><span class="cm">** attached database. It is not an error if database zDb is not attached
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the database when the session object is created.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_create</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Database handle */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDb</span><span class="p">,</span> <span class="cm">/* Name of db (e.g. &#34;main&#34;)</span> <span class="err">*/</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_session</span> <span class="o">**</span><span class="n">ppSession</span> <span class="cm">/* OUT: New session object */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Delete A Session Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** DESTRUCTOR: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Delete a session object previously allocated using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3session_create()]. Once a session object has been deleted, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** results of attempting to use pSession with any other session module
</span></span></span><span class="line"><span class="cl"><span class="cm">** function are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Session objects must be deleted before the database handle to which they
</span></span></span><span class="line"><span class="cl"><span class="cm">** are attached is closed. Refer to the documentation for
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3session_create()] for details.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3session_delete</span><span class="p">(</span><span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Configure a Session Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This method is used to configure a session object after it has been
</span></span></span><span class="line"><span class="cl"><span class="cm">** created. At present the only valid values for the second parameter are
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_SESSION_OBJCONFIG_SIZE] and [SQLITE_SESSION_OBJCONFIG_ROWID].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_object_config</span><span class="p">(</span><span class="n">sqlite3_session</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">op</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pArg</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Options for sqlite3session_object_config
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The following values may passed as the the 2nd parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3session_object_config().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_SESSION_OBJCONFIG_SIZE &lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** This option is used to set, clear or query the flag that enables
</span></span></span><span class="line"><span class="cl"><span class="cm">** the [sqlite3session_changeset_size()] API. Because it imposes some
</span></span></span><span class="line"><span class="cl"><span class="cm">** computational overhead, this API is disabled by default. Argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** pArg must point to a value of type (int). If the value is initially
</span></span></span><span class="line"><span class="cl"><span class="cm">** 0, then the sqlite3session_changeset_size() API is disabled. If it
</span></span></span><span class="line"><span class="cl"><span class="cm">** is greater than 0, then the same API is enabled. Or, if the initial
</span></span></span><span class="line"><span class="cl"><span class="cm">** value is less than zero, no change is made. In all cases the (int)
</span></span></span><span class="line"><span class="cl"><span class="cm">** variable is set to 1 if the sqlite3session_changeset_size() API is
</span></span></span><span class="line"><span class="cl"><span class="cm">** enabled following the current call, or 0 otherwise.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
</span></span></span><span class="line"><span class="cl"><span class="cm">** the first table has been attached to the session object.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_SESSION_OBJCONFIG_ROWID &lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** This option is used to set, clear or query the flag that enables
</span></span></span><span class="line"><span class="cl"><span class="cm">** collection of data for tables with no explicit PRIMARY KEY.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Normally, tables with no explicit PRIMARY KEY are simply ignored
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the sessions module. However, if this flag is set, it behaves
</span></span></span><span class="line"><span class="cl"><span class="cm">** as if such tables have a column &#34;_rowid_ INTEGER PRIMARY KEY&#34; inserted
</span></span></span><span class="line"><span class="cl"><span class="cm">** as their leftmost columns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
</span></span></span><span class="line"><span class="cl"><span class="cm">** the first table has been attached to the session object.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SESSION_OBJCONFIG_SIZE 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SESSION_OBJCONFIG_ROWID 2
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Enable Or Disable A Session Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Enable or disable the recording of changes by a session object. When
</span></span></span><span class="line"><span class="cl"><span class="cm">** enabled, a session object records changes made to the database. When
</span></span></span><span class="line"><span class="cl"><span class="cm">** disabled - it does not. A newly created session object is enabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Refer to the documentation for [sqlite3session_changeset()] for further
</span></span></span><span class="line"><span class="cl"><span class="cm">** details regarding how enabling and disabling a session object affects
</span></span></span><span class="line"><span class="cl"><span class="cm">** the eventual changesets.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Passing zero to this function disables the session. Passing a value
</span></span></span><span class="line"><span class="cl"><span class="cm">** greater than zero enables it. Passing a value less than zero is a
</span></span></span><span class="line"><span class="cl"><span class="cm">** no-op, and may be used to query the current state of the session.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The return value indicates the final state of the session object: 0 if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the session is disabled, or 1 if it is enabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_enable</span><span class="p">(</span><span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">,</span> <span class="kt">int</span> <span class="n">bEnable</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Set Or Clear the Indirect Change Flag
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Each change recorded by a session object is marked as either direct or
</span></span></span><span class="line"><span class="cl"><span class="cm">** indirect. A change is marked as indirect if either:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The session object &#34;indirect&#34; flag is set when the change is
</span></span></span><span class="line"><span class="cl"><span class="cm">** made, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The change is made by an SQL trigger or foreign key action
</span></span></span><span class="line"><span class="cl"><span class="cm">** instead of directly as a result of a users SQL statement.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a single row is affected by more than one operation within a session,
</span></span></span><span class="line"><span class="cl"><span class="cm">** then the change is considered indirect if all operations meet the criteria
</span></span></span><span class="line"><span class="cl"><span class="cm">** for an indirect change above, or direct otherwise.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is used to set, clear or query the session object indirect
</span></span></span><span class="line"><span class="cl"><span class="cm">** flag. If the second argument passed to this function is zero, then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** indirect flag is cleared. If it is greater than zero, the indirect flag
</span></span></span><span class="line"><span class="cl"><span class="cm">** is set. Passing a value less than zero does not modify the current value
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the indirect flag, and may be used to query the current state of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** indirect flag for the specified session object.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The return value indicates the final state of the indirect flag: 0 if
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is clear, or 1 if it is set.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_indirect</span><span class="p">(</span><span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">,</span> <span class="kt">int</span> <span class="n">bIndirect</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Attach A Table To A Session Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If argument zTab is not NULL, then it is the name of a table to attach
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the session object passed as the first argument. All subsequent changes
</span></span></span><span class="line"><span class="cl"><span class="cm">** made to the table while the session object is enabled will be recorded. See
</span></span></span><span class="line"><span class="cl"><span class="cm">** documentation for [sqlite3session_changeset()] for further details.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Or, if argument zTab is NULL, then changes are recorded for all tables
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the database. If additional tables are added to the database (by
</span></span></span><span class="line"><span class="cl"><span class="cm">** executing &#34;CREATE TABLE&#34; statements) after this call is made, changes for
</span></span></span><span class="line"><span class="cl"><span class="cm">** the new tables are also recorded.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Changes can only be recorded for tables that have a PRIMARY KEY explicitly
</span></span></span><span class="line"><span class="cl"><span class="cm">** defined as part of their CREATE TABLE statement. It does not matter if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** PRIMARY KEY is an &#34;INTEGER PRIMARY KEY&#34; (rowid alias) or not. The PRIMARY
</span></span></span><span class="line"><span class="cl"><span class="cm">** KEY may consist of a single column, or may be a composite key.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is not an error if the named table does not exist in the database. Nor
</span></span></span><span class="line"><span class="cl"><span class="cm">** is it an error if the named table does not have a PRIMARY KEY. However,
</span></span></span><span class="line"><span class="cl"><span class="cm">** no changes will be recorded in either of these scenarios.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Changes are not recorded for individual rows that have NULL values stored
</span></span></span><span class="line"><span class="cl"><span class="cm">** in one or more of their PRIMARY KEY columns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OK is returned if the call completes without error. Or, if an error
</span></span></span><span class="line"><span class="cl"><span class="cm">** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;h3&gt;Special sqlite_stat1 Handling&lt;/h3&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** As of SQLite version 3.22.0, the &#34;sqlite_stat1&#34; table is an exception to
</span></span></span><span class="line"><span class="cl"><span class="cm">** some of the rules above. In SQLite, the schema of sqlite_stat1 is:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; CREATE TABLE sqlite_stat1(tbl,idx,stat)
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Even though sqlite_stat1 does not have a PRIMARY KEY, changes are
</span></span></span><span class="line"><span class="cl"><span class="cm">** recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes
</span></span></span><span class="line"><span class="cl"><span class="cm">** are recorded for rows for which (idx IS NULL) is true. However, for such
</span></span></span><span class="line"><span class="cl"><span class="cm">** rows a zero-length blob (SQL value X&#39;&#39;) is stored in the changeset or
</span></span></span><span class="line"><span class="cl"><span class="cm">** patchset instead of a NULL value. This allows such changesets to be
</span></span></span><span class="line"><span class="cl"><span class="cm">** manipulated by legacy implementations of sqlite3changeset_invert(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** concat() and similar.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3changeset_apply() function automatically converts the
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero-length blob back to a NULL value when updating the sqlite_stat1
</span></span></span><span class="line"><span class="cl"><span class="cm">** table. However, if the application calls sqlite3changeset_new(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">** iterator directly (including on a changeset iterator passed to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** conflict-handler callback) then the X&#39;&#39; value is returned. The application
</span></span></span><span class="line"><span class="cl"><span class="cm">** must translate X&#39;&#39; to NULL itself if required.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Legacy (older than 3.22.0) versions of the sessions module cannot capture
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes made to the sqlite_stat1 table. Legacy versions of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changeset_apply() function silently ignore any modifications to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite_stat1 table that are part of a changeset or patchset.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_attach</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">,</span> <span class="cm">/* Session object */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zTab</span> <span class="cm">/* Table name */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Set a table filter on a Session Object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second argument (xFilter) is the &#34;filter callback&#34;. For changes to rows
</span></span></span><span class="line"><span class="cl"><span class="cm">** in tables that are not attached to the Session object, the filter is called
</span></span></span><span class="line"><span class="cl"><span class="cm">** to determine whether changes to the table&#39;s rows should be tracked or not.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If xFilter returns 0, changes are not tracked. Note that once a table is
</span></span></span><span class="line"><span class="cl"><span class="cm">** attached, xFilter will not be called again.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3session_table_filter</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">,</span> <span class="cm">/* Session object */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xFilter</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of third arg to _filter_table() */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zTab</span> <span class="cm">/* Table name */</span>
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span> <span class="cm">/* First argument passed to xFilter */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Generate A Changeset From A Session Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Obtain a changeset containing changes to the tables attached to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** session object passed as the first argument. If successful,
</span></span></span><span class="line"><span class="cl"><span class="cm">** set *ppChangeset to point to a buffer containing the changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">** and *pnChangeset to the size of the changeset in bytes before returning
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OK. If an error occurs, set both *ppChangeset and *pnChangeset to
</span></span></span><span class="line"><span class="cl"><span class="cm">** zero and return an SQLite error code.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A changeset consists of zero or more INSERT, UPDATE and/or DELETE changes,
</span></span></span><span class="line"><span class="cl"><span class="cm">** each representing a change to a single row of an attached table. An INSERT
</span></span></span><span class="line"><span class="cl"><span class="cm">** change contains the values of each field of a new database row. A DELETE
</span></span></span><span class="line"><span class="cl"><span class="cm">** contains the original values of each field of a deleted database row. An
</span></span></span><span class="line"><span class="cl"><span class="cm">** UPDATE change contains the original values of each field of an updated
</span></span></span><span class="line"><span class="cl"><span class="cm">** database row along with the updated values for each updated non-primary-key
</span></span></span><span class="line"><span class="cl"><span class="cm">** column. It is not possible for an UPDATE change to represent a change that
</span></span></span><span class="line"><span class="cl"><span class="cm">** modifies the values of primary key columns. If such a change is made, it
</span></span></span><span class="line"><span class="cl"><span class="cm">** is represented in a changeset as a DELETE followed by an INSERT.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Changes are not recorded for rows that have NULL values stored in one or
</span></span></span><span class="line"><span class="cl"><span class="cm">** more of their PRIMARY KEY columns. If such a row is inserted or deleted,
</span></span></span><span class="line"><span class="cl"><span class="cm">** no corresponding change is present in the changesets returned by this
</span></span></span><span class="line"><span class="cl"><span class="cm">** function. If an existing row with one or more NULL values stored in
</span></span></span><span class="line"><span class="cl"><span class="cm">** PRIMARY KEY columns is updated so that all PRIMARY KEY columns are non-NULL,
</span></span></span><span class="line"><span class="cl"><span class="cm">** only an INSERT is appears in the changeset. Similarly, if an existing row
</span></span></span><span class="line"><span class="cl"><span class="cm">** with non-NULL PRIMARY KEY values is updated so that one or more of its
</span></span></span><span class="line"><span class="cl"><span class="cm">** PRIMARY KEY columns are set to NULL, the resulting changeset contains a
</span></span></span><span class="line"><span class="cl"><span class="cm">** DELETE change only.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The contents of a changeset may be traversed using an iterator created
</span></span></span><span class="line"><span class="cl"><span class="cm">** using the [sqlite3changeset_start()] API. A changeset may be applied to
</span></span></span><span class="line"><span class="cl"><span class="cm">** a database with a compatible schema using the [sqlite3changeset_apply()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** API.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Within a changeset generated by this function, all changes related to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** single table are grouped together. In other words, when iterating through
</span></span></span><span class="line"><span class="cl"><span class="cm">** a changeset or when applying a changeset to a database, all changes related
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a single table are processed before moving on to the next table. Tables
</span></span></span><span class="line"><span class="cl"><span class="cm">** are sorted in the same order in which they were attached (or auto-attached)
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the sqlite3_session object. The order in which the changes related to
</span></span></span><span class="line"><span class="cl"><span class="cm">** a single table are stored is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Following a successful call to this function, it is the responsibility of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the caller to eventually free the buffer that *ppChangeset points to using
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3_free()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;h3&gt;Changeset Generation&lt;/h3&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Once a table has been attached to a session object, the session object
</span></span></span><span class="line"><span class="cl"><span class="cm">** records the primary key values of all new rows inserted into the table.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It also records the original primary key and other column values of any
</span></span></span><span class="line"><span class="cl"><span class="cm">** deleted or updated rows. For each unique primary key value, data is only
</span></span></span><span class="line"><span class="cl"><span class="cm">** recorded once - the first time a row with said primary key is inserted,
</span></span></span><span class="line"><span class="cl"><span class="cm">** updated or deleted in the lifetime of the session.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** There is one exception to the previous paragraph: when a row is inserted,
</span></span></span><span class="line"><span class="cl"><span class="cm">** updated or deleted, if one or more of its primary key columns contain a
</span></span></span><span class="line"><span class="cl"><span class="cm">** NULL value, no record of the change is made.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The session object therefore accumulates two types of records - those
</span></span></span><span class="line"><span class="cl"><span class="cm">** that consist of primary key values only (created when the user inserts
</span></span></span><span class="line"><span class="cl"><span class="cm">** a new record) and those that consist of the primary key values and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** original values of other table columns (created when the users deletes
</span></span></span><span class="line"><span class="cl"><span class="cm">** or updates a record).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When this function is called, the requested changeset is created using
</span></span></span><span class="line"><span class="cl"><span class="cm">** both the accumulated records and the current contents of the database
</span></span></span><span class="line"><span class="cl"><span class="cm">** file. Specifically:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; For each record generated by an insert, the database is queried
</span></span></span><span class="line"><span class="cl"><span class="cm">** for a row with a matching primary key. If one is found, an INSERT
</span></span></span><span class="line"><span class="cl"><span class="cm">** change is added to the changeset. If no such row is found, no change
</span></span></span><span class="line"><span class="cl"><span class="cm">** is added to the changeset.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; For each record generated by an update or delete, the database is
</span></span></span><span class="line"><span class="cl"><span class="cm">** queried for a row with a matching primary key. If such a row is
</span></span></span><span class="line"><span class="cl"><span class="cm">** found and one or more of the non-primary key fields have been
</span></span></span><span class="line"><span class="cl"><span class="cm">** modified from their original values, an UPDATE change is added to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the changeset. Or, if no such row is found in the table, a DELETE
</span></span></span><span class="line"><span class="cl"><span class="cm">** change is added to the changeset. If there is a row with a matching
</span></span></span><span class="line"><span class="cl"><span class="cm">** primary key in the database, but all fields contain their original
</span></span></span><span class="line"><span class="cl"><span class="cm">** values, no change is added to the changeset.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This means, amongst other things, that if a row is inserted and then later
</span></span></span><span class="line"><span class="cl"><span class="cm">** deleted while a session object is active, neither the insert nor the delete
</span></span></span><span class="line"><span class="cl"><span class="cm">** will be present in the changeset. Or if a row is deleted and then later a
</span></span></span><span class="line"><span class="cl"><span class="cm">** row with the same primary key values inserted while a session object is
</span></span></span><span class="line"><span class="cl"><span class="cm">** active, the resulting changeset will contain an UPDATE change instead of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a DELETE and an INSERT.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When a session object is disabled (see the [sqlite3session_enable()] API),
</span></span></span><span class="line"><span class="cl"><span class="cm">** it does not accumulate records when rows are inserted, updated or deleted.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This may appear to have some counter-intuitive effects if a single row
</span></span></span><span class="line"><span class="cl"><span class="cm">** is written to more than once during a session. For example, if a row
</span></span></span><span class="line"><span class="cl"><span class="cm">** is inserted while a session object is enabled, then later deleted while
</span></span></span><span class="line"><span class="cl"><span class="cm">** the same session object is disabled, no INSERT record will appear in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset, even though the delete took place while the session was disabled.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Or, if one field of a row is updated while a session is disabled, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** another field of the same row is updated while the session is enabled, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** resulting changeset will contain an UPDATE change that updates both fields.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_changeset</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">,</span> <span class="cm">/* Session object */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnChangeset</span><span class="p">,</span> <span class="cm">/* OUT: Size of buffer at *ppChangeset */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">**</span><span class="n">ppChangeset</span> <span class="cm">/* OUT: Buffer containing changeset */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Return An Upper-limit For The Size Of The Changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** By default, this function always returns 0. For it to return
</span></span></span><span class="line"><span class="cl"><span class="cm">** a useful result, the sqlite3_session object must have been configured
</span></span></span><span class="line"><span class="cl"><span class="cm">** to enable this API using sqlite3session_object_config() with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_SESSION_OBJCONFIG_SIZE verb.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When enabled, this function returns an upper limit, in bytes, for the size
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the changeset that might be produced if sqlite3session_changeset() were
</span></span></span><span class="line"><span class="cl"><span class="cm">** called. The final changeset size might be equal to or smaller than the
</span></span></span><span class="line"><span class="cl"><span class="cm">** size in bytes returned by this function.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3session_changeset_size</span><span class="p">(</span><span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Load The Difference Between Tables Into A Session
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If it is not already attached to the session object passed as the first
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument, this function attaches table zTbl in the same manner as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3session_attach()] function. If zTbl does not exist, or if it
</span></span></span><span class="line"><span class="cl"><span class="cm">** does not have a primary key, this function is a no-op (but does not return
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Argument zFromDb must be the name of a database (&#34;main&#34;, &#34;temp&#34; etc.)
</span></span></span><span class="line"><span class="cl"><span class="cm">** attached to the same database handle as the session object that contains
</span></span></span><span class="line"><span class="cl"><span class="cm">** a table compatible with the table attached to the session by this function.
</span></span></span><span class="line"><span class="cl"><span class="cm">** A table is considered compatible if it:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Has the same name,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Has the same set of columns declared in the same order, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Has the same PRIMARY KEY definition.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the tables are not compatible, SQLITE_SCHEMA is returned. If the tables
</span></span></span><span class="line"><span class="cl"><span class="cm">** are compatible but do not have any PRIMARY KEY columns, it is not an error
</span></span></span><span class="line"><span class="cl"><span class="cm">** but no changes are added to the session object. As with other session
</span></span></span><span class="line"><span class="cl"><span class="cm">** APIs, tables without PRIMARY KEYs are simply ignored.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function adds a set of changes to the session object that could be
</span></span></span><span class="line"><span class="cl"><span class="cm">** used to update the table in database zFrom (call this the &#34;from-table&#34;)
</span></span></span><span class="line"><span class="cl"><span class="cm">** so that its content is the same as the table attached to the session
</span></span></span><span class="line"><span class="cl"><span class="cm">** object (call this the &#34;to-table&#34;). Specifically:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; For each row (primary key) that exists in the to-table but not in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the from-table, an INSERT record is added to the session object.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; For each row (primary key) that exists in the to-table but not in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the from-table, a DELETE record is added to the session object.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; For each row (primary key) that exists in both tables, but features
</span></span></span><span class="line"><span class="cl"><span class="cm">** different non-PK values in each, an UPDATE record is added to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** session.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** To clarify, if this function is called and then a changeset constructed
</span></span></span><span class="line"><span class="cl"><span class="cm">** using [sqlite3session_changeset()], then after applying that changeset to
</span></span></span><span class="line"><span class="cl"><span class="cm">** database zFrom the contents of the two compatible tables would be
</span></span></span><span class="line"><span class="cl"><span class="cm">** identical.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It an error if database zFrom does not exist or does not contain the
</span></span></span><span class="line"><span class="cl"><span class="cm">** required compatible table.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
</span></span></span><span class="line"><span class="cl"><span class="cm">** may be set to point to a buffer containing an English language error
</span></span></span><span class="line"><span class="cl"><span class="cm">** message. It is the responsibility of the caller to free this buffer using
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_free().
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_diff</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zFromDb</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zTbl</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">char</span> <span class="o">**</span><span class="n">pzErrMsg</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Generate A Patchset From A Session Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_session
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The differences between a patchset and a changeset are that:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; DELETE records consist of the primary key fields only. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** original values of other fields are omitted.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The original values of any modified fields are omitted from
</span></span></span><span class="line"><span class="cl"><span class="cm">** UPDATE records.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A patchset blob may be used with up to date versions of all
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** which returns SQLITE_CORRUPT if it is passed a patchset. Similarly,
</span></span></span><span class="line"><span class="cl"><span class="cm">** attempting to use a patchset blob with old versions of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Because the non-primary key &#34;old.*&#34; fields are omitted, no
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset
</span></span></span><span class="line"><span class="cl"><span class="cm">** is passed to the sqlite3changeset_apply() API. Other conflict types work
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the same way as for changesets.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Changes within a patchset are ordered in the same way as for changesets
</span></span></span><span class="line"><span class="cl"><span class="cm">** generated by the sqlite3session_changeset() function (i.e. all changes for
</span></span></span><span class="line"><span class="cl"><span class="cm">** a single table are grouped together, tables appear in the order in which
</span></span></span><span class="line"><span class="cl"><span class="cm">** they were attached to the session object).
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_patchset</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">,</span> <span class="cm">/* Session object */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnPatchset</span><span class="p">,</span> <span class="cm">/* OUT: Size of buffer at *ppPatchset */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">**</span><span class="n">ppPatchset</span> <span class="cm">/* OUT: Buffer containing patchset */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Test if a changeset has recorded any changes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Return non-zero if no changes to attached tables have been recorded by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the session object passed as the first argument. Otherwise, if one or
</span></span></span><span class="line"><span class="cl"><span class="cm">** more changes have been recorded, return zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Even if this function returns zero, it is possible that calling
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3session_changeset()] on the session handle may still return a
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset that contains no changes. This can happen when a row in
</span></span></span><span class="line"><span class="cl"><span class="cm">** an attached table is modified and then later on the original values
</span></span></span><span class="line"><span class="cl"><span class="cm">** are restored. However, if this function returns non-zero, then it is
</span></span></span><span class="line"><span class="cl"><span class="cm">** guaranteed that a call to sqlite3session_changeset() will return a
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset containing zero changes.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_isempty</span><span class="p">(</span><span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Query for the amount of heap memory used by a session object.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This API returns the total amount of heap memory in bytes currently
</span></span></span><span class="line"><span class="cl"><span class="cm">** used by the session object passed as the only argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="n">sqlite3_int64</span> <span class="nf">sqlite3session_memory_used</span><span class="p">(</span><span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Create An Iterator To Traverse A Changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">** CONSTRUCTOR: sqlite3_changeset_iter
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Create an iterator used to iterate through the contents of a changeset.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If successful, *pp is set to point to the iterator handle and SQLITE_OK
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned. Otherwise, if an error occurs, *pp is set to zero and an
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite error code is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The following functions can be used to advance and query a changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">** iterator created by this function:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3changeset_next()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3changeset_op()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3changeset_new()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; [sqlite3changeset_old()]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is the responsibility of the caller to eventually destroy the iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** by passing it to [sqlite3changeset_finalize()]. The buffer containing the
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset (pChangeset) must remain valid until after the iterator is
</span></span></span><span class="line"><span class="cl"><span class="cm">** destroyed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Assuming the changeset blob was created by one of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3session_changeset()], [sqlite3changeset_concat()] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3changeset_invert()] functions, all changes within the changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">** that apply to a single table are grouped together. This means that when
</span></span></span><span class="line"><span class="cl"><span class="cm">** an application iterates through a changeset using an iterator created by
</span></span></span><span class="line"><span class="cl"><span class="cm">** this function, all changes that relate to a single table are visited
</span></span></span><span class="line"><span class="cl"><span class="cm">** consecutively. There is no chance that the iterator will visit a change
</span></span></span><span class="line"><span class="cl"><span class="cm">** the applies to table X, then one for table Y, and then later on visit
</span></span></span><span class="line"><span class="cl"><span class="cm">** another change for table X.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The behavior of sqlite3changeset_start_v2() and its streaming equivalent
</span></span></span><span class="line"><span class="cl"><span class="cm">** may be modified by passing a combination of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CHANGESETSTART_INVERT | supported flags] as the 4th parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that the sqlite3changeset_start_v2() API is still &lt;b&gt;experimental&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** and therefore subject to change.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_start</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">**</span><span class="n">pp</span><span class="p">,</span> <span class="cm">/* OUT: New changeset iterator handle */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nChangeset</span><span class="p">,</span> <span class="cm">/* Size of changeset blob in bytes */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pChangeset</span> <span class="cm">/* Pointer to blob containing changeset */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_start_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">**</span><span class="n">pp</span><span class="p">,</span> <span class="cm">/* OUT: New changeset iterator handle */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nChangeset</span><span class="p">,</span> <span class="cm">/* Size of changeset blob in bytes */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pChangeset</span><span class="p">,</span> <span class="cm">/* Pointer to blob containing changeset */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">flags</span> <span class="cm">/* SESSION_CHANGESETSTART_* flags */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Flags for sqlite3changeset_start_v2
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The following flags may passed via the 4th parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESETAPPLY_INVERT &lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Invert the changeset while iterating through it. This is equivalent to
</span></span></span><span class="line"><span class="cl"><span class="cm">** inverting a changeset using sqlite3changeset_invert() before applying it.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is an error to specify this flag with a patchset.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESETSTART_INVERT 0x0002
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Advance A Changeset Iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changeset_iter
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function may only be used with iterators created by the function
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3changeset_start()]. If it is called on an iterator passed to
</span></span></span><span class="line"><span class="cl"><span class="cm">** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned and the call has no effect.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Immediately after an iterator is created by sqlite3changeset_start(), it
</span></span></span><span class="line"><span class="cl"><span class="cm">** does not point to any change in the changeset. Assuming the changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not empty, the first call to this function advances the iterator to
</span></span></span><span class="line"><span class="cl"><span class="cm">** point to the first change in the changeset. Each subsequent call advances
</span></span></span><span class="line"><span class="cl"><span class="cm">** the iterator to point to the next change in the changeset (if any). If
</span></span></span><span class="line"><span class="cl"><span class="cm">** no error occurs and the iterator points to a valid change after a call
</span></span></span><span class="line"><span class="cl"><span class="cm">** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Otherwise, if all changes in the changeset have already been visited,
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_DONE is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If an error occurs, an SQLite error code is returned. Possible error
</span></span></span><span class="line"><span class="cl"><span class="cm">** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_NOMEM.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_next</span><span class="p">(</span><span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">pIter</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Obtain The Current Operation From A Changeset Iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changeset_iter
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The pIter argument passed to this function may either be an iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** created by [sqlite3changeset_start()]. In the latter case, the most recent
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not the case, this function returns [SQLITE_MISUSE].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Arguments pOp, pnCol and pzTab may not be NULL. Upon return, three
</span></span></span><span class="line"><span class="cl"><span class="cm">** outputs are set through these pointers:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** *pOp is set to one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
</span></span></span><span class="line"><span class="cl"><span class="cm">** depending on the type of change that the iterator currently points to;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** *pnCol is set to the number of columns in the table affected by the change; and
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** *pzTab is set to point to a nul-terminated utf-8 encoded string containing
</span></span></span><span class="line"><span class="cl"><span class="cm">** the name of the table affected by the current change. The buffer remains
</span></span></span><span class="line"><span class="cl"><span class="cm">** valid until either sqlite3changeset_next() is called on the iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** or until the conflict-handler function returns.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
</span></span></span><span class="line"><span class="cl"><span class="cm">** is an indirect change, or false (0) otherwise. See the documentation for
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3session_indirect()] for a description of direct and indirect
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If no error occurs, SQLITE_OK is returned. If an error does occur, an
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite error code is returned. The values of the output variables may not
</span></span></span><span class="line"><span class="cl"><span class="cm">** be trusted in this case.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_op</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">pIter</span><span class="p">,</span> <span class="cm">/* Iterator object */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">pzTab</span><span class="p">,</span> <span class="cm">/* OUT: Pointer to table name */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnCol</span><span class="p">,</span> <span class="cm">/* OUT: Number of columns in table */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pOp</span><span class="p">,</span> <span class="cm">/* OUT: SQLITE_INSERT, DELETE or UPDATE */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pbIndirect</span> <span class="cm">/* OUT: True for an &#39;indirect&#39; change */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Obtain The Primary Key Definition Of A Table
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changeset_iter
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For each modified table, a changeset includes the following:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The number of columns in the table, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Which of those columns make up the tables PRIMARY KEY.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is used to find which columns comprise the PRIMARY KEY of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the table modified by the change that iterator pIter currently points to.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If successful, *pabPK is set to point to an array of nCol entries, where
</span></span></span><span class="line"><span class="cl"><span class="cm">** nCol is the number of columns in the table. Elements of *pabPK are set to
</span></span></span><span class="line"><span class="cl"><span class="cm">** 0x01 if the corresponding column is part of the tables primary key, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** 0x00 if it is not.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If argument pnCol is not NULL, then *pnCol is set to the number of columns
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the table.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If this function is called when the iterator does not point to a valid
</span></span></span><span class="line"><span class="cl"><span class="cm">** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OK is returned and the output variables populated as described
</span></span></span><span class="line"><span class="cl"><span class="cm">** above.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_pk</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">pIter</span><span class="p">,</span> <span class="cm">/* Iterator object */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">**</span><span class="n">pabPK</span><span class="p">,</span> <span class="cm">/* OUT: Array of boolean - true for PK cols */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnCol</span> <span class="cm">/* OUT: Number of entries in output array */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Obtain old.* Values From A Changeset Iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changeset_iter
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The pIter argument passed to this function may either be an iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** created by [sqlite3changeset_start()]. In the latter case, the most recent
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to [sqlite3changeset_next()] must have returned SQLITE_ROW.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Furthermore, it may only be called if the type of change that the iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** currently points to is either [SQLITE_DELETE] or [SQLITE_UPDATE]. Otherwise,
</span></span></span><span class="line"><span class="cl"><span class="cm">** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Argument iVal must be greater than or equal to 0, and less than the number
</span></span></span><span class="line"><span class="cl"><span class="cm">** of columns in the table affected by the current change. Otherwise,
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If successful, this function sets *ppValue to point to a protected
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value object containing the iVal&#39;th value from the vector of
</span></span></span><span class="line"><span class="cl"><span class="cm">** original row values stored as part of the UPDATE or DELETE change and
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns SQLITE_OK. The name of the function comes from the fact that this
</span></span></span><span class="line"><span class="cl"><span class="cm">** is similar to the &#34;old.*&#34; columns available to update or delete triggers.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If some other error occurs (e.g. an OOM condition), an SQLite error code
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned and *ppValue is set to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_old</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">pIter</span><span class="p">,</span> <span class="cm">/* Changeset iterator */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iVal</span><span class="p">,</span> <span class="cm">/* Column number */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="n">ppValue</span> <span class="cm">/* OUT: Old value (or NULL pointer)</span> <span class="err">*/</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Obtain new.* Values From A Changeset Iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changeset_iter
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The pIter argument passed to this function may either be an iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** created by [sqlite3changeset_start()]. In the latter case, the most recent
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to [sqlite3changeset_next()] must have returned SQLITE_ROW.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Furthermore, it may only be called if the type of change that the iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** currently points to is either [SQLITE_UPDATE] or [SQLITE_INSERT]. Otherwise,
</span></span></span><span class="line"><span class="cl"><span class="cm">** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Argument iVal must be greater than or equal to 0, and less than the number
</span></span></span><span class="line"><span class="cl"><span class="cm">** of columns in the table affected by the current change. Otherwise,
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If successful, this function sets *ppValue to point to a protected
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value object containing the iVal&#39;th value from the vector of
</span></span></span><span class="line"><span class="cl"><span class="cm">** new row values stored as part of the UPDATE or INSERT change and
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns SQLITE_OK. If the change is an UPDATE and does not include
</span></span></span><span class="line"><span class="cl"><span class="cm">** a new value for the requested column, *ppValue is set to NULL and
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OK returned. The name of the function comes from the fact that
</span></span></span><span class="line"><span class="cl"><span class="cm">** this is similar to the &#34;new.*&#34; columns available to update or delete
</span></span></span><span class="line"><span class="cl"><span class="cm">** triggers.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If some other error occurs (e.g. an OOM condition), an SQLite error code
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned and *ppValue is set to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_new</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">pIter</span><span class="p">,</span> <span class="cm">/* Changeset iterator */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iVal</span><span class="p">,</span> <span class="cm">/* Column number */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="n">ppValue</span> <span class="cm">/* OUT: New value (or NULL pointer)</span> <span class="err">*/</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changeset_iter
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function should only be used with iterator objects passed to a
</span></span></span><span class="line"><span class="cl"><span class="cm">** conflict-handler callback by [sqlite3changeset_apply()] with either
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function
</span></span></span><span class="line"><span class="cl"><span class="cm">** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue
</span></span></span><span class="line"><span class="cl"><span class="cm">** is set to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Argument iVal must be greater than or equal to 0, and less than the number
</span></span></span><span class="line"><span class="cl"><span class="cm">** of columns in the table affected by the current change. Otherwise,
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If successful, this function sets *ppValue to point to a protected
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_value object containing the iVal&#39;th value from the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;conflicting row&#34; associated with the current conflict-handler callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** and returns SQLITE_OK.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If some other error occurs (e.g. an OOM condition), an SQLite error code
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned and *ppValue is set to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_conflict</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">pIter</span><span class="p">,</span> <span class="cm">/* Changeset iterator */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iVal</span><span class="p">,</span> <span class="cm">/* Column number */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="n">ppValue</span> <span class="cm">/* OUT: Value from conflicting row */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changeset_iter
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function may only be called with an iterator passed to an
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case
</span></span></span><span class="line"><span class="cl"><span class="cm">** it sets the output variable to the total number of known foreign key
</span></span></span><span class="line"><span class="cl"><span class="cm">** violations in the destination database and returns SQLITE_OK.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In all other cases this function returns SQLITE_MISUSE.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_fk_conflicts</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">pIter</span><span class="p">,</span> <span class="cm">/* Changeset iterator */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnOut</span> <span class="cm">/* OUT: Number of FK violations */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Finalize A Changeset Iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changeset_iter
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is used to finalize an iterator allocated with
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3changeset_start()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function should only be called on iterators created using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3changeset_start()] function. If an application calls this
</span></span></span><span class="line"><span class="cl"><span class="cm">** function with an iterator passed to a conflict-handler by
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** call has no effect.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If an error was encountered within a call to an sqlite3changeset_xxx()
</span></span></span><span class="line"><span class="cl"><span class="cm">** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding
</span></span></span><span class="line"><span class="cl"><span class="cm">** to that error is returned by this function. Otherwise, SQLITE_OK is
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned. This is to allow the following pattern (pseudo-code):
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changeset_start();
</span></span></span><span class="line"><span class="cl"><span class="cm">** while( SQLITE_ROW==sqlite3changeset_next() ){
</span></span></span><span class="line"><span class="cl"><span class="cm">** // Do something with change.
</span></span></span><span class="line"><span class="cl"><span class="cm">** }
</span></span></span><span class="line"><span class="cl"><span class="cm">** rc = sqlite3changeset_finalize();
</span></span></span><span class="line"><span class="cl"><span class="cm">** if( rc!=SQLITE_OK ){
</span></span></span><span class="line"><span class="cl"><span class="cm">** // An error has occurred
</span></span></span><span class="line"><span class="cl"><span class="cm">** }
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_finalize</span><span class="p">(</span><span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">pIter</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Invert A Changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is used to &#34;invert&#34; a changeset object. Applying an inverted
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset to a database reverses the effects of applying the uninverted
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset. Specifically:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Each DELETE change is changed to an INSERT, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Each INSERT change is changed to a DELETE, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; For each UPDATE change, the old.* and new.* values are exchanged.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function does not change the order in which changes appear within
</span></span></span><span class="line"><span class="cl"><span class="cm">** the changeset. It merely reverses the sense of each individual change.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If successful, a pointer to a buffer containing the inverted changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">** is stored in *ppOut, the size of the same buffer is stored in *pnOut, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are
</span></span></span><span class="line"><span class="cl"><span class="cm">** zeroed and an SQLite error code returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is the responsibility of the caller to eventually call sqlite3_free()
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the *ppOut pointer to free the buffer allocation following a successful
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to this function.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** WARNING/TODO: This function currently assumes that the input is a valid
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset. If it is not, the results are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_invert</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nIn</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="cm">/* Input changeset */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnOut</span><span class="p">,</span> <span class="kt">void</span> <span class="o">**</span><span class="n">ppOut</span> <span class="cm">/* OUT: Inverse of input */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Concatenate Two Changeset Objects
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is used to concatenate two changesets, A and B, into a
</span></span></span><span class="line"><span class="cl"><span class="cm">** single changeset. The result is a changeset equivalent to applying
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset A followed by changeset B.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function combines the two input changesets using an
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_changegroup object. Calling it produces similar results as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** following code fragment:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_changegroup *pGrp;
</span></span></span><span class="line"><span class="cl"><span class="cm">** rc = sqlite3_changegroup_new(&amp;pGrp);
</span></span></span><span class="line"><span class="cl"><span class="cm">** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA);
</span></span></span><span class="line"><span class="cl"><span class="cm">** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB);
</span></span></span><span class="line"><span class="cl"><span class="cm">** if( rc==SQLITE_OK ){
</span></span></span><span class="line"><span class="cl"><span class="cm">** rc = sqlite3changegroup_output(pGrp, pnOut, ppOut);
</span></span></span><span class="line"><span class="cl"><span class="cm">** }else{
</span></span></span><span class="line"><span class="cl"><span class="cm">** *ppOut = 0;
</span></span></span><span class="line"><span class="cl"><span class="cm">** *pnOut = 0;
</span></span></span><span class="line"><span class="cl"><span class="cm">** }
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Refer to the sqlite3_changegroup documentation below for details.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_concat</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nA</span><span class="p">,</span> <span class="cm">/* Number of bytes in buffer pA */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pA</span><span class="p">,</span> <span class="cm">/* Pointer to buffer containing changeset A */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nB</span><span class="p">,</span> <span class="cm">/* Number of bytes in buffer pB */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pB</span><span class="p">,</span> <span class="cm">/* Pointer to buffer containing changeset B */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnOut</span><span class="p">,</span> <span class="cm">/* OUT: Number of bytes in output changeset */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">**</span><span class="n">ppOut</span> <span class="cm">/* OUT: Buffer containing output changeset */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Upgrade the Schema of a Changeset/Patchset
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_upgrade</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDb</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nIn</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="cm">/* Input changeset */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnOut</span><span class="p">,</span> <span class="kt">void</span> <span class="o">**</span><span class="n">ppOut</span> <span class="cm">/* OUT: Inverse of input */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Changegroup Handle
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A changegroup is an object used to combine two or more
</span></span></span><span class="line"><span class="cl"><span class="cm">** [changesets] or [patchsets]
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_changegroup</span> <span class="n">sqlite3_changegroup</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Create A New Changegroup Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** CONSTRUCTOR: sqlite3_changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** An sqlite3_changegroup object is used to combine two or more changesets
</span></span></span><span class="line"><span class="cl"><span class="cm">** (or patchsets) into a single changeset (or patchset). A single changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">** object may combine changesets or patchsets, but not both. The output is
</span></span></span><span class="line"><span class="cl"><span class="cm">** always in the same format as the input.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If successful, this function returns SQLITE_OK and populates (*pp) with
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to a new sqlite3_changegroup object before returning. The caller
</span></span></span><span class="line"><span class="cl"><span class="cm">** should eventually free the returned object using a call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changegroup_delete(). If an error occurs, an SQLite error code
</span></span></span><span class="line"><span class="cl"><span class="cm">** (i.e. SQLITE_NOMEM) is returned and *pp is set to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The usual usage pattern for an sqlite3_changegroup object is as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; It is created using a call to sqlite3changegroup_new().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Zero or more changesets (or patchsets) are added to the object
</span></span></span><span class="line"><span class="cl"><span class="cm">** by calling sqlite3changegroup_add().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The result of combining all input changesets together is obtained
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the application via a call to sqlite3changegroup_output().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The object is deleted using a call to sqlite3changegroup_delete().
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Any number of calls to add() and output() may be made between the calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** new() and delete(), and in any order.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** As well as the regular sqlite3changegroup_add() and
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changegroup_output() functions, also available are the streaming
</span></span></span><span class="line"><span class="cl"><span class="cm">** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm().
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changegroup_new</span><span class="p">(</span><span class="n">sqlite3_changegroup</span> <span class="o">**</span><span class="n">pp</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Add a Schema to a Changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changegroup_schema
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This method may be used to optionally enforce the rule that the changesets
</span></span></span><span class="line"><span class="cl"><span class="cm">** added to the changegroup handle must match the schema of database zDb
</span></span></span><span class="line"><span class="cl"><span class="cm">** (&#34;main&#34;, &#34;temp&#34;, or the name of an attached database). If
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changegroup_add() is called to add a changeset that is not compatible
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the configured schema, SQLITE_SCHEMA is returned and the changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">** object is left in an undefined state.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A changeset schema is considered compatible with the database schema in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the same way as for sqlite3changeset_apply(). Specifically, for each
</span></span></span><span class="line"><span class="cl"><span class="cm">** table in the changeset, there exists a database table with:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The name identified by the changeset, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; at least as many columns as recorded in the changeset, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; the primary key columns in the same position as recorded in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the changeset.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The output of the changegroup object always has the same schema as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database nominated using this function. In cases where changesets passed
</span></span></span><span class="line"><span class="cl"><span class="cm">** to sqlite3changegroup_add() have fewer columns than the corresponding table
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the database schema, these are filled in using the default column
</span></span></span><span class="line"><span class="cl"><span class="cm">** values from the database schema. This makes it possible to combined
</span></span></span><span class="line"><span class="cl"><span class="cm">** changesets that have different numbers of columns for a single table
</span></span></span><span class="line"><span class="cl"><span class="cm">** within a changegroup, provided that they are otherwise compatible.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changegroup_schema</span><span class="p">(</span><span class="n">sqlite3_changegroup</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zDb</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Add A Changeset To A Changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Add all changes within the changeset (or patchset) in buffer pData (size
</span></span></span><span class="line"><span class="cl"><span class="cm">** nData bytes) to the changegroup.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the buffer contains a patchset, then all prior calls to this function
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the same changegroup object must also have specified patchsets. Or, if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the buffer contains a changeset, so must have the earlier calls to this
</span></span></span><span class="line"><span class="cl"><span class="cm">** function. Otherwise, SQLITE_ERROR is returned and no changes are added
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the changegroup.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Rows within the changeset and changegroup are identified by the values in
</span></span></span><span class="line"><span class="cl"><span class="cm">** their PRIMARY KEY columns. A change in the changeset is considered to
</span></span></span><span class="line"><span class="cl"><span class="cm">** apply to the same row as a change already present in the changegroup if
</span></span></span><span class="line"><span class="cl"><span class="cm">** the two rows have the same primary key.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Changes to rows that do not already appear in the changegroup are
</span></span></span><span class="line"><span class="cl"><span class="cm">** simply copied into it. Or, if both the new changeset and the changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">** contain changes that apply to a single row, the final contents of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** changegroup depends on the type of each change, as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;table border=1 style=&#34;margin-left:8ex;margin-right:8ex&#34;&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;th style=&#34;white-space:pre&#34;&gt;Existing Change &lt;/th&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;th style=&#34;white-space:pre&#34;&gt;New Change &lt;/th&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;th&gt;Output Change
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;INSERT &lt;td&gt;INSERT &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The new change is ignored. This case does not occur if the new
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset was recorded immediately after the changesets already
</span></span></span><span class="line"><span class="cl"><span class="cm">** added to the changegroup.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;INSERT &lt;td&gt;UPDATE &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The INSERT change remains in the changegroup. The values in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** INSERT change are modified as if the row was inserted by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** existing change and then updated according to the new change.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;INSERT &lt;td&gt;DELETE &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The existing INSERT is removed from the changegroup. The DELETE is
</span></span></span><span class="line"><span class="cl"><span class="cm">** not added.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;UPDATE &lt;td&gt;INSERT &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The new change is ignored. This case does not occur if the new
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset was recorded immediately after the changesets already
</span></span></span><span class="line"><span class="cl"><span class="cm">** added to the changegroup.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;UPDATE &lt;td&gt;UPDATE &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The existing UPDATE remains within the changegroup. It is amended
</span></span></span><span class="line"><span class="cl"><span class="cm">** so that the accompanying values are as if the row was updated once
</span></span></span><span class="line"><span class="cl"><span class="cm">** by the existing change and then again by the new change.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;UPDATE &lt;td&gt;DELETE &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The existing UPDATE is replaced by the new DELETE within the
</span></span></span><span class="line"><span class="cl"><span class="cm">** changegroup.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;DELETE &lt;td&gt;INSERT &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** If one or more of the column values in the row inserted by the
</span></span></span><span class="line"><span class="cl"><span class="cm">** new change differ from those in the row deleted by the existing
</span></span></span><span class="line"><span class="cl"><span class="cm">** change, the existing DELETE is replaced by an UPDATE within the
</span></span></span><span class="line"><span class="cl"><span class="cm">** changegroup. Otherwise, if the inserted row is exactly the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** as the deleted row, the existing DELETE is simply discarded.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;DELETE &lt;td&gt;UPDATE &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The new change is ignored. This case does not occur if the new
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset was recorded immediately after the changesets already
</span></span></span><span class="line"><span class="cl"><span class="cm">** added to the changegroup.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;DELETE &lt;td&gt;DELETE &lt;td&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The new change is ignored. This case does not occur if the new
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset was recorded immediately after the changesets already
</span></span></span><span class="line"><span class="cl"><span class="cm">** added to the changegroup.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/table&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the new changeset contains changes to a table that is already present
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the changegroup, then the number of columns and the position of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** primary key columns for the table must be consistent. If this is not the
</span></span></span><span class="line"><span class="cl"><span class="cm">** case, this function fails with SQLITE_SCHEMA. Except, if the changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">** object has been configured with a database schema using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changegroup_schema() API, then it is possible to combine changesets
</span></span></span><span class="line"><span class="cl"><span class="cm">** with different numbers of columns for a single table, provided that
</span></span></span><span class="line"><span class="cl"><span class="cm">** they are otherwise compatible.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the input changeset appears to be corrupt and the corruption is
</span></span></span><span class="line"><span class="cl"><span class="cm">** detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition
</span></span></span><span class="line"><span class="cl"><span class="cm">** occurs during processing, this function returns SQLITE_NOMEM.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In all cases, if an error occurs the state of the final contents of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** changegroup is undefined. If no error occurs, SQLITE_OK is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changegroup_add</span><span class="p">(</span><span class="n">sqlite3_changegroup</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nData</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Add A Single Change To A Changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function adds the single change currently indicated by the iterator
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed as the second argument to the changegroup object. The rules for
</span></span></span><span class="line"><span class="cl"><span class="cm">** adding the change are just as described for [sqlite3changegroup_add()].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the change is successfully added to the changegroup, SQLITE_OK is
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned. Otherwise, an SQLite error code is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The iterator must point to a valid entry when this function is called.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If it does not, SQLITE_ERROR is returned and no change is added to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** changegroup. Additionally, the iterator must not have been opened with
</span></span></span><span class="line"><span class="cl"><span class="cm">** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changegroup_add_change</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changegroup</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span><span class="o">*</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Obtain A Composite Changeset From A Changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">** METHOD: sqlite3_changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Obtain a buffer containing a changeset (or patchset) representing the
</span></span></span><span class="line"><span class="cl"><span class="cm">** current contents of the changegroup. If the inputs to the changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">** were themselves changesets, the output is a changeset. Or, if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** inputs were patchsets, the output is also a patchset.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** As with the output of the sqlite3session_changeset() and
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3session_patchset() functions, all changes related to a single
</span></span></span><span class="line"><span class="cl"><span class="cm">** table are grouped together in the output of this function. Tables appear
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the same order as for the very first changeset added to the changegroup.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the second or subsequent changesets added to the changegroup contain
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes for tables that do not appear in the first changeset, they are
</span></span></span><span class="line"><span class="cl"><span class="cm">** appended onto the end of the output changeset, again in the order in
</span></span></span><span class="line"><span class="cl"><span class="cm">** which they are first encountered.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If an error occurs, an SQLite error code is returned and the output
</span></span></span><span class="line"><span class="cl"><span class="cm">** variables (*pnData) and (*ppData) are set to 0. Otherwise, SQLITE_OK
</span></span></span><span class="line"><span class="cl"><span class="cm">** is returned and the output variables are set to the size of and a
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer to the output buffer, respectively. In this case it is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** responsibility of the caller to eventually free the buffer using a
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to sqlite3_free().
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changegroup_output</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changegroup</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnData</span><span class="p">,</span> <span class="cm">/* OUT: Size of output buffer in bytes */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">**</span><span class="n">ppData</span> <span class="cm">/* OUT: Pointer to output buffer */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Delete A Changegroup Object
</span></span></span><span class="line"><span class="cl"><span class="cm">** DESTRUCTOR: sqlite3_changegroup
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3changegroup_delete</span><span class="p">(</span><span class="n">sqlite3_changegroup</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Apply A Changeset To A Database
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Apply a changeset or patchset to a database. These functions attempt to
</span></span></span><span class="line"><span class="cl"><span class="cm">** update the &#34;main&#34; database attached to handle db with the changes found in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the changeset passed via the second and third arguments.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The fourth argument (xFilter) passed to these functions is the &#34;filter
</span></span></span><span class="line"><span class="cl"><span class="cm">** callback&#34;. If it is not NULL, then for each table affected by at least one
</span></span></span><span class="line"><span class="cl"><span class="cm">** change in the changeset, the filter callback is invoked with
</span></span></span><span class="line"><span class="cl"><span class="cm">** the table name as the second argument, and a copy of the context pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed as the sixth argument as the first. If the &#34;filter callback&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns zero, then no attempt is made to apply any changes to the table.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Otherwise, if the return value is non-zero or the xFilter argument to
</span></span></span><span class="line"><span class="cl"><span class="cm">** is NULL, all changes related to the table are attempted.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For each table that is not excluded by the filter callback, this function
</span></span></span><span class="line"><span class="cl"><span class="cm">** tests that the target database contains a compatible table. A table is
</span></span></span><span class="line"><span class="cl"><span class="cm">** considered compatible if all of the following are true:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The table has the same name as the name recorded in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The table has at least as many columns as recorded in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The table has primary key columns in the same position as
</span></span></span><span class="line"><span class="cl"><span class="cm">** recorded in the changeset.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If there is no compatible table, it is not an error, but none of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes associated with the table are applied. A warning message is issued
</span></span></span><span class="line"><span class="cl"><span class="cm">** via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most
</span></span></span><span class="line"><span class="cl"><span class="cm">** one such warning is issued for each table in the changeset.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For each change for which there is a compatible table, an attempt is made
</span></span></span><span class="line"><span class="cl"><span class="cm">** to modify the table contents according to the UPDATE, INSERT or DELETE
</span></span></span><span class="line"><span class="cl"><span class="cm">** change. If a change cannot be applied cleanly, the conflict handler
</span></span></span><span class="line"><span class="cl"><span class="cm">** function passed as the fifth argument to sqlite3changeset_apply() may be
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked. A description of exactly when the conflict handler is invoked for
</span></span></span><span class="line"><span class="cl"><span class="cm">** each type of change is below.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Unlike the xFilter argument, xConflict may not be passed NULL. The results
</span></span></span><span class="line"><span class="cl"><span class="cm">** of passing anything other than a valid function pointer as the xConflict
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Each time the conflict handler function is invoked, it must return one
</span></span></span><span class="line"><span class="cl"><span class="cm">** of [SQLITE_CHANGESET_OMIT], [SQLITE_CHANGESET_ABORT] or
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CHANGESET_REPLACE]. SQLITE_CHANGESET_REPLACE may only be returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** if the second argument passed to the conflict handler is either
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns an illegal value, any changes already made are rolled back and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different
</span></span></span><span class="line"><span class="cl"><span class="cm">** actions are taken by sqlite3changeset_apply() depending on the value
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned by each invocation of the conflict-handler function. Refer to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the documentation for the three
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CHANGESET_OMIT|available return values] for details.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;DELETE Changes&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** For each DELETE change, the function checks if the target database
</span></span></span><span class="line"><span class="cl"><span class="cm">** contains a row with the same primary key value (or values) as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** original row values stored in the changeset. If it does, and the values
</span></span></span><span class="line"><span class="cl"><span class="cm">** stored in all non-primary key columns also match the values stored in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the changeset the row is deleted from the target database.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a row with matching primary key values is found, but one or more of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the non-primary key fields contains a value different from the original
</span></span></span><span class="line"><span class="cl"><span class="cm">** row value stored in the changeset, the conflict-handler function is
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked with [SQLITE_CHANGESET_DATA] as the second argument. If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database table has more columns than are recorded in the changeset,
</span></span></span><span class="line"><span class="cl"><span class="cm">** only the values of those non-primary key fields are compared against
</span></span></span><span class="line"><span class="cl"><span class="cm">** the current database contents - any trailing database table columns
</span></span></span><span class="line"><span class="cl"><span class="cm">** are ignored.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If no row with matching primary key values is found in the database,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed as the second argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the DELETE operation is attempted, but SQLite returns SQLITE_CONSTRAINT
</span></span></span><span class="line"><span class="cl"><span class="cm">** (which can only happen if a foreign key constraint is violated), the
</span></span></span><span class="line"><span class="cl"><span class="cm">** conflict-handler function is invoked with [SQLITE_CHANGESET_CONSTRAINT]
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed as the second argument. This includes the case where the DELETE
</span></span></span><span class="line"><span class="cl"><span class="cm">** operation is attempted because an earlier call to the conflict handler
</span></span></span><span class="line"><span class="cl"><span class="cm">** function returned [SQLITE_CHANGESET_REPLACE].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;INSERT Changes&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** For each INSERT change, an attempt is made to insert the new row into
</span></span></span><span class="line"><span class="cl"><span class="cm">** the database. If the changeset row contains fewer fields than the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database table, the trailing fields are populated with their default
</span></span></span><span class="line"><span class="cl"><span class="cm">** values.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the attempt to insert the row fails because the database already
</span></span></span><span class="line"><span class="cl"><span class="cm">** contains a row with the same primary key values, the conflict handler
</span></span></span><span class="line"><span class="cl"><span class="cm">** function is invoked with the second argument set to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CHANGESET_CONFLICT].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the attempt to insert the row fails because of some other constraint
</span></span></span><span class="line"><span class="cl"><span class="cm">** violation (e.g. NOT NULL or UNIQUE), the conflict handler function is
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked with the second argument set to [SQLITE_CHANGESET_CONSTRAINT].
</span></span></span><span class="line"><span class="cl"><span class="cm">** This includes the case where the INSERT operation is re-attempted because
</span></span></span><span class="line"><span class="cl"><span class="cm">** an earlier call to the conflict handler function returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CHANGESET_REPLACE].
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;UPDATE Changes&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** For each UPDATE change, the function checks if the target database
</span></span></span><span class="line"><span class="cl"><span class="cm">** contains a row with the same primary key value (or values) as the
</span></span></span><span class="line"><span class="cl"><span class="cm">** original row values stored in the changeset. If it does, and the values
</span></span></span><span class="line"><span class="cl"><span class="cm">** stored in all modified non-primary key columns also match the values
</span></span></span><span class="line"><span class="cl"><span class="cm">** stored in the changeset the row is updated within the target database.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a row with matching primary key values is found, but one or more of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the modified non-primary key fields contains a value different from an
</span></span></span><span class="line"><span class="cl"><span class="cm">** original row value stored in the changeset, the conflict-handler function
</span></span></span><span class="line"><span class="cl"><span class="cm">** is invoked with [SQLITE_CHANGESET_DATA] as the second argument. Since
</span></span></span><span class="line"><span class="cl"><span class="cm">** UPDATE changes only contain values for non-primary key fields that are
</span></span></span><span class="line"><span class="cl"><span class="cm">** to be modified, only those fields need to match the original values to
</span></span></span><span class="line"><span class="cl"><span class="cm">** avoid the SQLITE_CHANGESET_DATA conflict-handler callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If no row with matching primary key values is found in the database,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed as the second argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the UPDATE operation is attempted, but SQLite returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_CONSTRAINT, the conflict-handler function is invoked with
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CHANGESET_CONSTRAINT] passed as the second argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This includes the case where the UPDATE operation is attempted after
</span></span></span><span class="line"><span class="cl"><span class="cm">** an earlier call to the conflict handler function returned
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CHANGESET_REPLACE].
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is safe to execute SQL statements, including those that write to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** table that the callback related to, from within the xConflict callback.
</span></span></span><span class="line"><span class="cl"><span class="cm">** This can be used to further customize the application&#39;s conflict
</span></span></span><span class="line"><span class="cl"><span class="cm">** resolution strategy.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** All changes made by these functions are enclosed in a savepoint transaction.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If any other error (aside from a constraint failure when attempting to
</span></span></span><span class="line"><span class="cl"><span class="cm">** write to the target database) occurs, then the savepoint transaction is
</span></span></span><span class="line"><span class="cl"><span class="cm">** rolled back, restoring the target database to its original state, and an
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLite error code returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the output parameters (ppRebase) and (pnRebase) are non-NULL and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2()
</span></span></span><span class="line"><span class="cl"><span class="cm">** may set (*ppRebase) to point to a &#34;rebase&#34; that may be used with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase)
</span></span></span><span class="line"><span class="cl"><span class="cm">** is set to the size of the buffer in bytes. It is the responsibility of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** caller to eventually free any such buffer using sqlite3_free(). The buffer
</span></span></span><span class="line"><span class="cl"><span class="cm">** is only allocated and populated if one or more conflicts were encountered
</span></span></span><span class="line"><span class="cl"><span class="cm">** while applying the patchset. See comments surrounding the sqlite3_rebaser
</span></span></span><span class="line"><span class="cl"><span class="cm">** APIs for further details.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The behavior of sqlite3changeset_apply_v2() and its streaming equivalent
</span></span></span><span class="line"><span class="cl"><span class="cm">** may be modified by passing a combination of
</span></span></span><span class="line"><span class="cl"><span class="cm">** [SQLITE_CHANGESETAPPLY_NOSAVEPOINT | supported flags] as the 9th parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that the sqlite3changeset_apply_v2() API is still &lt;b&gt;experimental&lt;/b&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** and therefore subject to change.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_apply</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Apply change to &#34;main&#34; db of this handle */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nChangeset</span><span class="p">,</span> <span class="cm">/* Size of changeset in bytes */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pChangeset</span><span class="p">,</span> <span class="cm">/* Changeset blob */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xFilter</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of sixth arg to _apply() */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zTab</span> <span class="cm">/* Table name */</span>
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xConflict</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of sixth arg to _apply() */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eConflict</span><span class="p">,</span> <span class="cm">/* DATA, MISSING, CONFLICT, CONSTRAINT */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">p</span> <span class="cm">/* Handle describing change and conflict */</span>
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span> <span class="cm">/* First argument passed to xConflict */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_apply_v2</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Apply change to &#34;main&#34; db of this handle */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nChangeset</span><span class="p">,</span> <span class="cm">/* Size of changeset in bytes */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pChangeset</span><span class="p">,</span> <span class="cm">/* Changeset blob */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xFilter</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of sixth arg to _apply() */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zTab</span> <span class="cm">/* Table name */</span>
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xConflict</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of sixth arg to _apply() */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eConflict</span><span class="p">,</span> <span class="cm">/* DATA, MISSING, CONFLICT, CONSTRAINT */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">p</span> <span class="cm">/* Handle describing change and conflict */</span>
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* First argument passed to xConflict */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">**</span><span class="n">ppRebase</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnRebase</span><span class="p">,</span> <span class="cm">/* OUT: Rebase data */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">flags</span> <span class="cm">/* SESSION_CHANGESETAPPLY_* flags */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Flags for sqlite3changeset_apply_v2
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The following flags may passed via the 9th parameter to
</span></span></span><span class="line"><span class="cl"><span class="cm">** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESETAPPLY_NOSAVEPOINT &lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Usually, the sessions module encloses all operations performed by
</span></span></span><span class="line"><span class="cl"><span class="cm">** a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** SAVEPOINT is committed if the changeset or patchset is successfully
</span></span></span><span class="line"><span class="cl"><span class="cm">** applied, or rolled back if an error occurs. Specifying this flag
</span></span></span><span class="line"><span class="cl"><span class="cm">** causes the sessions module to omit this savepoint. In this case, if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** caller has an open transaction or savepoint when apply_v2() is called,
</span></span></span><span class="line"><span class="cl"><span class="cm">** it may revert the partially applied changeset by rolling it back.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESETAPPLY_INVERT &lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Invert the changeset before applying it. This is equivalent to inverting
</span></span></span><span class="line"><span class="cl"><span class="cm">** a changeset using sqlite3changeset_invert() before applying it. It is
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error to specify this flag with a patchset.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESETAPPLY_IGNORENOOP &lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** Do not invoke the conflict handler callback for any changes that
</span></span></span><span class="line"><span class="cl"><span class="cm">** would not actually modify the database even if they were applied.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Specifically, this means that the conflict handler is not invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** for:
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;a delete change if the row being deleted cannot be found,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;an update change if the modified fields are already set to
</span></span></span><span class="line"><span class="cl"><span class="cm">** their new values in the conflicting row, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt;an insert change if all fields of the conflicting row match
</span></span></span><span class="line"><span class="cl"><span class="cm">** the row being inserted.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESETAPPLY_FKNOACTION &lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** If this flag it set, then all foreign key constraints in the target
</span></span></span><span class="line"><span class="cl"><span class="cm">** database behave as if they were declared with &#34;ON UPDATE NO ACTION ON
</span></span></span><span class="line"><span class="cl"><span class="cm">** DELETE NO ACTION&#34;, even if they are actually CASCADE, RESTRICT, SET NULL
</span></span></span><span class="line"><span class="cl"><span class="cm">** or SET DEFAULT.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Constants Passed To The Conflict Handler
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Values that may be passed as the second argument to a conflict-handler.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESET_DATA&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The conflict handler is invoked with CHANGESET_DATA as the second argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** when processing a DELETE or UPDATE change if a row with the required
</span></span></span><span class="line"><span class="cl"><span class="cm">** PRIMARY KEY fields is present in the database, but one or more other
</span></span></span><span class="line"><span class="cl"><span class="cm">** (non primary-key) fields modified by the update do not contain the
</span></span></span><span class="line"><span class="cl"><span class="cm">** expected &#34;before&#34; values.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The conflicting row, in this case, is the database row with the matching
</span></span></span><span class="line"><span class="cl"><span class="cm">** primary key.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESET_NOTFOUND&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** The conflict handler is invoked with CHANGESET_NOTFOUND as the second
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument when processing a DELETE or UPDATE change if a row with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** required PRIMARY KEY fields is not present in the database.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** There is no conflicting row in this case. The results of invoking the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changeset_conflict() API are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESET_CONFLICT&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** CHANGESET_CONFLICT is passed as the second argument to the conflict
</span></span></span><span class="line"><span class="cl"><span class="cm">** handler while processing an INSERT change if the operation would result
</span></span></span><span class="line"><span class="cl"><span class="cm">** in duplicate primary key values.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The conflicting row in this case is the database row with the matching
</span></span></span><span class="line"><span class="cl"><span class="cm">** primary key.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESET_FOREIGN_KEY&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** If foreign key handling is enabled, and applying a changeset leaves the
</span></span></span><span class="line"><span class="cl"><span class="cm">** database in a state containing foreign key violations, the conflict
</span></span></span><span class="line"><span class="cl"><span class="cm">** handler is invoked with CHANGESET_FOREIGN_KEY as the second argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** exactly once before the changeset is committed. If the conflict handler
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns CHANGESET_OMIT, the changes, including those that caused the
</span></span></span><span class="line"><span class="cl"><span class="cm">** foreign key constraint violation, are committed. Or, if it returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** CHANGESET_ABORT, the changeset is rolled back.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** No current or conflicting row information is provided. The only function
</span></span></span><span class="line"><span class="cl"><span class="cm">** it is possible to call on the supplied sqlite3_changeset_iter handle
</span></span></span><span class="line"><span class="cl"><span class="cm">** is sqlite3changeset_fk_conflicts().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESET_CONSTRAINT&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** If any other constraint violation occurs while applying a change (i.e.
</span></span></span><span class="line"><span class="cl"><span class="cm">** a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked with CHANGESET_CONSTRAINT as the second argument.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** There is no conflicting row in this case. The results of invoking the
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changeset_conflict() API are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESET_DATA 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESET_NOTFOUND 2
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESET_CONFLICT 3
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESET_CONSTRAINT 4
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESET_FOREIGN_KEY 5
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Constants Returned By The Conflict Handler
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A conflict handler callback must return one of the following three values.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESET_OMIT&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** If a conflict handler returns this value no special action is taken. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** change that caused the conflict is not applied. The session module
</span></span></span><span class="line"><span class="cl"><span class="cm">** continues to the next change in the changeset.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESET_REPLACE&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** This value may only be returned if the second argument to the conflict
</span></span></span><span class="line"><span class="cl"><span class="cm">** handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this
</span></span></span><span class="line"><span class="cl"><span class="cm">** is not the case, any changes applied so far are rolled back and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** call to sqlite3changeset_apply() returns SQLITE_MISUSE.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict
</span></span></span><span class="line"><span class="cl"><span class="cm">** handler, then the conflicting row is either updated or deleted, depending
</span></span></span><span class="line"><span class="cl"><span class="cm">** on the type of change.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict
</span></span></span><span class="line"><span class="cl"><span class="cm">** handler, then the conflicting row is removed from the database and a
</span></span></span><span class="line"><span class="cl"><span class="cm">** second attempt to apply the change is made. If this second attempt fails,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the original row is restored to the database before continuing.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_CHANGESET_ABORT&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** If this value is returned, any changes applied so far are rolled back
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the call to sqlite3changeset_apply() returns SQLITE_ABORT.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESET_OMIT 0
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESET_REPLACE 1
</span></span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_CHANGESET_ABORT 2
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Rebasing changesets
</span></span></span><span class="line"><span class="cl"><span class="cm">** EXPERIMENTAL
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Suppose there is a site hosting a database in state S0. And that
</span></span></span><span class="line"><span class="cl"><span class="cm">** modifications are made that move that database to state S1 and a
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset recorded (the &#34;local&#34; changeset). Then, a changeset based
</span></span></span><span class="line"><span class="cl"><span class="cm">** on S0 is received from another site (the &#34;remote&#34; changeset) and
</span></span></span><span class="line"><span class="cl"><span class="cm">** applied to the database. The database is then in state
</span></span></span><span class="line"><span class="cl"><span class="cm">** (S1+&#34;remote&#34;), where the exact state depends on any conflict
</span></span></span><span class="line"><span class="cl"><span class="cm">** resolution decisions (OMIT or REPLACE) made while applying &#34;remote&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Rebasing a changeset is to update it to take those conflict
</span></span></span><span class="line"><span class="cl"><span class="cm">** resolution decisions into account, so that the same conflicts
</span></span></span><span class="line"><span class="cl"><span class="cm">** do not have to be resolved elsewhere in the network.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For example, if both the local and remote changesets contain an
</span></span></span><span class="line"><span class="cl"><span class="cm">** INSERT of the same key on &#34;CREATE TABLE t1(a PRIMARY KEY, b)&#34;:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** local: INSERT INTO t1 VALUES(1, &#39;v1&#39;);
</span></span></span><span class="line"><span class="cl"><span class="cm">** remote: INSERT INTO t1 VALUES(1, &#39;v2&#39;);
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** and the conflict resolution is REPLACE, then the INSERT change is
</span></span></span><span class="line"><span class="cl"><span class="cm">** removed from the local changeset (it was overridden). Or, if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** conflict resolution was &#34;OMIT&#34;, then the local changeset is modified
</span></span></span><span class="line"><span class="cl"><span class="cm">** to instead contain:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** UPDATE t1 SET b = &#39;v2&#39; WHERE a=1;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Changes within the local changeset are rebased as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;Local INSERT&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** This may only conflict with a remote INSERT. If the conflict
</span></span></span><span class="line"><span class="cl"><span class="cm">** resolution was OMIT, then add an UPDATE change to the rebased
</span></span></span><span class="line"><span class="cl"><span class="cm">** changeset. Or, if the conflict resolution was REPLACE, add
</span></span></span><span class="line"><span class="cl"><span class="cm">** nothing to the rebased changeset.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;Local DELETE&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** This may conflict with a remote UPDATE or DELETE. In both cases the
</span></span></span><span class="line"><span class="cl"><span class="cm">** only possible resolution is OMIT. If the remote operation was a
</span></span></span><span class="line"><span class="cl"><span class="cm">** DELETE, then add no change to the rebased changeset. If the remote
</span></span></span><span class="line"><span class="cl"><span class="cm">** operation was an UPDATE, then the old.* fields of change are updated
</span></span></span><span class="line"><span class="cl"><span class="cm">** to reflect the new.* values in the UPDATE.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;Local UPDATE&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** This may conflict with a remote UPDATE or DELETE. If it conflicts
</span></span></span><span class="line"><span class="cl"><span class="cm">** with a DELETE, and the conflict resolution was OMIT, then the update
</span></span></span><span class="line"><span class="cl"><span class="cm">** is changed into an INSERT. Any undefined values in the new.* record
</span></span></span><span class="line"><span class="cl"><span class="cm">** from the update change are filled in using the old.* values from
</span></span></span><span class="line"><span class="cl"><span class="cm">** the conflicting DELETE. Or, if the conflict resolution was REPLACE,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the UPDATE change is simply omitted from the rebased changeset.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If conflict is with a remote UPDATE and the resolution is OMIT, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the old.* values are rebased using the new.* values in the remote
</span></span></span><span class="line"><span class="cl"><span class="cm">** change. Or, if the resolution is REPLACE, then the change is copied
</span></span></span><span class="line"><span class="cl"><span class="cm">** into the rebased changeset with updates to columns also updated by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the conflicting remote UPDATE removed. If this means no columns would
</span></span></span><span class="line"><span class="cl"><span class="cm">** be updated, the change is omitted.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** A local change may be rebased against multiple remote changes
</span></span></span><span class="line"><span class="cl"><span class="cm">** simultaneously. If a single key is modified by multiple remote
</span></span></span><span class="line"><span class="cl"><span class="cm">** changesets, they are combined as follows before the local changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">** is rebased:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; If there has been one or more REPLACE resolutions on a
</span></span></span><span class="line"><span class="cl"><span class="cm">** key, it is rebased according to a REPLACE.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; If there have been no REPLACE resolutions on a key, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the local changeset is rebased according to the most recent
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the OMIT resolutions.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Note that conflict resolutions from multiple remote changesets are
</span></span></span><span class="line"><span class="cl"><span class="cm">** combined on a per-field basis, not per-row. This means that in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** case of multiple remote UPDATE operations, some fields of a single
</span></span></span><span class="line"><span class="cl"><span class="cm">** local change may be rebased for REPLACE while others are rebased for
</span></span></span><span class="line"><span class="cl"><span class="cm">** OMIT.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In order to rebase a local changeset, the remote changeset must first
</span></span></span><span class="line"><span class="cl"><span class="cm">** be applied to the local database using sqlite3changeset_apply_v2() and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the buffer of rebase information captured. Then:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; An sqlite3_rebaser object is created by calling
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3rebaser_create().
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The new object is configured with the rebase buffer obtained from
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure().
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the local changeset is to be rebased against multiple remote
</span></span></span><span class="line"><span class="cl"><span class="cm">** changesets, then sqlite3rebaser_configure() should be called
</span></span></span><span class="line"><span class="cl"><span class="cm">** multiple times, in the same order that the multiple
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changeset_apply_v2() calls were made.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; Each local changeset is rebased by calling sqlite3rebaser_rebase().
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; The sqlite3_rebaser object is deleted by calling
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3rebaser_delete().
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">sqlite3_rebaser</span> <span class="n">sqlite3_rebaser</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Create a changeset rebaser object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** EXPERIMENTAL
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Allocate a new changeset rebaser object. If successful, set (*ppNew) to
</span></span></span><span class="line"><span class="cl"><span class="cm">** point to the new object and return SQLITE_OK. Otherwise, if an error
</span></span></span><span class="line"><span class="cl"><span class="cm">** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew)
</span></span></span><span class="line"><span class="cl"><span class="cm">** to NULL.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3rebaser_create</span><span class="p">(</span><span class="n">sqlite3_rebaser</span> <span class="o">**</span><span class="n">ppNew</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Configure a changeset rebaser object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** EXPERIMENTAL
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Configure the changeset rebaser object to rebase changesets according
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the conflict resolutions described by buffer pRebase (size nRebase
</span></span></span><span class="line"><span class="cl"><span class="cm">** bytes), which must have been obtained from a previous call to
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3changeset_apply_v2().
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3rebaser_configure</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_rebaser</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nRebase</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pRebase</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Rebase a changeset
</span></span></span><span class="line"><span class="cl"><span class="cm">** EXPERIMENTAL
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Argument pIn must point to a buffer containing a changeset nIn bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** in size. This function allocates and populates a buffer with a copy
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the changeset rebased according to the configuration of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** rebaser object passed as the first argument. If successful, (*ppOut)
</span></span></span><span class="line"><span class="cl"><span class="cm">** is set to point to the new buffer containing the rebased changeset and
</span></span></span><span class="line"><span class="cl"><span class="cm">** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the
</span></span></span><span class="line"><span class="cl"><span class="cm">** responsibility of the caller to eventually free the new buffer using
</span></span></span><span class="line"><span class="cl"><span class="cm">** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut)
</span></span></span><span class="line"><span class="cl"><span class="cm">** are set to zero and an SQLite error code returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3rebaser_rebase</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_rebaser</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nIn</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="o">*</span><span class="n">pnOut</span><span class="p">,</span> <span class="kt">void</span> <span class="o">**</span><span class="n">ppOut</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Delete a changeset rebaser object.
</span></span></span><span class="line"><span class="cl"><span class="cm">** EXPERIMENTAL
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Delete the changeset rebaser object and all associated resources. There
</span></span></span><span class="line"><span class="cl"><span class="cm">** should be one call to this function for each successful invocation
</span></span></span><span class="line"><span class="cl"><span class="cm">** of sqlite3rebaser_create().
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">void</span> <span class="nf">sqlite3rebaser_delete</span><span class="p">(</span><span class="n">sqlite3_rebaser</span> <span class="o">*</span><span class="n">p</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Streaming Versions of API functions.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The six streaming API xxx_strm() functions serve similar purposes to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** corresponding non-streaming API functions:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;table border=1 style=&#34;margin-left:8ex;margin-right:8ex&#34;&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;th&gt;Streaming function&lt;th&gt;Non-streaming equivalent&lt;/th&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;sqlite3changeset_apply_strm&lt;td&gt;[sqlite3changeset_apply]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;sqlite3changeset_apply_strm_v2&lt;td&gt;[sqlite3changeset_apply_v2]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;sqlite3changeset_concat_strm&lt;td&gt;[sqlite3changeset_concat]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;sqlite3changeset_invert_strm&lt;td&gt;[sqlite3changeset_invert]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;sqlite3changeset_start_strm&lt;td&gt;[sqlite3changeset_start]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;sqlite3session_changeset_strm&lt;td&gt;[sqlite3session_changeset]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;tr&gt;&lt;td&gt;sqlite3session_patchset_strm&lt;td&gt;[sqlite3session_patchset]
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/table&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Non-streaming functions that accept changesets (or patchsets) as input
</span></span></span><span class="line"><span class="cl"><span class="cm">** require that the entire changeset be stored in a single buffer in memory.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Similarly, those that return a changeset or patchset do so by returning
</span></span></span><span class="line"><span class="cl"><span class="cm">** a pointer to a single large buffer allocated using sqlite3_malloc().
</span></span></span><span class="line"><span class="cl"><span class="cm">** Normally this is convenient. However, if an application running in a
</span></span></span><span class="line"><span class="cl"><span class="cm">** low-memory environment is required to handle very large changesets, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** large contiguous memory allocations required can become onerous.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In order to avoid this problem, instead of a single large buffer, input
</span></span></span><span class="line"><span class="cl"><span class="cm">** is passed to a streaming API functions by way of a callback function that
</span></span></span><span class="line"><span class="cl"><span class="cm">** the sessions module invokes to incrementally request input data as it is
</span></span></span><span class="line"><span class="cl"><span class="cm">** required. In all cases, a pair of API function parameters such as
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; int nChangeset,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; void *pChangeset,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Is replaced by:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; int (*xInput)(void *pIn, void *pData, int *pnData),
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; void *pIn,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Each time the xInput callback is invoked by the sessions module, the first
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument passed is a copy of the supplied pIn context pointer. The second
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument, pData, points to a buffer (*pnData) bytes in size. Assuming no
</span></span></span><span class="line"><span class="cl"><span class="cm">** error occurs the xInput method should copy up to (*pnData) bytes of data
</span></span></span><span class="line"><span class="cl"><span class="cm">** into the buffer and set (*pnData) to the actual number of bytes copied
</span></span></span><span class="line"><span class="cl"><span class="cm">** before returning SQLITE_OK. If the input is completely exhausted, (*pnData)
</span></span></span><span class="line"><span class="cl"><span class="cm">** should be set to zero to indicate this. Or, if an error occurs, an SQLite
</span></span></span><span class="line"><span class="cl"><span class="cm">** error code should be returned. In all cases, if an xInput callback returns
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error, all processing is abandoned and the streaming API function
</span></span></span><span class="line"><span class="cl"><span class="cm">** returns a copy of the error code to the caller.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In the case of sqlite3changeset_start_strm(), the xInput callback may be
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked by the sessions module at any point during the lifetime of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** iterator. If such an xInput callback returns an error, the iterator enters
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error state, whereby all subsequent calls to iterator functions
</span></span></span><span class="line"><span class="cl"><span class="cm">** immediately fail with the same error code as returned by xInput.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Similarly, streaming API functions that return changesets (or patchsets)
</span></span></span><span class="line"><span class="cl"><span class="cm">** return them in chunks by way of a callback function instead of via a
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer to a single large buffer. In this case, a pair of parameters such
</span></span></span><span class="line"><span class="cl"><span class="cm">** as:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; int *pnChangeset,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; void **ppChangeset,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Is replaced by:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; int (*xOutput)(void *pOut, const void *pData, int nData),
</span></span></span><span class="line"><span class="cl"><span class="cm">** &amp;nbsp; void *pOut
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/pre&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xOutput callback is invoked zero or more times to return data to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the application. The first parameter passed to each call is a copy of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** pOut pointer supplied by the application. The second parameter, pData,
</span></span></span><span class="line"><span class="cl"><span class="cm">** points to a buffer nData bytes in size containing the chunk of output
</span></span></span><span class="line"><span class="cl"><span class="cm">** data being returned. If the xOutput callback successfully processes the
</span></span></span><span class="line"><span class="cl"><span class="cm">** supplied data, it should return SQLITE_OK to indicate success. Otherwise,
</span></span></span><span class="line"><span class="cl"><span class="cm">** it should return some other SQLite error code. In this case processing
</span></span></span><span class="line"><span class="cl"><span class="cm">** is immediately abandoned and the streaming API function returns a copy
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the xOutput error code to the application.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sessions module never invokes an xOutput callback with the third
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter set to a value less than or equal to zero. Other than this,
</span></span></span><span class="line"><span class="cl"><span class="cm">** no guarantees are made as to the size of the chunks of data returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_apply_strm</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Apply change to &#34;main&#34; db of this handle */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnData</span><span class="p">),</span> <span class="cm">/* Input function */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="cm">/* First arg for xInput */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xFilter</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of sixth arg to _apply() */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zTab</span> <span class="cm">/* Table name */</span>
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xConflict</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of sixth arg to _apply() */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eConflict</span><span class="p">,</span> <span class="cm">/* DATA, MISSING, CONFLICT, CONSTRAINT */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">p</span> <span class="cm">/* Handle describing change and conflict */</span>
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span> <span class="cm">/* First argument passed to xConflict */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_apply_v2_strm</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3</span> <span class="o">*</span><span class="n">db</span><span class="p">,</span> <span class="cm">/* Apply change to &#34;main&#34; db of this handle */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnData</span><span class="p">),</span> <span class="cm">/* Input function */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="cm">/* First arg for xInput */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xFilter</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of sixth arg to _apply() */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zTab</span> <span class="cm">/* Table name */</span>
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="n">xConflict</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of sixth arg to _apply() */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">eConflict</span><span class="p">,</span> <span class="cm">/* DATA, MISSING, CONFLICT, CONSTRAINT */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">*</span><span class="n">p</span> <span class="cm">/* Handle describing change and conflict */</span>
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* First argument passed to xConflict */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">**</span><span class="n">ppRebase</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnRebase</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">flags</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_concat_strm</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInputA</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pInA</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInputB</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pInB</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xOutput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_invert_strm</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xOutput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_start_strm</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">**</span><span class="n">pp</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changeset_start_v2_strm</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_changeset_iter</span> <span class="o">**</span><span class="n">pp</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">flags</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_changeset_strm</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xOutput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_patchset_strm</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_session</span> <span class="o">*</span><span class="n">pSession</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xOutput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changegroup_add_strm</span><span class="p">(</span><span class="n">sqlite3_changegroup</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3changegroup_output_strm</span><span class="p">(</span><span class="n">sqlite3_changegroup</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xOutput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3rebaser_rebase_strm</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_rebaser</span> <span class="o">*</span><span class="n">pRebaser</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pIn</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xOutput</span><span class="p">)(</span><span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pData</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nData</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pOut</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Configure global parameters
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3session_config() interface is used to make global configuration
</span></span></span><span class="line"><span class="cl"><span class="cm">** changes to the sessions module in order to tune it to the specific needs
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the application.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The sqlite3session_config() interface is not threadsafe. If it is invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** while any other thread is inside any other sessions method then the
</span></span></span><span class="line"><span class="cl"><span class="cm">** results are undefined. Furthermore, if it is invoked after any sessions
</span></span></span><span class="line"><span class="cl"><span class="cm">** related objects have been created, the results are also undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument to the sqlite3session_config() function must be one
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the SQLITE_SESSION_CONFIG_XXX constants defined below. The
</span></span></span><span class="line"><span class="cl"><span class="cm">** interpretation of the (void*) value passed as the second parameter and
</span></span></span><span class="line"><span class="cl"><span class="cm">** the effect of calling this function depends on the value of the first
</span></span></span><span class="line"><span class="cl"><span class="cm">** parameter.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;dt&gt;SQLITE_SESSION_CONFIG_STRMSIZE&lt;dd&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** By default, the sessions module streaming interfaces attempt to input
</span></span></span><span class="line"><span class="cl"><span class="cm">** and output data in approximately 1 KiB chunks. This operand may be used
</span></span></span><span class="line"><span class="cl"><span class="cm">** to set and query the value of this configuration setting. The pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed as the second argument must point to a value of type (int).
</span></span></span><span class="line"><span class="cl"><span class="cm">** If this value is greater than 0, it is used as the new streaming data
</span></span></span><span class="line"><span class="cl"><span class="cm">** chunk size for both input and output. Before returning, the (int) value
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointed to by pArg is set to the final value of the streaming interface
</span></span></span><span class="line"><span class="cl"><span class="cm">** chunk size.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/dl&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function returns SQLITE_OK if successful, or an SQLite error code
</span></span></span><span class="line"><span class="cl"><span class="cm">** otherwise.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="n">SQLITE_API</span> <span class="kt">int</span> <span class="nf">sqlite3session_config</span><span class="p">(</span><span class="kt">int</span> <span class="n">op</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pArg</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CAPI3REF: Values for sqlite3session_config().
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define SQLITE_SESSION_CONFIG_STRMSIZE 1
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** Make sure we can call this stuff from C++.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef __cplusplus
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif </span><span class="cm">/* !defined(__SQLITESESSION_H_) &amp;&amp; defined(SQLITE_ENABLE_SESSION) */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/******** End of sqlite3session.h *********/</span>
</span></span><span class="line"><span class="cl"><span class="cm">/******** Begin file fts5.h *********/</span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** 2014 May 31
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The author disclaims copyright to this source code. In place of
</span></span></span><span class="line"><span class="cl"><span class="cm">** a legal notice, here is a blessing:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** May you do good and not evil.
</span></span></span><span class="line"><span class="cl"><span class="cm">** May you find forgiveness for yourself and forgive others.
</span></span></span><span class="line"><span class="cl"><span class="cm">** May you share freely, never taking more than you give.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">******************************************************************************
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Interfaces to extend FTS5. Using the interfaces defined in this file,
</span></span></span><span class="line"><span class="cl"><span class="cm">** FTS5 may be extended with:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** * custom tokenizers, and
</span></span></span><span class="line"><span class="cl"><span class="cm">** * custom auxiliary functions.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cp">#ifndef _FTS5_H
</span></span></span><span class="line"><span class="cl"><span class="cp">#define _FTS5_H
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef __cplusplus
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="k">extern</span> <span class="s">&#34;C&#34;</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*************************************************************************
</span></span></span><span class="line"><span class="cl"><span class="cm">** CUSTOM AUXILIARY FUNCTIONS
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Virtual table implementations may overload SQL functions by implementing
</span></span></span><span class="line"><span class="cl"><span class="cm">** the sqlite3_module.xFindFunction() method.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">Fts5ExtensionApi</span> <span class="n">Fts5ExtensionApi</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">Fts5Context</span> <span class="n">Fts5Context</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">Fts5PhraseIter</span> <span class="n">Fts5PhraseIter</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="nf">void</span> <span class="p">(</span><span class="o">*</span><span class="n">fts5_extension_function</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="n">Fts5ExtensionApi</span> <span class="o">*</span><span class="n">pApi</span><span class="p">,</span> <span class="cm">/* API offered by current FTS version */</span>
</span></span><span class="line"><span class="cl"> <span class="n">Fts5Context</span> <span class="o">*</span><span class="n">pFts</span><span class="p">,</span> <span class="cm">/* First arg to pass to pApi functions */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_context</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Context for returning result/error */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nVal</span><span class="p">,</span> <span class="cm">/* Number of values in apVal[] array */</span>
</span></span><span class="line"><span class="cl"> <span class="n">sqlite3_value</span> <span class="o">**</span><span class="n">apVal</span> <span class="cm">/* Array of trailing arguments */</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">Fts5PhraseIter</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">a</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">b</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** EXTENSION API FUNCTIONS
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xUserData(pFts):
</span></span></span><span class="line"><span class="cl"><span class="cm">** Return a copy of the pUserData pointer passed to the xCreateFunction()
</span></span></span><span class="line"><span class="cl"><span class="cm">** API when the extension function was registered.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xColumnTotalSize(pFts, iCol, pnToken):
</span></span></span><span class="line"><span class="cl"><span class="cm">** If parameter iCol is less than zero, set output variable *pnToken
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the total number of tokens in the FTS5 table. Or, if iCol is
</span></span></span><span class="line"><span class="cl"><span class="cm">** non-negative but less than the number of columns in the table, return
</span></span></span><span class="line"><span class="cl"><span class="cm">** the total number of tokens in column iCol, considering all rows in
</span></span></span><span class="line"><span class="cl"><span class="cm">** the FTS5 table.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If parameter iCol is greater than or equal to the number of columns
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
</span></span></span><span class="line"><span class="cl"><span class="cm">** an OOM condition or IO error), an appropriate SQLite error code is
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xColumnCount(pFts):
</span></span></span><span class="line"><span class="cl"><span class="cm">** Return the number of columns in the table.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xColumnSize(pFts, iCol, pnToken):
</span></span></span><span class="line"><span class="cl"><span class="cm">** If parameter iCol is less than zero, set output variable *pnToken
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the total number of tokens in the current row. Or, if iCol is
</span></span></span><span class="line"><span class="cl"><span class="cm">** non-negative but less than the number of columns in the table, set
</span></span></span><span class="line"><span class="cl"><span class="cm">** *pnToken to the number of tokens in column iCol of the current row.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If parameter iCol is greater than or equal to the number of columns
</span></span></span><span class="line"><span class="cl"><span class="cm">** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
</span></span></span><span class="line"><span class="cl"><span class="cm">** an OOM condition or IO error), an appropriate SQLite error code is
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function may be quite inefficient if used with an FTS5 table
</span></span></span><span class="line"><span class="cl"><span class="cm">** created with the &#34;columnsize=0&#34; option.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xColumnText:
</span></span></span><span class="line"><span class="cl"><span class="cm">** If parameter iCol is less than zero, or greater than or equal to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** number of columns in the table, SQLITE_RANGE is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Otherwise, this function attempts to retrieve the text of column iCol of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the current document. If successful, (*pz) is set to point to a buffer
</span></span></span><span class="line"><span class="cl"><span class="cm">** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
</span></span></span><span class="line"><span class="cl"><span class="cm">** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
</span></span></span><span class="line"><span class="cl"><span class="cm">** if an error occurs, an SQLite error code is returned and the final values
</span></span></span><span class="line"><span class="cl"><span class="cm">** of (*pz) and (*pn) are undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xPhraseCount:
</span></span></span><span class="line"><span class="cl"><span class="cm">** Returns the number of phrases in the current query expression.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xPhraseSize:
</span></span></span><span class="line"><span class="cl"><span class="cm">** If parameter iCol is less than zero, or greater than or equal to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** number of phrases in the current query, as returned by xPhraseCount,
</span></span></span><span class="line"><span class="cl"><span class="cm">** 0 is returned. Otherwise, this function returns the number of tokens in
</span></span></span><span class="line"><span class="cl"><span class="cm">** phrase iPhrase of the query. Phrases are numbered starting from zero.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xInstCount:
</span></span></span><span class="line"><span class="cl"><span class="cm">** Set *pnInst to the total number of occurrences of all phrases within
</span></span></span><span class="line"><span class="cl"><span class="cm">** the query within the current row. Return SQLITE_OK if successful, or
</span></span></span><span class="line"><span class="cl"><span class="cm">** an error code (i.e. SQLITE_NOMEM) if an error occurs.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This API can be quite slow if used with an FTS5 table created with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;detail=none&#34; or &#34;detail=column&#34; option. If the FTS5 table is created
</span></span></span><span class="line"><span class="cl"><span class="cm">** with either &#34;detail=none&#34; or &#34;detail=column&#34; and &#34;content=&#34; option
</span></span></span><span class="line"><span class="cl"><span class="cm">** (i.e. if it is a contentless table), then this API always returns 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xInst:
</span></span></span><span class="line"><span class="cl"><span class="cm">** Query for the details of phrase match iIdx within the current row.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Phrase matches are numbered starting from zero, so the iIdx argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** should be greater than or equal to zero and smaller than the value
</span></span></span><span class="line"><span class="cl"><span class="cm">** output by xInstCount(). If iIdx is less than zero or greater than
</span></span></span><span class="line"><span class="cl"><span class="cm">** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol
</span></span></span><span class="line"><span class="cl"><span class="cm">** to the column in which it occurs and *piOff the token offset of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** first token of the phrase. SQLITE_OK is returned if successful, or an
</span></span></span><span class="line"><span class="cl"><span class="cm">** error code (i.e. SQLITE_NOMEM) if an error occurs.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This API can be quite slow if used with an FTS5 table created with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;detail=none&#34; or &#34;detail=column&#34; option.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xRowid:
</span></span></span><span class="line"><span class="cl"><span class="cm">** Returns the rowid of the current row.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xTokenize:
</span></span></span><span class="line"><span class="cl"><span class="cm">** Tokenize text using the tokenizer belonging to the FTS5 table.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback):
</span></span></span><span class="line"><span class="cl"><span class="cm">** This API function is used to query the FTS table for phrase iPhrase
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the current query. Specifically, a query equivalent to:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** with $p set to a phrase equivalent to the phrase iPhrase of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** current query is executed. Any column filter that applies to
</span></span></span><span class="line"><span class="cl"><span class="cm">** phrase iPhrase of the current query is included in $p. For each
</span></span></span><span class="line"><span class="cl"><span class="cm">** row visited, the callback function passed as the fourth argument
</span></span></span><span class="line"><span class="cl"><span class="cm">** is invoked. The context and API objects passed to the callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** function may be used to access the properties of each matched row.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Invoking Api.xUserData() returns a copy of the pointer passed as
</span></span></span><span class="line"><span class="cl"><span class="cm">** the third argument to pUserData.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If parameter iPhrase is less than zero, or greater than or equal to
</span></span></span><span class="line"><span class="cl"><span class="cm">** the number of phrases in the query, as returned by xPhraseCount(),
</span></span></span><span class="line"><span class="cl"><span class="cm">** this function returns SQLITE_RANGE.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the callback function returns any value other than SQLITE_OK, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** query is abandoned and the xQueryPhrase function returns immediately.
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Otherwise, the error code is propagated upwards.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the query runs to completion without incident, SQLITE_OK is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Or, if some error occurs before the query completes or is aborted by
</span></span></span><span class="line"><span class="cl"><span class="cm">** the callback, an SQLite error code is returned.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xSetAuxdata(pFts5, pAux, xDelete)
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Save the pointer passed as the second argument as the extension function&#39;s
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;auxiliary data&#34;. The pointer may then be retrieved by the current or any
</span></span></span><span class="line"><span class="cl"><span class="cm">** future invocation of the same fts5 extension function made as part of
</span></span></span><span class="line"><span class="cl"><span class="cm">** the same MATCH query using the xGetAuxdata() API.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Each extension function is allocated a single auxiliary data slot for
</span></span></span><span class="line"><span class="cl"><span class="cm">** each FTS query (MATCH expression). If the extension function is invoked
</span></span></span><span class="line"><span class="cl"><span class="cm">** more than once for a single FTS query, then all invocations share a
</span></span></span><span class="line"><span class="cl"><span class="cm">** single auxiliary data context.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If there is already an auxiliary data pointer when this function is
</span></span></span><span class="line"><span class="cl"><span class="cm">** invoked, then it is replaced by the new pointer. If an xDelete callback
</span></span></span><span class="line"><span class="cl"><span class="cm">** was specified along with the original pointer, it is invoked at this
</span></span></span><span class="line"><span class="cl"><span class="cm">** point.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The xDelete callback, if one is specified, is also invoked on the
</span></span></span><span class="line"><span class="cl"><span class="cm">** auxiliary data pointer after the FTS5 query has finished.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If an error (e.g. an OOM condition) occurs within this function,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the auxiliary data is set to NULL and an error code returned. If the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xDelete parameter was not NULL, it is invoked on the auxiliary data
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer before returning.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xGetAuxdata(pFts5, bClear)
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Returns the current auxiliary data pointer for the fts5 extension
</span></span></span><span class="line"><span class="cl"><span class="cm">** function. See the xSetAuxdata() method for details.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If the bClear argument is non-zero, then the auxiliary data is cleared
</span></span></span><span class="line"><span class="cl"><span class="cm">** (set to NULL) before this function returns. In this case the xDelete,
</span></span></span><span class="line"><span class="cl"><span class="cm">** if any, is not invoked.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xRowCount(pFts5, pnRow)
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is used to retrieve the total number of rows in the table.
</span></span></span><span class="line"><span class="cl"><span class="cm">** In other words, the same value that would be returned by:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SELECT count(*) FROM ftstable;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xPhraseFirst()
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is used, along with type Fts5PhraseIter and the xPhraseNext
</span></span></span><span class="line"><span class="cl"><span class="cm">** method, to iterate through all instances of a single query phrase within
</span></span></span><span class="line"><span class="cl"><span class="cm">** the current row. This is the same information as is accessible via the
</span></span></span><span class="line"><span class="cl"><span class="cm">** xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient
</span></span></span><span class="line"><span class="cl"><span class="cm">** to use, this API may be faster under some circumstances. To iterate
</span></span></span><span class="line"><span class="cl"><span class="cm">** through instances of phrase iPhrase, use the following code:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Fts5PhraseIter iter;
</span></span></span><span class="line"><span class="cl"><span class="cm">** int iCol, iOff;
</span></span></span><span class="line"><span class="cl"><span class="cm">** for(pApi-&gt;xPhraseFirst(pFts, iPhrase, &amp;iter, &amp;iCol, &amp;iOff);
</span></span></span><span class="line"><span class="cl"><span class="cm">** iCol&gt;=0;
</span></span></span><span class="line"><span class="cl"><span class="cm">** pApi-&gt;xPhraseNext(pFts, &amp;iter, &amp;iCol, &amp;iOff)
</span></span></span><span class="line"><span class="cl"><span class="cm">** ){
</span></span></span><span class="line"><span class="cl"><span class="cm">** // An instance of phrase iPhrase at offset iOff of column iCol
</span></span></span><span class="line"><span class="cl"><span class="cm">** }
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The Fts5PhraseIter structure is defined above. Applications should not
</span></span></span><span class="line"><span class="cl"><span class="cm">** modify this structure directly - it should only be used as shown above
</span></span></span><span class="line"><span class="cl"><span class="cm">** with the xPhraseFirst() and xPhraseNext() API methods (and by
</span></span></span><span class="line"><span class="cl"><span class="cm">** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This API can be quite slow if used with an FTS5 table created with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;detail=none&#34; or &#34;detail=column&#34; option. If the FTS5 table is created
</span></span></span><span class="line"><span class="cl"><span class="cm">** with either &#34;detail=none&#34; or &#34;detail=column&#34; and &#34;content=&#34; option
</span></span></span><span class="line"><span class="cl"><span class="cm">** (i.e. if it is a contentless table), then this API always iterates
</span></span></span><span class="line"><span class="cl"><span class="cm">** through an empty set (all calls to xPhraseFirst() set iCol to -1).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xPhraseNext()
</span></span></span><span class="line"><span class="cl"><span class="cm">** See xPhraseFirst above.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xPhraseFirstColumn()
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function and xPhraseNextColumn() are similar to the xPhraseFirst()
</span></span></span><span class="line"><span class="cl"><span class="cm">** and xPhraseNext() APIs described above. The difference is that instead
</span></span></span><span class="line"><span class="cl"><span class="cm">** of iterating through all instances of a phrase in the current row, these
</span></span></span><span class="line"><span class="cl"><span class="cm">** APIs are used to iterate through the set of columns in the current row
</span></span></span><span class="line"><span class="cl"><span class="cm">** that contain one or more instances of a specified phrase. For example:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Fts5PhraseIter iter;
</span></span></span><span class="line"><span class="cl"><span class="cm">** int iCol;
</span></span></span><span class="line"><span class="cl"><span class="cm">** for(pApi-&gt;xPhraseFirstColumn(pFts, iPhrase, &amp;iter, &amp;iCol);
</span></span></span><span class="line"><span class="cl"><span class="cm">** iCol&gt;=0;
</span></span></span><span class="line"><span class="cl"><span class="cm">** pApi-&gt;xPhraseNextColumn(pFts, &amp;iter, &amp;iCol)
</span></span></span><span class="line"><span class="cl"><span class="cm">** ){
</span></span></span><span class="line"><span class="cl"><span class="cm">** // Column iCol contains at least one instance of phrase iPhrase
</span></span></span><span class="line"><span class="cl"><span class="cm">** }
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This API can be quite slow if used with an FTS5 table created with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;detail=none&#34; option. If the FTS5 table is created with either
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;detail=none&#34; &#34;content=&#34; option (i.e. if it is a contentless table),
</span></span></span><span class="line"><span class="cl"><span class="cm">** then this API always iterates through an empty set (all calls to
</span></span></span><span class="line"><span class="cl"><span class="cm">** xPhraseFirstColumn() set iCol to -1).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The information accessed using this API and its companion
</span></span></span><span class="line"><span class="cl"><span class="cm">** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext
</span></span></span><span class="line"><span class="cl"><span class="cm">** (or xInst/xInstCount). The chief advantage of this API is that it is
</span></span></span><span class="line"><span class="cl"><span class="cm">** significantly more efficient than those alternatives when used with
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;detail=column&#34; tables.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xPhraseNextColumn()
</span></span></span><span class="line"><span class="cl"><span class="cm">** See xPhraseFirstColumn above.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken)
</span></span></span><span class="line"><span class="cl"><span class="cm">** This is used to access token iToken of phrase iPhrase of the current
</span></span></span><span class="line"><span class="cl"><span class="cm">** query. Before returning, output parameter *ppToken is set to point
</span></span></span><span class="line"><span class="cl"><span class="cm">** to a buffer containing the requested token, and *pnToken to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** size of this buffer in bytes.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If iPhrase or iToken are less than zero, or if iPhrase is greater than
</span></span></span><span class="line"><span class="cl"><span class="cm">** or equal to the number of phrases in the query as reported by
</span></span></span><span class="line"><span class="cl"><span class="cm">** xPhraseCount(), or if iToken is equal to or greater than the number of
</span></span></span><span class="line"><span class="cl"><span class="cm">** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken
</span></span></span><span class="line"><span class="cl"><span class="cm"> are both zeroed.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The output text is not a copy of the query text that specified the
</span></span></span><span class="line"><span class="cl"><span class="cm">** token. It is the output of the tokenizer module. For tokendata=1
</span></span></span><span class="line"><span class="cl"><span class="cm">** tables, this includes any embedded 0x00 and trailing data.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken)
</span></span></span><span class="line"><span class="cl"><span class="cm">** This is used to access token iToken of phrase hit iIdx within the
</span></span></span><span class="line"><span class="cl"><span class="cm">** current row. If iIdx is less than zero or greater than or equal to the
</span></span></span><span class="line"><span class="cl"><span class="cm">** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
</span></span></span><span class="line"><span class="cl"><span class="cm">** output variable (*ppToken) is set to point to a buffer containing the
</span></span></span><span class="line"><span class="cl"><span class="cm">** matching document token, and (*pnToken) to the size of that buffer in
</span></span></span><span class="line"><span class="cl"><span class="cm">** bytes. This API is not available if the specified token matches a
</span></span></span><span class="line"><span class="cl"><span class="cm">** prefix query term. In that case both output variables are always set
</span></span></span><span class="line"><span class="cl"><span class="cm">** to 0.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The output text is not a copy of the document text that was tokenized.
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is the output of the tokenizer module. For tokendata=1 tables, this
</span></span></span><span class="line"><span class="cl"><span class="cm">** includes any embedded 0x00 and trailing data.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This API can be quite slow if used with an FTS5 table created with the
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;detail=none&#34; or &#34;detail=column&#34; option.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">Fts5ExtensionApi</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iVersion</span><span class="p">;</span> <span class="cm">/* Currently always set to 3 */</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xUserData</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xColumnCount</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xRowCount</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="n">sqlite3_int64</span> <span class="o">*</span><span class="n">pnRow</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xColumnTotalSize</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">,</span> <span class="n">sqlite3_int64</span> <span class="o">*</span><span class="n">pnToken</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xTokenize</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">pText</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nText</span><span class="p">,</span> <span class="cm">/* Text to tokenize */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Context passed to xToken() */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xToken</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="p">)</span> <span class="cm">/* Callback */</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xPhraseCount</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xPhraseSize</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iPhrase</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInstCount</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnInst</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInst</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iIdx</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">piPhrase</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">piCol</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">piOff</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nf">sqlite3_int64</span> <span class="p">(</span><span class="o">*</span><span class="n">xRowid</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xColumnText</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">pz</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pn</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xColumnSize</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iCol</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnToken</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xQueryPhrase</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iPhrase</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pUserData</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span><span class="p">(</span><span class="o">*</span><span class="p">)(</span><span class="k">const</span> <span class="n">Fts5ExtensionApi</span><span class="o">*</span><span class="p">,</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span><span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xSetAuxdata</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">pAux</span><span class="p">,</span> <span class="kt">void</span><span class="p">(</span><span class="o">*</span><span class="n">xDelete</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">xGetAuxdata</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">bClear</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xPhraseFirst</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iPhrase</span><span class="p">,</span> <span class="n">Fts5PhraseIter</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xPhraseNext</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="n">Fts5PhraseIter</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">piCol</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">piOff</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xPhraseFirstColumn</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iPhrase</span><span class="p">,</span> <span class="n">Fts5PhraseIter</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xPhraseNextColumn</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="n">Fts5PhraseIter</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">piCol</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="cm">/* Below this point are iVersion&gt;=3 only */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xQueryToken</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iPhrase</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iToken</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">ppToken</span><span class="p">,</span> <span class="kt">int</span> <span class="o">*</span><span class="n">pnToken</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xInstToken</span><span class="p">)(</span><span class="n">Fts5Context</span><span class="o">*</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iIdx</span><span class="p">,</span> <span class="kt">int</span> <span class="n">iToken</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">**</span><span class="p">,</span> <span class="kt">int</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** CUSTOM AUXILIARY FUNCTIONS
</span></span></span><span class="line"><span class="cl"><span class="cm">*************************************************************************/</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*************************************************************************
</span></span></span><span class="line"><span class="cl"><span class="cm">** CUSTOM TOKENIZERS
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Applications may also register custom tokenizer types. A tokenizer
</span></span></span><span class="line"><span class="cl"><span class="cm">** is registered by providing fts5 with a populated instance of the
</span></span></span><span class="line"><span class="cl"><span class="cm">** following structure. All structure methods must be defined, setting
</span></span></span><span class="line"><span class="cl"><span class="cm">** any member of the fts5_tokenizer struct to NULL leads to undefined
</span></span></span><span class="line"><span class="cl"><span class="cm">** behaviour. The structure methods are expected to function as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xCreate:
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is used to allocate and initialize a tokenizer instance.
</span></span></span><span class="line"><span class="cl"><span class="cm">** A tokenizer instance is required to actually tokenize text.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The first argument passed to this function is a copy of the (void*)
</span></span></span><span class="line"><span class="cl"><span class="cm">** pointer provided by the application when the fts5_tokenizer object
</span></span></span><span class="line"><span class="cl"><span class="cm">** was registered with FTS5 (the third argument to xCreateTokenizer()).
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second and third arguments are an array of nul-terminated strings
</span></span></span><span class="line"><span class="cl"><span class="cm">** containing the tokenizer arguments, if any, specified following the
</span></span></span><span class="line"><span class="cl"><span class="cm">** tokenizer name as part of the CREATE VIRTUAL TABLE statement used
</span></span></span><span class="line"><span class="cl"><span class="cm">** to create the FTS5 table.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The final argument is an output variable. If successful, (*ppOut)
</span></span></span><span class="line"><span class="cl"><span class="cm">** should be set to point to the new tokenizer handle and SQLITE_OK
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned. If an error occurs, some value other than SQLITE_OK should
</span></span></span><span class="line"><span class="cl"><span class="cm">** be returned. In this case, fts5 assumes that the final value of *ppOut
</span></span></span><span class="line"><span class="cl"><span class="cm">** is undefined.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xDelete:
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is invoked to delete a tokenizer handle previously
</span></span></span><span class="line"><span class="cl"><span class="cm">** allocated using xCreate(). Fts5 guarantees that this function will
</span></span></span><span class="line"><span class="cl"><span class="cm">** be invoked exactly once for each successful call to xCreate().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** xTokenize:
</span></span></span><span class="line"><span class="cl"><span class="cm">** This function is expected to tokenize the nText byte string indicated
</span></span></span><span class="line"><span class="cl"><span class="cm">** by argument pText. pText may or may not be nul-terminated. The first
</span></span></span><span class="line"><span class="cl"><span class="cm">** argument passed to this function is a pointer to an Fts5Tokenizer object
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned by an earlier call to xCreate().
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second argument indicates the reason that FTS5 is requesting
</span></span></span><span class="line"><span class="cl"><span class="cm">** tokenization of the supplied text. This is always one of the following
</span></span></span><span class="line"><span class="cl"><span class="cm">** four values:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ul&gt;&lt;li&gt; &lt;b&gt;FTS5_TOKENIZE_DOCUMENT&lt;/b&gt; - A document is being inserted into
</span></span></span><span class="line"><span class="cl"><span class="cm">** or removed from the FTS table. The tokenizer is being invoked to
</span></span></span><span class="line"><span class="cl"><span class="cm">** determine the set of tokens to add to (or delete from) the
</span></span></span><span class="line"><span class="cl"><span class="cm">** FTS index.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; &lt;b&gt;FTS5_TOKENIZE_QUERY&lt;/b&gt; - A MATCH query is being executed
</span></span></span><span class="line"><span class="cl"><span class="cm">** against the FTS index. The tokenizer is being called to tokenize
</span></span></span><span class="line"><span class="cl"><span class="cm">** a bareword or quoted string specified as part of the query.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; &lt;b&gt;(FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX)&lt;/b&gt; - Same as
</span></span></span><span class="line"><span class="cl"><span class="cm">** FTS5_TOKENIZE_QUERY, except that the bareword or quoted string is
</span></span></span><span class="line"><span class="cl"><span class="cm">** followed by a &#34;*&#34; character, indicating that the last token
</span></span></span><span class="line"><span class="cl"><span class="cm">** returned by the tokenizer will be treated as a token prefix.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; &lt;b&gt;FTS5_TOKENIZE_AUX&lt;/b&gt; - The tokenizer is being invoked to
</span></span></span><span class="line"><span class="cl"><span class="cm">** satisfy an fts5_api.xTokenize() request made by an auxiliary
</span></span></span><span class="line"><span class="cl"><span class="cm">** function. Or an fts5_api.xColumnSize() request made by the same
</span></span></span><span class="line"><span class="cl"><span class="cm">** on a columnsize=0 database.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ul&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For each token in the input string, the supplied callback xToken() must
</span></span></span><span class="line"><span class="cl"><span class="cm">** be invoked. The first argument to it should be a copy of the pointer
</span></span></span><span class="line"><span class="cl"><span class="cm">** passed as the second argument to xTokenize(). The third and fourth
</span></span></span><span class="line"><span class="cl"><span class="cm">** arguments are a pointer to a buffer containing the token text, and the
</span></span></span><span class="line"><span class="cl"><span class="cm">** size of the token in bytes. The 4th and 5th arguments are the byte offsets
</span></span></span><span class="line"><span class="cl"><span class="cm">** of the first byte of and first byte immediately following the text from
</span></span></span><span class="line"><span class="cl"><span class="cm">** which the token is derived within the input.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** The second argument passed to the xToken() callback (&#34;tflags&#34;) should
</span></span></span><span class="line"><span class="cl"><span class="cm">** normally be set to 0. The exception is if the tokenizer supports
</span></span></span><span class="line"><span class="cl"><span class="cm">** synonyms. In this case see the discussion below for details.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** FTS5 assumes the xToken() callback is invoked for each token in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** order that they occur within the input text.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** If an xToken() callback returns any value other than SQLITE_OK, then
</span></span></span><span class="line"><span class="cl"><span class="cm">** the tokenization should be abandoned and the xTokenize() method should
</span></span></span><span class="line"><span class="cl"><span class="cm">** immediately return a copy of the xToken() return value. Or, if the
</span></span></span><span class="line"><span class="cl"><span class="cm">** input buffer is exhausted, xTokenize() should return SQLITE_OK. Finally,
</span></span></span><span class="line"><span class="cl"><span class="cm">** if an error occurs with the xTokenize() implementation itself, it
</span></span></span><span class="line"><span class="cl"><span class="cm">** may abandon the tokenization and return any error code other than
</span></span></span><span class="line"><span class="cl"><span class="cm">** SQLITE_OK or SQLITE_DONE.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** SYNONYM SUPPORT
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Custom tokenizers may also support synonyms. Consider a case in which a
</span></span></span><span class="line"><span class="cl"><span class="cm">** user wishes to query for a phrase such as &#34;first place&#34;. Using the
</span></span></span><span class="line"><span class="cl"><span class="cm">** built-in tokenizers, the FTS5 query &#39;first + place&#39; will match instances
</span></span></span><span class="line"><span class="cl"><span class="cm">** of &#34;first place&#34; within the document set, but not alternative forms
</span></span></span><span class="line"><span class="cl"><span class="cm">** such as &#34;1st place&#34;. In some applications, it would be better to match
</span></span></span><span class="line"><span class="cl"><span class="cm">** all instances of &#34;first place&#34; or &#34;1st place&#34; regardless of which form
</span></span></span><span class="line"><span class="cl"><span class="cm">** the user specified in the MATCH query text.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** There are several ways to approach this in FTS5:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;ol&gt;&lt;li&gt; By mapping all synonyms to a single token. In this case, using
</span></span></span><span class="line"><span class="cl"><span class="cm">** the above example, this means that the tokenizer returns the
</span></span></span><span class="line"><span class="cl"><span class="cm">** same token for inputs &#34;first&#34; and &#34;1st&#34;. Say that token is in
</span></span></span><span class="line"><span class="cl"><span class="cm">** fact &#34;first&#34;, so that when the user inserts the document &#34;I won
</span></span></span><span class="line"><span class="cl"><span class="cm">** 1st place&#34; entries are added to the index for tokens &#34;i&#34;, &#34;won&#34;,
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;first&#34; and &#34;place&#34;. If the user then queries for &#39;1st + place&#39;,
</span></span></span><span class="line"><span class="cl"><span class="cm">** the tokenizer substitutes &#34;first&#34; for &#34;1st&#34; and the query works
</span></span></span><span class="line"><span class="cl"><span class="cm">** as expected.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; By querying the index for all synonyms of each query term
</span></span></span><span class="line"><span class="cl"><span class="cm">** separately. In this case, when tokenizing query text, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** tokenizer may provide multiple synonyms for a single term
</span></span></span><span class="line"><span class="cl"><span class="cm">** within the document. FTS5 then queries the index for each
</span></span></span><span class="line"><span class="cl"><span class="cm">** synonym individually. For example, faced with the query:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;codeblock&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ... MATCH &#39;first place&#39;&lt;/codeblock&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** the tokenizer offers both &#34;1st&#34; and &#34;first&#34; as synonyms for the
</span></span></span><span class="line"><span class="cl"><span class="cm">** first token in the MATCH query and FTS5 effectively runs a query
</span></span></span><span class="line"><span class="cl"><span class="cm">** similar to:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;codeblock&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ... MATCH &#39;(first OR 1st) place&#39;&lt;/codeblock&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** except that, for the purposes of auxiliary functions, the query
</span></span></span><span class="line"><span class="cl"><span class="cm">** still appears to contain just two phrases - &#34;(first OR 1st)&#34;
</span></span></span><span class="line"><span class="cl"><span class="cm">** being treated as a single phrase.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;li&gt; By adding multiple synonyms for a single term to the FTS index.
</span></span></span><span class="line"><span class="cl"><span class="cm">** Using this method, when tokenizing document text, the tokenizer
</span></span></span><span class="line"><span class="cl"><span class="cm">** provides multiple synonyms for each token. So that when a
</span></span></span><span class="line"><span class="cl"><span class="cm">** document such as &#34;I won first place&#34; is tokenized, entries are
</span></span></span><span class="line"><span class="cl"><span class="cm">** added to the FTS index for &#34;i&#34;, &#34;won&#34;, &#34;first&#34;, &#34;1st&#34; and
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#34;place&#34;.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** This way, even if the tokenizer does not provide synonyms
</span></span></span><span class="line"><span class="cl"><span class="cm">** when tokenizing query text (it should not - to do so would be
</span></span></span><span class="line"><span class="cl"><span class="cm">** inefficient), it doesn&#39;t matter if the user queries for
</span></span></span><span class="line"><span class="cl"><span class="cm">** &#39;first + place&#39; or &#39;1st + place&#39;, as there are entries in the
</span></span></span><span class="line"><span class="cl"><span class="cm">** FTS index corresponding to both forms of the first token.
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;/ol&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Whether it is parsing document or query text, any call to xToken that
</span></span></span><span class="line"><span class="cl"><span class="cm">** specifies a &lt;i&gt;tflags&lt;/i&gt; argument with the FTS5_TOKEN_COLOCATED bit
</span></span></span><span class="line"><span class="cl"><span class="cm">** is considered to supply a synonym for the previous token. For example,
</span></span></span><span class="line"><span class="cl"><span class="cm">** when parsing the document &#34;I won first place&#34;, a tokenizer that supports
</span></span></span><span class="line"><span class="cl"><span class="cm">** synonyms would call xToken() 5 times, as follows:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;codeblock&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** xToken(pCtx, 0, &#34;i&#34;, 1, 0, 1);
</span></span></span><span class="line"><span class="cl"><span class="cm">** xToken(pCtx, 0, &#34;won&#34;, 3, 2, 5);
</span></span></span><span class="line"><span class="cl"><span class="cm">** xToken(pCtx, 0, &#34;first&#34;, 5, 6, 11);
</span></span></span><span class="line"><span class="cl"><span class="cm">** xToken(pCtx, FTS5_TOKEN_COLOCATED, &#34;1st&#34;, 3, 6, 11);
</span></span></span><span class="line"><span class="cl"><span class="cm">** xToken(pCtx, 0, &#34;place&#34;, 5, 12, 17);
</span></span></span><span class="line"><span class="cl"><span class="cm">**&lt;/codeblock&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time
</span></span></span><span class="line"><span class="cl"><span class="cm">** xToken() is called. Multiple synonyms may be specified for a single token
</span></span></span><span class="line"><span class="cl"><span class="cm">** by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence.
</span></span></span><span class="line"><span class="cl"><span class="cm">** There is no limit to the number of synonyms that may be provided for a
</span></span></span><span class="line"><span class="cl"><span class="cm">** single token.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** In many cases, method (1) above is the best approach. It does not add
</span></span></span><span class="line"><span class="cl"><span class="cm">** extra data to the FTS index or require FTS5 to query for multiple terms,
</span></span></span><span class="line"><span class="cl"><span class="cm">** so it is efficient in terms of disk space and query speed. However, it
</span></span></span><span class="line"><span class="cl"><span class="cm">** does not support prefix queries very well. If, as suggested above, the
</span></span></span><span class="line"><span class="cl"><span class="cm">** token &#34;first&#34; is substituted for &#34;1st&#34; by the tokenizer, then the query:
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** &lt;codeblock&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">** ... MATCH &#39;1s*&#39;&lt;/codeblock&gt;
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** will not match documents that contain the token &#34;1st&#34; (as the tokenizer
</span></span></span><span class="line"><span class="cl"><span class="cm">** will probably not map &#34;1s&#34; to any prefix of &#34;first&#34;).
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** For full prefix support, method (3) may be preferred. In this case,
</span></span></span><span class="line"><span class="cl"><span class="cm">** because the index contains entries for both &#34;first&#34; and &#34;1st&#34;, prefix
</span></span></span><span class="line"><span class="cl"><span class="cm">** queries such as &#39;fi*&#39; or &#39;1s*&#39; will match correctly. However, because
</span></span></span><span class="line"><span class="cl"><span class="cm">** extra entries are added to the FTS index, this method uses more space
</span></span></span><span class="line"><span class="cl"><span class="cm">** within the database.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** Method (2) offers a midpoint between (1) and (3). Using this method,
</span></span></span><span class="line"><span class="cl"><span class="cm">** a query such as &#39;1s*&#39; will match documents that contain the literal
</span></span></span><span class="line"><span class="cl"><span class="cm">** token &#34;1st&#34;, but not &#34;first&#34; (assuming the tokenizer is not able to
</span></span></span><span class="line"><span class="cl"><span class="cm">** provide synonyms for prefixes). However, a non-prefix query like &#39;1st&#39;
</span></span></span><span class="line"><span class="cl"><span class="cm">** will match against &#34;1st&#34; and &#34;first&#34;. This method does not require
</span></span></span><span class="line"><span class="cl"><span class="cm">** extra disk space, as no extra entries are added to the FTS index.
</span></span></span><span class="line"><span class="cl"><span class="cm">** On the other hand, it may require more CPU cycles to run MATCH queries,
</span></span></span><span class="line"><span class="cl"><span class="cm">** as separate queries of the FTS index are required for each synonym.
</span></span></span><span class="line"><span class="cl"><span class="cm">**
</span></span></span><span class="line"><span class="cl"><span class="cm">** When using methods (2) or (3), it is important that the tokenizer only
</span></span></span><span class="line"><span class="cl"><span class="cm">** provide synonyms when tokenizing document text (method (3)) or query
</span></span></span><span class="line"><span class="cl"><span class="cm">** text (method (2)), not both. Doing so will not cause any errors, but is
</span></span></span><span class="line"><span class="cl"><span class="cm">** inefficient.
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">Fts5Tokenizer</span> <span class="n">Fts5Tokenizer</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">fts5_tokenizer</span> <span class="n">fts5_tokenizer</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">fts5_tokenizer</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xCreate</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">azArg</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nArg</span><span class="p">,</span> <span class="n">Fts5Tokenizer</span> <span class="o">**</span><span class="n">ppOut</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xDelete</span><span class="p">)(</span><span class="n">Fts5Tokenizer</span><span class="o">*</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xTokenize</span><span class="p">)(</span><span class="n">Fts5Tokenizer</span><span class="o">*</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">flags</span><span class="p">,</span> <span class="cm">/* Mask of FTS5_TOKENIZE_* flags */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">pText</span><span class="p">,</span> <span class="kt">int</span> <span class="n">nText</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xToken</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pCtx</span><span class="p">,</span> <span class="cm">/* Copy of 2nd argument to xTokenize() */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">tflags</span><span class="p">,</span> <span class="cm">/* Mask of FTS5_TOKEN_* flags */</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">pToken</span><span class="p">,</span> <span class="cm">/* Pointer to buffer containing token */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">nToken</span><span class="p">,</span> <span class="cm">/* Size of token in bytes */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iStart</span><span class="p">,</span> <span class="cm">/* Byte offset of token within input text */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iEnd</span> <span class="cm">/* Byte offset of end of token within input text */</span>
</span></span><span class="line"><span class="cl"> <span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/* Flags that may be passed as the third argument to xTokenize() */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define FTS5_TOKENIZE_QUERY 0x0001
</span></span></span><span class="line"><span class="cl"><span class="cp">#define FTS5_TOKENIZE_PREFIX 0x0002
</span></span></span><span class="line"><span class="cl"><span class="cp">#define FTS5_TOKENIZE_DOCUMENT 0x0004
</span></span></span><span class="line"><span class="cl"><span class="cp">#define FTS5_TOKENIZE_AUX 0x0008
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/* Flags that may be passed by the tokenizer implementation back to FTS5
</span></span></span><span class="line"><span class="cl"><span class="cm">** as the third argument to the supplied xToken callback. */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#define FTS5_TOKEN_COLOCATED 0x0001 </span><span class="cm">/* Same position as prev. token */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** END OF CUSTOM TOKENIZERS
</span></span></span><span class="line"><span class="cl"><span class="cm">*************************************************************************/</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*************************************************************************
</span></span></span><span class="line"><span class="cl"><span class="cm">** FTS5 EXTENSION REGISTRATION API
</span></span></span><span class="line"><span class="cl"><span class="cm">*/</span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">fts5_api</span> <span class="n">fts5_api</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="n">fts5_api</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="n">iVersion</span><span class="p">;</span> <span class="cm">/* Currently always set to 2 */</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="cm">/* Create a new tokenizer */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xCreateTokenizer</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="n">fts5_api</span> <span class="o">*</span><span class="n">pApi</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pUserData</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">fts5_tokenizer</span> <span class="o">*</span><span class="n">pTokenizer</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xDestroy</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="cm">/* Find an existing tokenizer */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xFindTokenizer</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="n">fts5_api</span> <span class="o">*</span><span class="n">pApi</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">**</span><span class="n">ppUserData</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">fts5_tokenizer</span> <span class="o">*</span><span class="n">pTokenizer</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="cm">/* Create a new auxiliary function */</span>
</span></span><span class="line"><span class="cl"> <span class="kt">int</span> <span class="p">(</span><span class="o">*</span><span class="n">xCreateFunction</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl"> <span class="n">fts5_api</span> <span class="o">*</span><span class="n">pApi</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">zName</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="o">*</span><span class="n">pUserData</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">fts5_extension_function</span> <span class="n">xFunction</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">void</span> <span class="p">(</span><span class="o">*</span><span class="n">xDestroy</span><span class="p">)(</span><span class="kt">void</span><span class="o">*</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">** END OF REGISTRATION API
</span></span></span><span class="line"><span class="cl"><span class="cm">*************************************************************************/</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="cp">#ifdef __cplusplus
</span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="p">}</span> <span class="cm">/* end of the &#39;extern &#34;C&#34;&#39; block */</span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cp">#endif </span><span class="cm">/* _FTS5_H */</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="cm">/******** End of fts5.h *********/</span>
</span></span></code></pre>
</body>
</html>