poppler 3.0.7-x86-mingw32 → 3.0.8-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +6 -6
- data/ext/poppler/extconf.rb +1 -0
- data/ext/poppler/rbpoppler.c +0 -1
- data/lib/2.2/poppler.so +0 -0
- data/lib/2.3/poppler.so +0 -0
- data/lib/poppler.rb +1 -1
- data/test/poppler-test-utils.rb +1 -1
- data/vendor/local/bin/cjpeg.exe +0 -0
- data/vendor/local/bin/djpeg.exe +0 -0
- data/vendor/local/bin/jpegtran.exe +0 -0
- data/vendor/local/bin/libjpeg-9.dll +0 -0
- data/vendor/local/bin/libopenjp2.dll +0 -0
- data/vendor/local/bin/{libpoppler-55.dll → libpoppler-59.dll} +0 -0
- data/vendor/local/bin/libpoppler-cpp-0.dll +0 -0
- data/vendor/local/bin/libpoppler-glib-8.dll +0 -0
- data/vendor/local/bin/libsqlite3-0.dll +0 -0
- data/vendor/local/bin/opj_compress.exe +0 -0
- data/vendor/local/bin/opj_decompress.exe +0 -0
- data/vendor/local/bin/opj_dump.exe +0 -0
- data/vendor/local/bin/pdfdetach.exe +0 -0
- data/vendor/local/bin/pdffonts.exe +0 -0
- data/vendor/local/bin/pdfimages.exe +0 -0
- data/vendor/local/bin/pdfinfo.exe +0 -0
- data/vendor/local/bin/pdfseparate.exe +0 -0
- data/vendor/local/bin/pdftocairo.exe +0 -0
- data/vendor/local/bin/pdftohtml.exe +0 -0
- data/vendor/local/bin/pdftoppm.exe +0 -0
- data/vendor/local/bin/pdftops.exe +0 -0
- data/vendor/local/bin/pdftotext.exe +0 -0
- data/vendor/local/bin/pdfunite.exe +0 -0
- data/vendor/local/bin/rdjpgcom.exe +0 -0
- data/vendor/local/bin/sqlite3.exe +0 -0
- data/vendor/local/bin/wrjpgcom.exe +0 -0
- data/vendor/local/include/jpeglib.h +3 -3
- data/vendor/local/include/poppler/cpp/poppler-version.h +2 -2
- data/vendor/local/include/poppler/glib/poppler-enums.h +0 -2
- data/vendor/local/include/poppler/glib/poppler-features.h +1 -1
- data/vendor/local/include/poppler/glib/poppler-page.h +1 -0
- data/vendor/local/include/poppler/glib/poppler.h +0 -8
- data/vendor/local/include/sqlite3.h +923 -50
- data/vendor/local/include/sqlite3ext.h +22 -3
- data/vendor/local/lib/girepository-1.0/Poppler-0.18.typelib +0 -0
- data/vendor/local/lib/libjpeg.a +0 -0
- data/vendor/local/lib/libjpeg.dll.a +0 -0
- data/vendor/local/lib/libjpeg.la +4 -4
- data/vendor/local/lib/libopenjp2.dll.a +0 -0
- data/vendor/local/lib/libpoppler-cpp.a +0 -0
- data/vendor/local/lib/libpoppler-cpp.dll.a +0 -0
- data/vendor/local/lib/libpoppler-cpp.la +2 -2
- data/vendor/local/lib/libpoppler-glib.a +0 -0
- data/vendor/local/lib/libpoppler-glib.dll.a +0 -0
- data/vendor/local/lib/libpoppler-glib.la +3 -3
- data/vendor/local/lib/libpoppler.a +0 -0
- data/vendor/local/lib/libpoppler.dll.a +0 -0
- data/vendor/local/lib/libpoppler.la +4 -4
- data/vendor/local/lib/libsqlite3.a +0 -0
- data/vendor/local/lib/libsqlite3.dll.a +0 -0
- data/vendor/local/lib/libsqlite3.la +2 -2
- data/vendor/local/lib/openjpeg-2.1/OpenJPEGTargets-noconfig.cmake +1 -1
- data/vendor/local/lib/openjpeg-2.1/OpenJPEGTargets.cmake +1 -1
- data/vendor/local/lib/pkgconfig/poppler-cairo.pc +2 -2
- data/vendor/local/lib/pkgconfig/poppler-cpp.pc +2 -2
- data/vendor/local/lib/pkgconfig/poppler-glib.pc +2 -2
- data/vendor/local/lib/pkgconfig/poppler-splash.pc +2 -2
- data/vendor/local/lib/pkgconfig/poppler.pc +1 -1
- data/vendor/local/lib/pkgconfig/sqlite3.pc +1 -1
- data/vendor/local/share/gir-1.0/Poppler-0.18.gir +27 -36
- data/vendor/local/share/gtk-doc/html/poppler/PopplerAnnot.html +228 -263
- data/vendor/local/share/gtk-doc/html/poppler/PopplerAttachment.html +16 -20
- data/vendor/local/share/gtk-doc/html/poppler/PopplerDocument.html +235 -289
- data/vendor/local/share/gtk-doc/html/poppler/PopplerFormField.html +105 -129
- data/vendor/local/share/gtk-doc/html/poppler/PopplerLayer.html +28 -33
- data/vendor/local/share/gtk-doc/html/poppler/PopplerMedia.html +31 -38
- data/vendor/local/share/gtk-doc/html/poppler/PopplerMovie.html +18 -22
- data/vendor/local/share/gtk-doc/html/poppler/PopplerPage.html +201 -222
- data/vendor/local/share/gtk-doc/html/poppler/PopplerStructureElement.html +310 -356
- data/vendor/local/share/gtk-doc/html/poppler/annotation-glossary.html +4 -5
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-12.html +4 -5
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-14.html +4 -5
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-16.html +4 -5
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-18.html +4 -5
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-20.html +4 -5
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-22.html +4 -5
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-26.html +4 -5
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-33.html +4 -5
- data/vendor/local/share/gtk-doc/html/poppler/api-index-deprecated.html +4 -5
- data/vendor/local/share/gtk-doc/html/poppler/api-index-full.html +7 -15
- data/vendor/local/share/gtk-doc/html/poppler/ch01.html +9 -10
- data/vendor/local/share/gtk-doc/html/poppler/index.html +7 -8
- data/vendor/local/share/gtk-doc/html/poppler/index.sgml +298 -10
- data/vendor/local/share/gtk-doc/html/poppler/left-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/left.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/{poppler-poppler.html → poppler-Error-handling.html} +26 -63
- data/vendor/local/share/gtk-doc/html/poppler/poppler-PDF-Utility-functions.html +9 -11
- data/vendor/local/share/gtk-doc/html/poppler/poppler-PopplerAction.html +40 -43
- data/vendor/local/share/gtk-doc/html/poppler/poppler-PopplerColor.html +19 -22
- data/vendor/local/share/gtk-doc/html/poppler/poppler-Version-and-Features-Information.html +13 -17
- data/vendor/local/share/gtk-doc/html/poppler/poppler.devhelp2 +294 -6
- data/vendor/local/share/gtk-doc/html/poppler/right.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/style.css +9 -6
- data/vendor/local/share/gtk-doc/html/poppler/up-insensitive.png +0 -0
- data/vendor/local/share/man/man1/cjpeg.1 +2 -2
- data/vendor/local/share/man/man1/djpeg.1 +14 -9
- data/vendor/local/share/man/man1/jpegtran.1 +17 -7
- data/vendor/local/share/man/man1/pdfdetach.1 +4 -1
- data/vendor/local/share/man/man1/pdffonts.1 +3 -0
- data/vendor/local/share/man/man1/pdfimages.1 +4 -1
- data/vendor/local/share/man/man1/pdfinfo.1 +15 -3
- data/vendor/local/share/man/man1/pdfseparate.1 +11 -1
- data/vendor/local/share/man/man1/pdftocairo.1 +8 -4
- data/vendor/local/share/man/man1/pdftohtml.1 +3 -0
- data/vendor/local/share/man/man1/pdftoppm.1 +3 -0
- data/vendor/local/share/man/man1/pdftops.1 +3 -0
- data/vendor/local/share/man/man1/pdftotext.1 +4 -1
- data/vendor/local/share/man/man1/pdfunite.1 +11 -1
- metadata +8 -9
- data/lib/2.0/poppler.so +0 -0
- data/lib/2.1/poppler.so +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a7bea49a07a01a9e3834b67f6ede5d047bb2ba1
|
4
|
+
data.tar.gz: ac1df09902c61b8d87cba1f3de9987c5ff737a96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3861b8d6ece9a12c556a999822bad180a9ce59c06a630df0a4135a6dd1a9721bb4fcb9455cb8fe9f42e0ca89cc70754aba3a2f9c8120f0cf4569c1fadc72da38
|
7
|
+
data.tar.gz: bf67a5a340bdc18b80b8327062ca61c30c0ef1dd719535302be812a5fa84ee9900b48a6f0c11bdd124aa03e24dea9ee0e073d575974481d1e929ffd1932119e2
|
data/Rakefile
CHANGED
@@ -36,8 +36,8 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
36
36
|
package.external_packages = [
|
37
37
|
{
|
38
38
|
:name => "libjpeg",
|
39
|
-
:base_name => "jpeg-
|
40
|
-
:archive_base_name => "jpegsrc.
|
39
|
+
:base_name => "jpeg-9b",
|
40
|
+
:archive_base_name => "jpegsrc.v9b.tar.gz",
|
41
41
|
:download_base_url => "http://www.ijg.org/files",
|
42
42
|
:label => "libjpeg",
|
43
43
|
:windows => {
|
@@ -47,9 +47,9 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
47
47
|
},
|
48
48
|
{
|
49
49
|
:name => "sqlite-autoconf",
|
50
|
-
:download_base_url => "http://www.sqlite.org/
|
50
|
+
:download_base_url => "http://www.sqlite.org/2016",
|
51
51
|
:label => "SQLite",
|
52
|
-
:version => "
|
52
|
+
:version => "3120000",
|
53
53
|
:compression_method => "gz",
|
54
54
|
:windows => {
|
55
55
|
:configure_args => [],
|
@@ -71,9 +71,9 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
71
71
|
},
|
72
72
|
{
|
73
73
|
:name => "poppler",
|
74
|
-
:download_base_url => "
|
74
|
+
:download_base_url => "https://poppler.freedesktop.org",
|
75
75
|
:label => "Poppler",
|
76
|
-
:version => "0.
|
76
|
+
:version => "0.42.0",
|
77
77
|
:compression_method => "xz",
|
78
78
|
:windows => {
|
79
79
|
:configure_args => [
|
data/ext/poppler/extconf.rb
CHANGED
data/ext/poppler/rbpoppler.c
CHANGED
@@ -56,7 +56,6 @@ Init_poppler(void)
|
|
56
56
|
INT2FIX(POPPLER_MICRO_VERSION)));
|
57
57
|
|
58
58
|
G_DEF_CLASS(POPPLER_TYPE_ERROR, "Error", RG_TARGET_NAMESPACE);
|
59
|
-
G_DEF_CLASS(POPPLER_TYPE_ORIENTATION, "Orientation", RG_TARGET_NAMESPACE);
|
60
59
|
|
61
60
|
G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION_TYPE,
|
62
61
|
"PageTransitionType", RG_TARGET_NAMESPACE);
|
data/lib/2.2/poppler.so
CHANGED
Binary file
|
data/lib/2.3/poppler.so
ADDED
Binary file
|
data/lib/poppler.rb
CHANGED
data/test/poppler-test-utils.rb
CHANGED
@@ -22,7 +22,7 @@ module PopplerTestUtils
|
|
22
22
|
def form_pdf
|
23
23
|
file = File.join(fixtures_dir, "form.pdf")
|
24
24
|
return file if File.exist?(file)
|
25
|
-
pdf = open("
|
25
|
+
pdf = open("https://www.irs.gov/pub/irs-pdf/fw9.pdf").read
|
26
26
|
File.open(file, "wb") do |output|
|
27
27
|
output.print(pdf)
|
28
28
|
end
|
data/vendor/local/bin/cjpeg.exe
CHANGED
Binary file
|
data/vendor/local/bin/djpeg.exe
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* jpeglib.h
|
3
3
|
*
|
4
4
|
* Copyright (C) 1991-1998, Thomas G. Lane.
|
5
|
-
* Modified 2002-
|
5
|
+
* Modified 2002-2015 by Guido Vollbeding.
|
6
6
|
* This file is part of the Independent JPEG Group's software.
|
7
7
|
* For conditions of distribution and use, see the accompanying README file.
|
8
8
|
*
|
@@ -39,7 +39,7 @@ extern "C" {
|
|
39
39
|
|
40
40
|
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
|
41
41
|
#define JPEG_LIB_VERSION_MAJOR 9
|
42
|
-
#define JPEG_LIB_VERSION_MINOR
|
42
|
+
#define JPEG_LIB_VERSION_MINOR 2
|
43
43
|
|
44
44
|
|
45
45
|
/* Various constants determining the sizes of things.
|
@@ -979,7 +979,7 @@ EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
|
|
979
979
|
unsigned char ** outbuffer,
|
980
980
|
unsigned long * outsize));
|
981
981
|
EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo,
|
982
|
-
unsigned char * inbuffer,
|
982
|
+
const unsigned char * inbuffer,
|
983
983
|
unsigned long insize));
|
984
984
|
|
985
985
|
/* Default parameter setup for compression */
|
@@ -21,9 +21,9 @@
|
|
21
21
|
|
22
22
|
#include "poppler-global.h"
|
23
23
|
|
24
|
-
#define POPPLER_VERSION "0.
|
24
|
+
#define POPPLER_VERSION "0.42.0"
|
25
25
|
#define POPPLER_VERSION_MAJOR 0
|
26
|
-
#define POPPLER_VERSION_MINOR
|
26
|
+
#define POPPLER_VERSION_MINOR 42
|
27
27
|
#define POPPLER_VERSION_MICRO 0
|
28
28
|
|
29
29
|
namespace poppler
|
@@ -92,8 +92,6 @@ GType poppler_structure_table_scope_get_type (void) G_GNUC_CONST;
|
|
92
92
|
/* enumerations from "poppler.h" */
|
93
93
|
GType poppler_error_get_type (void) G_GNUC_CONST;
|
94
94
|
#define POPPLER_TYPE_ERROR (poppler_error_get_type ())
|
95
|
-
GType poppler_orientation_get_type (void) G_GNUC_CONST;
|
96
|
-
#define POPPLER_TYPE_ORIENTATION (poppler_orientation_get_type ())
|
97
95
|
GType poppler_page_transition_type_get_type (void) G_GNUC_CONST;
|
98
96
|
#define POPPLER_TYPE_PAGE_TRANSITION_TYPE (poppler_page_transition_type_get_type ())
|
99
97
|
GType poppler_page_transition_alignment_get_type (void) G_GNUC_CONST;
|
@@ -46,14 +46,6 @@ typedef enum
|
|
46
46
|
POPPLER_ERROR_DAMAGED
|
47
47
|
} PopplerError;
|
48
48
|
|
49
|
-
typedef enum
|
50
|
-
{
|
51
|
-
POPPLER_ORIENTATION_PORTRAIT,
|
52
|
-
POPPLER_ORIENTATION_LANDSCAPE,
|
53
|
-
POPPLER_ORIENTATION_UPSIDEDOWN,
|
54
|
-
POPPLER_ORIENTATION_SEASCAPE
|
55
|
-
} PopplerOrientation;
|
56
|
-
|
57
49
|
/**
|
58
50
|
* PopplerPageTransitionType:
|
59
51
|
* @POPPLER_PAGE_TRANSITION_REPLACE: the new page replace the old one
|
@@ -111,9 +111,9 @@ extern "C" {
|
|
111
111
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
112
112
|
** [sqlite_version()] and [sqlite_source_id()].
|
113
113
|
*/
|
114
|
-
#define SQLITE_VERSION "3.
|
115
|
-
#define SQLITE_VERSION_NUMBER
|
116
|
-
#define SQLITE_SOURCE_ID "
|
114
|
+
#define SQLITE_VERSION "3.12.0"
|
115
|
+
#define SQLITE_VERSION_NUMBER 3012000
|
116
|
+
#define SQLITE_SOURCE_ID "2016-03-29 10:14:15 e9bb4cf40f4971974a74468ef922bdee481c988b"
|
117
117
|
|
118
118
|
/*
|
119
119
|
** CAPI3REF: Run-Time Library Version Numbers
|
@@ -124,7 +124,7 @@ extern "C" {
|
|
124
124
|
** but are associated with the library instead of the header file. ^(Cautious
|
125
125
|
** programmers might include assert() statements in their application to
|
126
126
|
** verify that values returned by these interfaces match the macros in
|
127
|
-
** the header, and thus
|
127
|
+
** the header, and thus ensure that the application is
|
128
128
|
** compiled with matching library and header files.
|
129
129
|
**
|
130
130
|
** <blockquote><pre>
|
@@ -347,7 +347,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
|
347
347
|
** from [sqlite3_malloc()] and passed back through the 5th parameter.
|
348
348
|
** To avoid memory leaks, the application should invoke [sqlite3_free()]
|
349
349
|
** on error message strings returned through the 5th parameter of
|
350
|
-
**
|
350
|
+
** sqlite3_exec() after the error message string is no longer needed.
|
351
351
|
** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
|
352
352
|
** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
|
353
353
|
** NULL before returning.
|
@@ -374,7 +374,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
|
374
374
|
** Restrictions:
|
375
375
|
**
|
376
376
|
** <ul>
|
377
|
-
** <li> The application must
|
377
|
+
** <li> The application must ensure that the 1st parameter to sqlite3_exec()
|
378
378
|
** is a valid and open [database connection].
|
379
379
|
** <li> The application must not close the [database connection] specified by
|
380
380
|
** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
|
@@ -477,6 +477,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
|
|
477
477
|
#define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8))
|
478
478
|
#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8))
|
479
479
|
#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8))
|
480
|
+
#define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8))
|
481
|
+
#define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8))
|
480
482
|
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
|
481
483
|
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
|
482
484
|
#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8))
|
@@ -792,8 +794,13 @@ struct sqlite3_io_methods {
|
|
792
794
|
** <li>[[SQLITE_FCNTL_FILE_POINTER]]
|
793
795
|
** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
|
794
796
|
** to the [sqlite3_file] object associated with a particular database
|
795
|
-
** connection. See
|
796
|
-
**
|
797
|
+
** connection. See also [SQLITE_FCNTL_JOURNAL_POINTER].
|
798
|
+
**
|
799
|
+
** <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]
|
800
|
+
** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
|
801
|
+
** to the [sqlite3_file] object associated with the journal file (either
|
802
|
+
** the [rollback journal] or the [write-ahead log]) for a particular database
|
803
|
+
** connection. See also [SQLITE_FCNTL_FILE_POINTER].
|
797
804
|
**
|
798
805
|
** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
|
799
806
|
** No longer in use.
|
@@ -880,6 +887,15 @@ struct sqlite3_io_methods {
|
|
880
887
|
** pointer in case this file-control is not implemented. This file-control
|
881
888
|
** is intended for diagnostic use only.
|
882
889
|
**
|
890
|
+
** <li>[[SQLITE_FCNTL_VFS_POINTER]]
|
891
|
+
** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
|
892
|
+
** [VFSes] currently in use. ^(The argument X in
|
893
|
+
** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
|
894
|
+
** of type "[sqlite3_vfs] **". This opcodes will set *X
|
895
|
+
** to a pointer to the top-level VFS.)^
|
896
|
+
** ^When there are multiple VFS shims in the stack, this opcode finds the
|
897
|
+
** upper-most shim only.
|
898
|
+
**
|
883
899
|
** <li>[[SQLITE_FCNTL_PRAGMA]]
|
884
900
|
** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
|
885
901
|
** file control is sent to the open [sqlite3_file] object corresponding
|
@@ -998,6 +1014,8 @@ struct sqlite3_io_methods {
|
|
998
1014
|
#define SQLITE_FCNTL_WAL_BLOCK 24
|
999
1015
|
#define SQLITE_FCNTL_ZIPVFS 25
|
1000
1016
|
#define SQLITE_FCNTL_RBU 26
|
1017
|
+
#define SQLITE_FCNTL_VFS_POINTER 27
|
1018
|
+
#define SQLITE_FCNTL_JOURNAL_POINTER 28
|
1001
1019
|
|
1002
1020
|
/* deprecated names */
|
1003
1021
|
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
@@ -1210,7 +1228,7 @@ struct sqlite3_vfs {
|
|
1210
1228
|
const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
|
1211
1229
|
/*
|
1212
1230
|
** The methods above are in versions 1 through 3 of the sqlite_vfs object.
|
1213
|
-
** New fields may be appended in
|
1231
|
+
** New fields may be appended in future versions. The iVersion
|
1214
1232
|
** value will increment whenever this happens.
|
1215
1233
|
*/
|
1216
1234
|
};
|
@@ -1366,9 +1384,11 @@ SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void);
|
|
1366
1384
|
** applications and so this routine is usually not necessary. It is
|
1367
1385
|
** provided to support rare applications with unusual needs.
|
1368
1386
|
**
|
1369
|
-
** The sqlite3_config() interface is not threadsafe.
|
1370
|
-
** must
|
1371
|
-
** threads while sqlite3_config() is running
|
1387
|
+
** <b>The sqlite3_config() interface is not threadsafe. The application
|
1388
|
+
** must ensure that no other SQLite interfaces are invoked by other
|
1389
|
+
** threads while sqlite3_config() is running.</b>
|
1390
|
+
**
|
1391
|
+
** The sqlite3_config() interface
|
1372
1392
|
** may only be invoked prior to library initialization using
|
1373
1393
|
** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
|
1374
1394
|
** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
|
@@ -1595,29 +1615,34 @@ struct sqlite3_mem_methods {
|
|
1595
1615
|
** </dd>
|
1596
1616
|
**
|
1597
1617
|
** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
|
1598
|
-
** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a
|
1618
|
+
** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool
|
1599
1619
|
** that SQLite can use for the database page cache with the default page
|
1600
1620
|
** cache implementation.
|
1601
|
-
** This configuration
|
1602
|
-
** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2]
|
1603
|
-
** configuration option.
|
1621
|
+
** This configuration option is a no-op if an application-define page
|
1622
|
+
** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2].
|
1604
1623
|
** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
|
1605
|
-
** 8-byte aligned
|
1606
|
-
**
|
1624
|
+
** 8-byte aligned memory (pMem), the size of each page cache line (sz),
|
1625
|
+
** and the number of cache lines (N).
|
1607
1626
|
** The sz argument should be the size of the largest database page
|
1608
1627
|
** (a power of two between 512 and 65536) plus some extra bytes for each
|
1609
1628
|
** page header. ^The number of extra bytes needed by the page header
|
1610
|
-
** can be determined using
|
1611
|
-
** to [sqlite3_config()].
|
1629
|
+
** can be determined using [SQLITE_CONFIG_PCACHE_HDRSZ].
|
1612
1630
|
** ^It is harmless, apart from the wasted memory,
|
1613
|
-
** for the sz parameter to be larger than necessary. The
|
1614
|
-
** argument
|
1615
|
-
**
|
1616
|
-
** undefined.
|
1617
|
-
** ^
|
1618
|
-
**
|
1619
|
-
** page cache
|
1620
|
-
**
|
1631
|
+
** for the sz parameter to be larger than necessary. The pMem
|
1632
|
+
** argument must be either a NULL pointer or a pointer to an 8-byte
|
1633
|
+
** aligned block of memory of at least sz*N bytes, otherwise
|
1634
|
+
** subsequent behavior is undefined.
|
1635
|
+
** ^When pMem is not NULL, SQLite will strive to use the memory provided
|
1636
|
+
** to satisfy page cache needs, falling back to [sqlite3_malloc()] if
|
1637
|
+
** a page cache line is larger than sz bytes or if all of the pMem buffer
|
1638
|
+
** is exhausted.
|
1639
|
+
** ^If pMem is NULL and N is non-zero, then each database connection
|
1640
|
+
** does an initial bulk allocation for page cache memory
|
1641
|
+
** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
|
1642
|
+
** of -1024*N bytes if N is negative, . ^If additional
|
1643
|
+
** page cache memory is needed beyond what is provided by the initial
|
1644
|
+
** allocation, then SQLite goes to [sqlite3_malloc()] separately for each
|
1645
|
+
** additional cache line. </dd>
|
1621
1646
|
**
|
1622
1647
|
** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
|
1623
1648
|
** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
|
@@ -1795,6 +1820,20 @@ struct sqlite3_mem_methods {
|
|
1795
1820
|
** is enabled (using the [PRAGMA threads] command) and the amount of content
|
1796
1821
|
** to be sorted exceeds the page size times the minimum of the
|
1797
1822
|
** [PRAGMA cache_size] setting and this value.
|
1823
|
+
**
|
1824
|
+
** [[SQLITE_CONFIG_STMTJRNL_SPILL]]
|
1825
|
+
** <dt>SQLITE_CONFIG_STMTJRNL_SPILL
|
1826
|
+
** <dd>^The SQLITE_CONFIG_STMTJRNL_SPILL option takes a single parameter which
|
1827
|
+
** becomes the [statement journal] spill-to-disk threshold.
|
1828
|
+
** [Statement journals] are held in memory until their size (in bytes)
|
1829
|
+
** exceeds this threshold, at which point they are written to disk.
|
1830
|
+
** Or if the threshold is -1, statement journals are always held
|
1831
|
+
** exclusively in memory.
|
1832
|
+
** Since many statement journals never become large, setting the spill
|
1833
|
+
** threshold to a value such as 64KiB can greatly reduce the amount of
|
1834
|
+
** I/O required to support statement rollback.
|
1835
|
+
** The default value for this setting is controlled by the
|
1836
|
+
** [SQLITE_STMTJRNL_SPILL] compile-time option.
|
1798
1837
|
** </dl>
|
1799
1838
|
*/
|
1800
1839
|
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
|
@@ -1822,6 +1861,7 @@ struct sqlite3_mem_methods {
|
|
1822
1861
|
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
|
1823
1862
|
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
|
1824
1863
|
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
|
1864
|
+
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
|
1825
1865
|
|
1826
1866
|
/*
|
1827
1867
|
** CAPI3REF: Database Connection Configuration Options
|
@@ -1879,11 +1919,25 @@ struct sqlite3_mem_methods {
|
|
1879
1919
|
** following this call. The second parameter may be a NULL pointer, in
|
1880
1920
|
** which case the trigger setting is not reported back. </dd>
|
1881
1921
|
**
|
1922
|
+
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
|
1923
|
+
** <dd> ^This option is used to enable or disable the two-argument
|
1924
|
+
** version of the [fts3_tokenizer()] function which is part of the
|
1925
|
+
** [FTS3] full-text search engine extension.
|
1926
|
+
** There should be two additional arguments.
|
1927
|
+
** The first argument is an integer which is 0 to disable fts3_tokenizer() or
|
1928
|
+
** positive to enable fts3_tokenizer() or negative to leave the setting
|
1929
|
+
** unchanged.
|
1930
|
+
** The second parameter is a pointer to an integer into which
|
1931
|
+
** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled
|
1932
|
+
** following this call. The second parameter may be a NULL pointer, in
|
1933
|
+
** which case the new setting is not reported back. </dd>
|
1934
|
+
**
|
1882
1935
|
** </dl>
|
1883
1936
|
*/
|
1884
|
-
#define SQLITE_DBCONFIG_LOOKASIDE
|
1885
|
-
#define SQLITE_DBCONFIG_ENABLE_FKEY
|
1886
|
-
#define SQLITE_DBCONFIG_ENABLE_TRIGGER
|
1937
|
+
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
|
1938
|
+
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
|
1939
|
+
#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
|
1940
|
+
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
|
1887
1941
|
|
1888
1942
|
|
1889
1943
|
/*
|
@@ -3373,7 +3427,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
|
|
3373
3427
|
**
|
3374
3428
|
** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the
|
3375
3429
|
** [prepared statement] S has been stepped at least once using
|
3376
|
-
** [sqlite3_step(S)] but has
|
3430
|
+
** [sqlite3_step(S)] but has neither run to completion (returned
|
3431
|
+
** [SQLITE_DONE] from [sqlite3_step(S)]) nor
|
3377
3432
|
** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S)
|
3378
3433
|
** interface returns false if S is a NULL pointer. If S is not a
|
3379
3434
|
** NULL pointer and is not a pointer to a valid [prepared statement]
|
@@ -3626,7 +3681,7 @@ SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt*,
|
|
3626
3681
|
**
|
3627
3682
|
** See also: [sqlite3_bind_blob|sqlite3_bind()],
|
3628
3683
|
** [sqlite3_bind_parameter_count()], and
|
3629
|
-
** [
|
3684
|
+
** [sqlite3_bind_parameter_name()].
|
3630
3685
|
*/
|
3631
3686
|
SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
|
3632
3687
|
|
@@ -4355,6 +4410,22 @@ SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_value*);
|
|
4355
4410
|
SQLITE_API int SQLITE_STDCALL sqlite3_value_type(sqlite3_value*);
|
4356
4411
|
SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value*);
|
4357
4412
|
|
4413
|
+
/*
|
4414
|
+
** CAPI3REF: Finding The Subtype Of SQL Values
|
4415
|
+
** METHOD: sqlite3_value
|
4416
|
+
**
|
4417
|
+
** The sqlite3_value_subtype(V) function returns the subtype for
|
4418
|
+
** an [application-defined SQL function] argument V. The subtype
|
4419
|
+
** information can be used to pass a limited amount of context from
|
4420
|
+
** one SQL function to another. Use the [sqlite3_result_subtype()]
|
4421
|
+
** routine to set the subtype for the return value of an SQL function.
|
4422
|
+
**
|
4423
|
+
** SQLite makes no use of subtype itself. It merely passes the subtype
|
4424
|
+
** from the result of one [application-defined SQL function] into the
|
4425
|
+
** input of another.
|
4426
|
+
*/
|
4427
|
+
SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value*);
|
4428
|
+
|
4358
4429
|
/*
|
4359
4430
|
** CAPI3REF: Copy And Free SQL Values
|
4360
4431
|
** METHOD: sqlite3_value
|
@@ -4369,8 +4440,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value*);
|
|
4369
4440
|
** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
|
4370
4441
|
** then sqlite3_value_free(V) is a harmless no-op.
|
4371
4442
|
*/
|
4372
|
-
SQLITE_API
|
4373
|
-
SQLITE_API
|
4443
|
+
SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value*);
|
4444
|
+
SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
|
4374
4445
|
|
4375
4446
|
/*
|
4376
4447
|
** CAPI3REF: Obtain Aggregate Function Context
|
@@ -4654,6 +4725,21 @@ SQLITE_API void SQLITE_STDCALL sqlite3_result_value(sqlite3_context*, sqlite3_va
|
|
4654
4725
|
SQLITE_API void SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context*, int n);
|
4655
4726
|
SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
|
4656
4727
|
|
4728
|
+
|
4729
|
+
/*
|
4730
|
+
** CAPI3REF: Setting The Subtype Of An SQL Function
|
4731
|
+
** METHOD: sqlite3_context
|
4732
|
+
**
|
4733
|
+
** The sqlite3_result_subtype(C,T) function causes the subtype of
|
4734
|
+
** the result from the [application-defined SQL function] with
|
4735
|
+
** [sqlite3_context] C to be the value T. Only the lower 8 bits
|
4736
|
+
** of the subtype T are preserved in current versions of SQLite;
|
4737
|
+
** higher order bits are discarded.
|
4738
|
+
** The number of subtype bytes preserved by SQLite might increase
|
4739
|
+
** in future releases of SQLite.
|
4740
|
+
*/
|
4741
|
+
SQLITE_API void SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context*,unsigned int);
|
4742
|
+
|
4657
4743
|
/*
|
4658
4744
|
** CAPI3REF: Define New Collating Sequences
|
4659
4745
|
** METHOD: sqlite3
|
@@ -5574,6 +5660,17 @@ struct sqlite3_module {
|
|
5574
5660
|
** ^Information about the ORDER BY clause is stored in aOrderBy[].
|
5575
5661
|
** ^Each term of aOrderBy records a column of the ORDER BY clause.
|
5576
5662
|
**
|
5663
|
+
** The colUsed field indicates which columns of the virtual table may be
|
5664
|
+
** required by the current scan. Virtual table columns are numbered from
|
5665
|
+
** zero in the order in which they appear within the CREATE TABLE statement
|
5666
|
+
** passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
|
5667
|
+
** the corresponding bit is set within the colUsed mask if the column may be
|
5668
|
+
** required by SQLite. If the table has at least 64 columns and any column
|
5669
|
+
** to the right of the first 63 is required, then bit 63 of colUsed is also
|
5670
|
+
** set. In other words, column iCol may be required if the expression
|
5671
|
+
** (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
|
5672
|
+
** non-zero.
|
5673
|
+
**
|
5577
5674
|
** The [xBestIndex] method must fill aConstraintUsage[] with information
|
5578
5675
|
** about what parameters to pass to xFilter. ^If argvIndex>0 then
|
5579
5676
|
** the right-hand side of the corresponding aConstraint[] is evaluated
|
@@ -5599,19 +5696,37 @@ struct sqlite3_module {
|
|
5599
5696
|
** ^The estimatedRows value is an estimate of the number of rows that
|
5600
5697
|
** will be returned by the strategy.
|
5601
5698
|
**
|
5699
|
+
** The xBestIndex method may optionally populate the idxFlags field with a
|
5700
|
+
** mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
|
5701
|
+
** SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
|
5702
|
+
** assumes that the strategy may visit at most one row.
|
5703
|
+
**
|
5704
|
+
** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
|
5705
|
+
** SQLite also assumes that if a call to the xUpdate() method is made as
|
5706
|
+
** part of the same statement to delete or update a virtual table row and the
|
5707
|
+
** implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
|
5708
|
+
** any database changes. In other words, if the xUpdate() returns
|
5709
|
+
** SQLITE_CONSTRAINT, the database contents must be exactly as they were
|
5710
|
+
** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
|
5711
|
+
** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
|
5712
|
+
** the xUpdate method are automatically rolled back by SQLite.
|
5713
|
+
**
|
5602
5714
|
** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
|
5603
5715
|
** structure for SQLite version 3.8.2. If a virtual table extension is
|
5604
5716
|
** used with an SQLite version earlier than 3.8.2, the results of attempting
|
5605
5717
|
** to read or write the estimatedRows field are undefined (but are likely
|
5606
5718
|
** to included crashing the application). The estimatedRows field should
|
5607
5719
|
** therefore only be used if [sqlite3_libversion_number()] returns a
|
5608
|
-
** value greater than or equal to 3008002.
|
5720
|
+
** value greater than or equal to 3008002. Similarly, the idxFlags field
|
5721
|
+
** was added for version 3.9.0. It may therefore only be used if
|
5722
|
+
** sqlite3_libversion_number() returns a value greater than or equal to
|
5723
|
+
** 3009000.
|
5609
5724
|
*/
|
5610
5725
|
struct sqlite3_index_info {
|
5611
5726
|
/* Inputs */
|
5612
5727
|
int nConstraint; /* Number of entries in aConstraint */
|
5613
5728
|
struct sqlite3_index_constraint {
|
5614
|
-
int iColumn; /* Column
|
5729
|
+
int iColumn; /* Column constrained. -1 for ROWID */
|
5615
5730
|
unsigned char op; /* Constraint operator */
|
5616
5731
|
unsigned char usable; /* True if this constraint is usable */
|
5617
5732
|
int iTermOffset; /* Used internally - xBestIndex should ignore */
|
@@ -5633,8 +5748,17 @@ struct sqlite3_index_info {
|
|
5633
5748
|
double estimatedCost; /* Estimated cost of using this index */
|
5634
5749
|
/* Fields below are only available in SQLite 3.8.2 and later */
|
5635
5750
|
sqlite3_int64 estimatedRows; /* Estimated number of rows returned */
|
5751
|
+
/* Fields below are only available in SQLite 3.9.0 and later */
|
5752
|
+
int idxFlags; /* Mask of SQLITE_INDEX_SCAN_* flags */
|
5753
|
+
/* Fields below are only available in SQLite 3.10.0 and later */
|
5754
|
+
sqlite3_uint64 colUsed; /* Input: Mask of columns used by statement */
|
5636
5755
|
};
|
5637
5756
|
|
5757
|
+
/*
|
5758
|
+
** CAPI3REF: Virtual Table Scan Flags
|
5759
|
+
*/
|
5760
|
+
#define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */
|
5761
|
+
|
5638
5762
|
/*
|
5639
5763
|
** CAPI3REF: Virtual Table Constraint Operator Codes
|
5640
5764
|
**
|
@@ -5643,12 +5767,15 @@ struct sqlite3_index_info {
|
|
5643
5767
|
** an operator that is part of a constraint term in the wHERE clause of
|
5644
5768
|
** a query that uses a [virtual table].
|
5645
5769
|
*/
|
5646
|
-
#define SQLITE_INDEX_CONSTRAINT_EQ
|
5647
|
-
#define SQLITE_INDEX_CONSTRAINT_GT
|
5648
|
-
#define SQLITE_INDEX_CONSTRAINT_LE
|
5649
|
-
#define SQLITE_INDEX_CONSTRAINT_LT
|
5650
|
-
#define SQLITE_INDEX_CONSTRAINT_GE
|
5651
|
-
#define SQLITE_INDEX_CONSTRAINT_MATCH
|
5770
|
+
#define SQLITE_INDEX_CONSTRAINT_EQ 2
|
5771
|
+
#define SQLITE_INDEX_CONSTRAINT_GT 4
|
5772
|
+
#define SQLITE_INDEX_CONSTRAINT_LE 8
|
5773
|
+
#define SQLITE_INDEX_CONSTRAINT_LT 16
|
5774
|
+
#define SQLITE_INDEX_CONSTRAINT_GE 32
|
5775
|
+
#define SQLITE_INDEX_CONSTRAINT_MATCH 64
|
5776
|
+
#define SQLITE_INDEX_CONSTRAINT_LIKE 65
|
5777
|
+
#define SQLITE_INDEX_CONSTRAINT_GLOB 66
|
5778
|
+
#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
|
5652
5779
|
|
5653
5780
|
/*
|
5654
5781
|
** CAPI3REF: Register A Virtual Table Implementation
|
@@ -6092,6 +6219,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs*);
|
|
6092
6219
|
** <li> SQLITE_MUTEX_STATIC_APP1
|
6093
6220
|
** <li> SQLITE_MUTEX_STATIC_APP2
|
6094
6221
|
** <li> SQLITE_MUTEX_STATIC_APP3
|
6222
|
+
** <li> SQLITE_MUTEX_STATIC_VFS1
|
6223
|
+
** <li> SQLITE_MUTEX_STATIC_VFS2
|
6224
|
+
** <li> SQLITE_MUTEX_STATIC_VFS3
|
6095
6225
|
** </ul>
|
6096
6226
|
**
|
6097
6227
|
** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
|
@@ -6509,7 +6639,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_status64(
|
|
6509
6639
|
** The value written into the *pCurrent parameter is undefined.</dd>)^
|
6510
6640
|
**
|
6511
6641
|
** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
|
6512
|
-
** <dd>
|
6642
|
+
** <dd>The *pHighwater parameter records the deepest parser stack.
|
6643
|
+
** The *pCurrent value is undefined. The *pHighwater value is only
|
6513
6644
|
** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^
|
6514
6645
|
** </dl>
|
6515
6646
|
**
|
@@ -7295,18 +7426,43 @@ SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *, const char *, int);
|
|
7295
7426
|
/*
|
7296
7427
|
** CAPI3REF: String Globbing
|
7297
7428
|
*
|
7298
|
-
** ^The [sqlite3_strglob(P,X)] interface returns zero if
|
7299
|
-
** the
|
7300
|
-
**
|
7429
|
+
** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
|
7430
|
+
** string X matches the [GLOB] pattern P.
|
7431
|
+
** ^The definition of [GLOB] pattern matching used in
|
7301
7432
|
** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the
|
7302
|
-
** SQL dialect
|
7303
|
-
** sensitive.
|
7433
|
+
** SQL dialect understood by SQLite. ^The [sqlite3_strglob(P,X)] function
|
7434
|
+
** is case sensitive.
|
7304
7435
|
**
|
7305
7436
|
** Note that this routine returns zero on a match and non-zero if the strings
|
7306
7437
|
** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
|
7438
|
+
**
|
7439
|
+
** See also: [sqlite3_strlike()].
|
7307
7440
|
*/
|
7308
7441
|
SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlob, const char *zStr);
|
7309
7442
|
|
7443
|
+
/*
|
7444
|
+
** CAPI3REF: String LIKE Matching
|
7445
|
+
*
|
7446
|
+
** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
|
7447
|
+
** string X matches the [LIKE] pattern P with escape character E.
|
7448
|
+
** ^The definition of [LIKE] pattern matching used in
|
7449
|
+
** [sqlite3_strlike(P,X,E)] is the same as for the "X LIKE P ESCAPE E"
|
7450
|
+
** operator in the SQL dialect understood by SQLite. ^For "X LIKE P" without
|
7451
|
+
** the ESCAPE clause, set the E parameter of [sqlite3_strlike(P,X,E)] to 0.
|
7452
|
+
** ^As with the LIKE operator, the [sqlite3_strlike(P,X,E)] function is case
|
7453
|
+
** insensitive - equivalent upper and lower case ASCII characters match
|
7454
|
+
** one another.
|
7455
|
+
**
|
7456
|
+
** ^The [sqlite3_strlike(P,X,E)] function matches Unicode characters, though
|
7457
|
+
** only ASCII characters are case folded.
|
7458
|
+
**
|
7459
|
+
** Note that this routine returns zero on a match and non-zero if the strings
|
7460
|
+
** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
|
7461
|
+
**
|
7462
|
+
** See also: [sqlite3_strglob()].
|
7463
|
+
*/
|
7464
|
+
SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
|
7465
|
+
|
7310
7466
|
/*
|
7311
7467
|
** CAPI3REF: Error Logging Interface
|
7312
7468
|
**
|
@@ -7362,7 +7518,7 @@ SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...)
|
|
7362
7518
|
** previously registered write-ahead log callback. ^Note that the
|
7363
7519
|
** [sqlite3_wal_autocheckpoint()] interface and the
|
7364
7520
|
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
|
7365
|
-
**
|
7521
|
+
** overwrite any prior [sqlite3_wal_hook()] settings.
|
7366
7522
|
*/
|
7367
7523
|
SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
|
7368
7524
|
sqlite3*,
|
@@ -7727,6 +7883,145 @@ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
|
|
7727
7883
|
*/
|
7728
7884
|
SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
|
7729
7885
|
|
7886
|
+
/*
|
7887
|
+
** CAPI3REF: Flush caches to disk mid-transaction
|
7888
|
+
**
|
7889
|
+
** ^If a write-transaction is open on [database connection] D when the
|
7890
|
+
** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
|
7891
|
+
** pages in the pager-cache that are not currently in use are written out
|
7892
|
+
** to disk. A dirty page may be in use if a database cursor created by an
|
7893
|
+
** active SQL statement is reading from it, or if it is page 1 of a database
|
7894
|
+
** file (page 1 is always "in use"). ^The [sqlite3_db_cacheflush(D)]
|
7895
|
+
** interface flushes caches for all schemas - "main", "temp", and
|
7896
|
+
** any [attached] databases.
|
7897
|
+
**
|
7898
|
+
** ^If this function needs to obtain extra database locks before dirty pages
|
7899
|
+
** can be flushed to disk, it does so. ^If those locks cannot be obtained
|
7900
|
+
** immediately and there is a busy-handler callback configured, it is invoked
|
7901
|
+
** in the usual manner. ^If the required lock still cannot be obtained, then
|
7902
|
+
** the database is skipped and an attempt made to flush any dirty pages
|
7903
|
+
** belonging to the next (if any) database. ^If any databases are skipped
|
7904
|
+
** because locks cannot be obtained, but no other error occurs, this
|
7905
|
+
** function returns SQLITE_BUSY.
|
7906
|
+
**
|
7907
|
+
** ^If any other error occurs while flushing dirty pages to disk (for
|
7908
|
+
** example an IO error or out-of-memory condition), then processing is
|
7909
|
+
** abandoned and an SQLite [error code] is returned to the caller immediately.
|
7910
|
+
**
|
7911
|
+
** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
|
7912
|
+
**
|
7913
|
+
** ^This function does not set the database handle error code or message
|
7914
|
+
** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
|
7915
|
+
*/
|
7916
|
+
SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
|
7917
|
+
|
7918
|
+
/*
|
7919
|
+
** CAPI3REF: Low-level system error code
|
7920
|
+
**
|
7921
|
+
** ^Attempt to return the underlying operating system error code or error
|
7922
|
+
** number that caused the most reason I/O error or failure to open a file.
|
7923
|
+
** The return value is OS-dependent. For example, on unix systems, after
|
7924
|
+
** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
|
7925
|
+
** called to get back the underlying "errno" that caused the problem, such
|
7926
|
+
** as ENOSPC, EAUTH, EISDIR, and so forth.
|
7927
|
+
*/
|
7928
|
+
SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3*);
|
7929
|
+
|
7930
|
+
/*
|
7931
|
+
** CAPI3REF: Database Snapshot
|
7932
|
+
** KEYWORDS: {snapshot}
|
7933
|
+
** EXPERIMENTAL
|
7934
|
+
**
|
7935
|
+
** An instance of the snapshot object records the state of a [WAL mode]
|
7936
|
+
** database for some specific point in history.
|
7937
|
+
**
|
7938
|
+
** In [WAL mode], multiple [database connections] that are open on the
|
7939
|
+
** same database file can each be reading a different historical version
|
7940
|
+
** of the database file. When a [database connection] begins a read
|
7941
|
+
** transaction, that connection sees an unchanging copy of the database
|
7942
|
+
** as it existed for the point in time when the transaction first started.
|
7943
|
+
** Subsequent changes to the database from other connections are not seen
|
7944
|
+
** by the reader until a new read transaction is started.
|
7945
|
+
**
|
7946
|
+
** The sqlite3_snapshot object records state information about an historical
|
7947
|
+
** version of the database file so that it is possible to later open a new read
|
7948
|
+
** transaction that sees that historical version of the database rather than
|
7949
|
+
** the most recent version.
|
7950
|
+
**
|
7951
|
+
** The constructor for this object is [sqlite3_snapshot_get()]. The
|
7952
|
+
** [sqlite3_snapshot_open()] method causes a fresh read transaction to refer
|
7953
|
+
** to an historical snapshot (if possible). The destructor for
|
7954
|
+
** sqlite3_snapshot objects is [sqlite3_snapshot_free()].
|
7955
|
+
*/
|
7956
|
+
typedef struct sqlite3_snapshot sqlite3_snapshot;
|
7957
|
+
|
7958
|
+
/*
|
7959
|
+
** CAPI3REF: Record A Database Snapshot
|
7960
|
+
** EXPERIMENTAL
|
7961
|
+
**
|
7962
|
+
** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a
|
7963
|
+
** new [sqlite3_snapshot] object that records the current state of
|
7964
|
+
** schema S in database connection D. ^On success, the
|
7965
|
+
** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly
|
7966
|
+
** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.
|
7967
|
+
** ^If schema S of [database connection] D is not a [WAL mode] database
|
7968
|
+
** that is in a read transaction, then [sqlite3_snapshot_get(D,S,P)]
|
7969
|
+
** leaves the *P value unchanged and returns an appropriate [error code].
|
7970
|
+
**
|
7971
|
+
** The [sqlite3_snapshot] object returned from a successful call to
|
7972
|
+
** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()]
|
7973
|
+
** to avoid a memory leak.
|
7974
|
+
**
|
7975
|
+
** The [sqlite3_snapshot_get()] interface is only available when the
|
7976
|
+
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
|
7977
|
+
*/
|
7978
|
+
SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_get(
|
7979
|
+
sqlite3 *db,
|
7980
|
+
const char *zSchema,
|
7981
|
+
sqlite3_snapshot **ppSnapshot
|
7982
|
+
);
|
7983
|
+
|
7984
|
+
/*
|
7985
|
+
** CAPI3REF: Start a read transaction on an historical snapshot
|
7986
|
+
** EXPERIMENTAL
|
7987
|
+
**
|
7988
|
+
** ^The [sqlite3_snapshot_open(D,S,P)] interface attempts to move the
|
7989
|
+
** read transaction that is currently open on schema S of
|
7990
|
+
** [database connection] D so that it refers to historical [snapshot] P.
|
7991
|
+
** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success
|
7992
|
+
** or an appropriate [error code] if it fails.
|
7993
|
+
**
|
7994
|
+
** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
|
7995
|
+
** the first operation, apart from other sqlite3_snapshot_open() calls,
|
7996
|
+
** following the [BEGIN] that starts a new read transaction.
|
7997
|
+
** ^A [snapshot] will fail to open if it has been overwritten by a
|
7998
|
+
** [checkpoint].
|
7999
|
+
** ^A [snapshot] will fail to open if the database connection D has not
|
8000
|
+
** previously completed at least one read operation against the database
|
8001
|
+
** file. (Hint: Run "[PRAGMA application_id]" against a newly opened
|
8002
|
+
** database connection in order to make it ready to use snapshots.)
|
8003
|
+
**
|
8004
|
+
** The [sqlite3_snapshot_open()] interface is only available when the
|
8005
|
+
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
|
8006
|
+
*/
|
8007
|
+
SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
|
8008
|
+
sqlite3 *db,
|
8009
|
+
const char *zSchema,
|
8010
|
+
sqlite3_snapshot *pSnapshot
|
8011
|
+
);
|
8012
|
+
|
8013
|
+
/*
|
8014
|
+
** CAPI3REF: Destroy a snapshot
|
8015
|
+
** EXPERIMENTAL
|
8016
|
+
**
|
8017
|
+
** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.
|
8018
|
+
** The application must eventually free every [sqlite3_snapshot] object
|
8019
|
+
** using this routine to avoid a memory leak.
|
8020
|
+
**
|
8021
|
+
** The [sqlite3_snapshot_free()] interface is only available when the
|
8022
|
+
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
|
8023
|
+
*/
|
8024
|
+
SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot*);
|
7730
8025
|
|
7731
8026
|
/*
|
7732
8027
|
** Undo the hack that converts floating point types to integer for
|
@@ -7858,3 +8153,581 @@ struct sqlite3_rtree_query_info {
|
|
7858
8153
|
|
7859
8154
|
#endif /* ifndef _SQLITE3RTREE_H_ */
|
7860
8155
|
|
8156
|
+
/*
|
8157
|
+
** 2014 May 31
|
8158
|
+
**
|
8159
|
+
** The author disclaims copyright to this source code. In place of
|
8160
|
+
** a legal notice, here is a blessing:
|
8161
|
+
**
|
8162
|
+
** May you do good and not evil.
|
8163
|
+
** May you find forgiveness for yourself and forgive others.
|
8164
|
+
** May you share freely, never taking more than you give.
|
8165
|
+
**
|
8166
|
+
******************************************************************************
|
8167
|
+
**
|
8168
|
+
** Interfaces to extend FTS5. Using the interfaces defined in this file,
|
8169
|
+
** FTS5 may be extended with:
|
8170
|
+
**
|
8171
|
+
** * custom tokenizers, and
|
8172
|
+
** * custom auxiliary functions.
|
8173
|
+
*/
|
8174
|
+
|
8175
|
+
|
8176
|
+
#ifndef _FTS5_H
|
8177
|
+
#define _FTS5_H
|
8178
|
+
|
8179
|
+
|
8180
|
+
#ifdef __cplusplus
|
8181
|
+
extern "C" {
|
8182
|
+
#endif
|
8183
|
+
|
8184
|
+
/*************************************************************************
|
8185
|
+
** CUSTOM AUXILIARY FUNCTIONS
|
8186
|
+
**
|
8187
|
+
** Virtual table implementations may overload SQL functions by implementing
|
8188
|
+
** the sqlite3_module.xFindFunction() method.
|
8189
|
+
*/
|
8190
|
+
|
8191
|
+
typedef struct Fts5ExtensionApi Fts5ExtensionApi;
|
8192
|
+
typedef struct Fts5Context Fts5Context;
|
8193
|
+
typedef struct Fts5PhraseIter Fts5PhraseIter;
|
8194
|
+
|
8195
|
+
typedef void (*fts5_extension_function)(
|
8196
|
+
const Fts5ExtensionApi *pApi, /* API offered by current FTS version */
|
8197
|
+
Fts5Context *pFts, /* First arg to pass to pApi functions */
|
8198
|
+
sqlite3_context *pCtx, /* Context for returning result/error */
|
8199
|
+
int nVal, /* Number of values in apVal[] array */
|
8200
|
+
sqlite3_value **apVal /* Array of trailing arguments */
|
8201
|
+
);
|
8202
|
+
|
8203
|
+
struct Fts5PhraseIter {
|
8204
|
+
const unsigned char *a;
|
8205
|
+
const unsigned char *b;
|
8206
|
+
};
|
8207
|
+
|
8208
|
+
/*
|
8209
|
+
** EXTENSION API FUNCTIONS
|
8210
|
+
**
|
8211
|
+
** xUserData(pFts):
|
8212
|
+
** Return a copy of the context pointer the extension function was
|
8213
|
+
** registered with.
|
8214
|
+
**
|
8215
|
+
** xColumnTotalSize(pFts, iCol, pnToken):
|
8216
|
+
** If parameter iCol is less than zero, set output variable *pnToken
|
8217
|
+
** to the total number of tokens in the FTS5 table. Or, if iCol is
|
8218
|
+
** non-negative but less than the number of columns in the table, return
|
8219
|
+
** the total number of tokens in column iCol, considering all rows in
|
8220
|
+
** the FTS5 table.
|
8221
|
+
**
|
8222
|
+
** If parameter iCol is greater than or equal to the number of columns
|
8223
|
+
** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
|
8224
|
+
** an OOM condition or IO error), an appropriate SQLite error code is
|
8225
|
+
** returned.
|
8226
|
+
**
|
8227
|
+
** xColumnCount(pFts):
|
8228
|
+
** Return the number of columns in the table.
|
8229
|
+
**
|
8230
|
+
** xColumnSize(pFts, iCol, pnToken):
|
8231
|
+
** If parameter iCol is less than zero, set output variable *pnToken
|
8232
|
+
** to the total number of tokens in the current row. Or, if iCol is
|
8233
|
+
** non-negative but less than the number of columns in the table, set
|
8234
|
+
** *pnToken to the number of tokens in column iCol of the current row.
|
8235
|
+
**
|
8236
|
+
** If parameter iCol is greater than or equal to the number of columns
|
8237
|
+
** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
|
8238
|
+
** an OOM condition or IO error), an appropriate SQLite error code is
|
8239
|
+
** returned.
|
8240
|
+
**
|
8241
|
+
** This function may be quite inefficient if used with an FTS5 table
|
8242
|
+
** created with the "columnsize=0" option.
|
8243
|
+
**
|
8244
|
+
** xColumnText:
|
8245
|
+
** This function attempts to retrieve the text of column iCol of the
|
8246
|
+
** current document. If successful, (*pz) is set to point to a buffer
|
8247
|
+
** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
|
8248
|
+
** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
|
8249
|
+
** if an error occurs, an SQLite error code is returned and the final values
|
8250
|
+
** of (*pz) and (*pn) are undefined.
|
8251
|
+
**
|
8252
|
+
** xPhraseCount:
|
8253
|
+
** Returns the number of phrases in the current query expression.
|
8254
|
+
**
|
8255
|
+
** xPhraseSize:
|
8256
|
+
** Returns the number of tokens in phrase iPhrase of the query. Phrases
|
8257
|
+
** are numbered starting from zero.
|
8258
|
+
**
|
8259
|
+
** xInstCount:
|
8260
|
+
** Set *pnInst to the total number of occurrences of all phrases within
|
8261
|
+
** the query within the current row. Return SQLITE_OK if successful, or
|
8262
|
+
** an error code (i.e. SQLITE_NOMEM) if an error occurs.
|
8263
|
+
**
|
8264
|
+
** This API can be quite slow if used with an FTS5 table created with the
|
8265
|
+
** "detail=none" or "detail=column" option. If the FTS5 table is created
|
8266
|
+
** with either "detail=none" or "detail=column" and "content=" option
|
8267
|
+
** (i.e. if it is a contentless table), then this API always returns 0.
|
8268
|
+
**
|
8269
|
+
** xInst:
|
8270
|
+
** Query for the details of phrase match iIdx within the current row.
|
8271
|
+
** Phrase matches are numbered starting from zero, so the iIdx argument
|
8272
|
+
** should be greater than or equal to zero and smaller than the value
|
8273
|
+
** output by xInstCount().
|
8274
|
+
**
|
8275
|
+
** Usually, output parameter *piPhrase is set to the phrase number, *piCol
|
8276
|
+
** to the column in which it occurs and *piOff the token offset of the
|
8277
|
+
** first token of the phrase. The exception is if the table was created
|
8278
|
+
** with the offsets=0 option specified. In this case *piOff is always
|
8279
|
+
** set to -1.
|
8280
|
+
**
|
8281
|
+
** Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM)
|
8282
|
+
** if an error occurs.
|
8283
|
+
**
|
8284
|
+
** This API can be quite slow if used with an FTS5 table created with the
|
8285
|
+
** "detail=none" or "detail=column" option.
|
8286
|
+
**
|
8287
|
+
** xRowid:
|
8288
|
+
** Returns the rowid of the current row.
|
8289
|
+
**
|
8290
|
+
** xTokenize:
|
8291
|
+
** Tokenize text using the tokenizer belonging to the FTS5 table.
|
8292
|
+
**
|
8293
|
+
** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback):
|
8294
|
+
** This API function is used to query the FTS table for phrase iPhrase
|
8295
|
+
** of the current query. Specifically, a query equivalent to:
|
8296
|
+
**
|
8297
|
+
** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
|
8298
|
+
**
|
8299
|
+
** with $p set to a phrase equivalent to the phrase iPhrase of the
|
8300
|
+
** current query is executed. For each row visited, the callback function
|
8301
|
+
** passed as the fourth argument is invoked. The context and API objects
|
8302
|
+
** passed to the callback function may be used to access the properties of
|
8303
|
+
** each matched row. Invoking Api.xUserData() returns a copy of the pointer
|
8304
|
+
** passed as the third argument to pUserData.
|
8305
|
+
**
|
8306
|
+
** If the callback function returns any value other than SQLITE_OK, the
|
8307
|
+
** query is abandoned and the xQueryPhrase function returns immediately.
|
8308
|
+
** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
|
8309
|
+
** Otherwise, the error code is propagated upwards.
|
8310
|
+
**
|
8311
|
+
** If the query runs to completion without incident, SQLITE_OK is returned.
|
8312
|
+
** Or, if some error occurs before the query completes or is aborted by
|
8313
|
+
** the callback, an SQLite error code is returned.
|
8314
|
+
**
|
8315
|
+
**
|
8316
|
+
** xSetAuxdata(pFts5, pAux, xDelete)
|
8317
|
+
**
|
8318
|
+
** Save the pointer passed as the second argument as the extension functions
|
8319
|
+
** "auxiliary data". The pointer may then be retrieved by the current or any
|
8320
|
+
** future invocation of the same fts5 extension function made as part of
|
8321
|
+
** of the same MATCH query using the xGetAuxdata() API.
|
8322
|
+
**
|
8323
|
+
** Each extension function is allocated a single auxiliary data slot for
|
8324
|
+
** each FTS query (MATCH expression). If the extension function is invoked
|
8325
|
+
** more than once for a single FTS query, then all invocations share a
|
8326
|
+
** single auxiliary data context.
|
8327
|
+
**
|
8328
|
+
** If there is already an auxiliary data pointer when this function is
|
8329
|
+
** invoked, then it is replaced by the new pointer. If an xDelete callback
|
8330
|
+
** was specified along with the original pointer, it is invoked at this
|
8331
|
+
** point.
|
8332
|
+
**
|
8333
|
+
** The xDelete callback, if one is specified, is also invoked on the
|
8334
|
+
** auxiliary data pointer after the FTS5 query has finished.
|
8335
|
+
**
|
8336
|
+
** If an error (e.g. an OOM condition) occurs within this function, an
|
8337
|
+
** the auxiliary data is set to NULL and an error code returned. If the
|
8338
|
+
** xDelete parameter was not NULL, it is invoked on the auxiliary data
|
8339
|
+
** pointer before returning.
|
8340
|
+
**
|
8341
|
+
**
|
8342
|
+
** xGetAuxdata(pFts5, bClear)
|
8343
|
+
**
|
8344
|
+
** Returns the current auxiliary data pointer for the fts5 extension
|
8345
|
+
** function. See the xSetAuxdata() method for details.
|
8346
|
+
**
|
8347
|
+
** If the bClear argument is non-zero, then the auxiliary data is cleared
|
8348
|
+
** (set to NULL) before this function returns. In this case the xDelete,
|
8349
|
+
** if any, is not invoked.
|
8350
|
+
**
|
8351
|
+
**
|
8352
|
+
** xRowCount(pFts5, pnRow)
|
8353
|
+
**
|
8354
|
+
** This function is used to retrieve the total number of rows in the table.
|
8355
|
+
** In other words, the same value that would be returned by:
|
8356
|
+
**
|
8357
|
+
** SELECT count(*) FROM ftstable;
|
8358
|
+
**
|
8359
|
+
** xPhraseFirst()
|
8360
|
+
** This function is used, along with type Fts5PhraseIter and the xPhraseNext
|
8361
|
+
** method, to iterate through all instances of a single query phrase within
|
8362
|
+
** the current row. This is the same information as is accessible via the
|
8363
|
+
** xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient
|
8364
|
+
** to use, this API may be faster under some circumstances. To iterate
|
8365
|
+
** through instances of phrase iPhrase, use the following code:
|
8366
|
+
**
|
8367
|
+
** Fts5PhraseIter iter;
|
8368
|
+
** int iCol, iOff;
|
8369
|
+
** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff);
|
8370
|
+
** iCol>=0;
|
8371
|
+
** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)
|
8372
|
+
** ){
|
8373
|
+
** // An instance of phrase iPhrase at offset iOff of column iCol
|
8374
|
+
** }
|
8375
|
+
**
|
8376
|
+
** The Fts5PhraseIter structure is defined above. Applications should not
|
8377
|
+
** modify this structure directly - it should only be used as shown above
|
8378
|
+
** with the xPhraseFirst() and xPhraseNext() API methods (and by
|
8379
|
+
** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).
|
8380
|
+
**
|
8381
|
+
** This API can be quite slow if used with an FTS5 table created with the
|
8382
|
+
** "detail=none" or "detail=column" option. If the FTS5 table is created
|
8383
|
+
** with either "detail=none" or "detail=column" and "content=" option
|
8384
|
+
** (i.e. if it is a contentless table), then this API always iterates
|
8385
|
+
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
|
8386
|
+
**
|
8387
|
+
** xPhraseNext()
|
8388
|
+
** See xPhraseFirst above.
|
8389
|
+
**
|
8390
|
+
** xPhraseFirstColumn()
|
8391
|
+
** This function and xPhraseNextColumn() are similar to the xPhraseFirst()
|
8392
|
+
** and xPhraseNext() APIs described above. The difference is that instead
|
8393
|
+
** of iterating through all instances of a phrase in the current row, these
|
8394
|
+
** APIs are used to iterate through the set of columns in the current row
|
8395
|
+
** that contain one or more instances of a specified phrase. For example:
|
8396
|
+
**
|
8397
|
+
** Fts5PhraseIter iter;
|
8398
|
+
** int iCol;
|
8399
|
+
** for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol);
|
8400
|
+
** iCol>=0;
|
8401
|
+
** pApi->xPhraseNextColumn(pFts, &iter, &iCol)
|
8402
|
+
** ){
|
8403
|
+
** // Column iCol contains at least one instance of phrase iPhrase
|
8404
|
+
** }
|
8405
|
+
**
|
8406
|
+
** This API can be quite slow if used with an FTS5 table created with the
|
8407
|
+
** "detail=none" option. If the FTS5 table is created with either
|
8408
|
+
** "detail=none" "content=" option (i.e. if it is a contentless table),
|
8409
|
+
** then this API always iterates through an empty set (all calls to
|
8410
|
+
** xPhraseFirstColumn() set iCol to -1).
|
8411
|
+
**
|
8412
|
+
** The information accessed using this API and its companion
|
8413
|
+
** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext
|
8414
|
+
** (or xInst/xInstCount). The chief advantage of this API is that it is
|
8415
|
+
** significantly more efficient than those alternatives when used with
|
8416
|
+
** "detail=column" tables.
|
8417
|
+
**
|
8418
|
+
** xPhraseNextColumn()
|
8419
|
+
** See xPhraseFirstColumn above.
|
8420
|
+
*/
|
8421
|
+
struct Fts5ExtensionApi {
|
8422
|
+
int iVersion; /* Currently always set to 3 */
|
8423
|
+
|
8424
|
+
void *(*xUserData)(Fts5Context*);
|
8425
|
+
|
8426
|
+
int (*xColumnCount)(Fts5Context*);
|
8427
|
+
int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow);
|
8428
|
+
int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken);
|
8429
|
+
|
8430
|
+
int (*xTokenize)(Fts5Context*,
|
8431
|
+
const char *pText, int nText, /* Text to tokenize */
|
8432
|
+
void *pCtx, /* Context passed to xToken() */
|
8433
|
+
int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
|
8434
|
+
);
|
8435
|
+
|
8436
|
+
int (*xPhraseCount)(Fts5Context*);
|
8437
|
+
int (*xPhraseSize)(Fts5Context*, int iPhrase);
|
8438
|
+
|
8439
|
+
int (*xInstCount)(Fts5Context*, int *pnInst);
|
8440
|
+
int (*xInst)(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff);
|
8441
|
+
|
8442
|
+
sqlite3_int64 (*xRowid)(Fts5Context*);
|
8443
|
+
int (*xColumnText)(Fts5Context*, int iCol, const char **pz, int *pn);
|
8444
|
+
int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken);
|
8445
|
+
|
8446
|
+
int (*xQueryPhrase)(Fts5Context*, int iPhrase, void *pUserData,
|
8447
|
+
int(*)(const Fts5ExtensionApi*,Fts5Context*,void*)
|
8448
|
+
);
|
8449
|
+
int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*));
|
8450
|
+
void *(*xGetAuxdata)(Fts5Context*, int bClear);
|
8451
|
+
|
8452
|
+
int (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);
|
8453
|
+
void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff);
|
8454
|
+
|
8455
|
+
int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
|
8456
|
+
void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
|
8457
|
+
};
|
8458
|
+
|
8459
|
+
/*
|
8460
|
+
** CUSTOM AUXILIARY FUNCTIONS
|
8461
|
+
*************************************************************************/
|
8462
|
+
|
8463
|
+
/*************************************************************************
|
8464
|
+
** CUSTOM TOKENIZERS
|
8465
|
+
**
|
8466
|
+
** Applications may also register custom tokenizer types. A tokenizer
|
8467
|
+
** is registered by providing fts5 with a populated instance of the
|
8468
|
+
** following structure. All structure methods must be defined, setting
|
8469
|
+
** any member of the fts5_tokenizer struct to NULL leads to undefined
|
8470
|
+
** behaviour. The structure methods are expected to function as follows:
|
8471
|
+
**
|
8472
|
+
** xCreate:
|
8473
|
+
** This function is used to allocate and inititalize a tokenizer instance.
|
8474
|
+
** A tokenizer instance is required to actually tokenize text.
|
8475
|
+
**
|
8476
|
+
** The first argument passed to this function is a copy of the (void*)
|
8477
|
+
** pointer provided by the application when the fts5_tokenizer object
|
8478
|
+
** was registered with FTS5 (the third argument to xCreateTokenizer()).
|
8479
|
+
** The second and third arguments are an array of nul-terminated strings
|
8480
|
+
** containing the tokenizer arguments, if any, specified following the
|
8481
|
+
** tokenizer name as part of the CREATE VIRTUAL TABLE statement used
|
8482
|
+
** to create the FTS5 table.
|
8483
|
+
**
|
8484
|
+
** The final argument is an output variable. If successful, (*ppOut)
|
8485
|
+
** should be set to point to the new tokenizer handle and SQLITE_OK
|
8486
|
+
** returned. If an error occurs, some value other than SQLITE_OK should
|
8487
|
+
** be returned. In this case, fts5 assumes that the final value of *ppOut
|
8488
|
+
** is undefined.
|
8489
|
+
**
|
8490
|
+
** xDelete:
|
8491
|
+
** This function is invoked to delete a tokenizer handle previously
|
8492
|
+
** allocated using xCreate(). Fts5 guarantees that this function will
|
8493
|
+
** be invoked exactly once for each successful call to xCreate().
|
8494
|
+
**
|
8495
|
+
** xTokenize:
|
8496
|
+
** This function is expected to tokenize the nText byte string indicated
|
8497
|
+
** by argument pText. pText may or may not be nul-terminated. The first
|
8498
|
+
** argument passed to this function is a pointer to an Fts5Tokenizer object
|
8499
|
+
** returned by an earlier call to xCreate().
|
8500
|
+
**
|
8501
|
+
** The second argument indicates the reason that FTS5 is requesting
|
8502
|
+
** tokenization of the supplied text. This is always one of the following
|
8503
|
+
** four values:
|
8504
|
+
**
|
8505
|
+
** <ul><li> <b>FTS5_TOKENIZE_DOCUMENT</b> - A document is being inserted into
|
8506
|
+
** or removed from the FTS table. The tokenizer is being invoked to
|
8507
|
+
** determine the set of tokens to add to (or delete from) the
|
8508
|
+
** FTS index.
|
8509
|
+
**
|
8510
|
+
** <li> <b>FTS5_TOKENIZE_QUERY</b> - A MATCH query is being executed
|
8511
|
+
** against the FTS index. The tokenizer is being called to tokenize
|
8512
|
+
** a bareword or quoted string specified as part of the query.
|
8513
|
+
**
|
8514
|
+
** <li> <b>(FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX)</b> - Same as
|
8515
|
+
** FTS5_TOKENIZE_QUERY, except that the bareword or quoted string is
|
8516
|
+
** followed by a "*" character, indicating that the last token
|
8517
|
+
** returned by the tokenizer will be treated as a token prefix.
|
8518
|
+
**
|
8519
|
+
** <li> <b>FTS5_TOKENIZE_AUX</b> - The tokenizer is being invoked to
|
8520
|
+
** satisfy an fts5_api.xTokenize() request made by an auxiliary
|
8521
|
+
** function. Or an fts5_api.xColumnSize() request made by the same
|
8522
|
+
** on a columnsize=0 database.
|
8523
|
+
** </ul>
|
8524
|
+
**
|
8525
|
+
** For each token in the input string, the supplied callback xToken() must
|
8526
|
+
** be invoked. The first argument to it should be a copy of the pointer
|
8527
|
+
** passed as the second argument to xTokenize(). The third and fourth
|
8528
|
+
** arguments are a pointer to a buffer containing the token text, and the
|
8529
|
+
** size of the token in bytes. The 4th and 5th arguments are the byte offsets
|
8530
|
+
** of the first byte of and first byte immediately following the text from
|
8531
|
+
** which the token is derived within the input.
|
8532
|
+
**
|
8533
|
+
** The second argument passed to the xToken() callback ("tflags") should
|
8534
|
+
** normally be set to 0. The exception is if the tokenizer supports
|
8535
|
+
** synonyms. In this case see the discussion below for details.
|
8536
|
+
**
|
8537
|
+
** FTS5 assumes the xToken() callback is invoked for each token in the
|
8538
|
+
** order that they occur within the input text.
|
8539
|
+
**
|
8540
|
+
** If an xToken() callback returns any value other than SQLITE_OK, then
|
8541
|
+
** the tokenization should be abandoned and the xTokenize() method should
|
8542
|
+
** immediately return a copy of the xToken() return value. Or, if the
|
8543
|
+
** input buffer is exhausted, xTokenize() should return SQLITE_OK. Finally,
|
8544
|
+
** if an error occurs with the xTokenize() implementation itself, it
|
8545
|
+
** may abandon the tokenization and return any error code other than
|
8546
|
+
** SQLITE_OK or SQLITE_DONE.
|
8547
|
+
**
|
8548
|
+
** SYNONYM SUPPORT
|
8549
|
+
**
|
8550
|
+
** Custom tokenizers may also support synonyms. Consider a case in which a
|
8551
|
+
** user wishes to query for a phrase such as "first place". Using the
|
8552
|
+
** built-in tokenizers, the FTS5 query 'first + place' will match instances
|
8553
|
+
** of "first place" within the document set, but not alternative forms
|
8554
|
+
** such as "1st place". In some applications, it would be better to match
|
8555
|
+
** all instances of "first place" or "1st place" regardless of which form
|
8556
|
+
** the user specified in the MATCH query text.
|
8557
|
+
**
|
8558
|
+
** There are several ways to approach this in FTS5:
|
8559
|
+
**
|
8560
|
+
** <ol><li> By mapping all synonyms to a single token. In this case, the
|
8561
|
+
** In the above example, this means that the tokenizer returns the
|
8562
|
+
** same token for inputs "first" and "1st". Say that token is in
|
8563
|
+
** fact "first", so that when the user inserts the document "I won
|
8564
|
+
** 1st place" entries are added to the index for tokens "i", "won",
|
8565
|
+
** "first" and "place". If the user then queries for '1st + place',
|
8566
|
+
** the tokenizer substitutes "first" for "1st" and the query works
|
8567
|
+
** as expected.
|
8568
|
+
**
|
8569
|
+
** <li> By adding multiple synonyms for a single term to the FTS index.
|
8570
|
+
** In this case, when tokenizing query text, the tokenizer may
|
8571
|
+
** provide multiple synonyms for a single term within the document.
|
8572
|
+
** FTS5 then queries the index for each synonym individually. For
|
8573
|
+
** example, faced with the query:
|
8574
|
+
**
|
8575
|
+
** <codeblock>
|
8576
|
+
** ... MATCH 'first place'</codeblock>
|
8577
|
+
**
|
8578
|
+
** the tokenizer offers both "1st" and "first" as synonyms for the
|
8579
|
+
** first token in the MATCH query and FTS5 effectively runs a query
|
8580
|
+
** similar to:
|
8581
|
+
**
|
8582
|
+
** <codeblock>
|
8583
|
+
** ... MATCH '(first OR 1st) place'</codeblock>
|
8584
|
+
**
|
8585
|
+
** except that, for the purposes of auxiliary functions, the query
|
8586
|
+
** still appears to contain just two phrases - "(first OR 1st)"
|
8587
|
+
** being treated as a single phrase.
|
8588
|
+
**
|
8589
|
+
** <li> By adding multiple synonyms for a single term to the FTS index.
|
8590
|
+
** Using this method, when tokenizing document text, the tokenizer
|
8591
|
+
** provides multiple synonyms for each token. So that when a
|
8592
|
+
** document such as "I won first place" is tokenized, entries are
|
8593
|
+
** added to the FTS index for "i", "won", "first", "1st" and
|
8594
|
+
** "place".
|
8595
|
+
**
|
8596
|
+
** This way, even if the tokenizer does not provide synonyms
|
8597
|
+
** when tokenizing query text (it should not - to do would be
|
8598
|
+
** inefficient), it doesn't matter if the user queries for
|
8599
|
+
** 'first + place' or '1st + place', as there are entires in the
|
8600
|
+
** FTS index corresponding to both forms of the first token.
|
8601
|
+
** </ol>
|
8602
|
+
**
|
8603
|
+
** Whether it is parsing document or query text, any call to xToken that
|
8604
|
+
** specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit
|
8605
|
+
** is considered to supply a synonym for the previous token. For example,
|
8606
|
+
** when parsing the document "I won first place", a tokenizer that supports
|
8607
|
+
** synonyms would call xToken() 5 times, as follows:
|
8608
|
+
**
|
8609
|
+
** <codeblock>
|
8610
|
+
** xToken(pCtx, 0, "i", 1, 0, 1);
|
8611
|
+
** xToken(pCtx, 0, "won", 3, 2, 5);
|
8612
|
+
** xToken(pCtx, 0, "first", 5, 6, 11);
|
8613
|
+
** xToken(pCtx, FTS5_TOKEN_COLOCATED, "1st", 3, 6, 11);
|
8614
|
+
** xToken(pCtx, 0, "place", 5, 12, 17);
|
8615
|
+
**</codeblock>
|
8616
|
+
**
|
8617
|
+
** It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time
|
8618
|
+
** xToken() is called. Multiple synonyms may be specified for a single token
|
8619
|
+
** by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence.
|
8620
|
+
** There is no limit to the number of synonyms that may be provided for a
|
8621
|
+
** single token.
|
8622
|
+
**
|
8623
|
+
** In many cases, method (1) above is the best approach. It does not add
|
8624
|
+
** extra data to the FTS index or require FTS5 to query for multiple terms,
|
8625
|
+
** so it is efficient in terms of disk space and query speed. However, it
|
8626
|
+
** does not support prefix queries very well. If, as suggested above, the
|
8627
|
+
** token "first" is subsituted for "1st" by the tokenizer, then the query:
|
8628
|
+
**
|
8629
|
+
** <codeblock>
|
8630
|
+
** ... MATCH '1s*'</codeblock>
|
8631
|
+
**
|
8632
|
+
** will not match documents that contain the token "1st" (as the tokenizer
|
8633
|
+
** will probably not map "1s" to any prefix of "first").
|
8634
|
+
**
|
8635
|
+
** For full prefix support, method (3) may be preferred. In this case,
|
8636
|
+
** because the index contains entries for both "first" and "1st", prefix
|
8637
|
+
** queries such as 'fi*' or '1s*' will match correctly. However, because
|
8638
|
+
** extra entries are added to the FTS index, this method uses more space
|
8639
|
+
** within the database.
|
8640
|
+
**
|
8641
|
+
** Method (2) offers a midpoint between (1) and (3). Using this method,
|
8642
|
+
** a query such as '1s*' will match documents that contain the literal
|
8643
|
+
** token "1st", but not "first" (assuming the tokenizer is not able to
|
8644
|
+
** provide synonyms for prefixes). However, a non-prefix query like '1st'
|
8645
|
+
** will match against "1st" and "first". This method does not require
|
8646
|
+
** extra disk space, as no extra entries are added to the FTS index.
|
8647
|
+
** On the other hand, it may require more CPU cycles to run MATCH queries,
|
8648
|
+
** as separate queries of the FTS index are required for each synonym.
|
8649
|
+
**
|
8650
|
+
** When using methods (2) or (3), it is important that the tokenizer only
|
8651
|
+
** provide synonyms when tokenizing document text (method (2)) or query
|
8652
|
+
** text (method (3)), not both. Doing so will not cause any errors, but is
|
8653
|
+
** inefficient.
|
8654
|
+
*/
|
8655
|
+
typedef struct Fts5Tokenizer Fts5Tokenizer;
|
8656
|
+
typedef struct fts5_tokenizer fts5_tokenizer;
|
8657
|
+
struct fts5_tokenizer {
|
8658
|
+
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
8659
|
+
void (*xDelete)(Fts5Tokenizer*);
|
8660
|
+
int (*xTokenize)(Fts5Tokenizer*,
|
8661
|
+
void *pCtx,
|
8662
|
+
int flags, /* Mask of FTS5_TOKENIZE_* flags */
|
8663
|
+
const char *pText, int nText,
|
8664
|
+
int (*xToken)(
|
8665
|
+
void *pCtx, /* Copy of 2nd argument to xTokenize() */
|
8666
|
+
int tflags, /* Mask of FTS5_TOKEN_* flags */
|
8667
|
+
const char *pToken, /* Pointer to buffer containing token */
|
8668
|
+
int nToken, /* Size of token in bytes */
|
8669
|
+
int iStart, /* Byte offset of token within input text */
|
8670
|
+
int iEnd /* Byte offset of end of token within input text */
|
8671
|
+
)
|
8672
|
+
);
|
8673
|
+
};
|
8674
|
+
|
8675
|
+
/* Flags that may be passed as the third argument to xTokenize() */
|
8676
|
+
#define FTS5_TOKENIZE_QUERY 0x0001
|
8677
|
+
#define FTS5_TOKENIZE_PREFIX 0x0002
|
8678
|
+
#define FTS5_TOKENIZE_DOCUMENT 0x0004
|
8679
|
+
#define FTS5_TOKENIZE_AUX 0x0008
|
8680
|
+
|
8681
|
+
/* Flags that may be passed by the tokenizer implementation back to FTS5
|
8682
|
+
** as the third argument to the supplied xToken callback. */
|
8683
|
+
#define FTS5_TOKEN_COLOCATED 0x0001 /* Same position as prev. token */
|
8684
|
+
|
8685
|
+
/*
|
8686
|
+
** END OF CUSTOM TOKENIZERS
|
8687
|
+
*************************************************************************/
|
8688
|
+
|
8689
|
+
/*************************************************************************
|
8690
|
+
** FTS5 EXTENSION REGISTRATION API
|
8691
|
+
*/
|
8692
|
+
typedef struct fts5_api fts5_api;
|
8693
|
+
struct fts5_api {
|
8694
|
+
int iVersion; /* Currently always set to 2 */
|
8695
|
+
|
8696
|
+
/* Create a new tokenizer */
|
8697
|
+
int (*xCreateTokenizer)(
|
8698
|
+
fts5_api *pApi,
|
8699
|
+
const char *zName,
|
8700
|
+
void *pContext,
|
8701
|
+
fts5_tokenizer *pTokenizer,
|
8702
|
+
void (*xDestroy)(void*)
|
8703
|
+
);
|
8704
|
+
|
8705
|
+
/* Find an existing tokenizer */
|
8706
|
+
int (*xFindTokenizer)(
|
8707
|
+
fts5_api *pApi,
|
8708
|
+
const char *zName,
|
8709
|
+
void **ppContext,
|
8710
|
+
fts5_tokenizer *pTokenizer
|
8711
|
+
);
|
8712
|
+
|
8713
|
+
/* Create a new auxiliary function */
|
8714
|
+
int (*xCreateFunction)(
|
8715
|
+
fts5_api *pApi,
|
8716
|
+
const char *zName,
|
8717
|
+
void *pContext,
|
8718
|
+
fts5_extension_function xFunction,
|
8719
|
+
void (*xDestroy)(void*)
|
8720
|
+
);
|
8721
|
+
};
|
8722
|
+
|
8723
|
+
/*
|
8724
|
+
** END OF REGISTRATION API
|
8725
|
+
*************************************************************************/
|
8726
|
+
|
8727
|
+
#ifdef __cplusplus
|
8728
|
+
} /* end of the 'extern "C"' block */
|
8729
|
+
#endif
|
8730
|
+
|
8731
|
+
#endif /* _FTS5_H */
|
8732
|
+
|
8733
|
+
|