** that can be useful before or after a period of disconnected operation.
**
** On Win32 systems, the file is named "_fossil" and is located in
** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%.
**
** Available operations are:
**
** cache Mangages the cache used for potentially expensive web
** pages. Any additional arguments are passed on verbatim
** to the cache command.
**
** changes Shows all local checkouts that have uncommitted changes.
** This operation has no additional options.
**
** clean Delete all "extra" files in all local checkouts. Extreme
................................................................................
** unset conjunction with the "max-loadavg" setting which cannot
** otherwise be set globally.
**
** In addition, the following maintenance operations are supported:
**
** add Add all the repositories named to the set of repositories
** tracked by Fossil. Normally Fossil is able to keep up with
** this list by itself, but sometime it can benefit from this
** hint if you rename repositories.
**
** ignore Arguments are repositories that should be ignored by
** subsequent clean, extras, list, pull, push, rebuild, and
** sync operations. The -c|--ckout option causes the listed
** local checkouts to be ignored instead.
**
................................................................................
" ORDER BY 1"
);
}
db_multi_exec("CREATE TEMP TABLE todel(x TEXT)");
db_prepare(&q, "SELECT name, tag FROM repolist ORDER BY 1");
while( db_step(&q)==SQLITE_ROW ){
const char *zFilename = db_column_text(&q, 0);
if( file_access(zFilename, F_OK)
|| !file_is_canonical(zFilename)
|| (useCheckouts && file_isdir(zFilename)!=1)
){
db_multi_exec("INSERT INTO todel VALUES(%Q)", db_column_text(&q, 1));
nToDel++;
continue;

** that can be useful before or after a period of disconnected operation.
**
** On Win32 systems, the file is named "_fossil" and is located in
** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%.
**
** Available operations are:
**
** cache Manages the cache used for potentially expensive web
** pages. Any additional arguments are passed on verbatim
** to the cache command.
**
** changes Shows all local checkouts that have uncommitted changes.
** This operation has no additional options.
**
** clean Delete all "extra" files in all local checkouts. Extreme
................................................................................
** unset conjunction with the "max-loadavg" setting which cannot
** otherwise be set globally.
**
** In addition, the following maintenance operations are supported:
**
** add Add all the repositories named to the set of repositories
** tracked by Fossil. Normally Fossil is able to keep up with
** this list by itself, but sometimes it can benefit from this
** hint if you rename repositories.
**
** ignore Arguments are repositories that should be ignored by
** subsequent clean, extras, list, pull, push, rebuild, and
** sync operations. The -c|--ckout option causes the listed
** local checkouts to be ignored instead.
**
................................................................................
" ORDER BY 1"
);
}
db_multi_exec("CREATE TEMP TABLE todel(x TEXT)");
db_prepare(&q, "SELECT name, tag FROM repolist ORDER BY 1");
while( db_step(&q)==SQLITE_ROW ){
const char *zFilename = db_column_text(&q, 0);
#if !USE_SEE if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;#endif
if( file_access(zFilename, F_OK)
|| !file_is_canonical(zFilename)
|| (useCheckouts && file_isdir(zFilename)!=1)
){
db_multi_exec("INSERT INTO todel VALUES(%Q)", db_column_text(&q, 1));
nToDel++;
continue;

blob_reset(&name);
}
}
}
/*
** COMMAND: extras
** Usage: %fossil extras ?OPTIONS? ?PATH1 ...?
**
** Print a list of all files in the source tree that are not part of
** the current checkout. See also the "clean" command. If paths are
** specified, only files in the given directories will be listed.
**
** Files and subdirectories whose names begin with "." are normally
** ignored but can be included by adding the --dotfiles option.
**
** The GLOBPATTERN is a comma-separated list of GLOB expressions for
** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
** is used if the --ignore option is omitted.
**
** Pathnames are displayed according to the "relative-paths" setting,
** unless overridden by the --abs-paths or --rel-paths options.
**
** Options:
** --abs-paths Display absolute pathnames.
** --case-sensitive <BOOL> override case-sensitive setting
................................................................................
}
blob_reset(&rewrittenPathname);
db_finalize(&q);
}
/*
** COMMAND: clean
** Usage: %fossil clean ?OPTIONS? ?PATH ...?
**
** Delete all "extra" files in the source tree. "Extra" files are
** files that are not officially part of the checkout. This operation
** cannot be undone. If one or more PATH arguments appear, then only
** the files named, or files contained with directories named, will be
** removed.
**
** Prompted are issued to confirm the removal of each file, unless
** the --force flag is used or unless the file matches glob pattern
** specified by the --clean option. No file that matches glob patterns
** specified by --ignore or --keep will ever be deleted. The default
** values for --clean, --ignore, and --keep are determined by the
** (versionable) clean-glob, ignore-glob, and keep-glob settings.
** Files and subdirectories whose names begin with "." are automatically** ignored unless the --dotfiles option is used.
**
** The --verily option ignores the keep-glob and ignore-glob settings
** and turns on --force, --dotfiles, and --emptydirs. Use the --verily
** option when you really want to clean up everything. Extreme care
** should be exercised when using the --verily option.
**
** Options:
** --allckouts Check for empty directories within any checkouts
** that may be nested within the current one. This
** option should be used with great care because the
** empty-dirs setting (and other applicable settings)
** belonging to the other repositories, if any, will
................................................................................
** explicitly exempted via the empty-dirs setting
** or another applicable setting or command line
** argument. Matching files, if any, are removed
** prior to checking for any empty directories;
** therefore, directories that contain only files
** that were removed will be removed as well.
** -f|--force Remove files without prompting.
** -i|--prompt Prompt before removing each file.
** -x|--verily WARNING: Removes everything that is not a managed
** file or the repository itself. This option
** implies the --force, --emptydirs, --dotfiles, and
** --disable-undo options. Furthermore, it completely
** disregards the keep-glob and ignore-glob settings.
** However, it does honor the --ignore and --keep
** options.
................................................................................
g.markPrivate = 1;
}
/*
** Autosync if autosync is enabled and this is not a private check-in.
*/
if( !g.markPrivate ){
if( autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1)) ){
prompt_user("continue in spite of sync failure (y/N)? ", &ans); cReply = blob_str(&ans)[0]; if( cReply!='y' && cReply!='Y' ){ fossil_exit(1);
}
}
}
/* Require confirmation to continue with the check-in if there is
** clock skew
*/
if( g.clockSkewSeen ){
................................................................................
if( dryRunFlag ){
db_end_transaction(1);
exit(1);
}
db_end_transaction(0);
if( !g.markPrivate ){
autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1));
}
if( count_nonbranch_children(vid)>1 ){
fossil_print("**** warning: a fork has occurred *****\n");
}
}

blob_reset(&name);
}
}
}
/*
** COMMAND: extras
**
** Usage: %fossil extras ?OPTIONS? ?PATH1 ...?
**
** Print a list of all files in the source tree that are not part of the
** current checkout. See also the "clean" command. If paths are specified,
** only files in the given directories will be listed.
**
** Files and subdirectories whose names begin with "." are normally
** ignored but can be included by adding the --dotfiles option.
**
** Files whose names match any of the glob patterns in the "ignore-glob"
** setting are ignored. This setting can be overridden by the --ignore
** option, whose CSG argument is a comma-separated list of glob patterns.
**
** Pathnames are displayed according to the "relative-paths" setting,
** unless overridden by the --abs-paths or --rel-paths options.
**
** Options:
** --abs-paths Display absolute pathnames.
** --case-sensitive <BOOL> override case-sensitive setting
................................................................................
}
blob_reset(&rewrittenPathname);
db_finalize(&q);
}
/*
** COMMAND: clean
**
** Usage: %fossil clean ?OPTIONS? ?PATH ...?
**
** Delete all "extra" files in the source tree. "Extra" files are files
** that are not officially part of the checkout. If one or more PATH
** arguments appear, then only the files named, or files contained with
** directories named, will be removed.
**
** If the --prompt option is used, prompts are issued to confirm the
** permanent removal of each file. Otherwise, files are backed up to the** undo buffer prior to removal, and prompts are issued only for files** whose removal cannot be undone due to their large size or due to** --disable-undo being used.** ** The --force option treats all prompts as having been answered yes,** whereas --no-prompt treats them as having been answered no.**
** Files matching any glob pattern specified by the --clean option are** deleted without prompting, and the removal cannot be undone.**
** No file that matches glob patterns specified by --ignore or --keep will
** ever be deleted. Files and subdirectories whose names begin with "."** are automatically ignored unless the --dotfiles option is used.**
** The default values for --clean, --ignore, and --keep are determined by
** the (versionable) clean-glob, ignore-glob, and keep-glob settings.
**
** The --verily option ignores the keep-glob and ignore-glob settings and** turns on --force, --emptydirs, --dotfiles, and --disable-undo. Use the
** --verily option when you really want to clean up everything. Extreme
** care should be exercised when using the --verily option.
**
** Options:
** --allckouts Check for empty directories within any checkouts
** that may be nested within the current one. This
** option should be used with great care because the
** empty-dirs setting (and other applicable settings)
** belonging to the other repositories, if any, will
................................................................................
** explicitly exempted via the empty-dirs setting
** or another applicable setting or command line
** argument. Matching files, if any, are removed
** prior to checking for any empty directories;
** therefore, directories that contain only files
** that were removed will be removed as well.
** -f|--force Remove files without prompting.
** -i|--prompt Prompt before removing each file. This option** implies the --disable-undo option.
** -x|--verily WARNING: Removes everything that is not a managed
** file or the repository itself. This option
** implies the --force, --emptydirs, --dotfiles, and
** --disable-undo options. Furthermore, it completely
** disregards the keep-glob and ignore-glob settings.
** However, it does honor the --ignore and --keep
** options.
................................................................................
g.markPrivate = 1;
}
/*
** Autosync if autosync is enabled and this is not a private check-in.
*/
if( !g.markPrivate ){
if( autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1), 1) ){
fossil_exit(1);
}
}
/* Require confirmation to continue with the check-in if there is
** clock skew
*/
if( g.clockSkewSeen ){
................................................................................
if( dryRunFlag ){
db_end_transaction(1);
exit(1);
}
db_end_transaction(0);
if( !g.markPrivate ){
autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0);
}
if( count_nonbranch_children(vid)>1 ){
fossil_print("**** warning: a fork has occurred *****\n");
}
}

Changes to src/checkout.c.

284
285
286
287
288
289
290
291
292
293
294
295
296
297
298

/*
** COMMAND: close*
**
** Usage: %fossil close ?OPTIONS?
**
** The opposite of "open". Close the current database connection.
** Require a -f or --force flag if there are unsaved changed in the
** current check-out or if there is non-empty stash.
**
** Options:
** --force|-f necessary to close a check out with uncommitted changes
**
** See also: open
*/

|

284
285
286
287
288
289
290
291
292
293
294
295
296
297
298

/*
** COMMAND: close*
**
** Usage: %fossil close ?OPTIONS?
**
** The opposite of "open". Close the current database connection.
** Require a -f or --force flag if there are unsaved changes in the
** current check-out or if there is non-empty stash.
**
** Options:
** --force|-f necessary to close a check out with uncommitted changes
**
** See also: open
*/

fossil_free(z);
}
fossil_free(zLastBr);
db_finalize(&q);
}
/*
** WEBPAGE: leaves
**
** Show leaf check-ins in a timeline. By default only open leaves
** are listed.
**
** A "leaf" is a check-in with no children in the same branch. A
** "closed leaf" is a leaf that has a "closed" tag. An "open leaf"
** is a leaf without a "closed" tag.

|

429
430
431
432
433
434
435
436
437
438
439
440
441
442
443

fossil_free(z);
}
fossil_free(zLastBr);
db_finalize(&q);
}
/*
** WEBPAGE: leaves
**
** Show leaf check-ins in a timeline. By default only open leaves
** are listed.
**
** A "leaf" is a check-in with no children in the same branch. A
** "closed leaf" is a leaf that has a "closed" tag. An "open leaf"
** is a leaf without a "closed" tag.

ManifestFile *pFile; /* Name of a cached file */
Blob content; /* Content of the cached file */
/* Parsed path */
char *az[3]; /* 0=type, 1=id, 2=path */
} fusefs;
/*
** Clear the fusefs.sz[] array.
*/
static void fusefs_clear_path(void){
int i;
for(i=0; i<count(fusefs.az); i++){
fossil_free(fusefs.az[i]);
fusefs.az[i] = 0;
}
................................................................................
#endif /* FOSSIL_HAVE_FUSEFS */
/*
** COMMAND: fusefs
**
** Usage: %fossil fusefs [--debug] DIRECTORY
**
** This command uses the Fuse Filesystem to mount a directory at
** DIRECTORY that contains the content of all check-ins in the
** repository. The names of files are DIRECTORY/checkins/VERSION/PATH
** where DIRECTORY is the root of the mount, VERSION is any valid
** check-in name (examples: "trunk" or "tip" or a tag or any unique
** prefix of a SHA1 hash, etc) and PATH is the pathname of the file
** in the check-in. If DIRECTORY does not exist, then an attempt is
** made to create it.
**
** The DIRECTORY/checkins directory is not searchable so one cannot
** do "ls DIRECTORY/checkins" to get a listing of all possible check-in
** names. There are countless variations on check-in names and it is
** impractical to list them all. But all other directories are searchable
** and so the "ls" command will work everywhere else in the fusefs
** file hierarchy.
**
** The FuseFS typically only works on Linux, and then only on Linux
** systems that have the right kernel drivers and have install the
** appropriate support libraries.
**
** After stopping the "fossil fusefs" command, it might also be necessary
** to run "fusermount -u DIRECTORY" to reset the FuseFS before using it
** again.
*/
void fusefs_cmd(void){

ManifestFile *pFile; /* Name of a cached file */
Blob content; /* Content of the cached file */
/* Parsed path */
char *az[3]; /* 0=type, 1=id, 2=path */
} fusefs;
/*
** Clear the fusefs.az[] array.
*/
static void fusefs_clear_path(void){
int i;
for(i=0; i<count(fusefs.az); i++){
fossil_free(fusefs.az[i]);
fusefs.az[i] = 0;
}
................................................................................
#endif /* FOSSIL_HAVE_FUSEFS */
/*
** COMMAND: fusefs
**
** Usage: %fossil fusefs [--debug] DIRECTORY
**
** This command uses the Fuse Filesystem (FuseFS) to mount a directory
** at DIRECTORY that contains the content of all check-ins in the
** repository. The names of files are DIRECTORY/checkins/VERSION/PATH
** where DIRECTORY is the root of the mount, VERSION is any valid
** check-in name (examples: "trunk" or "tip" or a tag or any unique
** prefix of a SHA1 hash, etc) and PATH is the pathname of the file in
** the check-in. If DIRECTORY does not exist, then an attempt is made
** to create it.
**
** The DIRECTORY/checkins directory is not searchable so one cannot
** do "ls DIRECTORY/checkins" to get a listing of all possible check-in
** names. There are countless variations on check-in names and it is
** impractical to list them all. But all other directories are searchable
** and so the "ls" command will work everywhere else in the fusefs
** file hierarchy.
**
** The FuseFS typically only works on Linux, and then only on Linux
** systems that have the right kernel drivers and have installed the
** appropriate support libraries.
**
** After stopping the "fossil fusefs" command, it might also be necessary
** to run "fusermount -u DIRECTORY" to reset the FuseFS before using it
** again.
*/
void fusefs_cmd(void){

files change, the entire program must be recompiled.
It also happens that those important .h files tend to be the ones that
change most frequently.
This means that the entire program must be recompiled frequently,
leading to a lengthy modify-compile-test cycle and a corresponding
decrease in programmer productivity.
<p><li>
The C programming language requires that declarations depending upon
each other must occur in a particular order.
In a program with complex, interwoven data structures, the correct
declaration order can become very difficult to determine manually,
especially when the declarations involved are spread out over several
files.
</ol>
</p>
<a name="H0004"></a>
<h3>1.2 The Makeheaders Solution</h3>
<p>
The makeheaders program is designed to ameliorate the problems associated
with the traditional C programming model by automatically generating
the interface information in the .h files from
interface information contained in other .h files and
from implementation information in the .c files.
When the makeheaders program is run, it scans the source
files for a project,
then generates a series of new .h files, one for each .c file.
The generated .h files contain exactly those declarations required by the
corresponding .c files, no more and no less.
................................................................................
a problem.
Simply rerun makeheaders to resynchronize everything.
<p><li>
The generated .h file contains the minimal set of declarations needed
by the .c file.
This means that when something changes, a minimal amount of recompilation
is required to produce an updated executable.
Experience has shown that this gives a dramatic improvement
in programmer productivity by facilitating a rapid modify-compile-test
cycle during development.
<p><li>
The makeheaders program automatically sorts declarations into the
correct order, completely eliminating the wearisome and error-prone
task of sorting declarations by hand.
</ol>
................................................................................
but manually entered .h files
that contain structure declarations and so forth will be scanned and
the declarations will be copied into the generated .h files as
appropriate.
But if makeheaders sees that the .h file that it has generated is no
different from the .h file it generated last time, it doesn't update
the file.
This prevents the corresponding .c files from having to
be needlessly recompiled.
</p>
<p>
There are several options to the makeheaders program that can
be used to alter its behavior.
The default behavior is to write a single .h file for each .c file and
................................................................................
In this example, makeheaders will scan the three files named
``alpha.c'',
``beta.c'' and
``gamma.c''
but because of the colon on the end of third filename
it will only generate headers for the first two files.
Unfortunately,
it is not possible to get makeheaders to process any file whose
name contains a colon.
</p>
<p>
In a large project, the length of the command line for makeheaders
can become very long.
If the operating system doesn't support long command lines
................................................................................
Such prototypes are normally omitted.
</p>
<p>
Finally, makeheaders also includes a ``-doc'' option.
This command line option prevents makeheaders from generating any
headers at all.
Instead, makeheaders will write to standard output
information about every definition and declaration that it encounters
in its scan of source files.
The information output includes the type of the definition or
declaration and any comment that preceeds the definition or
declaration.
The output is in a format that can be easily parsed, and is
intended to be read by another program that will generate
................................................................................
<a name="H0007"></a>
<h3>3.1 The Basic Setup</h3>
<p>
The simpliest way to use makeheaders is to put all definitions in
one or more .c files and all structure and type declarations in
separate .h files.
The only restriction is that you should take care to chose basenames
for your .h files that are different from the basenames for you
.c files.
Recall that if your .c file is named (for example) ``alpha.c''
makeheaders will attempt to generate a corresponding header file
named ``alpha.h''.
For that reason, you don't want to use that name for
any of the .h files you write since that will prevent makeheaders
................................................................................
<pre>
makeheaders *.[ch]
</pre>
The makeheaders program will scan all of the .c files and all of the
manually written .h files and then automatically generate .h files
corresponding to all .c files.
</p>
<p>
Note that
the wildcard expression used in the above example,
``<code>*.[ch]</code>'',
will expand to include all .h files in the current directory, both
those entered manually be the programmer and others generated automatically
by a prior run of makeheaders.
But that is not a problem.
The makeheaders program will recognize and ignore any files it
has previously generated that show up on its input list.
</p>
<a name="H0008"></a>
<h3>3.2 What Declarations Get Copied</h3>
<p>
................................................................................
declaration of that variable is placed in the header of every
.c file that uses the variable.
</p>
<p><li>
When a structure, union or enumeration declaration or a
function prototype or a C++ class declaration appears in a
manually produced .h file, that declaration is copied into the
automatically generated
.h files of all .c files that use the structure, union, enumeration,
function or class.
But declarations that appear in a
.c file are considered private to that .c file and are not copied into
any automatically generated files.
</p>
................................................................................
<p>
You can instruct makeheaders to treat any part of a .c file as if
it were a .h file by enclosing that part of the .c file within:
<pre>
#if INTERFACE
#endif
</pre>
Thus any structure definitions that appear after the
``#if INTERFACE'' but before the corresponding
``#endif'' are eligable to be copied into the
automatically generated
.h files of other .c files.
</p>
<p>
If you use the ``#if INTERFACE'' mechanism in a .c file,
then the generated header for that .c file will contain a line
................................................................................
<pre>
#if EXPORT_INTERFACE
#endif
</pre>
will become part of the exported interface.
The ``#if EXPORT_INTERFACE'' mechanism can be used in either
.c or .h files.
(The ``#if INTERFACE'' can also be used in both .h and .c files,
but since it's use in a .h file would be redundant, we haven't mentioned
it before.)
</p>
<a name="H0011"></a>
<h3>3.5 Local declarations processed by makeheaders</h3>
................................................................................
<p>
Sometimes it is convenient to have makeheaders sort a sequence
of private declarations into the correct order for us automatically.
Or, we could have static functions and procedures for which we would like
makeheaders to generate prototypes, but the arguments to these
functions and procedures uses private declarations.
In both of these cases, we want makeheaders to be aware of the
private declarations and copy them into the local header file,
but we don't want makeheaders to propagate the
declarations outside of the file in which they are declared.
</p>
<p>
When this situation arises, enclose the private declarations
................................................................................
file ``alpha.cpp'' will induce makeheaders to
generate a header file named ``alpha.hpp''.
</p>
<p>
Makeheaders augments class definitions by inserting prototypes to
methods were appropriate. If a method definition begins with one
of the special keywords <b>PUBLIC</b>, <b>PROTECTED</b>, or
<b>PRIVATE</b> (in upper-case to distinguish them from the regular
C++ keywords with the same meaning) then a prototype for that
method will be inserted into the class definition. If none of
these keywords appear, then the prototype is not inserted. For
example, in the following code, the constructor is not explicitly
declared in the class definition but makeheaders will add it there
because of the PUBLIC keyword that appears before the constructor
................................................................................
Perhaps these issued will be addressed in future revisions.
</p>
<a name="H0013"></a>
<h3>3.7 Conditional Compilation</h3>
<p>
The makeheaders program understands and tracks the conditional
compilation constructs in the source code files it scans.
Hence, if the following code appears in a source file
<pre>
#ifdef UNIX
# define WORKS_WELL 1
#else
# define WORKS_WELL 0
................................................................................
as well as Cygwin32 and MSVC 5.0 for Win32.
</p>
<a name="H0017"></a>
<h2>6.0 Summary And Conclusion</h2>
<p>
The makeheaders program will automatically generate a minimal header file
for each of a set of C source and header files, and will
generate a composite header file for the entire source file suite,
for either internal or external use.
It can also be used as the parser in an automated program
documentation system.
</p>

files change, the entire program must be recompiled.
It also happens that those important .h files tend to be the ones that
change most frequently.
This means that the entire program must be recompiled frequently,
leading to a lengthy modify-compile-test cycle and a corresponding
decrease in programmer productivity.
<p><li>
The C programming language requires that declarations depending upon
each other must occur in a particular order.
In a program with complex, interwoven data structures, the correct
declaration order can become very difficult to determine manually,
especially when the declarations involved are spread out over several
files.
</ol>
</p>
<a name="H0004"></a>
<h3>1.2 The Makeheaders Solution</h3>
<p>
The makeheaders program is designed to ameliorate the problems associated
with the traditional C programming model by automatically generating
the interface information in the .h files from
interface information contained in other .h files and
from implementation information in the .c files.
When the makeheaders program is run, it scans the source
files for a project,
then generates a series of new .h files, one for each .c file.
The generated .h files contain exactly those declarations required by the
corresponding .c files, no more and no less.
................................................................................
a problem.
Simply rerun makeheaders to resynchronize everything.
<p><li>
The generated .h file contains the minimal set of declarations needed
by the .c file.
This means that when something changes, a minimal amount of recompilation
is required to produce an updated executable.
Experience has shown that this gives a dramatic improvement
in programmer productivity by facilitating a rapid modify-compile-test
cycle during development.
<p><li>
The makeheaders program automatically sorts declarations into the
correct order, completely eliminating the wearisome and error-prone
task of sorting declarations by hand.
</ol>
................................................................................
but manually entered .h files
that contain structure declarations and so forth will be scanned and
the declarations will be copied into the generated .h files as
appropriate.
But if makeheaders sees that the .h file that it has generated is no
different from the .h file it generated last time, it doesn't update
the file.
This prevents the corresponding .c files from having to
be needlessly recompiled.
</p>
<p>
There are several options to the makeheaders program that can
be used to alter its behavior.
The default behavior is to write a single .h file for each .c file and
................................................................................
In this example, makeheaders will scan the three files named
``alpha.c'',
``beta.c'' and
``gamma.c''
but because of the colon on the end of third filename
it will only generate headers for the first two files.
Unfortunately,
it is not possible to get makeheaders to process any file whose
name contains a colon.
</p>
<p>
In a large project, the length of the command line for makeheaders
can become very long.
If the operating system doesn't support long command lines
................................................................................
Such prototypes are normally omitted.
</p>
<p>
Finally, makeheaders also includes a ``-doc'' option.
This command line option prevents makeheaders from generating any
headers at all.
Instead, makeheaders will write to standard output
information about every definition and declaration that it encounters
in its scan of source files.
The information output includes the type of the definition or
declaration and any comment that preceeds the definition or
declaration.
The output is in a format that can be easily parsed, and is
intended to be read by another program that will generate
................................................................................
<a name="H0007"></a>
<h3>3.1 The Basic Setup</h3>
<p>
The simpliest way to use makeheaders is to put all definitions in
one or more .c files and all structure and type declarations in
separate .h files.
The only restriction is that you should take care to chose basenames
for your .h files that are different from the basenames for you
.c files.
Recall that if your .c file is named (for example) ``alpha.c''
makeheaders will attempt to generate a corresponding header file
named ``alpha.h''.
For that reason, you don't want to use that name for
any of the .h files you write since that will prevent makeheaders
................................................................................
<pre>
makeheaders *.[ch]
</pre>
The makeheaders program will scan all of the .c files and all of the
manually written .h files and then automatically generate .h files
corresponding to all .c files.
</p>
<p>
Note that
the wildcard expression used in the above example,
``<code>*.[ch]</code>'',
will expand to include all .h files in the current directory, both
those entered manually be the programmer and others generated automatically
by a prior run of makeheaders.
But that is not a problem.
The makeheaders program will recognize and ignore any files it
has previously generated that show up on its input list.
</p>
<a name="H0008"></a>
<h3>3.2 What Declarations Get Copied</h3>
<p>
................................................................................
declaration of that variable is placed in the header of every
.c file that uses the variable.
</p>
<p><li>
When a structure, union or enumeration declaration or a
function prototype or a C++ class declaration appears in a
manually produced .h file, that declaration is copied into the
automatically generated
.h files of all .c files that use the structure, union, enumeration,
function or class.
But declarations that appear in a
.c file are considered private to that .c file and are not copied into
any automatically generated files.
</p>
................................................................................
<p>
You can instruct makeheaders to treat any part of a .c file as if
it were a .h file by enclosing that part of the .c file within:
<pre>
#if INTERFACE
#endif
</pre>
Thus any structure definitions that appear after the
``#if INTERFACE'' but before the corresponding
``#endif'' are eligable to be copied into the
automatically generated
.h files of other .c files.
</p>
<p>
If you use the ``#if INTERFACE'' mechanism in a .c file,
then the generated header for that .c file will contain a line
................................................................................
<pre>
#if EXPORT_INTERFACE
#endif
</pre>
will become part of the exported interface.
The ``#if EXPORT_INTERFACE'' mechanism can be used in either
.c or .h files.
(The ``#if INTERFACE'' can also be used in both .h and .c files,
but since it's use in a .h file would be redundant, we haven't mentioned
it before.)
</p>
<a name="H0011"></a>
<h3>3.5 Local declarations processed by makeheaders</h3>
................................................................................
<p>
Sometimes it is convenient to have makeheaders sort a sequence
of private declarations into the correct order for us automatically.
Or, we could have static functions and procedures for which we would like
makeheaders to generate prototypes, but the arguments to these
functions and procedures uses private declarations.
In both of these cases, we want makeheaders to be aware of the
private declarations and copy them into the local header file,
but we don't want makeheaders to propagate the
declarations outside of the file in which they are declared.
</p>
<p>
When this situation arises, enclose the private declarations
................................................................................
file ``alpha.cpp'' will induce makeheaders to
generate a header file named ``alpha.hpp''.
</p>
<p>
Makeheaders augments class definitions by inserting prototypes to
methods were appropriate. If a method definition begins with one
of the special keywords <b>PUBLIC</b>, <b>PROTECTED</b>, or
<b>PRIVATE</b> (in upper-case to distinguish them from the regular
C++ keywords with the same meaning) then a prototype for that
method will be inserted into the class definition. If none of
these keywords appear, then the prototype is not inserted. For
example, in the following code, the constructor is not explicitly
declared in the class definition but makeheaders will add it there
because of the PUBLIC keyword that appears before the constructor
................................................................................
Perhaps these issued will be addressed in future revisions.
</p>
<a name="H0013"></a>
<h3>3.7 Conditional Compilation</h3>
<p>
The makeheaders program understands and tracks the conditional
compilation constructs in the source code files it scans.
Hence, if the following code appears in a source file
<pre>
#ifdef UNIX
# define WORKS_WELL 1
#else
# define WORKS_WELL 0
................................................................................
as well as Cygwin32 and MSVC 5.0 for Win32.
</p>
<a name="H0017"></a>
<h2>6.0 Summary And Conclusion</h2>
<p>
The makeheaders program will automatically generate a minimal header file
for each of a set of C source and header files, and will
generate a composite header file for the entire source file suite,
for either internal or external use.
It can also be used as the parser in an automated program
documentation system.
</p>

# Markdown formatting rulesIn addition to its native Wiki formatting syntax, Fossil supports Markdown syntax as specified by[John Gruber's original Markdown implementation](http://daringfireball.net/projects/markdown/).For lots of examples - not repeated here - please refer to its[syntax description](http://daringfireball.net/projects/markdown/syntax), of which the page youare reading is an extract.This page itself uses Markdown formatting.## Summary - Block elements * A **paragraph** is a group of consecutive lines. Paragraphs are separated by blank lines. * A **Header** is a line of text underlined with equal signs or hyphens, or prefixed by a number of hash marks. * **Block quotes** are blocks of text prefixed by '>'. * **Ordered list** items are prefixed by a number and a period. **Unordered list** items are prefixed by a hyphen, asterisk or plus sign. Prefix and item text are separated by whitespace. * **Code blocks** are formed by lines of text (possibly including empty lines) prefixed by at least 4 spaces or a tab. * A **horizontal rule** is a line consisting of 3 or more asterisks, hyphens or underscores, with optional whitespace between them. - Span elements * 3 types of **links** exist: - **automatic links** are URLs or email addresses enclosed in angle brackets ('<' and '>'), and are displayed as such. - **inline links** consist of the displayed link text in square brackets ('[' and ']'), followed by the link target in parentheses. - **reference links** separate _link instance_ from _link definition_. A link instance consists of the displayed link text in square brackets, followed by a link definition name in square brackets. The corresponding link definition can occur anywhere on the page, and consists of the link definition name in square brackets followed by a colon, whitespace and the link target. * **Emphasis** can be given by wrapping text in one or two asterisks or underscores - use one for HTML `<em>`, and two for `<strong>` emphasis. * A **code span** is text wrapped in backticks ('`'). * **Images** use a syntax much like inline or reference links, but with alt attribute text ('img alt=...') instead of link text, and the first pair of square brackets in an image instance prefixed by an exclamation mark. - **Inline HTML** is mostly interpreted automatically. - **Escaping** Markdown punctuation characters is done by prefixing them by a backslash ('\\').## Details### Paragraphs
To cause an explicit line break within a paragraph, use 2 or more spaces at the end of a line.Any line containing only whitespace (space or tab characters) is considered a blank line.
### Headers#### 'Setext' style headers (underlined)The number of underlining equal signs or hyphens used has no impact on the resulting header.Underlining using equal sign(s) creates a top level header (corresponding to HTML `<h1>`),while hyphen(s) create a second level header (HTML `<h2>`). Thus, only 2 levels of headerscan be made this way.#### 'Atx' style headers (hash prefixed)1 to 6 hash characters can be used to indicate header levels 1 (HTML `<h1>`) to 6 (`<h6>`).Headers may optionally be 'closed' for cosmetic reasons, by appending a whitespace and hashcharacters to the header. The number of trailing hash characters has no impact on the headerlevel.### Block quotesNot every line in a paragraph needs to be prefixed by '>' in order to make it a block quote,only the first line.Block quoted paragraphs can be nested by using multiple '>' characters as prefix.Within a block quote, Markdown formatting (e.g. lists, emphasis) still works as normal.
### ListsA list item prefix need not occur first on its line; up to 3 leading spaces are allowed(4 spaces would make a code block out of the following text).For unordered lists, asterisks, hyphens and plus signs can be used interchangeably.For ordered lists, arbitrary numbers can be used as part of an item prefix; the items will berenumbered during rendering. However, future implementations may demand that the number usedfor the first item in a list indicates an offset to be used for subsequent items.For list items spanning multiple lines, subsequent lines can be indented using an arbitrary amountof whitespace.List items will be wrapped in HTML `<p>` tags if they are separated by blank lines.A list item may span multiple paragraphs. At least the first line of each such paragraph mustbe indented using at least 4 spaces or a tab character.Block quotes within list items must have their '>' delimiters indented using 4 up to 7 spaces.Code blocks within list items need to be indented _twice_, that is, using 8 spaces or 2 tabcharacters.### Code blocksLines within a code block are rendered verbatim using HTML `<pre>` and `<code>` tags, except thatHTML punctuation characters like '<' and '&' are automatically converted to HTML entities. Thus,there is no need to explicitly escape HTML syntax within a code block.A code block runs until the first non blank line with indent less than 4 spaces or 1 tab character.Regular Markdown syntax is not processed within code blocks.
### Links#### Automatic linksWhen rendering automatic links to email addresses, HTML encoding obfuscation is used toprevent some spambots from harvesting.#### Inline linksLinks to resources on the same server can use relative paths (i.e. can start with a '/').An optional title for the link (e.g. to have mouseover text in the browser) may be given behindthe link target but within the parentheses, in single and double quotes, and separated from thelink target by whitespace.#### Reference links> Each reference link consists of
>
> - one or more _link instances_ at appropriate locations in the page text> - a single _link definition_ at an arbitrary location on the page
>
> During rendering, each link instance is resolved, and the corresponding definition is> filled in. No separate link definition clauses occur in the rendered output.>> There are 3 fields involved in link instances and definitions:>> - link text (i.e. the text that is displayed at the resulting link)> - link definition name (i.e. an unique ID binding link instances to link definition)> - link target (a target URL for the link)Multiple link instances may reference the same link definition using its link definitionname.Link definition names are case insensitive, and may contain letters, numbers, spaces andpunctuation.##### Link instanceA space may be inserted between the bracket pairs for link text and link definition name.A link instance can use an _implicit link definition name_ shortcut, in which case the linktext is used as the link definition name. The second set of brackets then remains empty, e.g.'[Google][]' ('Google' being used as both link text and link definition name).##### Link definitionThe first bracket pair containing the link definition name may be indented using up to 3 spaces.The link target may optionally be surrounded by angle brackets ('<' and '>').A link target may be followed by an optional title (e.g. to have mouseover text in the browser).This title may be enclosed in parentheses, single or double quotes.Link definitions may be split into 2 lines, with the title on the second line, arbitrarilyindented. This may be more visually pleasing when using long link targets.### EmphasisThe same character(s) used for starting the emphasis must be used to end it; don't mixasterisks and underscores.Emphasis can be used in the middle of a word. That is, there need not be whitespace on eitherside of emphasis start or end punctuation characters.### Code spansTo include a literal backtick character in a code span, use multiple backticks as opening andclosing delimiters.Whitespace may exist immediately after the opening delimiter and before the closing delimiterof a code span, to allow for code fragments starting or ending with a backtick.Within a code span - like within a code block - angle brackets and ampersands are automatically encoded to make includingHTML fragments easier.### ImagesIf necessary, HTML must be used to specify image dimensions. Markdown has no provision for this.### Inline HTMLStart and end tags ofa HTML block level construct (`<div>`, `<table>` etc) must be separated from surroundingcontext using blank lines, and must both occur at the start of a line.No extra unwanted `<p>` HTML tags are added around HTML block level tags.Markdown formatting within HTML block level tags is not processed; however, formatting withinspan level tags (e.g. `<mark>`) is processed normally.### Escaping Markdown punctuationThe following punctuation characters can be escaped using backslash: - \\ backslash - ` backtick - * asterisk - _ underscore - {} curly braces - [] square brackets - () parentheses - # hash mark - + plus sign - - minus sign (hyphen) - . dot - ! exclamation markTo render a literal backslash, use 2 backslashes ('\\\\').

** Write the content of one or more artifacts in the graveyard onto
** standard output.
**
** fossil purge ?checkins? TAGS... ?OPTIONS?
**
** Move the check-ins identified by TAGS and all of their descendants
** out of the repository and into the graveyard. The "checkins"
** subcommand keyword is option and can be omitted as long as TAGS
** does not conflict with any other subcommand.
**
** If a TAGS includes a branch name then it means all the check-ins
** on the most recent occurrance of that branch.
**
** --explain Make no changes, but show what would happen.
** --dry-run Make no chances.
**
** fossil purge list|ls ?-l?
**
** Show the graveyard of prior purges. The -l option gives more
** detail in the output.
**
** fossil purge obliterate ID...

** Write the content of one or more artifacts in the graveyard onto
** standard output.
**
** fossil purge ?checkins? TAGS... ?OPTIONS?
**
** Move the check-ins identified by TAGS and all of their descendants
** out of the repository and into the graveyard. The "checkins"
** subcommand keyword is optional and can be omitted as long as TAGS
** does not conflict with any other subcommand.
**
** If TAGS includes a branch name then it means all the check-ins
** on the most recent occurrance of that branch.
**
** --explain Make no changes, but show what would happen.
** --dry-run Make no changes.
**
** fossil purge list|ls ?-l?
**
** Show the graveyard of prior purges. The -l option gives more
** detail in the output.
**
** fossil purge obliterate ID...

** This file contains code to implement the sitemap webpage.
*/
#include "config.h"
#include "sitemap.h"
#include <assert.h>
/*
** WEBPAGE: sitemap
**
** List some of the web pages offered by the Fossil web engine. This
** page is intended as a suppliment to the menu bar on the main screen.
** That is, this page is designed to hold links that are omitted from
** the main menu due to lack of space.
*/
void sitemap_page(void){
int srchFlags;
login_check_credentials();
srchFlags = search_restrict(SRCH_ALL);

|
|

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

** This file contains code to implement the sitemap webpage.
*/
#include "config.h"
#include "sitemap.h"
#include <assert.h>
/*
** WEBPAGE: sitemap
**
** List some of the web pages offered by the Fossil web engine. This
** page is intended as a supplement to the menu bar on the main screen.
** That is, this page is designed to hold links that are omitted from
** the main menu due to lack of space.
*/
void sitemap_page(void){
int srchFlags;
login_check_credentials();
srchFlags = search_restrict(SRCH_ALL);

** string contains the date and time of the check-in (UTC) and an SHA1
** hash of the entire source tree.
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.11.0"
#define SQLITE_VERSION_NUMBER 3011000
#define SQLITE_SOURCE_ID "2016-02-15 17:29:24 3d862f207e3adc00f78066799ac5a8c282430a5f"
/*
** CAPI3REF: Run-Time Library Version Numbers
** KEYWORDS: sqlite3_version, sqlite3_sourceid
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
** Those below are for version 3 and greater.
*/
int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);
sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);
const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
/*
** The methods above are in versions 1 through 3 of the sqlite_vfs object.
** New fields may be appended in figure versions. The iVersion
** value will increment whenever this happens.
*/
};
/*
** CAPI3REF: Flags for the xAccess VFS method
**
................................................................................
** is an unsigned integer and sets the "Minimum PMA Size" for the multithreaded
** sorter to that integer. The default minimum PMA Size is set by the
** [SQLITE_SORTER_PMASZ] compile-time option. New threads are launched
** to help with sort operations when multithreaded sorting
** is enabled (using the [PRAGMA threads] command) and the amount of content
** to be sorted exceeds the page size times the minimum of the
** [PRAGMA cache_size] setting and this value.
** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
................................................................................
#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
/*
** CAPI3REF: Database Connection Configuration Options
**
** These constants are the available integer configuration options that
** can be passed as the second argument to the [sqlite3_db_config()] interface.
**
................................................................................
** The first argument is an integer which is 0 to disable triggers,
** positive to enable triggers or negative to leave the setting unchanged.
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether triggers are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
** which case the trigger setting is not reported back. </dd>
**
** </dl>
*/
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
/*
** CAPI3REF: Enable Or Disable Extended Result Codes
** METHOD: sqlite3
**
** ^The sqlite3_extended_result_codes() routine enables or disables the
................................................................................
/*
** CAPI3REF: Data Change Notification Callbacks
** METHOD: sqlite3
**
** ^The sqlite3_update_hook() interface registers a callback function
** with the [database connection] identified by the first argument
** to be invoked whenever a row is updated, inserted or deleted in
** a rowid table.
** ^Any callback set by a previous call to this function
** for the same database connection is overridden.
**
** ^The second argument is a pointer to the function to invoke when a
** row is updated, inserted or deleted in a rowid table.
** ^The first argument to the callback is a copy of the third argument
** to sqlite3_update_hook().
................................................................................
** database connections for the meaning of "modify" in this paragraph.
**
** ^The sqlite3_update_hook(D,C,P) function
** returns the P argument from the previous call
** on the same [database connection] D, or NULL for
** the first call on D.
**
** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]
** interfaces.
*/
SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
sqlite3*,
void(*)(void *,int ,char const *,char const *,sqlite3_int64),
void*
);
................................................................................
** ^If an error occurs and pzErrMsg is not 0, then the
** [sqlite3_load_extension()] interface shall attempt to
** fill *pzErrMsg with error message text stored in memory
** obtained from [sqlite3_malloc()]. The calling function
** should free this memory by calling [sqlite3_free()].
**
** ^Extension loading must be enabled using
** [sqlite3_enable_load_extension()] prior to calling this API,
** otherwise an error will be returned.
**
** See also the [load_extension() SQL function].
*/
SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
sqlite3 *db, /* Load the extension into this database connection */
const char *zFile, /* Name of the shared library containing extension */
const char *zProc, /* Entry point. Derived from zFile if 0 */
................................................................................
** [extension loading] while evaluating user-entered SQL, the following API
** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
**
** ^Extension loading is off by default.
** ^Call the sqlite3_enable_load_extension() routine with onoff==1
** to turn extension loading on and call it with onoff==0 to turn
** it back off again.
*/
SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int onoff);
/*
** CAPI3REF: Automatically Load Statically Linked Extensions
**
** ^This interface causes the xEntryPoint() function to be invoked for
................................................................................
** ^The S and M arguments passed to
** sqlite3_backup_init(D,N,S,M) identify the [database connection]
** and database name of the source database, respectively.
** ^The source and destination [database connections] (parameters S and D)
** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
** an error.
**
** ^A call to sqlite3_backup_init() will fail, returning SQLITE_ERROR, if
** there is already a read or read-write transaction open on the
** destination database.
**
** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
** returned and an error code and error message are stored in the
** destination [database connection] D.
** ^The error code and message for the failed call to sqlite3_backup_init()
................................................................................
** are undefined.
**
** A single database handle may have at most a single write-ahead log callback
** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
** previously registered write-ahead log callback. ^Note that the
** [sqlite3_wal_autocheckpoint()] interface and the
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
** those overwrite any prior [sqlite3_wal_hook()] settings.
*/
SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
sqlite3*,
int(*)(void *,sqlite3*,const char*,int),
void*
);
................................................................................
** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
**
** ^This function does not set the database handle error code or message
** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
*/
SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
/*
** CAPI3REF: Database Snapshot
** KEYWORDS: {snapshot}
** EXPERIMENTAL
**
** An instance of the snapshot object records the state of a [WAL mode]
** database for some specific point in history.
................................................................................
sqlite3_snapshot **ppSnapshot
);
/*
** CAPI3REF: Start a read transaction on an historical snapshot
** EXPERIMENTAL
**
** ^The [sqlite3_snapshot_open(D,S,P)] interface attempts to move the
** read transaction that is currently open on schema S of
** [database connection] D so that it refers to historical [snapshot] P.
** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success
** or an appropriate [error code] if it fails.
**
** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
** the first operation, apart from other sqlite3_snapshot_open() calls,
** following the [BEGIN] that starts a new read transaction.
** ^A [snapshot] will fail to open if it has been overwritten by a
** [checkpoint].
**
** The [sqlite3_snapshot_open()] interface is only available when the
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
*/
SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
sqlite3 *db,
const char *zSchema,
................................................................................
** using this routine to avoid a memory leak.
**
** The [sqlite3_snapshot_free()] interface is only available when the
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
*/
SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot*);
/*
** Undo the hack that converts floating point types to integer for
** builds on processors without floating point support.
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# undef double
#endif
#ifdef __cplusplus
} /* End of the 'extern "C"' block */
#endif
#endif /* _SQLITE3_H_ */
/*
** 2010 August 30
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
................................................................................
#ifdef __cplusplus
} /* end of the 'extern "C"' block */
#endif
#endif /* ifndef _SQLITE3RTREE_H_ */
/*
** 2014 May 31
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
................................................................................
** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback):
** This API function is used to query the FTS table for phrase iPhrase
** of the current query. Specifically, a query equivalent to:
**
** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
**
** with $p set to a phrase equivalent to the phrase iPhrase of the
** current query is executed. For each row visited, the callback function
** passed as the fourth argument is invoked. The context and API objects
** passed to the callback function may be used to access the properties of
** each matched row. Invoking Api.xUserData() returns a copy of the pointer
** passed as the third argument to pUserData.
**
** If the callback function returns any value other than SQLITE_OK, the
** query is abandoned and the xQueryPhrase function returns immediately.
** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
** Otherwise, the error code is propagated upwards.
**
** If the query runs to completion without incident, SQLITE_OK is returned.
................................................................................
#ifdef __cplusplus
} /* end of the 'extern "C"' block */
#endif
#endif /* _FTS5_H */

** string contains the date and time of the check-in (UTC) and an SHA1
** hash of the entire source tree.
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.13.0"
#define SQLITE_VERSION_NUMBER 3013000
#define SQLITE_SOURCE_ID "2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2"
/*
** CAPI3REF: Run-Time Library Version Numbers
** KEYWORDS: sqlite3_version, sqlite3_sourceid
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
** Those below are for version 3 and greater.
*/
int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);
sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);
const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
/*
** The methods above are in versions 1 through 3 of the sqlite_vfs object.
** New fields may be appended in future versions. The iVersion
** value will increment whenever this happens.
*/
};
/*
** CAPI3REF: Flags for the xAccess VFS method
**
................................................................................
** is an unsigned integer and sets the "Minimum PMA Size" for the multithreaded
** sorter to that integer. The default minimum PMA Size is set by the
** [SQLITE_SORTER_PMASZ] compile-time option. New threads are launched
** to help with sort operations when multithreaded sorting
** is enabled (using the [PRAGMA threads] command) and the amount of content
** to be sorted exceeds the page size times the minimum of the
** [PRAGMA cache_size] setting and this value.
**** [[SQLITE_CONFIG_STMTJRNL_SPILL]]** <dt>SQLITE_CONFIG_STMTJRNL_SPILL** <dd>^The SQLITE_CONFIG_STMTJRNL_SPILL option takes a single parameter which** becomes the [statement journal] spill-to-disk threshold. ** [Statement journals] are held in memory until their size (in bytes)** exceeds this threshold, at which point they are written to disk.** Or if the threshold is -1, statement journals are always held** exclusively in memory.** Since many statement journals never become large, setting the spill** threshold to a value such as 64KiB can greatly reduce the amount of** I/O required to support statement rollback.** The default value for this setting is controlled by the** [SQLITE_STMTJRNL_SPILL] compile-time option.
** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
................................................................................
#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
/*
** CAPI3REF: Database Connection Configuration Options
**
** These constants are the available integer configuration options that
** can be passed as the second argument to the [sqlite3_db_config()] interface.
**
................................................................................
** The first argument is an integer which is 0 to disable triggers,
** positive to enable triggers or negative to leave the setting unchanged.
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether triggers are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
** which case the trigger setting is not reported back. </dd>
**
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>** <dd> ^This option is used to enable or disable the two-argument** version of the [fts3_tokenizer()] function which is part of the** [FTS3] full-text search engine extension.** There should be two additional arguments.** The first argument is an integer which is 0 to disable fts3_tokenizer() or** positive to enable fts3_tokenizer() or negative to leave the setting** unchanged.** The second parameter is a pointer to an integer into which** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled** following this call. The second parameter may be a NULL pointer, in** which case the new setting is not reported back. </dd>**** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt>** <dd> ^This option is used to enable or disable the [sqlite3_load_extension()]** interface independently of the [load_extension()] SQL function.** The [sqlite3_enable_load_extension()] API enables or disables both the** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].** There should be two additional arguments.** When the first argument to this interface is 1, then only the C-API is** enabled and the SQL function remains disabled. If the first argment to** this interface is 0, then both the C-API and the SQL function are disabled.** If the first argument is -1, then no changes are made to state of either the** C-API or the SQL function.** The second parameter is a pointer to an integer into which** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface** is disabled or enabled following this call. The second parameter may** be a NULL pointer, in which case the new setting is not reported back.** </dd>**
** </dl>
*/
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
/*
** CAPI3REF: Enable Or Disable Extended Result Codes
** METHOD: sqlite3
**
** ^The sqlite3_extended_result_codes() routine enables or disables the
................................................................................
/*
** CAPI3REF: Data Change Notification Callbacks
** METHOD: sqlite3
**
** ^The sqlite3_update_hook() interface registers a callback function
** with the [database connection] identified by the first argument
** to be invoked whenever a row is updated, inserted or deleted in
** a [rowid table].
** ^Any callback set by a previous call to this function
** for the same database connection is overridden.
**
** ^The second argument is a pointer to the function to invoke when a
** row is updated, inserted or deleted in a rowid table.
** ^The first argument to the callback is a copy of the third argument
** to sqlite3_update_hook().
................................................................................
** database connections for the meaning of "modify" in this paragraph.
**
** ^The sqlite3_update_hook(D,C,P) function
** returns the P argument from the previous call
** on the same [database connection] D, or NULL for
** the first call on D.
**
** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
** and [sqlite3_preupdate_hook()] interfaces.
*/
SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
sqlite3*,
void(*)(void *,int ,char const *,char const *,sqlite3_int64),
void*
);
................................................................................
** ^If an error occurs and pzErrMsg is not 0, then the
** [sqlite3_load_extension()] interface shall attempt to
** fill *pzErrMsg with error message text stored in memory
** obtained from [sqlite3_malloc()]. The calling function
** should free this memory by calling [sqlite3_free()].
**
** ^Extension loading must be enabled using
** [sqlite3_enable_load_extension()] or** [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],1,NULL)** prior to calling this API,
** otherwise an error will be returned.
**** <b>Security warning:</b> It is recommended that the ** [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method be used to enable only this** interface. The use of the [sqlite3_enable_load_extension()] interface** should be avoided. This will keep the SQL function [load_extension()]** disabled and prevent SQL injections from giving attackers** access to extension loading capabilities.
**
** See also the [load_extension() SQL function].
*/
SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
sqlite3 *db, /* Load the extension into this database connection */
const char *zFile, /* Name of the shared library containing extension */
const char *zProc, /* Entry point. Derived from zFile if 0 */
................................................................................
** [extension loading] while evaluating user-entered SQL, the following API
** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
**
** ^Extension loading is off by default.
** ^Call the sqlite3_enable_load_extension() routine with onoff==1
** to turn extension loading on and call it with onoff==0 to turn
** it back off again.
**** ^This interface enables or disables both the C-API** [sqlite3_load_extension()] and the SQL function [load_extension()].** Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)** to enable or disable only the C-API.**** <b>Security warning:</b> It is recommended that extension loading** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method** rather than this interface, so the [load_extension()] SQL function** remains disabled. This will prevent SQL injections from giving attackers** access to extension loading capabilities.
*/
SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int onoff);
/*
** CAPI3REF: Automatically Load Statically Linked Extensions
**
** ^This interface causes the xEntryPoint() function to be invoked for
................................................................................
** ^The S and M arguments passed to
** sqlite3_backup_init(D,N,S,M) identify the [database connection]
** and database name of the source database, respectively.
** ^The source and destination [database connections] (parameters S and D)
** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
** an error.
**
** ^A call to sqlite3_backup_init() will fail, returning NULL, if
** there is already a read or read-write transaction open on the
** destination database.
**
** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
** returned and an error code and error message are stored in the
** destination [database connection] D.
** ^The error code and message for the failed call to sqlite3_backup_init()
................................................................................
** are undefined.
**
** A single database handle may have at most a single write-ahead log callback
** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
** previously registered write-ahead log callback. ^Note that the
** [sqlite3_wal_autocheckpoint()] interface and the
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
** overwrite any prior [sqlite3_wal_hook()] settings.
*/
SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
sqlite3*,
int(*)(void *,sqlite3*,const char*,int),
void*
);
................................................................................
** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
**
** ^This function does not set the database handle error code or message
** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
*/
SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
/*** CAPI3REF: The pre-update hook.**** ^These interfaces are only available if SQLite is compiled using the** [SQLITE_ENABLE_PREUPDATE_HOOK] compile-time option.**** ^The [sqlite3_preupdate_hook()] interface registers a callback function** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation** on a [rowid table].** ^At most one preupdate hook may be registered at a time on a single** [database connection]; each call to [sqlite3_preupdate_hook()] overrides** the previous setting.** ^The preupdate hook is disabled by invoking [sqlite3_preupdate_hook()]** with a NULL pointer as the second parameter.** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as** the first parameter to callbacks.**** ^The preupdate hook only fires for changes to [rowid tables]; the preupdate** hook is not invoked for changes to [virtual tables] or [WITHOUT ROWID]** tables.**** ^The second parameter to the preupdate callback is a pointer to** the [database connection] that registered the preupdate hook.** ^The third parameter to the preupdate callback is one of the constants** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to indentify the** kind of update operation that is about to occur.** ^(The fourth parameter to the preupdate callback is the name of the** database within the database connection that is being modified. This** will be "main" for the main database or "temp" for TEMP tables or ** the name given after the AS keyword in the [ATTACH] statement for attached** databases.)^** ^The fifth parameter to the preupdate callback is the name of the** table that is being modified.** ^The sixth parameter to the preupdate callback is the initial [rowid] of the** row being changes for SQLITE_UPDATE and SQLITE_DELETE changes and is** undefined for SQLITE_INSERT changes.** ^The seventh parameter to the preupdate callback is the final [rowid] of** the row being changed for SQLITE_UPDATE and SQLITE_INSERT changes and is** undefined for SQLITE_DELETE changes.**** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces** provide additional information about a preupdate event. These routines** may only be called from within a preupdate callback. Invoking any of** these routines from outside of a preupdate callback or with a** [database connection] pointer that is different from the one supplied** to the preupdate callback results in undefined and probably undesirable** behavior.**** ^The [sqlite3_preupdate_count(D)] interface returns the number of columns** in the row that is being inserted, updated, or deleted.**** ^The [sqlite3_preupdate_old(D,N,P)] interface writes into P a pointer to** a [protected sqlite3_value] that contains the value of the Nth column of** the table row before it is updated. The N parameter must be between 0** and one less than the number of columns or the behavior will be** undefined. This must only be used within SQLITE_UPDATE and SQLITE_DELETE** preupdate callbacks; if it is used by an SQLITE_INSERT callback then the** behavior is undefined. The [sqlite3_value] that P points to** will be destroyed when the preupdate callback returns.**** ^The [sqlite3_preupdate_new(D,N,P)] interface writes into P a pointer to** a [protected sqlite3_value] that contains the value of the Nth column of** the table row after it is updated. The N parameter must be between 0** and one less than the number of columns or the behavior will be** undefined. This must only be used within SQLITE_INSERT and SQLITE_UPDATE** preupdate callbacks; if it is used by an SQLITE_DELETE callback then the** behavior is undefined. The [sqlite3_value] that P points to** will be destroyed when the preupdate callback returns.**** ^The [sqlite3_preupdate_depth(D)] interface returns 0 if the preupdate** callback was invoked as a result of a direct insert, update, or delete** operation; or 1 for inserts, updates, or deletes invoked by top-level ** triggers; or 2 for changes resulting from triggers called by top-level** triggers; and so forth.**** See also: [sqlite3_update_hook()]*/SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_preupdate_hook( sqlite3 *db, void(*xPreUpdate)( void *pCtx, /* Copy of third arg to preupdate_hook() */ sqlite3 *db, /* Database handle */ int op, /* SQLITE_UPDATE, DELETE or INSERT */ char const *zDb, /* Database name */ char const *zName, /* Table name */ sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */ sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */ ), void*);SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_count(sqlite3 *);SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_depth(sqlite3 *);SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);/*** CAPI3REF: Low-level system error code**** ^Attempt to return the underlying operating system error code or error** number that caused the most recent I/O error or failure to open a file.** The return value is OS-dependent. For example, on unix systems, after** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be** called to get back the underlying "errno" that caused the problem, such** as ENOSPC, EAUTH, EISDIR, and so forth. */SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3*);
/*
** CAPI3REF: Database Snapshot
** KEYWORDS: {snapshot}
** EXPERIMENTAL
**
** An instance of the snapshot object records the state of a [WAL mode]
** database for some specific point in history.
................................................................................
sqlite3_snapshot **ppSnapshot
);
/*
** CAPI3REF: Start a read transaction on an historical snapshot
** EXPERIMENTAL
**
** ^The [sqlite3_snapshot_open(D,S,P)] interface starts a
** read transaction for schema S of
** [database connection] D such that the read transaction
** refers to historical [snapshot] P, rather than the most** recent change to the database.
** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success
** or an appropriate [error code] if it fails.
**
** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
** the first operation following the [BEGIN] that takes the schema S** out of [autocommit mode].** ^In other words, schema S must not currently be in** a transaction for [sqlite3_snapshot_open(D,S,P)] to work, but the** database connection D must be out of [autocommit mode].
** ^A [snapshot] will fail to open if it has been overwritten by a
** [checkpoint].
** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the** database connection D does not know that the database file for** schema S is in [WAL mode]. A database connection might not know** that the database file is in [WAL mode] if there has been no prior** I/O on that database connection, or if the database entered [WAL mode] ** after the most recent I/O on the database connection.)^** (Hint: Run "[PRAGMA application_id]" against a newly opened** database connection in order to make it ready to use snapshots.)
**
** The [sqlite3_snapshot_open()] interface is only available when the
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
*/
SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
sqlite3 *db,
const char *zSchema,
................................................................................
** using this routine to avoid a memory leak.
**
** The [sqlite3_snapshot_free()] interface is only available when the
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
*/
SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot*);
/*** CAPI3REF: Compare the ages of two snapshot handles.** EXPERIMENTAL**** The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages** of two valid snapshot handles. **** If the two snapshot handles are not associated with the same database ** file, the result of the comparison is undefined. **** Additionally, the result of the comparison is only valid if both of the** snapshot handles were obtained by calling sqlite3_snapshot_get() since the** last time the wal file was deleted. The wal file is deleted when the** database is changed back to rollback mode or when the number of database** clients drops to zero. If either snapshot handle was obtained before the ** wal file was last deleted, the value returned by this function ** is undefined.**** Otherwise, this API returns a negative value if P1 refers to an older** snapshot than P2, zero if the two handles refer to the same database** snapshot, and a positive value if P1 is a newer snapshot than P2.*/SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_cmp( sqlite3_snapshot *p1, sqlite3_snapshot *p2);
/*
** Undo the hack that converts floating point types to integer for
** builds on processors without floating point support.
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# undef double
#endif
#ifdef __cplusplus
} /* End of the 'extern "C"' block */
#endif
#endif /* _SQLITE3_H_ */
/******** Begin file sqlite3rtree.h *********/
/*
** 2010 August 30
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
................................................................................
#ifdef __cplusplus
} /* end of the 'extern "C"' block */
#endif
#endif /* ifndef _SQLITE3RTREE_H_ */
/******** End of sqlite3rtree.h *********//******** Begin file sqlite3session.h *********/#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)#define __SQLITESESSION_H_ 1/*** Make sure we can call this stuff from C++.*/#ifdef __cplusplusextern "C" {#endif/*** CAPI3REF: Session Object Handle*/typedef struct sqlite3_session sqlite3_session;/*** CAPI3REF: Changeset Iterator Handle*/typedef struct sqlite3_changeset_iter sqlite3_changeset_iter;/*** CAPI3REF: Create A New Session Object**** Create a new session object attached to database handle db. If successful,** a pointer to the new object is written to *ppSession and SQLITE_OK is** returned. If an error occurs, *ppSession is set to NULL and an SQLite** error code (e.g. SQLITE_NOMEM) is returned.**** It is possible to create multiple session objects attached to a single** database handle.**** Session objects created using this function should be deleted using the** [sqlite3session_delete()] function before the database handle that they** are attached to is itself closed. If the database handle is closed before** the session object is deleted, then the results of calling any session** module function, including [sqlite3session_delete()] on the session object** are undefined.**** Because the session module uses the [sqlite3_preupdate_hook()] API, it** is not possible for an application to register a pre-update hook on a** database handle that has one or more session objects attached. Nor is** it possible to create a session object attached to a database handle for** which a pre-update hook is already defined. The results of attempting ** either of these things are undefined.**** The session object will be used to create changesets for tables in** database zDb, where zDb is either "main", or "temp", or the name of an** attached database. It is not an error if database zDb is not attached** to the database when the session object is created.*/int sqlite3session_create( sqlite3 *db, /* Database handle */ const char *zDb, /* Name of db (e.g. "main") */ sqlite3_session **ppSession /* OUT: New session object */);/*** CAPI3REF: Delete A Session Object**** Delete a session object previously allocated using ** [sqlite3session_create()]. Once a session object has been deleted, the** results of attempting to use pSession with any other session module** function are undefined.**** Session objects must be deleted before the database handle to which they** are attached is closed. Refer to the documentation for ** [sqlite3session_create()] for details.*/void sqlite3session_delete(sqlite3_session *pSession);/*** CAPI3REF: Enable Or Disable A Session Object**** Enable or disable the recording of changes by a session object. When** enabled, a session object records changes made to the database. When** disabled - it does not. A newly created session object is enabled.** Refer to the documentation for [sqlite3session_changeset()] for further** details regarding how enabling and disabling a session object affects** the eventual changesets.**** Passing zero to this function disables the session. Passing a value** greater than zero enables it. Passing a value less than zero is a ** no-op, and may be used to query the current state of the session.**** The return value indicates the final state of the session object: 0 if ** the session is disabled, or 1 if it is enabled.*/int sqlite3session_enable(sqlite3_session *pSession, int bEnable);/*** CAPI3REF: Set Or Clear the Indirect Change Flag**** Each change recorded by a session object is marked as either direct or** indirect. A change is marked as indirect if either:**** <ul>** <li> The session object "indirect" flag is set when the change is** made, or** <li> The change is made by an SQL trigger or foreign key action ** instead of directly as a result of a users SQL statement.** </ul>**** If a single row is affected by more than one operation within a session,** then the change is considered indirect if all operations meet the criteria** for an indirect change above, or direct otherwise.**** This function is used to set, clear or query the session object indirect** flag. If the second argument passed to this function is zero, then the** indirect flag is cleared. If it is greater than zero, the indirect flag** is set. Passing a value less than zero does not modify the current value** of the indirect flag, and may be used to query the current state of the ** indirect flag for the specified session object.**** The return value indicates the final state of the indirect flag: 0 if ** it is clear, or 1 if it is set.*/int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);/*** CAPI3REF: Attach A Table To A Session Object**** If argument zTab is not NULL, then it is the name of a table to attach** to the session object passed as the first argument. All subsequent changes ** made to the table while the session object is enabled will be recorded. See ** documentation for [sqlite3session_changeset()] for further details.**** Or, if argument zTab is NULL, then changes are recorded for all tables** in the database. If additional tables are added to the database (by ** executing "CREATE TABLE" statements) after this call is made, changes for ** the new tables are also recorded.**** Changes can only be recorded for tables that have a PRIMARY KEY explicitly** defined as part of their CREATE TABLE statement. It does not matter if the ** PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) or not. The PRIMARY** KEY may consist of a single column, or may be a composite key.** ** It is not an error if the named table does not exist in the database. Nor** is it an error if the named table does not have a PRIMARY KEY. However,** no changes will be recorded in either of these scenarios.**** Changes are not recorded for individual rows that have NULL values stored** in one or more of their PRIMARY KEY columns.**** SQLITE_OK is returned if the call completes without error. Or, if an error ** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.*/int sqlite3session_attach( sqlite3_session *pSession, /* Session object */ const char *zTab /* Table name */);/*** CAPI3REF: Set a table filter on a Session Object.**** The second argument (xFilter) is the "filter callback". For changes to rows ** in tables that are not attached to the Session oject, the filter is called** to determine whether changes to the table's rows should be tracked or not. ** If xFilter returns 0, changes is not tracked. Note that once a table is ** attached, xFilter will not be called again.*/void sqlite3session_table_filter( sqlite3_session *pSession, /* Session object */ int(*xFilter)( void *pCtx, /* Copy of third arg to _filter_table() */ const char *zTab /* Table name */ ), void *pCtx /* First argument passed to xFilter */);/*** CAPI3REF: Generate A Changeset From A Session Object**** Obtain a changeset containing changes to the tables attached to the ** session object passed as the first argument. If successful, ** set *ppChangeset to point to a buffer containing the changeset ** and *pnChangeset to the size of the changeset in bytes before returning** SQLITE_OK. If an error occurs, set both *ppChangeset and *pnChangeset to** zero and return an SQLite error code.**** A changeset consists of zero or more INSERT, UPDATE and/or DELETE changes,** each representing a change to a single row of an attached table. An INSERT** change contains the values of each field of a new database row. A DELETE** contains the original values of each field of a deleted database row. An** UPDATE change contains the original values of each field of an updated** database row along with the updated values for each updated non-primary-key** column. It is not possible for an UPDATE change to represent a change that** modifies the values of primary key columns. If such a change is made, it** is represented in a changeset as a DELETE followed by an INSERT.**** Changes are not recorded for rows that have NULL values stored in one or ** more of their PRIMARY KEY columns. If such a row is inserted or deleted,** no corresponding change is present in the changesets returned by this** function. If an existing row with one or more NULL values stored in** PRIMARY KEY columns is updated so that all PRIMARY KEY columns are non-NULL,** only an INSERT is appears in the changeset. Similarly, if an existing row** with non-NULL PRIMARY KEY values is updated so that one or more of its** PRIMARY KEY columns are set to NULL, the resulting changeset contains a** DELETE change only.**** The contents of a changeset may be traversed using an iterator created** using the [sqlite3changeset_start()] API. A changeset may be applied to** a database with a compatible schema using the [sqlite3changeset_apply()]** API.**** Within a changeset generated by this function, all changes related to a** single table are grouped together. In other words, when iterating through** a changeset or when applying a changeset to a database, all changes related** to a single table are processed before moving on to the next table. Tables** are sorted in the same order in which they were attached (or auto-attached)** to the sqlite3_session object. The order in which the changes related to** a single table are stored is undefined.**** Following a successful call to this function, it is the responsibility of** the caller to eventually free the buffer that *ppChangeset points to using** [sqlite3_free()].**** <h3>Changeset Generation</h3>**** Once a table has been attached to a session object, the session object** records the primary key values of all new rows inserted into the table.** It also records the original primary key and other column values of any** deleted or updated rows. For each unique primary key value, data is only** recorded once - the first time a row with said primary key is inserted,** updated or deleted in the lifetime of the session.**** There is one exception to the previous paragraph: when a row is inserted,** updated or deleted, if one or more of its primary key columns contain a** NULL value, no record of the change is made.**** The session object therefore accumulates two types of records - those** that consist of primary key values only (created when the user inserts** a new record) and those that consist of the primary key values and the** original values of other table columns (created when the users deletes** or updates a record).**** When this function is called, the requested changeset is created using** both the accumulated records and the current contents of the database** file. Specifically:**** <ul>** <li> For each record generated by an insert, the database is queried** for a row with a matching primary key. If one is found, an INSERT** change is added to the changeset. If no such row is found, no change ** is added to the changeset.**** <li> For each record generated by an update or delete, the database is ** queried for a row with a matching primary key. If such a row is** found and one or more of the non-primary key fields have been** modified from their original values, an UPDATE change is added to ** the changeset. Or, if no such row is found in the table, a DELETE ** change is added to the changeset. If there is a row with a matching** primary key in the database, but all fields contain their original** values, no change is added to the changeset.** </ul>**** This means, amongst other things, that if a row is inserted and then later** deleted while a session object is active, neither the insert nor the delete** will be present in the changeset. Or if a row is deleted and then later a ** row with the same primary key values inserted while a session object is** active, the resulting changeset will contain an UPDATE change instead of** a DELETE and an INSERT.**** When a session object is disabled (see the [sqlite3session_enable()] API),** it does not accumulate records when rows are inserted, updated or deleted.** This may appear to have some counter-intuitive effects if a single row** is written to more than once during a session. For example, if a row** is inserted while a session object is enabled, then later deleted while ** the same session object is disabled, no INSERT record will appear in the** changeset, even though the delete took place while the session was disabled.** Or, if one field of a row is updated while a session is disabled, and ** another field of the same row is updated while the session is enabled, the** resulting changeset will contain an UPDATE change that updates both fields.*/int sqlite3session_changeset( sqlite3_session *pSession, /* Session object */ int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ void **ppChangeset /* OUT: Buffer containing changeset */);/*** CAPI3REF: Load The Difference Between Tables Into A Session **** If it is not already attached to the session object passed as the first** argument, this function attaches table zTbl in the same manner as the** [sqlite3session_attach()] function. If zTbl does not exist, or if it** does not have a primary key, this function is a no-op (but does not return** an error).**** Argument zFromDb must be the name of a database ("main", "temp" etc.)** attached to the same database handle as the session object that contains ** a table compatible with the table attached to the session by this function.** A table is considered compatible if it:**** <ul>** <li> Has the same name,** <li> Has the same set of columns declared in the same order, and** <li> Has the same PRIMARY KEY definition.** </ul>**** If the tables are not compatible, SQLITE_SCHEMA is returned. If the tables** are compatible but do not have any PRIMARY KEY columns, it is not an error** but no changes are added to the session object. As with other session** APIs, tables without PRIMARY KEYs are simply ignored.**** This function adds a set of changes to the session object that could be** used to update the table in database zFrom (call this the "from-table") ** so that its content is the same as the table attached to the session ** object (call this the "to-table"). Specifically:**** <ul>** <li> For each row (primary key) that exists in the to-table but not in ** the from-table, an INSERT record is added to the session object.**** <li> For each row (primary key) that exists in the to-table but not in ** the from-table, a DELETE record is added to the session object.**** <li> For each row (primary key) that exists in both tables, but features ** different in each, an UPDATE record is added to the session.** </ul>**** To clarify, if this function is called and then a changeset constructed** using [sqlite3session_changeset()], then after applying that changeset to ** database zFrom the contents of the two compatible tables would be ** identical.**** It an error if database zFrom does not exist or does not contain the** required compatible table.**** If the operation successful, SQLITE_OK is returned. Otherwise, an SQLite** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg** may be set to point to a buffer containing an English language error ** message. It is the responsibility of the caller to free this buffer using** sqlite3_free().*/int sqlite3session_diff( sqlite3_session *pSession, const char *zFromDb, const char *zTbl, char **pzErrMsg);/*** CAPI3REF: Generate A Patchset From A Session Object**** The differences between a patchset and a changeset are that:**** <ul>** <li> DELETE records consist of the primary key fields only. The ** original values of other fields are omitted.** <li> The original values of any modified fields are omitted from ** UPDATE records.** </ul>**** A patchset blob may be used with up to date versions of all ** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(), ** which returns SQLITE_CORRUPT if it is passed a patchset. Similarly,** attempting to use a patchset blob with old versions of the** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. **** Because the non-primary key "old.*" fields are omitted, no ** SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset** is passed to the sqlite3changeset_apply() API. Other conflict types work** in the same way as for changesets.**** Changes within a patchset are ordered in the same way as for changesets** generated by the sqlite3session_changeset() function (i.e. all changes for** a single table are grouped together, tables appear in the order in which** they were attached to the session object).*/int sqlite3session_patchset( sqlite3_session *pSession, /* Session object */ int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */ void **ppPatchset /* OUT: Buffer containing changeset */);/*** CAPI3REF: Test if a changeset has recorded any changes.**** Return non-zero if no changes to attached tables have been recorded by ** the session object passed as the first argument. Otherwise, if one or ** more changes have been recorded, return zero.**** Even if this function returns zero, it is possible that calling** [sqlite3session_changeset()] on the session handle may still return a** changeset that contains no changes. This can happen when a row in ** an attached table is modified and then later on the original values ** are restored. However, if this function returns non-zero, then it is** guaranteed that a call to sqlite3session_changeset() will return a ** changeset containing zero changes.*/int sqlite3session_isempty(sqlite3_session *pSession);/*** CAPI3REF: Create An Iterator To Traverse A Changeset **** Create an iterator used to iterate through the contents of a changeset.** If successful, *pp is set to point to the iterator handle and SQLITE_OK** is returned. Otherwise, if an error occurs, *pp is set to zero and an** SQLite error code is returned.**** The following functions can be used to advance and query a changeset ** iterator created by this function:**** <ul>** <li> [sqlite3changeset_next()]** <li> [sqlite3changeset_op()]** <li> [sqlite3changeset_new()]** <li> [sqlite3changeset_old()]** </ul>**** It is the responsibility of the caller to eventually destroy the iterator** by passing it to [sqlite3changeset_finalize()]. The buffer containing the** changeset (pChangeset) must remain valid until after the iterator is** destroyed.**** Assuming the changeset blob was created by one of the** [sqlite3session_changeset()], [sqlite3changeset_concat()] or** [sqlite3changeset_invert()] functions, all changes within the changeset ** that apply to a single table are grouped together. This means that when ** an application iterates through a changeset using an iterator created by ** this function, all changes that relate to a single table are visted ** consecutively. There is no chance that the iterator will visit a change ** the applies to table X, then one for table Y, and then later on visit ** another change for table X.*/int sqlite3changeset_start( sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ int nChangeset, /* Size of changeset blob in bytes */ void *pChangeset /* Pointer to blob containing changeset */);/*** CAPI3REF: Advance A Changeset Iterator**** This function may only be used with iterators created by function** [sqlite3changeset_start()]. If it is called on an iterator passed to** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE** is returned and the call has no effect.**** Immediately after an iterator is created by sqlite3changeset_start(), it** does not point to any change in the changeset. Assuming the changeset** is not empty, the first call to this function advances the iterator to** point to the first change in the changeset. Each subsequent call advances** the iterator to point to the next change in the changeset (if any). If** no error occurs and the iterator points to a valid change after a call** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned. ** Otherwise, if all changes in the changeset have already been visited,** SQLITE_DONE is returned.**** If an error occurs, an SQLite error code is returned. Possible error ** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or ** SQLITE_NOMEM.*/int sqlite3changeset_next(sqlite3_changeset_iter *pIter);/*** CAPI3REF: Obtain The Current Operation From A Changeset Iterator**** The pIter argument passed to this function may either be an iterator** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator** created by [sqlite3changeset_start()]. In the latter case, the most recent** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this** is not the case, this function returns [SQLITE_MISUSE].**** If argument pzTab is not NULL, then *pzTab is set to point to a** nul-terminated utf-8 encoded string containing the name of the table** affected by the current change. The buffer remains valid until either** sqlite3changeset_next() is called on the iterator or until the ** conflict-handler function returns. If pnCol is not NULL, then *pnCol is ** set to the number of columns in the table affected by the change. If** pbIncorrect is not NULL, then *pbIndirect is set to true (1) if the change** is an indirect change, or false (0) otherwise. See the documentation for** [sqlite3session_indirect()] for a description of direct and indirect** changes. Finally, if pOp is not NULL, then *pOp is set to one of ** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the ** type of change that the iterator currently points to.**** If no error occurs, SQLITE_OK is returned. If an error does occur, an** SQLite error code is returned. The values of the output variables may not** be trusted in this case.*/int sqlite3changeset_op( sqlite3_changeset_iter *pIter, /* Iterator object */ const char **pzTab, /* OUT: Pointer to table name */ int *pnCol, /* OUT: Number of columns in table */ int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */ int *pbIndirect /* OUT: True for an 'indirect' change */);/*** CAPI3REF: Obtain The Primary Key Definition Of A Table**** For each modified table, a changeset includes the following:**** <ul>** <li> The number of columns in the table, and** <li> Which of those columns make up the tables PRIMARY KEY.** </ul>**** This function is used to find which columns comprise the PRIMARY KEY of** the table modified by the change that iterator pIter currently points to.** If successful, *pabPK is set to point to an array of nCol entries, where** nCol is the number of columns in the table. Elements of *pabPK are set to** 0x01 if the corresponding column is part of the tables primary key, or** 0x00 if it is not.**** If argumet pnCol is not NULL, then *pnCol is set to the number of columns** in the table.**** If this function is called when the iterator does not point to a valid** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,** SQLITE_OK is returned and the output variables populated as described** above.*/int sqlite3changeset_pk( sqlite3_changeset_iter *pIter, /* Iterator object */ unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */ int *pnCol /* OUT: Number of entries in output array */);/*** CAPI3REF: Obtain old.* Values From A Changeset Iterator**** The pIter argument passed to this function may either be an iterator** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator** created by [sqlite3changeset_start()]. In the latter case, the most recent** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. ** Furthermore, it may only be called if the type of change that the iterator** currently points to is either [SQLITE_DELETE] or [SQLITE_UPDATE]. Otherwise,** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.**** Argument iVal must be greater than or equal to 0, and less than the number** of columns in the table affected by the current change. Otherwise,** [SQLITE_RANGE] is returned and *ppValue is set to NULL.**** If successful, this function sets *ppValue to point to a protected** sqlite3_value object containing the iVal'th value from the vector of ** original row values stored as part of the UPDATE or DELETE change and** returns SQLITE_OK. The name of the function comes from the fact that this ** is similar to the "old.*" columns available to update or delete triggers.**** If some other error occurs (e.g. an OOM condition), an SQLite error code** is returned and *ppValue is set to NULL.*/int sqlite3changeset_old( sqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */);/*** CAPI3REF: Obtain new.* Values From A Changeset Iterator**** The pIter argument passed to this function may either be an iterator** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator** created by [sqlite3changeset_start()]. In the latter case, the most recent** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. ** Furthermore, it may only be called if the type of change that the iterator** currently points to is either [SQLITE_UPDATE] or [SQLITE_INSERT]. Otherwise,** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.**** Argument iVal must be greater than or equal to 0, and less than the number** of columns in the table affected by the current change. Otherwise,** [SQLITE_RANGE] is returned and *ppValue is set to NULL.**** If successful, this function sets *ppValue to point to a protected** sqlite3_value object containing the iVal'th value from the vector of ** new row values stored as part of the UPDATE or INSERT change and** returns SQLITE_OK. If the change is an UPDATE and does not include** a new value for the requested column, *ppValue is set to NULL and ** SQLITE_OK returned. The name of the function comes from the fact that ** this is similar to the "new.*" columns available to update or delete ** triggers.**** If some other error occurs (e.g. an OOM condition), an SQLite error code** is returned and *ppValue is set to NULL.*/int sqlite3changeset_new( sqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */);/*** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator**** This function should only be used with iterator objects passed to a** conflict-handler callback by [sqlite3changeset_apply()] with either** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue** is set to NULL.**** Argument iVal must be greater than or equal to 0, and less than the number** of columns in the table affected by the current change. Otherwise,** [SQLITE_RANGE] is returned and *ppValue is set to NULL.**** If successful, this function sets *ppValue to point to a protected** sqlite3_value object containing the iVal'th value from the ** "conflicting row" associated with the current conflict-handler callback** and returns SQLITE_OK.**** If some other error occurs (e.g. an OOM condition), an SQLite error code** is returned and *ppValue is set to NULL.*/int sqlite3changeset_conflict( sqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ sqlite3_value **ppValue /* OUT: Value from conflicting row */);/*** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations**** This function may only be called with an iterator passed to an** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case** it sets the output variable to the total number of known foreign key** violations in the destination database and returns SQLITE_OK.**** In all other cases this function returns SQLITE_MISUSE.*/int sqlite3changeset_fk_conflicts( sqlite3_changeset_iter *pIter, /* Changeset iterator */ int *pnOut /* OUT: Number of FK violations */);/*** CAPI3REF: Finalize A Changeset Iterator**** This function is used to finalize an iterator allocated with** [sqlite3changeset_start()].**** This function should only be called on iterators created using the** [sqlite3changeset_start()] function. If an application calls this** function with an iterator passed to a conflict-handler by** [sqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the** call has no effect.**** If an error was encountered within a call to an sqlite3changeset_xxx()** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an ** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding** to that error is returned by this function. Otherwise, SQLITE_OK is** returned. This is to allow the following pattern (pseudo-code):**** sqlite3changeset_start();** while( SQLITE_ROW==sqlite3changeset_next() ){** // Do something with change.** }** rc = sqlite3changeset_finalize();** if( rc!=SQLITE_OK ){** // An error has occurred ** }*/int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);/*** CAPI3REF: Invert A Changeset**** This function is used to "invert" a changeset object. Applying an inverted** changeset to a database reverses the effects of applying the uninverted** changeset. Specifically:**** <ul>** <li> Each DELETE change is changed to an INSERT, and** <li> Each INSERT change is changed to a DELETE, and** <li> For each UPDATE change, the old.* and new.* values are exchanged.** </ul>**** This function does not change the order in which changes appear within** the changeset. It merely reverses the sense of each individual change.**** If successful, a pointer to a buffer containing the inverted changeset** is stored in *ppOut, the size of the same buffer is stored in *pnOut, and** SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are** zeroed and an SQLite error code returned.**** It is the responsibility of the caller to eventually call sqlite3_free()** on the *ppOut pointer to free the buffer allocation following a successful ** call to this function.**** WARNING/TODO: This function currently assumes that the input is a valid** changeset. If it is not, the results are undefined.*/int sqlite3changeset_invert( int nIn, const void *pIn, /* Input changeset */ int *pnOut, void **ppOut /* OUT: Inverse of input */);/*** CAPI3REF: Concatenate Two Changeset Objects**** This function is used to concatenate two changesets, A and B, into a ** single changeset. The result is a changeset equivalent to applying** changeset A followed by changeset B. **** This function combines the two input changesets using an ** sqlite3_changegroup object. Calling it produces similar results as the** following code fragment:**** sqlite3_changegroup *pGrp;** rc = sqlite3_changegroup_new(&pGrp);** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA);** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB);** if( rc==SQLITE_OK ){** rc = sqlite3changegroup_output(pGrp, pnOut, ppOut);** }else{** *ppOut = 0;** *pnOut = 0;** }**** Refer to the sqlite3_changegroup documentation below for details.*/int sqlite3changeset_concat( int nA, /* Number of bytes in buffer pA */ void *pA, /* Pointer to buffer containing changeset A */ int nB, /* Number of bytes in buffer pB */ void *pB, /* Pointer to buffer containing changeset B */ int *pnOut, /* OUT: Number of bytes in output changeset */ void **ppOut /* OUT: Buffer containing output changeset */);/*** Changegroup handle.*/typedef struct sqlite3_changegroup sqlite3_changegroup;/*** CAPI3REF: Combine two or more changesets into a single changeset.**** An sqlite3_changegroup object is used to combine two or more changesets** (or patchsets) into a single changeset (or patchset). A single changegroup** object may combine changesets or patchsets, but not both. The output is** always in the same format as the input.**** If successful, this function returns SQLITE_OK and populates (*pp) with** a pointer to a new sqlite3_changegroup object before returning. The caller** should eventually free the returned object using a call to ** sqlite3changegroup_delete(). If an error occurs, an SQLite error code** (i.e. SQLITE_NOMEM) is returned and *pp is set to NULL.**** The usual usage pattern for an sqlite3_changegroup object is as follows:**** <ul>** <li> It is created using a call to sqlite3changegroup_new().**** <li> Zero or more changesets (or patchsets) are added to the object** by calling sqlite3changegroup_add().**** <li> The result of combining all input changesets together is obtained ** by the application via a call to sqlite3changegroup_output().**** <li> The object is deleted using a call to sqlite3changegroup_delete().** </ul>**** Any number of calls to add() and output() may be made between the calls to** new() and delete(), and in any order.**** As well as the regular sqlite3changegroup_add() and ** sqlite3changegroup_output() functions, also available are the streaming** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm().*/int sqlite3changegroup_new(sqlite3_changegroup **pp);/*** Add all changes within the changeset (or patchset) in buffer pData (size** nData bytes) to the changegroup. **** If the buffer contains a patchset, then all prior calls to this function** on the same changegroup object must also have specified patchsets. Or, if** the buffer contains a changeset, so must have the earlier calls to this** function. Otherwise, SQLITE_ERROR is returned and no changes are added** to the changegroup.**** Rows within the changeset and changegroup are identified by the values in** their PRIMARY KEY columns. A change in the changeset is considered to** apply to the same row as a change already present in the changegroup if** the two rows have the same primary key.**** Changes to rows that that do not already appear in the changegroup are** simply copied into it. Or, if both the new changeset and the changegroup** contain changes that apply to a single row, the final contents of the** changegroup depends on the type of each change, as follows:**** <table border=1 style="margin-left:8ex;margin-right:8ex">** <tr><th style="white-space:pre">Existing Change </th>** <th style="white-space:pre">New Change </th>** <th>Output Change** <tr><td>INSERT <td>INSERT <td>** The new change is ignored. This case does not occur if the new** changeset was recorded immediately after the changesets already** added to the changegroup.** <tr><td>INSERT <td>UPDATE <td>** The INSERT change remains in the changegroup. The values in the ** INSERT change are modified as if the row was inserted by the** existing change and then updated according to the new change.** <tr><td>INSERT <td>DELETE <td>** The existing INSERT is removed from the changegroup. The DELETE is** not added.** <tr><td>UPDATE <td>INSERT <td>** The new change is ignored. This case does not occur if the new** changeset was recorded immediately after the changesets already** added to the changegroup.** <tr><td>UPDATE <td>UPDATE <td>** The existing UPDATE remains within the changegroup. It is amended ** so that the accompanying values are as if the row was updated once ** by the existing change and then again by the new change.** <tr><td>UPDATE <td>DELETE <td>** The existing UPDATE is replaced by the new DELETE within the** changegroup.** <tr><td>DELETE <td>INSERT <td>** If one or more of the column values in the row inserted by the** new change differ from those in the row deleted by the existing ** change, the existing DELETE is replaced by an UPDATE within the** changegroup. Otherwise, if the inserted row is exactly the same ** as the deleted row, the existing DELETE is simply discarded.** <tr><td>DELETE <td>UPDATE <td>** The new change is ignored. This case does not occur if the new** changeset was recorded immediately after the changesets already** added to the changegroup.** <tr><td>DELETE <td>DELETE <td>** The new change is ignored. This case does not occur if the new** changeset was recorded immediately after the changesets already** added to the changegroup.** </table>**** If the new changeset contains changes to a table that is already present** in the changegroup, then the number of columns and the position of the** primary key columns for the table must be consistent. If this is not the** case, this function fails with SQLITE_SCHEMA. If the input changeset** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is** returned. Or, if an out-of-memory condition occurs during processing, this** function returns SQLITE_NOMEM. In all cases, if an error occurs the** final contents of the changegroup is undefined.**** If no error occurs, SQLITE_OK is returned.*/int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);/*** Obtain a buffer containing a changeset (or patchset) representing the** current contents of the changegroup. If the inputs to the changegroup** were themselves changesets, the output is a changeset. Or, if the** inputs were patchsets, the output is also a patchset.**** As with the output of the sqlite3session_changeset() and** sqlite3session_patchset() functions, all changes related to a single** table are grouped together in the output of this function. Tables appear** in the same order as for the very first changeset added to the changegroup.** If the second or subsequent changesets added to the changegroup contain** changes for tables that do not appear in the first changeset, they are** appended onto the end of the output changeset, again in the order in** which they are first encountered.**** If an error occurs, an SQLite error code is returned and the output** variables (*pnData) and (*ppData) are set to 0. Otherwise, SQLITE_OK** is returned and the output variables are set to the size of and a ** pointer to the output buffer, respectively. In this case it is the** responsibility of the caller to eventually free the buffer using a** call to sqlite3_free().*/int sqlite3changegroup_output( sqlite3_changegroup*, int *pnData, /* OUT: Size of output buffer in bytes */ void **ppData /* OUT: Pointer to output buffer */);/*** Delete a changegroup object.*/void sqlite3changegroup_delete(sqlite3_changegroup*);/*** CAPI3REF: Apply A Changeset To A Database**** Apply a changeset to a database. This function attempts to update the** "main" database attached to handle db with the changes found in the** changeset passed via the second and third arguments.**** The fourth argument (xFilter) passed to this function is the "filter** callback". If it is not NULL, then for each table affected by at least one** change in the changeset, the filter callback is invoked with** the table name as the second argument, and a copy of the context pointer** passed as the sixth argument to this function as the first. If the "filter** callback" returns zero, then no attempt is made to apply any changes to ** the table. Otherwise, if the return value is non-zero or the xFilter** argument to this function is NULL, all changes related to the table are** attempted.**** For each table that is not excluded by the filter callback, this function ** tests that the target database contains a compatible table. A table is ** considered compatible if all of the following are true:**** <ul>** <li> The table has the same name as the name recorded in the ** changeset, and** <li> The table has the same number of columns as recorded in the ** changeset, and** <li> The table has primary key columns in the same position as ** recorded in the changeset.** </ul>**** If there is no compatible table, it is not an error, but none of the** changes associated with the table are applied. A warning message is issued** via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most** one such warning is issued for each table in the changeset.**** For each change for which there is a compatible table, an attempt is made ** to modify the table contents according to the UPDATE, INSERT or DELETE ** change. If a change cannot be applied cleanly, the conflict handler ** function passed as the fifth argument to sqlite3changeset_apply() may be ** invoked. A description of exactly when the conflict handler is invoked for ** each type of change is below.**** Unlike the xFilter argument, xConflict may not be passed NULL. The results** of passing anything other than a valid function pointer as the xConflict** argument are undefined.**** Each time the conflict handler function is invoked, it must return one** of [SQLITE_CHANGESET_OMIT], [SQLITE_CHANGESET_ABORT] or ** [SQLITE_CHANGESET_REPLACE]. SQLITE_CHANGESET_REPLACE may only be returned** if the second argument passed to the conflict handler is either** SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler** returns an illegal value, any changes already made are rolled back and** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different ** actions are taken by sqlite3changeset_apply() depending on the value** returned by each invocation of the conflict-handler function. Refer to** the documentation for the three ** [SQLITE_CHANGESET_OMIT|available return values] for details.**** <dl>** <dt>DELETE Changes<dd>** For each DELETE change, this function checks if the target database ** contains a row with the same primary key value (or values) as the ** original row values stored in the changeset. If it does, and the values ** stored in all non-primary key columns also match the values stored in ** the changeset the row is deleted from the target database.**** If a row with matching primary key values is found, but one or more of** the non-primary key fields contains a value different from the original** row value stored in the changeset, the conflict-handler function is** invoked with [SQLITE_CHANGESET_DATA] as the second argument.**** If no row with matching primary key values is found in the database,** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]** passed as the second argument.**** If the DELETE operation is attempted, but SQLite returns SQLITE_CONSTRAINT** (which can only happen if a foreign key constraint is violated), the** conflict-handler function is invoked with [SQLITE_CHANGESET_CONSTRAINT]** passed as the second argument. This includes the case where the DELETE** operation is attempted because an earlier call to the conflict handler** function returned [SQLITE_CHANGESET_REPLACE].**** <dt>INSERT Changes<dd>** For each INSERT change, an attempt is made to insert the new row into** the database.**** If the attempt to insert the row fails because the database already ** contains a row with the same primary key values, the conflict handler** function is invoked with the second argument set to ** [SQLITE_CHANGESET_CONFLICT].**** If the attempt to insert the row fails because of some other constraint** violation (e.g. NOT NULL or UNIQUE), the conflict handler function is ** invoked with the second argument set to [SQLITE_CHANGESET_CONSTRAINT].** This includes the case where the INSERT operation is re-attempted because ** an earlier call to the conflict handler function returned ** [SQLITE_CHANGESET_REPLACE].**** <dt>UPDATE Changes<dd>** For each UPDATE change, this function checks if the target database ** contains a row with the same primary key value (or values) as the ** original row values stored in the changeset. If it does, and the values ** stored in all non-primary key columns also match the values stored in ** the changeset the row is updated within the target database.**** If a row with matching primary key values is found, but one or more of** the non-primary key fields contains a value different from an original** row value stored in the changeset, the conflict-handler function is** invoked with [SQLITE_CHANGESET_DATA] as the second argument. Since** UPDATE changes only contain values for non-primary key fields that are** to be modified, only those fields need to match the original values to** avoid the SQLITE_CHANGESET_DATA conflict-handler callback.**** If no row with matching primary key values is found in the database,** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]** passed as the second argument.**** If the UPDATE operation is attempted, but SQLite returns ** SQLITE_CONSTRAINT, the conflict-handler function is invoked with ** [SQLITE_CHANGESET_CONSTRAINT] passed as the second argument.** This includes the case where the UPDATE operation is attempted after ** an earlier call to the conflict handler function returned** [SQLITE_CHANGESET_REPLACE]. ** </dl>**** It is safe to execute SQL statements, including those that write to the** table that the callback related to, from within the xConflict callback.** This can be used to further customize the applications conflict** resolution strategy.**** All changes made by this function are enclosed in a savepoint transaction.** If any other error (aside from a constraint failure when attempting to** write to the target database) occurs, then the savepoint transaction is** rolled back, restoring the target database to its original state, and an ** SQLite error code returned.*/int sqlite3changeset_apply( sqlite3 *db, /* Apply change to "main" db of this handle */ int nChangeset, /* Size of changeset in bytes */ void *pChangeset, /* Changeset blob */ int(*xFilter)( void *pCtx, /* Copy of sixth arg to _apply() */ const char *zTab /* Table name */ ), int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ sqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx /* First argument passed to xConflict */);/* ** CAPI3REF: Constants Passed To The Conflict Handler**** Values that may be passed as the second argument to a conflict-handler.**** <dl>** <dt>SQLITE_CHANGESET_DATA<dd>** The conflict handler is invoked with CHANGESET_DATA as the second argument** when processing a DELETE or UPDATE change if a row with the required** PRIMARY KEY fields is present in the database, but one or more other ** (non primary-key) fields modified by the update do not contain the ** expected "before" values.** ** The conflicting row, in this case, is the database row with the matching** primary key.** ** <dt>SQLITE_CHANGESET_NOTFOUND<dd>** The conflict handler is invoked with CHANGESET_NOTFOUND as the second** argument when processing a DELETE or UPDATE change if a row with the** required PRIMARY KEY fields is not present in the database.** ** There is no conflicting row in this case. The results of invoking the** sqlite3changeset_conflict() API are undefined.** ** <dt>SQLITE_CHANGESET_CONFLICT<dd>** CHANGESET_CONFLICT is passed as the second argument to the conflict** handler while processing an INSERT change if the operation would result ** in duplicate primary key values.** ** The conflicting row in this case is the database row with the matching** primary key.**** <dt>SQLITE_CHANGESET_FOREIGN_KEY<dd>** If foreign key handling is enabled, and applying a changeset leaves the** database in a state containing foreign key violations, the conflict ** handler is invoked with CHANGESET_FOREIGN_KEY as the second argument** exactly once before the changeset is committed. If the conflict handler** returns CHANGESET_OMIT, the changes, including those that caused the** foreign key constraint violation, are committed. Or, if it returns** CHANGESET_ABORT, the changeset is rolled back.**** No current or conflicting row information is provided. The only function** it is possible to call on the supplied sqlite3_changeset_iter handle** is sqlite3changeset_fk_conflicts().** ** <dt>SQLITE_CHANGESET_CONSTRAINT<dd>** If any other constraint violation occurs while applying a change (i.e. ** a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is ** invoked with CHANGESET_CONSTRAINT as the second argument.** ** There is no conflicting row in this case. The results of invoking the** sqlite3changeset_conflict() API are undefined.**** </dl>*/#define SQLITE_CHANGESET_DATA 1#define SQLITE_CHANGESET_NOTFOUND 2#define SQLITE_CHANGESET_CONFLICT 3#define SQLITE_CHANGESET_CONSTRAINT 4#define SQLITE_CHANGESET_FOREIGN_KEY 5/* ** CAPI3REF: Constants Returned By The Conflict Handler**** A conflict handler callback must return one of the following three values.**** <dl>** <dt>SQLITE_CHANGESET_OMIT<dd>** If a conflict handler returns this value no special action is taken. The** change that caused the conflict is not applied. The session module ** continues to the next change in the changeset.**** <dt>SQLITE_CHANGESET_REPLACE<dd>** This value may only be returned if the second argument to the conflict** handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this** is not the case, any changes applied so far are rolled back and the ** call to sqlite3changeset_apply() returns SQLITE_MISUSE.**** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict** handler, then the conflicting row is either updated or deleted, depending** on the type of change.**** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict** handler, then the conflicting row is removed from the database and a** second attempt to apply the change is made. If this second attempt fails,** the original row is restored to the database before continuing.**** <dt>SQLITE_CHANGESET_ABORT<dd>** If this value is returned, any changes applied so far are rolled back ** and the call to sqlite3changeset_apply() returns SQLITE_ABORT.** </dl>*/#define SQLITE_CHANGESET_OMIT 0#define SQLITE_CHANGESET_REPLACE 1#define SQLITE_CHANGESET_ABORT 2/*** CAPI3REF: Streaming Versions of API functions.**** The six streaming API xxx_strm() functions serve similar purposes to the ** corresponding non-streaming API functions:**** <table border=1 style="margin-left:8ex;margin-right:8ex">** <tr><th>Streaming function<th>Non-streaming equivalent</th>** <tr><td>sqlite3changeset_apply_str<td>[sqlite3changeset_apply] ** <tr><td>sqlite3changeset_concat_str<td>[sqlite3changeset_concat] ** <tr><td>sqlite3changeset_invert_str<td>[sqlite3changeset_invert] ** <tr><td>sqlite3changeset_start_str<td>[sqlite3changeset_start] ** <tr><td>sqlite3session_changeset_str<td>[sqlite3session_changeset] ** <tr><td>sqlite3session_patchset_str<td>[sqlite3session_patchset] ** </table>**** Non-streaming functions that accept changesets (or patchsets) as input** require that the entire changeset be stored in a single buffer in memory. ** Similarly, those that return a changeset or patchset do so by returning ** a pointer to a single large buffer allocated using sqlite3_malloc(). ** Normally this is convenient. However, if an application running in a ** low-memory environment is required to handle very large changesets, the** large contiguous memory allocations required can become onerous.**** In order to avoid this problem, instead of a single large buffer, input** is passed to a streaming API functions by way of a callback function that** the sessions module invokes to incrementally request input data as it is** required. In all cases, a pair of API function parameters such as**** <pre>** &nbsp; int nChangeset,** &nbsp; void *pChangeset,** </pre>**** Is replaced by:**** <pre>** &nbsp; int (*xInput)(void *pIn, void *pData, int *pnData),** &nbsp; void *pIn,** </pre>**** Each time the xInput callback is invoked by the sessions module, the first** argument passed is a copy of the supplied pIn context pointer. The second ** argument, pData, points to a buffer (*pnData) bytes in size. Assuming no ** error occurs the xInput method should copy up to (*pnData) bytes of data ** into the buffer and set (*pnData) to the actual number of bytes copied ** before returning SQLITE_OK. If the input is completely exhausted, (*pnData) ** should be set to zero to indicate this. Or, if an error occurs, an SQLite ** error code should be returned. In all cases, if an xInput callback returns** an error, all processing is abandoned and the streaming API function** returns a copy of the error code to the caller.**** In the case of sqlite3changeset_start_strm(), the xInput callback may be** invoked by the sessions module at any point during the lifetime of the** iterator. If such an xInput callback returns an error, the iterator enters** an error state, whereby all subsequent calls to iterator functions ** immediately fail with the same error code as returned by xInput.**** Similarly, streaming API functions that return changesets (or patchsets)** return them in chunks by way of a callback function instead of via a** pointer to a single large buffer. In this case, a pair of parameters such** as:**** <pre>** &nbsp; int *pnChangeset,** &nbsp; void **ppChangeset,** </pre>**** Is replaced by:**** <pre>** &nbsp; int (*xOutput)(void *pOut, const void *pData, int nData),** &nbsp; void *pOut** </pre>**** The xOutput callback is invoked zero or more times to return data to** the application. The first parameter passed to each call is a copy of the** pOut pointer supplied by the application. The second parameter, pData,** points to a buffer nData bytes in size containing the chunk of output** data being returned. If the xOutput callback successfully processes the** supplied data, it should return SQLITE_OK to indicate success. Otherwise,** it should return some other SQLite error code. In this case processing** is immediately abandoned and the streaming API function returns a copy** of the xOutput error code to the application.**** The sessions module never invokes an xOutput callback with the third ** parameter set to a value less than or equal to zero. Other than this,** no guarantees are made as to the size of the chunks of data returned.*/int sqlite3changeset_apply_strm( sqlite3 *db, /* Apply change to "main" db of this handle */ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ void *pIn, /* First arg for xInput */ int(*xFilter)( void *pCtx, /* Copy of sixth arg to _apply() */ const char *zTab /* Table name */ ), int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ sqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx /* First argument passed to xConflict */);int sqlite3changeset_concat_strm( int (*xInputA)(void *pIn, void *pData, int *pnData), void *pInA, int (*xInputB)(void *pIn, void *pData, int *pnData), void *pInB, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut);int sqlite3changeset_invert_strm( int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut);int sqlite3changeset_start_strm( sqlite3_changeset_iter **pp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn);int sqlite3session_changeset_strm( sqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut);int sqlite3session_patchset_strm( sqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut);int sqlite3changegroup_add_strm(sqlite3_changegroup*, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn);int sqlite3changegroup_output_strm(sqlite3_changegroup*, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut);/*** Make sure we can call this stuff from C++.*/#ifdef __cplusplus}#endif#endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) *//******** End of sqlite3session.h *********//******** Begin file fts5.h *********/
/*
** 2014 May 31
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
................................................................................
** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback):
** This API function is used to query the FTS table for phrase iPhrase
** of the current query. Specifically, a query equivalent to:
**
** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
**
** with $p set to a phrase equivalent to the phrase iPhrase of the
** current query is executed. Any column filter that applies to** phrase iPhrase of the current query is included in $p. For each
** row visited, the callback function passed as the fourth argument
** is invoked. The context and API objects passed to the callback
** function may be used to access the properties of each matched row.
** Invoking Api.xUserData() returns a copy of the pointer passed as
** the third argument to pUserData.
**
** If the callback function returns any value other than SQLITE_OK, the
** query is abandoned and the xQueryPhrase function returns immediately.
** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
** Otherwise, the error code is propagated upwards.
**
** If the query runs to completion without incident, SQLITE_OK is returned.
................................................................................
#ifdef __cplusplus
} /* end of the 'extern "C"' block */
#endif
#endif /* _FTS5_H */
/******** End of fts5.h *********/