Mercurial > embed
comparison sqlite/sqlite3.h @ 59:e5880f2798a1
sqlite: upgrade to 3.23.1, closes #829
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 30 May 2018 13:27:12 +0200 |
parents | a7a33cbf3e52 |
children | a49197d6289b |
comparison
equal
deleted
inserted
replaced
58:e505b2708c99 | 59:e5880f2798a1 |
---|---|
113 ** <a href="http://www.fossil-scm.org/">Fossil configuration management | 113 ** <a href="http://www.fossil-scm.org/">Fossil configuration management |
114 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to | 114 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to |
115 ** a string which identifies a particular check-in of SQLite | 115 ** a string which identifies a particular check-in of SQLite |
116 ** within its configuration management system. ^The SQLITE_SOURCE_ID | 116 ** within its configuration management system. ^The SQLITE_SOURCE_ID |
117 ** string contains the date and time of the check-in (UTC) and a SHA1 | 117 ** string contains the date and time of the check-in (UTC) and a SHA1 |
118 ** or SHA3-256 hash of the entire source tree. | 118 ** or SHA3-256 hash of the entire source tree. If the source code has |
119 ** been edited in any way since it was last checked in, then the last | |
120 ** four hexadecimal digits of the hash may be modified. | |
119 ** | 121 ** |
120 ** See also: [sqlite3_libversion()], | 122 ** See also: [sqlite3_libversion()], |
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()], | 123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
122 ** [sqlite_version()] and [sqlite_source_id()]. | 124 ** [sqlite_version()] and [sqlite_source_id()]. |
123 */ | 125 */ |
124 #define SQLITE_VERSION "3.20.1" | 126 #define SQLITE_VERSION "3.23.1" |
125 #define SQLITE_VERSION_NUMBER 3020001 | 127 #define SQLITE_VERSION_NUMBER 3023001 |
126 #define SQLITE_SOURCE_ID "2017-08-24 16:21:36 8d3a7ea6c5690d6b7c3767558f4f01b511c55463e3f9e64506801fe9b74dce34" | 128 #define SQLITE_SOURCE_ID "2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b" |
127 | 129 |
128 /* | 130 /* |
129 ** CAPI3REF: Run-Time Library Version Numbers | 131 ** CAPI3REF: Run-Time Library Version Numbers |
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid | 132 ** KEYWORDS: sqlite3_version sqlite3_sourceid |
131 ** | 133 ** |
137 ** the header, and thus ensure that the application is | 139 ** the header, and thus ensure that the application is |
138 ** compiled with matching library and header files. | 140 ** compiled with matching library and header files. |
139 ** | 141 ** |
140 ** <blockquote><pre> | 142 ** <blockquote><pre> |
141 ** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER ); | 143 ** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER ); |
142 ** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 ); | 144 ** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 ); |
143 ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 ); | 145 ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 ); |
144 ** </pre></blockquote>)^ | 146 ** </pre></blockquote>)^ |
145 ** | 147 ** |
146 ** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] | 148 ** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] |
147 ** macro. ^The sqlite3_libversion() function returns a pointer to the | 149 ** macro. ^The sqlite3_libversion() function returns a pointer to the |
148 ** to the sqlite3_version[] string constant. The sqlite3_libversion() | 150 ** to the sqlite3_version[] string constant. The sqlite3_libversion() |
149 ** function is provided for use in DLLs since DLL users usually do not have | 151 ** function is provided for use in DLLs since DLL users usually do not have |
150 ** direct access to string constants within the DLL. ^The | 152 ** direct access to string constants within the DLL. ^The |
151 ** sqlite3_libversion_number() function returns an integer equal to | 153 ** sqlite3_libversion_number() function returns an integer equal to |
152 ** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns | 154 ** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns |
153 ** a pointer to a string constant whose value is the same as the | 155 ** a pointer to a string constant whose value is the same as the |
154 ** [SQLITE_SOURCE_ID] C preprocessor macro. | 156 ** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built |
157 ** using an edited copy of [the amalgamation], then the last four characters | |
158 ** of the hash might be different from [SQLITE_SOURCE_ID].)^ | |
155 ** | 159 ** |
156 ** See also: [sqlite_version()] and [sqlite_source_id()]. | 160 ** See also: [sqlite_version()] and [sqlite_source_id()]. |
157 */ | 161 */ |
158 SQLITE_API SQLITE_EXTERN const char sqlite3_version[]; | 162 SQLITE_API SQLITE_EXTERN const char sqlite3_version[]; |
159 SQLITE_API const char *sqlite3_libversion(void); | 163 SQLITE_API const char *sqlite3_libversion(void); |
430 #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ | 434 #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ |
431 #define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */ | 435 #define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */ |
432 #define SQLITE_FULL 13 /* Insertion failed because database is full */ | 436 #define SQLITE_FULL 13 /* Insertion failed because database is full */ |
433 #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ | 437 #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ |
434 #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ | 438 #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ |
435 #define SQLITE_EMPTY 16 /* Not used */ | 439 #define SQLITE_EMPTY 16 /* Internal use only */ |
436 #define SQLITE_SCHEMA 17 /* The database schema changed */ | 440 #define SQLITE_SCHEMA 17 /* The database schema changed */ |
437 #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ | 441 #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ |
438 #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ | 442 #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ |
439 #define SQLITE_MISMATCH 20 /* Data type mismatch */ | 443 #define SQLITE_MISMATCH 20 /* Data type mismatch */ |
440 #define SQLITE_MISUSE 21 /* Library used incorrectly */ | 444 #define SQLITE_MISUSE 21 /* Library used incorrectly */ |
464 ** on a per database connection basis using the | 468 ** on a per database connection basis using the |
465 ** [sqlite3_extended_result_codes()] API. Or, the extended code for | 469 ** [sqlite3_extended_result_codes()] API. Or, the extended code for |
466 ** the most recent error can be obtained using | 470 ** the most recent error can be obtained using |
467 ** [sqlite3_extended_errcode()]. | 471 ** [sqlite3_extended_errcode()]. |
468 */ | 472 */ |
473 #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8)) | |
474 #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8)) | |
469 #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) | 475 #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) |
470 #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) | 476 #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) |
471 #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) | 477 #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) |
472 #define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) | 478 #define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) |
473 #define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) | 479 #define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) |
492 #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) | 498 #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
493 #define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) | 499 #define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) |
494 #define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8)) | 500 #define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8)) |
495 #define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8)) | 501 #define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8)) |
496 #define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8)) | 502 #define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8)) |
503 #define SQLITE_IOERR_BEGIN_ATOMIC (SQLITE_IOERR | (29<<8)) | |
504 #define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30<<8)) | |
505 #define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8)) | |
497 #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) | 506 #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
498 #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) | 507 #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
499 #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) | 508 #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
500 #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) | 509 #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
501 #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) | 510 #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
504 #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) | 513 #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
505 #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) | 514 #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
506 #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) | 515 #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
507 #define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) | 516 #define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) |
508 #define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8)) | 517 #define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8)) |
518 #define SQLITE_READONLY_CANTINIT (SQLITE_READONLY | (5<<8)) | |
519 #define SQLITE_READONLY_DIRECTORY (SQLITE_READONLY | (6<<8)) | |
509 #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) | 520 #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
510 #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) | 521 #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) |
511 #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) | 522 #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) |
512 #define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) | 523 #define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) |
513 #define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) | 524 #define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) |
578 ** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN | 589 ** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN |
579 ** flag indicates that a file cannot be deleted when open. The | 590 ** flag indicates that a file cannot be deleted when open. The |
580 ** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on | 591 ** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on |
581 ** read-only media and cannot be changed even by processes with | 592 ** read-only media and cannot be changed even by processes with |
582 ** elevated privileges. | 593 ** elevated privileges. |
594 ** | |
595 ** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying | |
596 ** filesystem supports doing multiple write operations atomically when those | |
597 ** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and | |
598 ** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. | |
583 */ | 599 */ |
584 #define SQLITE_IOCAP_ATOMIC 0x00000001 | 600 #define SQLITE_IOCAP_ATOMIC 0x00000001 |
585 #define SQLITE_IOCAP_ATOMIC512 0x00000002 | 601 #define SQLITE_IOCAP_ATOMIC512 0x00000002 |
586 #define SQLITE_IOCAP_ATOMIC1K 0x00000004 | 602 #define SQLITE_IOCAP_ATOMIC1K 0x00000004 |
587 #define SQLITE_IOCAP_ATOMIC2K 0x00000008 | 603 #define SQLITE_IOCAP_ATOMIC2K 0x00000008 |
593 #define SQLITE_IOCAP_SAFE_APPEND 0x00000200 | 609 #define SQLITE_IOCAP_SAFE_APPEND 0x00000200 |
594 #define SQLITE_IOCAP_SEQUENTIAL 0x00000400 | 610 #define SQLITE_IOCAP_SEQUENTIAL 0x00000400 |
595 #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 | 611 #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 |
596 #define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000 | 612 #define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000 |
597 #define SQLITE_IOCAP_IMMUTABLE 0x00002000 | 613 #define SQLITE_IOCAP_IMMUTABLE 0x00002000 |
614 #define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000 | |
598 | 615 |
599 /* | 616 /* |
600 ** CAPI3REF: File Locking Levels | 617 ** CAPI3REF: File Locking Levels |
601 ** | 618 ** |
602 ** SQLite uses one of these integer values as the second | 619 ** SQLite uses one of these integer values as the second |
727 ** <li> [SQLITE_IOCAP_SAFE_APPEND] | 744 ** <li> [SQLITE_IOCAP_SAFE_APPEND] |
728 ** <li> [SQLITE_IOCAP_SEQUENTIAL] | 745 ** <li> [SQLITE_IOCAP_SEQUENTIAL] |
729 ** <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN] | 746 ** <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN] |
730 ** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE] | 747 ** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE] |
731 ** <li> [SQLITE_IOCAP_IMMUTABLE] | 748 ** <li> [SQLITE_IOCAP_IMMUTABLE] |
749 ** <li> [SQLITE_IOCAP_BATCH_ATOMIC] | |
732 ** </ul> | 750 ** </ul> |
733 ** | 751 ** |
734 ** The SQLITE_IOCAP_ATOMIC property means that all writes of | 752 ** The SQLITE_IOCAP_ATOMIC property means that all writes of |
735 ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values | 753 ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values |
736 ** mean that writes of blocks that are nnn bytes in size and | 754 ** mean that writes of blocks that are nnn bytes in size and |
1010 ** | 1028 ** |
1011 ** <li>[[SQLITE_FCNTL_RBU]] | 1029 ** <li>[[SQLITE_FCNTL_RBU]] |
1012 ** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by | 1030 ** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by |
1013 ** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for | 1031 ** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for |
1014 ** this opcode. | 1032 ** this opcode. |
1033 ** | |
1034 ** <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]] | |
1035 ** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then | |
1036 ** the file descriptor is placed in "batch write mode", which | |
1037 ** means all subsequent write operations will be deferred and done | |
1038 ** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems | |
1039 ** that do not support batch atomic writes will return SQLITE_NOTFOUND. | |
1040 ** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to | |
1041 ** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or | |
1042 ** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make | |
1043 ** no VFS interface calls on the same [sqlite3_file] file descriptor | |
1044 ** except for calls to the xWrite method and the xFileControl method | |
1045 ** with [SQLITE_FCNTL_SIZE_HINT]. | |
1046 ** | |
1047 ** <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]] | |
1048 ** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write | |
1049 ** operations since the previous successful call to | |
1050 ** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically. | |
1051 ** This file control returns [SQLITE_OK] if and only if the writes were | |
1052 ** all performed successfully and have been committed to persistent storage. | |
1053 ** ^Regardless of whether or not it is successful, this file control takes | |
1054 ** the file descriptor out of batch write mode so that all subsequent | |
1055 ** write operations are independent. | |
1056 ** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without | |
1057 ** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]. | |
1058 ** | |
1059 ** <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]] | |
1060 ** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write | |
1061 ** operations since the previous successful call to | |
1062 ** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back. | |
1063 ** ^This file control takes the file descriptor out of batch write mode | |
1064 ** so that all subsequent write operations are independent. | |
1065 ** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without | |
1066 ** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]. | |
1067 ** | |
1068 ** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]] | |
1069 ** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode causes attempts to obtain | |
1070 ** a file lock using the xLock or xShmLock methods of the VFS to wait | |
1071 ** for up to M milliseconds before failing, where M is the single | |
1072 ** unsigned integer parameter. | |
1015 ** </ul> | 1073 ** </ul> |
1016 */ | 1074 */ |
1017 #define SQLITE_FCNTL_LOCKSTATE 1 | 1075 #define SQLITE_FCNTL_LOCKSTATE 1 |
1018 #define SQLITE_FCNTL_GET_LOCKPROXYFILE 2 | 1076 #define SQLITE_FCNTL_GET_LOCKPROXYFILE 2 |
1019 #define SQLITE_FCNTL_SET_LOCKPROXYFILE 3 | 1077 #define SQLITE_FCNTL_SET_LOCKPROXYFILE 3 |
1041 #define SQLITE_FCNTL_RBU 26 | 1099 #define SQLITE_FCNTL_RBU 26 |
1042 #define SQLITE_FCNTL_VFS_POINTER 27 | 1100 #define SQLITE_FCNTL_VFS_POINTER 27 |
1043 #define SQLITE_FCNTL_JOURNAL_POINTER 28 | 1101 #define SQLITE_FCNTL_JOURNAL_POINTER 28 |
1044 #define SQLITE_FCNTL_WIN32_GET_HANDLE 29 | 1102 #define SQLITE_FCNTL_WIN32_GET_HANDLE 29 |
1045 #define SQLITE_FCNTL_PDB 30 | 1103 #define SQLITE_FCNTL_PDB 30 |
1104 #define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31 | |
1105 #define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32 | |
1106 #define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33 | |
1107 #define SQLITE_FCNTL_LOCK_TIMEOUT 34 | |
1046 | 1108 |
1047 /* deprecated names */ | 1109 /* deprecated names */ |
1048 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE | 1110 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE |
1049 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE | 1111 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE |
1050 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO | 1112 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO |
1078 ** An instance of the sqlite3_vfs object defines the interface between | 1140 ** An instance of the sqlite3_vfs object defines the interface between |
1079 ** the SQLite core and the underlying operating system. The "vfs" | 1141 ** the SQLite core and the underlying operating system. The "vfs" |
1080 ** in the name of the object stands for "virtual file system". See | 1142 ** in the name of the object stands for "virtual file system". See |
1081 ** the [VFS | VFS documentation] for further information. | 1143 ** the [VFS | VFS documentation] for further information. |
1082 ** | 1144 ** |
1083 ** The value of the iVersion field is initially 1 but may be larger in | 1145 ** The VFS interface is sometimes extended by adding new methods onto |
1084 ** future versions of SQLite. Additional fields may be appended to this | 1146 ** the end. Each time such an extension occurs, the iVersion field |
1085 ** object when the iVersion value is increased. Note that the structure | 1147 ** is incremented. The iVersion value started out as 1 in |
1086 ** of the sqlite3_vfs object changes in the transaction between | 1148 ** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2 |
1087 ** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not | 1149 ** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased |
1088 ** modified. | 1150 ** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields |
1151 ** may be appended to the sqlite3_vfs object and the iVersion value | |
1152 ** may increase again in future versions of SQLite. | |
1153 ** Note that the structure | |
1154 ** of the sqlite3_vfs object changes in the transition from | |
1155 ** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0] | |
1156 ** and yet the iVersion field was not modified. | |
1089 ** | 1157 ** |
1090 ** The szOsFile field is the size of the subclassed [sqlite3_file] | 1158 ** The szOsFile field is the size of the subclassed [sqlite3_file] |
1091 ** structure used by this VFS. mxPathname is the maximum length of | 1159 ** structure used by this VFS. mxPathname is the maximum length of |
1092 ** a pathname in this VFS. | 1160 ** a pathname in this VFS. |
1093 ** | 1161 ** |
1611 ** structure is filled with the currently defined memory allocation routines.)^ | 1679 ** structure is filled with the currently defined memory allocation routines.)^ |
1612 ** This option can be used to overload the default memory allocation | 1680 ** This option can be used to overload the default memory allocation |
1613 ** routines with a wrapper that simulations memory allocation failure or | 1681 ** routines with a wrapper that simulations memory allocation failure or |
1614 ** tracks memory usage, for example. </dd> | 1682 ** tracks memory usage, for example. </dd> |
1615 ** | 1683 ** |
1684 ** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt> | |
1685 ** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of | |
1686 ** type int, interpreted as a boolean, which if true provides a hint to | |
1687 ** SQLite that it should avoid large memory allocations if possible. | |
1688 ** SQLite will run faster if it is free to make large memory allocations, | |
1689 ** but some application might prefer to run slower in exchange for | |
1690 ** guarantees about memory fragmentation that are possible if large | |
1691 ** allocations are avoided. This hint is normally off. | |
1692 ** </dd> | |
1693 ** | |
1616 ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt> | 1694 ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt> |
1617 ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int, | 1695 ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int, |
1618 ** interpreted as a boolean, which enables or disables the collection of | 1696 ** interpreted as a boolean, which enables or disables the collection of |
1619 ** memory allocation statistics. ^(When memory allocation statistics are | 1697 ** memory allocation statistics. ^(When memory allocation statistics are |
1620 ** disabled, the following SQLite interfaces become non-operational: | 1698 ** disabled, the following SQLite interfaces become non-operational: |
1628 ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory | 1706 ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory |
1629 ** allocation statistics are disabled by default. | 1707 ** allocation statistics are disabled by default. |
1630 ** </dd> | 1708 ** </dd> |
1631 ** | 1709 ** |
1632 ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt> | 1710 ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt> |
1633 ** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer | 1711 ** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used. |
1634 ** that SQLite can use for scratch memory. ^(There are three arguments | |
1635 ** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte | |
1636 ** aligned memory buffer from which the scratch allocations will be | |
1637 ** drawn, the size of each scratch allocation (sz), | |
1638 ** and the maximum number of scratch allocations (N).)^ | |
1639 ** The first argument must be a pointer to an 8-byte aligned buffer | |
1640 ** of at least sz*N bytes of memory. | |
1641 ** ^SQLite will not use more than one scratch buffers per thread. | |
1642 ** ^SQLite will never request a scratch buffer that is more than 6 | |
1643 ** times the database page size. | |
1644 ** ^If SQLite needs needs additional | |
1645 ** scratch memory beyond what is provided by this configuration option, then | |
1646 ** [sqlite3_malloc()] will be used to obtain the memory needed.<p> | |
1647 ** ^When the application provides any amount of scratch memory using | |
1648 ** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large | |
1649 ** [sqlite3_malloc|heap allocations]. | |
1650 ** This can help [Robson proof|prevent memory allocation failures] due to heap | |
1651 ** fragmentation in low-memory embedded systems. | |
1652 ** </dd> | 1712 ** </dd> |
1653 ** | 1713 ** |
1654 ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt> | 1714 ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt> |
1655 ** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool | 1715 ** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool |
1656 ** that SQLite can use for the database page cache with the default page | 1716 ** that SQLite can use for the database page cache with the default page |
1682 ** additional cache line. </dd> | 1742 ** additional cache line. </dd> |
1683 ** | 1743 ** |
1684 ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt> | 1744 ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt> |
1685 ** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer | 1745 ** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer |
1686 ** that SQLite will use for all of its dynamic memory allocation needs | 1746 ** that SQLite will use for all of its dynamic memory allocation needs |
1687 ** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and | 1747 ** beyond those provided for by [SQLITE_CONFIG_PAGECACHE]. |
1688 ** [SQLITE_CONFIG_PAGECACHE]. | |
1689 ** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled | 1748 ** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled |
1690 ** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns | 1749 ** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns |
1691 ** [SQLITE_ERROR] if invoked otherwise. | 1750 ** [SQLITE_ERROR] if invoked otherwise. |
1692 ** ^There are three arguments to SQLITE_CONFIG_HEAP: | 1751 ** ^There are three arguments to SQLITE_CONFIG_HEAP: |
1693 ** An 8-byte aligned pointer to the memory, | 1752 ** An 8-byte aligned pointer to the memory, |
1876 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ | 1935 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ |
1877 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ | 1936 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ |
1878 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ | 1937 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ |
1879 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ | 1938 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ |
1880 #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ | 1939 #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ |
1881 #define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */ | 1940 #define SQLITE_CONFIG_SCRATCH 6 /* No longer used */ |
1882 #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ | 1941 #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ |
1883 #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ | 1942 #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ |
1884 #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ | 1943 #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ |
1885 #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ | 1944 #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ |
1886 #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ | 1945 #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ |
1897 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ | 1956 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ |
1898 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ | 1957 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ |
1899 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ | 1958 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ |
1900 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ | 1959 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ |
1901 #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ | 1960 #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ |
1961 #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ | |
1902 | 1962 |
1903 /* | 1963 /* |
1904 ** CAPI3REF: Database Connection Configuration Options | 1964 ** CAPI3REF: Database Connection Configuration Options |
1905 ** | 1965 ** |
1906 ** These constants are the available integer configuration options that | 1966 ** These constants are the available integer configuration options that |
1999 ** <dd> Usually, when a database in wal mode is closed or detached from a | 2059 ** <dd> Usually, when a database in wal mode is closed or detached from a |
2000 ** database handle, SQLite checks if this will mean that there are now no | 2060 ** database handle, SQLite checks if this will mean that there are now no |
2001 ** connections at all to the database. If so, it performs a checkpoint | 2061 ** connections at all to the database. If so, it performs a checkpoint |
2002 ** operation before closing the connection. This option may be used to | 2062 ** operation before closing the connection. This option may be used to |
2003 ** override this behaviour. The first parameter passed to this operation | 2063 ** override this behaviour. The first parameter passed to this operation |
2004 ** is an integer - non-zero to disable checkpoints-on-close, or zero (the | 2064 ** is an integer - positive to disable checkpoints-on-close, or zero (the |
2005 ** default) to enable them. The second parameter is a pointer to an integer | 2065 ** default) to enable them, and negative to leave the setting unchanged. |
2066 ** The second parameter is a pointer to an integer | |
2006 ** into which is written 0 or 1 to indicate whether checkpoints-on-close | 2067 ** into which is written 0 or 1 to indicate whether checkpoints-on-close |
2007 ** have been disabled - 0 if they are not disabled, 1 if they are. | 2068 ** have been disabled - 0 if they are not disabled, 1 if they are. |
2008 ** </dd> | 2069 ** </dd> |
2009 ** | 2070 ** |
2010 ** <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> | 2071 ** <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
2014 ** of values of [bound parameters].)^ The QPSG disables some query optimizations | 2075 ** of values of [bound parameters].)^ The QPSG disables some query optimizations |
2015 ** that look at the values of bound parameters, which can make some queries | 2076 ** that look at the values of bound parameters, which can make some queries |
2016 ** slower. But the QPSG has the advantage of more predictable behavior. With | 2077 ** slower. But the QPSG has the advantage of more predictable behavior. With |
2017 ** the QPSG active, SQLite will always use the same query plan in the field as | 2078 ** the QPSG active, SQLite will always use the same query plan in the field as |
2018 ** was used during testing in the lab. | 2079 ** was used during testing in the lab. |
2080 ** The first argument to this setting is an integer which is 0 to disable | |
2081 ** the QPSG, positive to enable QPSG, or negative to leave the setting | |
2082 ** unchanged. The second parameter is a pointer to an integer into which | |
2083 ** is written 0 or 1 to indicate whether the QPSG is disabled or enabled | |
2084 ** following this call. | |
2019 ** </dd> | 2085 ** </dd> |
2020 ** | 2086 ** |
2087 ** <dt>SQLITE_DBCONFIG_TRIGGER_EQP</dt> | |
2088 ** <dd> By default, the output of EXPLAIN QUERY PLAN commands does not | |
2089 ** include output for any operations performed by trigger programs. This | |
2090 ** option is used to set or clear (the default) a flag that governs this | |
2091 ** behavior. The first parameter passed to this operation is an integer - | |
2092 ** positive to enable output for trigger programs, or zero to disable it, | |
2093 ** or negative to leave the setting unchanged. | |
2094 ** The second parameter is a pointer to an integer into which is written | |
2095 ** 0 or 1 to indicate whether output-for-triggers has been disabled - 0 if | |
2096 ** it is not disabled, 1 if it is. | |
2097 ** </dd> | |
2021 ** </dl> | 2098 ** </dl> |
2022 */ | 2099 */ |
2023 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ | 2100 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ |
2024 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ | 2101 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
2025 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ | 2102 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
2026 #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ | 2103 #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ |
2027 #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ | 2104 #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ |
2028 #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ | 2105 #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ |
2029 #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ | 2106 #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ |
2030 #define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ | 2107 #define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ |
2031 | 2108 #define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ |
2109 #define SQLITE_DBCONFIG_MAX 1008 /* Largest DBCONFIG */ | |
2032 | 2110 |
2033 /* | 2111 /* |
2034 ** CAPI3REF: Enable Or Disable Extended Result Codes | 2112 ** CAPI3REF: Enable Or Disable Extended Result Codes |
2035 ** METHOD: sqlite3 | 2113 ** METHOD: sqlite3 |
2036 ** | 2114 ** |
2432 /* | 2510 /* |
2433 ** CAPI3REF: Formatted String Printing Functions | 2511 ** CAPI3REF: Formatted String Printing Functions |
2434 ** | 2512 ** |
2435 ** These routines are work-alikes of the "printf()" family of functions | 2513 ** These routines are work-alikes of the "printf()" family of functions |
2436 ** from the standard C library. | 2514 ** from the standard C library. |
2437 ** These routines understand most of the common K&R formatting options, | 2515 ** These routines understand most of the common formatting options from |
2438 ** plus some additional non-standard formats, detailed below. | 2516 ** the standard library printf() |
2439 ** Note that some of the more obscure formatting options from recent | 2517 ** plus some additional non-standard formats ([%q], [%Q], [%w], and [%z]). |
2440 ** C-library standards are omitted from this implementation. | 2518 ** See the [built-in printf()] documentation for details. |
2441 ** | 2519 ** |
2442 ** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their | 2520 ** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their |
2443 ** results into memory obtained from [sqlite3_malloc()]. | 2521 ** results into memory obtained from [sqlite3_malloc64()]. |
2444 ** The strings returned by these two routines should be | 2522 ** The strings returned by these two routines should be |
2445 ** released by [sqlite3_free()]. ^Both routines return a | 2523 ** released by [sqlite3_free()]. ^Both routines return a |
2446 ** NULL pointer if [sqlite3_malloc()] is unable to allocate enough | 2524 ** NULL pointer if [sqlite3_malloc64()] is unable to allocate enough |
2447 ** memory to hold the resulting string. | 2525 ** memory to hold the resulting string. |
2448 ** | 2526 ** |
2449 ** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from | 2527 ** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from |
2450 ** the standard C library. The result is written into the | 2528 ** the standard C library. The result is written into the |
2451 ** buffer supplied as the second parameter whose size is given by | 2529 ** buffer supplied as the second parameter whose size is given by |
2465 ** the zero terminator. So the longest string that can be completely | 2543 ** the zero terminator. So the longest string that can be completely |
2466 ** written will be n-1 characters. | 2544 ** written will be n-1 characters. |
2467 ** | 2545 ** |
2468 ** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). | 2546 ** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). |
2469 ** | 2547 ** |
2470 ** These routines all implement some additional formatting | 2548 ** See also: [built-in printf()], [printf() SQL function] |
2471 ** options that are useful for constructing SQL statements. | |
2472 ** All of the usual printf() formatting options apply. In addition, there | |
2473 ** is are "%q", "%Q", "%w" and "%z" options. | |
2474 ** | |
2475 ** ^(The %q option works like %s in that it substitutes a nul-terminated | |
2476 ** string from the argument list. But %q also doubles every '\'' character. | |
2477 ** %q is designed for use inside a string literal.)^ By doubling each '\'' | |
2478 ** character it escapes that character and allows it to be inserted into | |
2479 ** the string. | |
2480 ** | |
2481 ** For example, assume the string variable zText contains text as follows: | |
2482 ** | |
2483 ** <blockquote><pre> | |
2484 ** char *zText = "It's a happy day!"; | |
2485 ** </pre></blockquote> | |
2486 ** | |
2487 ** One can use this text in an SQL statement as follows: | |
2488 ** | |
2489 ** <blockquote><pre> | |
2490 ** char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText); | |
2491 ** sqlite3_exec(db, zSQL, 0, 0, 0); | |
2492 ** sqlite3_free(zSQL); | |
2493 ** </pre></blockquote> | |
2494 ** | |
2495 ** Because the %q format string is used, the '\'' character in zText | |
2496 ** is escaped and the SQL generated is as follows: | |
2497 ** | |
2498 ** <blockquote><pre> | |
2499 ** INSERT INTO table1 VALUES('It''s a happy day!') | |
2500 ** </pre></blockquote> | |
2501 ** | |
2502 ** This is correct. Had we used %s instead of %q, the generated SQL | |
2503 ** would have looked like this: | |
2504 ** | |
2505 ** <blockquote><pre> | |
2506 ** INSERT INTO table1 VALUES('It's a happy day!'); | |
2507 ** </pre></blockquote> | |
2508 ** | |
2509 ** This second example is an SQL syntax error. As a general rule you should | |
2510 ** always use %q instead of %s when inserting text into a string literal. | |
2511 ** | |
2512 ** ^(The %Q option works like %q except it also adds single quotes around | |
2513 ** the outside of the total string. Additionally, if the parameter in the | |
2514 ** argument list is a NULL pointer, %Q substitutes the text "NULL" (without | |
2515 ** single quotes).)^ So, for example, one could say: | |
2516 ** | |
2517 ** <blockquote><pre> | |
2518 ** char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText); | |
2519 ** sqlite3_exec(db, zSQL, 0, 0, 0); | |
2520 ** sqlite3_free(zSQL); | |
2521 ** </pre></blockquote> | |
2522 ** | |
2523 ** The code above will render a correct SQL statement in the zSQL | |
2524 ** variable even if the zText variable is a NULL pointer. | |
2525 ** | |
2526 ** ^(The "%w" formatting option is like "%q" except that it expects to | |
2527 ** be contained within double-quotes instead of single quotes, and it | |
2528 ** escapes the double-quote character instead of the single-quote | |
2529 ** character.)^ The "%w" formatting option is intended for safely inserting | |
2530 ** table and column names into a constructed SQL statement. | |
2531 ** | |
2532 ** ^(The "%z" formatting option works like "%s" but with the | |
2533 ** addition that after the string has been read and copied into | |
2534 ** the result, [sqlite3_free()] is called on the input string.)^ | |
2535 */ | 2549 */ |
2536 SQLITE_API char *sqlite3_mprintf(const char*,...); | 2550 SQLITE_API char *sqlite3_mprintf(const char*,...); |
2537 SQLITE_API char *sqlite3_vmprintf(const char*, va_list); | 2551 SQLITE_API char *sqlite3_vmprintf(const char*, va_list); |
2538 SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...); | 2552 SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...); |
2539 SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list); | 2553 SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list); |
2887 /* | 2901 /* |
2888 ** CAPI3REF: SQL Trace Event Codes | 2902 ** CAPI3REF: SQL Trace Event Codes |
2889 ** KEYWORDS: SQLITE_TRACE | 2903 ** KEYWORDS: SQLITE_TRACE |
2890 ** | 2904 ** |
2891 ** These constants identify classes of events that can be monitored | 2905 ** These constants identify classes of events that can be monitored |
2892 ** using the [sqlite3_trace_v2()] tracing logic. The third argument | 2906 ** using the [sqlite3_trace_v2()] tracing logic. The M argument |
2893 ** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of | 2907 ** to [sqlite3_trace_v2(D,M,X,P)] is an OR-ed combination of one or more of |
2894 ** the following constants. ^The first argument to the trace callback | 2908 ** the following constants. ^The first argument to the trace callback |
2895 ** is one of the following constants. | 2909 ** is one of the following constants. |
2896 ** | 2910 ** |
2897 ** New tracing constants may be added in future releases. | 2911 ** New tracing constants may be added in future releases. |
2898 ** | 2912 ** |
3097 ** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3> | 3111 ** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3> |
3098 ** | 3112 ** |
3099 ** ^If [URI filename] interpretation is enabled, and the filename argument | 3113 ** ^If [URI filename] interpretation is enabled, and the filename argument |
3100 ** begins with "file:", then the filename is interpreted as a URI. ^URI | 3114 ** begins with "file:", then the filename is interpreted as a URI. ^URI |
3101 ** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is | 3115 ** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is |
3102 ** set in the fourth argument to sqlite3_open_v2(), or if it has | 3116 ** set in the third argument to sqlite3_open_v2(), or if it has |
3103 ** been enabled globally using the [SQLITE_CONFIG_URI] option with the | 3117 ** been enabled globally using the [SQLITE_CONFIG_URI] option with the |
3104 ** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. | 3118 ** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. |
3105 ** As of SQLite version 3.7.7, URI filename interpretation is turned off | 3119 ** URI filename interpretation is turned off |
3106 ** by default, but future releases of SQLite might enable URI filename | 3120 ** by default, but future releases of SQLite might enable URI filename |
3107 ** interpretation by default. See "[URI filenames]" for additional | 3121 ** interpretation by default. See "[URI filenames]" for additional |
3108 ** information. | 3122 ** information. |
3109 ** | 3123 ** |
3110 ** URI filenames are parsed according to RFC 3986. ^If the URI contains an | 3124 ** URI filenames are parsed according to RFC 3986. ^If the URI contains an |
3595 ** ^The specific value of WHERE-clause [parameter] might influence the | 3609 ** ^The specific value of WHERE-clause [parameter] might influence the |
3596 ** choice of query plan if the parameter is the left-hand side of a [LIKE] | 3610 ** choice of query plan if the parameter is the left-hand side of a [LIKE] |
3597 ** or [GLOB] operator or if the parameter is compared to an indexed column | 3611 ** or [GLOB] operator or if the parameter is compared to an indexed column |
3598 ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. | 3612 ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. |
3599 ** </li> | 3613 ** </li> |
3614 ** </ol> | |
3600 ** | 3615 ** |
3601 ** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having | 3616 ** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having |
3602 ** the extra prepFlags parameter, which is a bit array consisting of zero or | 3617 ** the extra prepFlags parameter, which is a bit array consisting of zero or |
3603 ** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The | 3618 ** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The |
3604 ** sqlite3_prepare_v2() interface works exactly the same as | 3619 ** sqlite3_prepare_v2() interface works exactly the same as |
3605 ** sqlite3_prepare_v3() with a zero prepFlags parameter. | 3620 ** sqlite3_prepare_v3() with a zero prepFlags parameter. |
3606 ** </ol> | |
3607 */ | 3621 */ |
3608 SQLITE_API int sqlite3_prepare( | 3622 SQLITE_API int sqlite3_prepare( |
3609 sqlite3 *db, /* Database handle */ | 3623 sqlite3 *db, /* Database handle */ |
3610 const char *zSql, /* SQL statement, UTF-8 encoded */ | 3624 const char *zSql, /* SQL statement, UTF-8 encoded */ |
3611 int nByte, /* Maximum length of zSql in bytes. */ | 3625 int nByte, /* Maximum length of zSql in bytes. */ |
3774 ** | 3788 ** |
3775 ** ^The sqlite3_value objects that are passed as parameters into the | 3789 ** ^The sqlite3_value objects that are passed as parameters into the |
3776 ** implementation of [application-defined SQL functions] are protected. | 3790 ** implementation of [application-defined SQL functions] are protected. |
3777 ** ^The sqlite3_value object returned by | 3791 ** ^The sqlite3_value object returned by |
3778 ** [sqlite3_column_value()] is unprotected. | 3792 ** [sqlite3_column_value()] is unprotected. |
3779 ** Unprotected sqlite3_value objects may only be used with | 3793 ** Unprotected sqlite3_value objects may only be used as arguments |
3780 ** [sqlite3_result_value()] and [sqlite3_bind_value()]. | 3794 ** to [sqlite3_result_value()], [sqlite3_bind_value()], and |
3795 ** [sqlite3_value_dup()]. | |
3781 ** The [sqlite3_value_blob | sqlite3_value_type()] family of | 3796 ** The [sqlite3_value_blob | sqlite3_value_type()] family of |
3782 ** interfaces require protected sqlite3_value objects. | 3797 ** interfaces require protected sqlite3_value objects. |
3783 */ | 3798 */ |
3784 typedef struct sqlite3_value sqlite3_value; | 3799 typedef struct sqlite3_value sqlite3_value; |
3785 | 3800 |
4197 ** For all versions of SQLite up to and including 3.6.23.1, a call to | 4212 ** For all versions of SQLite up to and including 3.6.23.1, a call to |
4198 ** [sqlite3_reset()] was required after sqlite3_step() returned anything | 4213 ** [sqlite3_reset()] was required after sqlite3_step() returned anything |
4199 ** other than [SQLITE_ROW] before any subsequent invocation of | 4214 ** other than [SQLITE_ROW] before any subsequent invocation of |
4200 ** sqlite3_step(). Failure to reset the prepared statement using | 4215 ** sqlite3_step(). Failure to reset the prepared statement using |
4201 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from | 4216 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from |
4202 ** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]), | 4217 ** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1], |
4203 ** sqlite3_step() began | 4218 ** sqlite3_step() began |
4204 ** calling [sqlite3_reset()] automatically in this circumstance rather | 4219 ** calling [sqlite3_reset()] automatically in this circumstance rather |
4205 ** than returning [SQLITE_MISUSE]. This is not considered a compatibility | 4220 ** than returning [SQLITE_MISUSE]. This is not considered a compatibility |
4206 ** break because any application that ever receives an SQLITE_MISUSE error | 4221 ** break because any application that ever receives an SQLITE_MISUSE error |
4207 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option | 4222 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option |
4733 ** TEXT in bytes | 4748 ** TEXT in bytes |
4734 ** <tr><td><b>sqlite3_value_type</b><td>→<td>Default | 4749 ** <tr><td><b>sqlite3_value_type</b><td>→<td>Default |
4735 ** datatype of the value | 4750 ** datatype of the value |
4736 ** <tr><td><b>sqlite3_value_numeric_type </b> | 4751 ** <tr><td><b>sqlite3_value_numeric_type </b> |
4737 ** <td>→ <td>Best numeric datatype of the value | 4752 ** <td>→ <td>Best numeric datatype of the value |
4753 ** <tr><td><b>sqlite3_value_nochange </b> | |
4754 ** <td>→ <td>True if the column is unchanged in an UPDATE | |
4755 ** against a virtual table. | |
4738 ** </table></blockquote> | 4756 ** </table></blockquote> |
4739 ** | 4757 ** |
4740 ** <b>Details:</b> | 4758 ** <b>Details:</b> |
4741 ** | 4759 ** |
4742 ** These routines extract type, size, and content information from | 4760 ** These routines extract type, size, and content information from |
4780 ** made to convert the value to an integer or floating point. If | 4798 ** made to convert the value to an integer or floating point. If |
4781 ** such a conversion is possible without loss of information (in other | 4799 ** such a conversion is possible without loss of information (in other |
4782 ** words, if the value is a string that looks like a number) | 4800 ** words, if the value is a string that looks like a number) |
4783 ** then the conversion is performed. Otherwise no conversion occurs. | 4801 ** then the conversion is performed. Otherwise no conversion occurs. |
4784 ** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ | 4802 ** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ |
4803 ** | |
4804 ** ^Within the [xUpdate] method of a [virtual table], the | |
4805 ** sqlite3_value_nochange(X) interface returns true if and only if | |
4806 ** the column corresponding to X is unchanged by the UPDATE operation | |
4807 ** that the xUpdate method call was invoked to implement and if | |
4808 ** and the prior [xColumn] method call that was invoked to extracted | |
4809 ** the value for that column returned without setting a result (probably | |
4810 ** because it queried [sqlite3_vtab_nochange()] and found that the column | |
4811 ** was unchanging). ^Within an [xUpdate] method, any value for which | |
4812 ** sqlite3_value_nochange(X) is true will in all other respects appear | |
4813 ** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other | |
4814 ** than within an [xUpdate] method call for an UPDATE statement, then | |
4815 ** the return value is arbitrary and meaningless. | |
4785 ** | 4816 ** |
4786 ** Please pay particular attention to the fact that the pointer returned | 4817 ** Please pay particular attention to the fact that the pointer returned |
4787 ** from [sqlite3_value_blob()], [sqlite3_value_text()], or | 4818 ** from [sqlite3_value_blob()], [sqlite3_value_text()], or |
4788 ** [sqlite3_value_text16()] can be invalidated by a subsequent call to | 4819 ** [sqlite3_value_text16()] can be invalidated by a subsequent call to |
4789 ** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], | 4820 ** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], |
4803 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); | 4834 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); |
4804 SQLITE_API int sqlite3_value_bytes(sqlite3_value*); | 4835 SQLITE_API int sqlite3_value_bytes(sqlite3_value*); |
4805 SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); | 4836 SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); |
4806 SQLITE_API int sqlite3_value_type(sqlite3_value*); | 4837 SQLITE_API int sqlite3_value_type(sqlite3_value*); |
4807 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); | 4838 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); |
4839 SQLITE_API int sqlite3_value_nochange(sqlite3_value*); | |
4808 | 4840 |
4809 /* | 4841 /* |
4810 ** CAPI3REF: Finding The Subtype Of SQL Values | 4842 ** CAPI3REF: Finding The Subtype Of SQL Values |
4811 ** METHOD: sqlite3_value | 4843 ** METHOD: sqlite3_value |
4812 ** | 4844 ** |
6201 ** These macros defined the allowed values for the | 6233 ** These macros defined the allowed values for the |
6202 ** [sqlite3_index_info].aConstraint[].op field. Each value represents | 6234 ** [sqlite3_index_info].aConstraint[].op field. Each value represents |
6203 ** an operator that is part of a constraint term in the wHERE clause of | 6235 ** an operator that is part of a constraint term in the wHERE clause of |
6204 ** a query that uses a [virtual table]. | 6236 ** a query that uses a [virtual table]. |
6205 */ | 6237 */ |
6206 #define SQLITE_INDEX_CONSTRAINT_EQ 2 | 6238 #define SQLITE_INDEX_CONSTRAINT_EQ 2 |
6207 #define SQLITE_INDEX_CONSTRAINT_GT 4 | 6239 #define SQLITE_INDEX_CONSTRAINT_GT 4 |
6208 #define SQLITE_INDEX_CONSTRAINT_LE 8 | 6240 #define SQLITE_INDEX_CONSTRAINT_LE 8 |
6209 #define SQLITE_INDEX_CONSTRAINT_LT 16 | 6241 #define SQLITE_INDEX_CONSTRAINT_LT 16 |
6210 #define SQLITE_INDEX_CONSTRAINT_GE 32 | 6242 #define SQLITE_INDEX_CONSTRAINT_GE 32 |
6211 #define SQLITE_INDEX_CONSTRAINT_MATCH 64 | 6243 #define SQLITE_INDEX_CONSTRAINT_MATCH 64 |
6212 #define SQLITE_INDEX_CONSTRAINT_LIKE 65 | 6244 #define SQLITE_INDEX_CONSTRAINT_LIKE 65 |
6213 #define SQLITE_INDEX_CONSTRAINT_GLOB 66 | 6245 #define SQLITE_INDEX_CONSTRAINT_GLOB 66 |
6214 #define SQLITE_INDEX_CONSTRAINT_REGEXP 67 | 6246 #define SQLITE_INDEX_CONSTRAINT_REGEXP 67 |
6247 #define SQLITE_INDEX_CONSTRAINT_NE 68 | |
6248 #define SQLITE_INDEX_CONSTRAINT_ISNOT 69 | |
6249 #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 | |
6250 #define SQLITE_INDEX_CONSTRAINT_ISNULL 71 | |
6251 #define SQLITE_INDEX_CONSTRAINT_IS 72 | |
6215 | 6252 |
6216 /* | 6253 /* |
6217 ** CAPI3REF: Register A Virtual Table Implementation | 6254 ** CAPI3REF: Register A Virtual Table Implementation |
6218 ** METHOD: sqlite3 | 6255 ** METHOD: sqlite3 |
6219 ** | 6256 ** |
6900 ** ^The third and fourth parameters to this routine | 6937 ** ^The third and fourth parameters to this routine |
6901 ** are passed directly through to the second and third parameters of | 6938 ** are passed directly through to the second and third parameters of |
6902 ** the xFileControl method. ^The return value of the xFileControl | 6939 ** the xFileControl method. ^The return value of the xFileControl |
6903 ** method becomes the return value of this routine. | 6940 ** method becomes the return value of this routine. |
6904 ** | 6941 ** |
6905 ** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes | 6942 ** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes |
6906 ** a pointer to the underlying [sqlite3_file] object to be written into | 6943 ** a pointer to the underlying [sqlite3_file] object to be written into |
6907 ** the space pointed to by the 4th parameter. ^The SQLITE_FCNTL_FILE_POINTER | 6944 ** the space pointed to by the 4th parameter. ^The [SQLITE_FCNTL_FILE_POINTER] |
6908 ** case is a short-circuit path which does not actually invoke the | 6945 ** case is a short-circuit path which does not actually invoke the |
6909 ** underlying sqlite3_io_methods.xFileControl method. | 6946 ** underlying sqlite3_io_methods.xFileControl method. |
6910 ** | 6947 ** |
6911 ** ^If the second parameter (zDbName) does not match the name of any | 6948 ** ^If the second parameter (zDbName) does not match the name of any |
6912 ** open database file, then SQLITE_ERROR is returned. ^This error | 6949 ** open database file, then SQLITE_ERROR is returned. ^This error |
6914 ** or [sqlite3_errmsg()]. The underlying xFileControl method might | 6951 ** or [sqlite3_errmsg()]. The underlying xFileControl method might |
6915 ** also return SQLITE_ERROR. There is no way to distinguish between | 6952 ** also return SQLITE_ERROR. There is no way to distinguish between |
6916 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying | 6953 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying |
6917 ** xFileControl method. | 6954 ** xFileControl method. |
6918 ** | 6955 ** |
6919 ** See also: [SQLITE_FCNTL_LOCKSTATE] | 6956 ** See also: [file control opcodes] |
6920 */ | 6957 */ |
6921 SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); | 6958 SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); |
6922 | 6959 |
6923 /* | 6960 /* |
6924 ** CAPI3REF: Testing Interface | 6961 ** CAPI3REF: Testing Interface |
6961 #define SQLITE_TESTCTRL_ASSERT 12 | 6998 #define SQLITE_TESTCTRL_ASSERT 12 |
6962 #define SQLITE_TESTCTRL_ALWAYS 13 | 6999 #define SQLITE_TESTCTRL_ALWAYS 13 |
6963 #define SQLITE_TESTCTRL_RESERVE 14 | 7000 #define SQLITE_TESTCTRL_RESERVE 14 |
6964 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 | 7001 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 |
6965 #define SQLITE_TESTCTRL_ISKEYWORD 16 | 7002 #define SQLITE_TESTCTRL_ISKEYWORD 16 |
6966 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 | 7003 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */ |
6967 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 | 7004 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 |
6968 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */ | 7005 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */ |
6969 #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19 | 7006 #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19 |
6970 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20 | 7007 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20 |
6971 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21 | 7008 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21 |
6972 #define SQLITE_TESTCTRL_BYTEORDER 22 | 7009 #define SQLITE_TESTCTRL_BYTEORDER 22 |
6973 #define SQLITE_TESTCTRL_ISINIT 23 | 7010 #define SQLITE_TESTCTRL_ISINIT 23 |
6974 #define SQLITE_TESTCTRL_SORTER_MMAP 24 | 7011 #define SQLITE_TESTCTRL_SORTER_MMAP 24 |
6975 #define SQLITE_TESTCTRL_IMPOSTER 25 | 7012 #define SQLITE_TESTCTRL_IMPOSTER 25 |
6976 #define SQLITE_TESTCTRL_LAST 25 | 7013 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 |
7014 #define SQLITE_TESTCTRL_LAST 26 /* Largest TESTCTRL */ | |
6977 | 7015 |
6978 /* | 7016 /* |
6979 ** CAPI3REF: SQLite Runtime Status | 7017 ** CAPI3REF: SQLite Runtime Status |
6980 ** | 7018 ** |
6981 ** ^These interfaces are used to retrieve runtime status information | 7019 ** ^These interfaces are used to retrieve runtime status information |
7020 ** <dl> | 7058 ** <dl> |
7021 ** [[SQLITE_STATUS_MEMORY_USED]] ^(<dt>SQLITE_STATUS_MEMORY_USED</dt> | 7059 ** [[SQLITE_STATUS_MEMORY_USED]] ^(<dt>SQLITE_STATUS_MEMORY_USED</dt> |
7022 ** <dd>This parameter is the current amount of memory checked out | 7060 ** <dd>This parameter is the current amount of memory checked out |
7023 ** using [sqlite3_malloc()], either directly or indirectly. The | 7061 ** using [sqlite3_malloc()], either directly or indirectly. The |
7024 ** figure includes calls made to [sqlite3_malloc()] by the application | 7062 ** figure includes calls made to [sqlite3_malloc()] by the application |
7025 ** and internal memory usage by the SQLite library. Scratch memory | 7063 ** and internal memory usage by the SQLite library. Auxiliary page-cache |
7026 ** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache | |
7027 ** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in | 7064 ** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in |
7028 ** this parameter. The amount returned is the sum of the allocation | 7065 ** this parameter. The amount returned is the sum of the allocation |
7029 ** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^ | 7066 ** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^ |
7030 ** | 7067 ** |
7031 ** [[SQLITE_STATUS_MALLOC_SIZE]] ^(<dt>SQLITE_STATUS_MALLOC_SIZE</dt> | 7068 ** [[SQLITE_STATUS_MALLOC_SIZE]] ^(<dt>SQLITE_STATUS_MALLOC_SIZE</dt> |
7059 ** <dd>This parameter records the largest memory allocation request | 7096 ** <dd>This parameter records the largest memory allocation request |
7060 ** handed to [pagecache memory allocator]. Only the value returned in the | 7097 ** handed to [pagecache memory allocator]. Only the value returned in the |
7061 ** *pHighwater parameter to [sqlite3_status()] is of interest. | 7098 ** *pHighwater parameter to [sqlite3_status()] is of interest. |
7062 ** The value written into the *pCurrent parameter is undefined.</dd>)^ | 7099 ** The value written into the *pCurrent parameter is undefined.</dd>)^ |
7063 ** | 7100 ** |
7064 ** [[SQLITE_STATUS_SCRATCH_USED]] ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt> | 7101 ** [[SQLITE_STATUS_SCRATCH_USED]] <dt>SQLITE_STATUS_SCRATCH_USED</dt> |
7065 ** <dd>This parameter returns the number of allocations used out of the | 7102 ** <dd>No longer used.</dd> |
7066 ** [scratch memory allocator] configured using | |
7067 ** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not | |
7068 ** in bytes. Since a single thread may only have one scratch allocation | |
7069 ** outstanding at time, this parameter also reports the number of threads | |
7070 ** using scratch memory at the same time.</dd>)^ | |
7071 ** | 7103 ** |
7072 ** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt> | 7104 ** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt> |
7073 ** <dd>This parameter returns the number of bytes of scratch memory | 7105 ** <dd>No longer used.</dd> |
7074 ** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH] | 7106 ** |
7075 ** buffer and where forced to overflow to [sqlite3_malloc()]. The values | 7107 ** [[SQLITE_STATUS_SCRATCH_SIZE]] <dt>SQLITE_STATUS_SCRATCH_SIZE</dt> |
7076 ** returned include overflows because the requested allocation was too | 7108 ** <dd>No longer used.</dd> |
7077 ** larger (that is, because the requested allocation was larger than the | |
7078 ** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer | |
7079 ** slots were available. | |
7080 ** </dd>)^ | |
7081 ** | |
7082 ** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt> | |
7083 ** <dd>This parameter records the largest memory allocation request | |
7084 ** handed to [scratch memory allocator]. Only the value returned in the | |
7085 ** *pHighwater parameter to [sqlite3_status()] is of interest. | |
7086 ** The value written into the *pCurrent parameter is undefined.</dd>)^ | |
7087 ** | 7109 ** |
7088 ** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt> | 7110 ** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt> |
7089 ** <dd>The *pHighwater parameter records the deepest parser stack. | 7111 ** <dd>The *pHighwater parameter records the deepest parser stack. |
7090 ** The *pCurrent value is undefined. The *pHighwater value is only | 7112 ** The *pCurrent value is undefined. The *pHighwater value is only |
7091 ** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^ | 7113 ** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^ |
7094 ** New status parameters may be added from time to time. | 7116 ** New status parameters may be added from time to time. |
7095 */ | 7117 */ |
7096 #define SQLITE_STATUS_MEMORY_USED 0 | 7118 #define SQLITE_STATUS_MEMORY_USED 0 |
7097 #define SQLITE_STATUS_PAGECACHE_USED 1 | 7119 #define SQLITE_STATUS_PAGECACHE_USED 1 |
7098 #define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 | 7120 #define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 |
7099 #define SQLITE_STATUS_SCRATCH_USED 3 | 7121 #define SQLITE_STATUS_SCRATCH_USED 3 /* NOT USED */ |
7100 #define SQLITE_STATUS_SCRATCH_OVERFLOW 4 | 7122 #define SQLITE_STATUS_SCRATCH_OVERFLOW 4 /* NOT USED */ |
7101 #define SQLITE_STATUS_MALLOC_SIZE 5 | 7123 #define SQLITE_STATUS_MALLOC_SIZE 5 |
7102 #define SQLITE_STATUS_PARSER_STACK 6 | 7124 #define SQLITE_STATUS_PARSER_STACK 6 |
7103 #define SQLITE_STATUS_PAGECACHE_SIZE 7 | 7125 #define SQLITE_STATUS_PAGECACHE_SIZE 7 |
7104 #define SQLITE_STATUS_SCRATCH_SIZE 8 | 7126 #define SQLITE_STATUS_SCRATCH_SIZE 8 /* NOT USED */ |
7105 #define SQLITE_STATUS_MALLOC_COUNT 9 | 7127 #define SQLITE_STATUS_MALLOC_COUNT 9 |
7106 | 7128 |
7107 /* | 7129 /* |
7108 ** CAPI3REF: Database Connection Status | 7130 ** CAPI3REF: Database Connection Status |
7109 ** METHOD: sqlite3 | 7131 ** METHOD: sqlite3 |
7220 ** database file in rollback mode databases. Any pages written as part of | 7242 ** database file in rollback mode databases. Any pages written as part of |
7221 ** transaction rollback or database recovery operations are not included. | 7243 ** transaction rollback or database recovery operations are not included. |
7222 ** If an IO or other error occurs while writing a page to disk, the effect | 7244 ** If an IO or other error occurs while writing a page to disk, the effect |
7223 ** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The | 7245 ** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The |
7224 ** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0. | 7246 ** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0. |
7247 ** </dd> | |
7248 ** | |
7249 ** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt> | |
7250 ** <dd>This parameter returns the number of dirty cache entries that have | |
7251 ** been written to disk in the middle of a transaction due to the page | |
7252 ** cache overflowing. Transactions are more efficient if they are written | |
7253 ** to disk all at once. When pages spill mid-transaction, that introduces | |
7254 ** additional overhead. This parameter can be used help identify | |
7255 ** inefficiencies that can be resolve by increasing the cache size. | |
7225 ** </dd> | 7256 ** </dd> |
7226 ** | 7257 ** |
7227 ** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt> | 7258 ** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt> |
7228 ** <dd>This parameter returns zero for the current value if and only if | 7259 ** <dd>This parameter returns zero for the current value if and only if |
7229 ** all foreign key constraints (deferred or immediate) have been | 7260 ** all foreign key constraints (deferred or immediate) have been |
7241 #define SQLITE_DBSTATUS_CACHE_HIT 7 | 7272 #define SQLITE_DBSTATUS_CACHE_HIT 7 |
7242 #define SQLITE_DBSTATUS_CACHE_MISS 8 | 7273 #define SQLITE_DBSTATUS_CACHE_MISS 8 |
7243 #define SQLITE_DBSTATUS_CACHE_WRITE 9 | 7274 #define SQLITE_DBSTATUS_CACHE_WRITE 9 |
7244 #define SQLITE_DBSTATUS_DEFERRED_FKS 10 | 7275 #define SQLITE_DBSTATUS_DEFERRED_FKS 10 |
7245 #define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 | 7276 #define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 |
7246 #define SQLITE_DBSTATUS_MAX 11 /* Largest defined DBSTATUS */ | 7277 #define SQLITE_DBSTATUS_CACHE_SPILL 12 |
7278 #define SQLITE_DBSTATUS_MAX 12 /* Largest defined DBSTATUS */ | |
7247 | 7279 |
7248 | 7280 |
7249 /* | 7281 /* |
7250 ** CAPI3REF: Prepared Statement Status | 7282 ** CAPI3REF: Prepared Statement Status |
7251 ** METHOD: sqlite3_stmt | 7283 ** METHOD: sqlite3_stmt |
8242 ** [virtual table]. | 8274 ** [virtual table]. |
8243 */ | 8275 */ |
8244 SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *); | 8276 SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *); |
8245 | 8277 |
8246 /* | 8278 /* |
8279 ** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE | |
8280 ** | |
8281 ** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn] | |
8282 ** method of a [virtual table], then it returns true if and only if the | |
8283 ** column is being fetched as part of an UPDATE operation during which the | |
8284 ** column value will not change. Applications might use this to substitute | |
8285 ** a lighter-weight value to return that the corresponding [xUpdate] method | |
8286 ** understands as a "no-change" value. | |
8287 ** | |
8288 ** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that | |
8289 ** the column is not changed by the UPDATE statement, they the xColumn | |
8290 ** method can optionally return without setting a result, without calling | |
8291 ** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces]. | |
8292 ** In that case, [sqlite3_value_nochange(X)] will return true for the | |
8293 ** same column in the [xUpdate] method. | |
8294 */ | |
8295 SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*); | |
8296 | |
8297 /* | |
8298 ** CAPI3REF: Determine The Collation For a Virtual Table Constraint | |
8299 ** | |
8300 ** This function may only be called from within a call to the [xBestIndex] | |
8301 ** method of a [virtual table]. | |
8302 ** | |
8303 ** The first argument must be the sqlite3_index_info object that is the | |
8304 ** first parameter to the xBestIndex() method. The second argument must be | |
8305 ** an index into the aConstraint[] array belonging to the sqlite3_index_info | |
8306 ** structure passed to xBestIndex. This function returns a pointer to a buffer | |
8307 ** containing the name of the collation sequence for the corresponding | |
8308 ** constraint. | |
8309 */ | |
8310 SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int); | |
8311 | |
8312 /* | |
8247 ** CAPI3REF: Conflict resolution modes | 8313 ** CAPI3REF: Conflict resolution modes |
8248 ** KEYWORDS: {conflict resolution mode} | 8314 ** KEYWORDS: {conflict resolution mode} |
8249 ** | 8315 ** |
8250 ** These constants are returned by [sqlite3_vtab_on_conflict()] to | 8316 ** These constants are returned by [sqlite3_vtab_on_conflict()] to |
8251 ** inform a [virtual table] implementation what the [ON CONFLICT] mode | 8317 ** inform a [virtual table] implementation what the [ON CONFLICT] mode |
8688 ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. | 8754 ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. |
8689 */ | 8755 */ |
8690 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb); | 8756 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb); |
8691 | 8757 |
8692 /* | 8758 /* |
8759 ** CAPI3REF: Serialize a database | |
8760 ** | |
8761 ** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory | |
8762 ** that is a serialization of the S database on [database connection] D. | |
8763 ** If P is not a NULL pointer, then the size of the database in bytes | |
8764 ** is written into *P. | |
8765 ** | |
8766 ** For an ordinary on-disk database file, the serialization is just a | |
8767 ** copy of the disk file. For an in-memory database or a "TEMP" database, | |
8768 ** the serialization is the same sequence of bytes which would be written | |
8769 ** to disk if that database where backed up to disk. | |
8770 ** | |
8771 ** The usual case is that sqlite3_serialize() copies the serialization of | |
8772 ** the database into memory obtained from [sqlite3_malloc64()] and returns | |
8773 ** a pointer to that memory. The caller is responsible for freeing the | |
8774 ** returned value to avoid a memory leak. However, if the F argument | |
8775 ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations | |
8776 ** are made, and the sqlite3_serialize() function will return a pointer | |
8777 ** to the contiguous memory representation of the database that SQLite | |
8778 ** is currently using for that database, or NULL if the no such contiguous | |
8779 ** memory representation of the database exists. A contiguous memory | |
8780 ** representation of the database will usually only exist if there has | |
8781 ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same | |
8782 ** values of D and S. | |
8783 ** The size of the database is written into *P even if the | |
8784 ** SQLITE_SERIALIZE_NOCOPY bit is set but no contigious copy | |
8785 ** of the database exists. | |
8786 ** | |
8787 ** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the | |
8788 ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory | |
8789 ** allocation error occurs. | |
8790 ** | |
8791 ** This interface is only available if SQLite is compiled with the | |
8792 ** [SQLITE_ENABLE_DESERIALIZE] option. | |
8793 */ | |
8794 SQLITE_API unsigned char *sqlite3_serialize( | |
8795 sqlite3 *db, /* The database connection */ | |
8796 const char *zSchema, /* Which DB to serialize. ex: "main", "temp", ... */ | |
8797 sqlite3_int64 *piSize, /* Write size of the DB here, if not NULL */ | |
8798 unsigned int mFlags /* Zero or more SQLITE_SERIALIZE_* flags */ | |
8799 ); | |
8800 | |
8801 /* | |
8802 ** CAPI3REF: Flags for sqlite3_serialize | |
8803 ** | |
8804 ** Zero or more of the following constants can be OR-ed together for | |
8805 ** the F argument to [sqlite3_serialize(D,S,P,F)]. | |
8806 ** | |
8807 ** SQLITE_SERIALIZE_NOCOPY means that [sqlite3_serialize()] will return | |
8808 ** a pointer to contiguous in-memory database that it is currently using, | |
8809 ** without making a copy of the database. If SQLite is not currently using | |
8810 ** a contiguous in-memory database, then this option causes | |
8811 ** [sqlite3_serialize()] to return a NULL pointer. SQLite will only be | |
8812 ** using a contiguous in-memory database if it has been initialized by a | |
8813 ** prior call to [sqlite3_deserialize()]. | |
8814 */ | |
8815 #define SQLITE_SERIALIZE_NOCOPY 0x001 /* Do no memory allocations */ | |
8816 | |
8817 /* | |
8818 ** CAPI3REF: Deserialize a database | |
8819 ** | |
8820 ** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the | |
8821 ** [database connection] D to disconnect from database S and then | |
8822 ** reopen S as an in-memory database based on the serialization contained | |
8823 ** in P. The serialized database P is N bytes in size. M is the size of | |
8824 ** the buffer P, which might be larger than N. If M is larger than N, and | |
8825 ** the SQLITE_DESERIALIZE_READONLY bit is not set in F, then SQLite is | |
8826 ** permitted to add content to the in-memory database as long as the total | |
8827 ** size does not exceed M bytes. | |
8828 ** | |
8829 ** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will | |
8830 ** invoke sqlite3_free() on the serialization buffer when the database | |
8831 ** connection closes. If the SQLITE_DESERIALIZE_RESIZEABLE bit is set, then | |
8832 ** SQLite will try to increase the buffer size using sqlite3_realloc64() | |
8833 ** if writes on the database cause it to grow larger than M bytes. | |
8834 ** | |
8835 ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the | |
8836 ** database is currently in a read transaction or is involved in a backup | |
8837 ** operation. | |
8838 ** | |
8839 ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the | |
8840 ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then | |
8841 ** [sqlite3_free()] is invoked on argument P prior to returning. | |
8842 ** | |
8843 ** This interface is only available if SQLite is compiled with the | |
8844 ** [SQLITE_ENABLE_DESERIALIZE] option. | |
8845 */ | |
8846 SQLITE_API int sqlite3_deserialize( | |
8847 sqlite3 *db, /* The database connection */ | |
8848 const char *zSchema, /* Which DB to reopen with the deserialization */ | |
8849 unsigned char *pData, /* The serialized database content */ | |
8850 sqlite3_int64 szDb, /* Number bytes in the deserialization */ | |
8851 sqlite3_int64 szBuf, /* Total size of buffer pData[] */ | |
8852 unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ | |
8853 ); | |
8854 | |
8855 /* | |
8856 ** CAPI3REF: Flags for sqlite3_deserialize() | |
8857 ** | |
8858 ** The following are allowed values for 6th argument (the F argument) to | |
8859 ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. | |
8860 ** | |
8861 ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization | |
8862 ** in the P argument is held in memory obtained from [sqlite3_malloc64()] | |
8863 ** and that SQLite should take ownership of this memory and automatically | |
8864 ** free it when it has finished using it. Without this flag, the caller | |
8865 ** is resposible for freeing any dynamically allocated memory. | |
8866 ** | |
8867 ** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to | |
8868 ** grow the size of the database using calls to [sqlite3_realloc64()]. This | |
8869 ** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used. | |
8870 ** Without this flag, the deserialized database cannot increase in size beyond | |
8871 ** the number of bytes specified by the M parameter. | |
8872 ** | |
8873 ** The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database | |
8874 ** should be treated as read-only. | |
8875 */ | |
8876 #define SQLITE_DESERIALIZE_FREEONCLOSE 1 /* Call sqlite3_free() on close */ | |
8877 #define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using sqlite3_realloc64() */ | |
8878 #define SQLITE_DESERIALIZE_READONLY 4 /* Database is read-only */ | |
8879 | |
8880 /* | |
8693 ** Undo the hack that converts floating point types to integer for | 8881 ** Undo the hack that converts floating point types to integer for |
8694 ** builds on processors without floating point support. | 8882 ** builds on processors without floating point support. |
8695 */ | 8883 */ |
8696 #ifdef SQLITE_OMIT_FLOATING_POINT | 8884 #ifdef SQLITE_OMIT_FLOATING_POINT |
8697 # undef double | 8885 # undef double |
8834 #endif | 9022 #endif |
8835 | 9023 |
8836 | 9024 |
8837 /* | 9025 /* |
8838 ** CAPI3REF: Session Object Handle | 9026 ** CAPI3REF: Session Object Handle |
9027 ** | |
9028 ** An instance of this object is a [session] that can be used to | |
9029 ** record changes to a database. | |
8839 */ | 9030 */ |
8840 typedef struct sqlite3_session sqlite3_session; | 9031 typedef struct sqlite3_session sqlite3_session; |
8841 | 9032 |
8842 /* | 9033 /* |
8843 ** CAPI3REF: Changeset Iterator Handle | 9034 ** CAPI3REF: Changeset Iterator Handle |
9035 ** | |
9036 ** An instance of this object acts as a cursor for iterating | |
9037 ** over the elements of a [changeset] or [patchset]. | |
8844 */ | 9038 */ |
8845 typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; | 9039 typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; |
8846 | 9040 |
8847 /* | 9041 /* |
8848 ** CAPI3REF: Create A New Session Object | 9042 ** CAPI3REF: Create A New Session Object |
9043 ** CONSTRUCTOR: sqlite3_session | |
8849 ** | 9044 ** |
8850 ** Create a new session object attached to database handle db. If successful, | 9045 ** Create a new session object attached to database handle db. If successful, |
8851 ** a pointer to the new object is written to *ppSession and SQLITE_OK is | 9046 ** a pointer to the new object is written to *ppSession and SQLITE_OK is |
8852 ** returned. If an error occurs, *ppSession is set to NULL and an SQLite | 9047 ** returned. If an error occurs, *ppSession is set to NULL and an SQLite |
8853 ** error code (e.g. SQLITE_NOMEM) is returned. | 9048 ** error code (e.g. SQLITE_NOMEM) is returned. |
8880 sqlite3_session **ppSession /* OUT: New session object */ | 9075 sqlite3_session **ppSession /* OUT: New session object */ |
8881 ); | 9076 ); |
8882 | 9077 |
8883 /* | 9078 /* |
8884 ** CAPI3REF: Delete A Session Object | 9079 ** CAPI3REF: Delete A Session Object |
9080 ** DESTRUCTOR: sqlite3_session | |
8885 ** | 9081 ** |
8886 ** Delete a session object previously allocated using | 9082 ** Delete a session object previously allocated using |
8887 ** [sqlite3session_create()]. Once a session object has been deleted, the | 9083 ** [sqlite3session_create()]. Once a session object has been deleted, the |
8888 ** results of attempting to use pSession with any other session module | 9084 ** results of attempting to use pSession with any other session module |
8889 ** function are undefined. | 9085 ** function are undefined. |
8895 SQLITE_API void sqlite3session_delete(sqlite3_session *pSession); | 9091 SQLITE_API void sqlite3session_delete(sqlite3_session *pSession); |
8896 | 9092 |
8897 | 9093 |
8898 /* | 9094 /* |
8899 ** CAPI3REF: Enable Or Disable A Session Object | 9095 ** CAPI3REF: Enable Or Disable A Session Object |
9096 ** METHOD: sqlite3_session | |
8900 ** | 9097 ** |
8901 ** Enable or disable the recording of changes by a session object. When | 9098 ** Enable or disable the recording of changes by a session object. When |
8902 ** enabled, a session object records changes made to the database. When | 9099 ** enabled, a session object records changes made to the database. When |
8903 ** disabled - it does not. A newly created session object is enabled. | 9100 ** disabled - it does not. A newly created session object is enabled. |
8904 ** Refer to the documentation for [sqlite3session_changeset()] for further | 9101 ** Refer to the documentation for [sqlite3session_changeset()] for further |
8914 */ | 9111 */ |
8915 SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable); | 9112 SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable); |
8916 | 9113 |
8917 /* | 9114 /* |
8918 ** CAPI3REF: Set Or Clear the Indirect Change Flag | 9115 ** CAPI3REF: Set Or Clear the Indirect Change Flag |
9116 ** METHOD: sqlite3_session | |
8919 ** | 9117 ** |
8920 ** Each change recorded by a session object is marked as either direct or | 9118 ** Each change recorded by a session object is marked as either direct or |
8921 ** indirect. A change is marked as indirect if either: | 9119 ** indirect. A change is marked as indirect if either: |
8922 ** | 9120 ** |
8923 ** <ul> | 9121 ** <ul> |
8943 */ | 9141 */ |
8944 SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect); | 9142 SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect); |
8945 | 9143 |
8946 /* | 9144 /* |
8947 ** CAPI3REF: Attach A Table To A Session Object | 9145 ** CAPI3REF: Attach A Table To A Session Object |
9146 ** METHOD: sqlite3_session | |
8948 ** | 9147 ** |
8949 ** If argument zTab is not NULL, then it is the name of a table to attach | 9148 ** If argument zTab is not NULL, then it is the name of a table to attach |
8950 ** to the session object passed as the first argument. All subsequent changes | 9149 ** to the session object passed as the first argument. All subsequent changes |
8951 ** made to the table while the session object is enabled will be recorded. See | 9150 ** made to the table while the session object is enabled will be recorded. See |
8952 ** documentation for [sqlite3session_changeset()] for further details. | 9151 ** documentation for [sqlite3session_changeset()] for further details. |
8968 ** Changes are not recorded for individual rows that have NULL values stored | 9167 ** Changes are not recorded for individual rows that have NULL values stored |
8969 ** in one or more of their PRIMARY KEY columns. | 9168 ** in one or more of their PRIMARY KEY columns. |
8970 ** | 9169 ** |
8971 ** SQLITE_OK is returned if the call completes without error. Or, if an error | 9170 ** SQLITE_OK is returned if the call completes without error. Or, if an error |
8972 ** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. | 9171 ** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. |
9172 ** | |
9173 ** <h3>Special sqlite_stat1 Handling</h3> | |
9174 ** | |
9175 ** As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to | |
9176 ** some of the rules above. In SQLite, the schema of sqlite_stat1 is: | |
9177 ** <pre> | |
9178 ** CREATE TABLE sqlite_stat1(tbl,idx,stat) | |
9179 ** </pre> | |
9180 ** | |
9181 ** Even though sqlite_stat1 does not have a PRIMARY KEY, changes are | |
9182 ** recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes | |
9183 ** are recorded for rows for which (idx IS NULL) is true. However, for such | |
9184 ** rows a zero-length blob (SQL value X'') is stored in the changeset or | |
9185 ** patchset instead of a NULL value. This allows such changesets to be | |
9186 ** manipulated by legacy implementations of sqlite3changeset_invert(), | |
9187 ** concat() and similar. | |
9188 ** | |
9189 ** The sqlite3changeset_apply() function automatically converts the | |
9190 ** zero-length blob back to a NULL value when updating the sqlite_stat1 | |
9191 ** table. However, if the application calls sqlite3changeset_new(), | |
9192 ** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset | |
9193 ** iterator directly (including on a changeset iterator passed to a | |
9194 ** conflict-handler callback) then the X'' value is returned. The application | |
9195 ** must translate X'' to NULL itself if required. | |
9196 ** | |
9197 ** Legacy (older than 3.22.0) versions of the sessions module cannot capture | |
9198 ** changes made to the sqlite_stat1 table. Legacy versions of the | |
9199 ** sqlite3changeset_apply() function silently ignore any modifications to the | |
9200 ** sqlite_stat1 table that are part of a changeset or patchset. | |
8973 */ | 9201 */ |
8974 SQLITE_API int sqlite3session_attach( | 9202 SQLITE_API int sqlite3session_attach( |
8975 sqlite3_session *pSession, /* Session object */ | 9203 sqlite3_session *pSession, /* Session object */ |
8976 const char *zTab /* Table name */ | 9204 const char *zTab /* Table name */ |
8977 ); | 9205 ); |
8978 | 9206 |
8979 /* | 9207 /* |
8980 ** CAPI3REF: Set a table filter on a Session Object. | 9208 ** CAPI3REF: Set a table filter on a Session Object. |
9209 ** METHOD: sqlite3_session | |
8981 ** | 9210 ** |
8982 ** The second argument (xFilter) is the "filter callback". For changes to rows | 9211 ** The second argument (xFilter) is the "filter callback". For changes to rows |
8983 ** in tables that are not attached to the Session object, the filter is called | 9212 ** in tables that are not attached to the Session object, the filter is called |
8984 ** to determine whether changes to the table's rows should be tracked or not. | 9213 ** to determine whether changes to the table's rows should be tracked or not. |
8985 ** If xFilter returns 0, changes is not tracked. Note that once a table is | 9214 ** If xFilter returns 0, changes is not tracked. Note that once a table is |
8994 void *pCtx /* First argument passed to xFilter */ | 9223 void *pCtx /* First argument passed to xFilter */ |
8995 ); | 9224 ); |
8996 | 9225 |
8997 /* | 9226 /* |
8998 ** CAPI3REF: Generate A Changeset From A Session Object | 9227 ** CAPI3REF: Generate A Changeset From A Session Object |
9228 ** METHOD: sqlite3_session | |
8999 ** | 9229 ** |
9000 ** Obtain a changeset containing changes to the tables attached to the | 9230 ** Obtain a changeset containing changes to the tables attached to the |
9001 ** session object passed as the first argument. If successful, | 9231 ** session object passed as the first argument. If successful, |
9002 ** set *ppChangeset to point to a buffer containing the changeset | 9232 ** set *ppChangeset to point to a buffer containing the changeset |
9003 ** and *pnChangeset to the size of the changeset in bytes before returning | 9233 ** and *pnChangeset to the size of the changeset in bytes before returning |
9103 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ | 9333 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ |
9104 void **ppChangeset /* OUT: Buffer containing changeset */ | 9334 void **ppChangeset /* OUT: Buffer containing changeset */ |
9105 ); | 9335 ); |
9106 | 9336 |
9107 /* | 9337 /* |
9108 ** CAPI3REF: Load The Difference Between Tables Into A Session | 9338 ** CAPI3REF: Load The Difference Between Tables Into A Session |
9339 ** METHOD: sqlite3_session | |
9109 ** | 9340 ** |
9110 ** If it is not already attached to the session object passed as the first | 9341 ** If it is not already attached to the session object passed as the first |
9111 ** argument, this function attaches table zTbl in the same manner as the | 9342 ** argument, this function attaches table zTbl in the same manner as the |
9112 ** [sqlite3session_attach()] function. If zTbl does not exist, or if it | 9343 ** [sqlite3session_attach()] function. If zTbl does not exist, or if it |
9113 ** does not have a primary key, this function is a no-op (but does not return | 9344 ** does not have a primary key, this function is a no-op (but does not return |
9168 ); | 9399 ); |
9169 | 9400 |
9170 | 9401 |
9171 /* | 9402 /* |
9172 ** CAPI3REF: Generate A Patchset From A Session Object | 9403 ** CAPI3REF: Generate A Patchset From A Session Object |
9404 ** METHOD: sqlite3_session | |
9173 ** | 9405 ** |
9174 ** The differences between a patchset and a changeset are that: | 9406 ** The differences between a patchset and a changeset are that: |
9175 ** | 9407 ** |
9176 ** <ul> | 9408 ** <ul> |
9177 ** <li> DELETE records consist of the primary key fields only. The | 9409 ** <li> DELETE records consist of the primary key fields only. The |
9196 ** a single table are grouped together, tables appear in the order in which | 9428 ** a single table are grouped together, tables appear in the order in which |
9197 ** they were attached to the session object). | 9429 ** they were attached to the session object). |
9198 */ | 9430 */ |
9199 SQLITE_API int sqlite3session_patchset( | 9431 SQLITE_API int sqlite3session_patchset( |
9200 sqlite3_session *pSession, /* Session object */ | 9432 sqlite3_session *pSession, /* Session object */ |
9201 int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */ | 9433 int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */ |
9202 void **ppPatchset /* OUT: Buffer containing changeset */ | 9434 void **ppPatchset /* OUT: Buffer containing patchset */ |
9203 ); | 9435 ); |
9204 | 9436 |
9205 /* | 9437 /* |
9206 ** CAPI3REF: Test if a changeset has recorded any changes. | 9438 ** CAPI3REF: Test if a changeset has recorded any changes. |
9207 ** | 9439 ** |
9219 */ | 9451 */ |
9220 SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession); | 9452 SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession); |
9221 | 9453 |
9222 /* | 9454 /* |
9223 ** CAPI3REF: Create An Iterator To Traverse A Changeset | 9455 ** CAPI3REF: Create An Iterator To Traverse A Changeset |
9456 ** CONSTRUCTOR: sqlite3_changeset_iter | |
9224 ** | 9457 ** |
9225 ** Create an iterator used to iterate through the contents of a changeset. | 9458 ** Create an iterator used to iterate through the contents of a changeset. |
9226 ** If successful, *pp is set to point to the iterator handle and SQLITE_OK | 9459 ** If successful, *pp is set to point to the iterator handle and SQLITE_OK |
9227 ** is returned. Otherwise, if an error occurs, *pp is set to zero and an | 9460 ** is returned. Otherwise, if an error occurs, *pp is set to zero and an |
9228 ** SQLite error code is returned. | 9461 ** SQLite error code is returned. |
9259 ); | 9492 ); |
9260 | 9493 |
9261 | 9494 |
9262 /* | 9495 /* |
9263 ** CAPI3REF: Advance A Changeset Iterator | 9496 ** CAPI3REF: Advance A Changeset Iterator |
9497 ** METHOD: sqlite3_changeset_iter | |
9264 ** | 9498 ** |
9265 ** This function may only be used with iterators created by function | 9499 ** This function may only be used with iterators created by function |
9266 ** [sqlite3changeset_start()]. If it is called on an iterator passed to | 9500 ** [sqlite3changeset_start()]. If it is called on an iterator passed to |
9267 ** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE | 9501 ** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE |
9268 ** is returned and the call has no effect. | 9502 ** is returned and the call has no effect. |
9283 */ | 9517 */ |
9284 SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter); | 9518 SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter); |
9285 | 9519 |
9286 /* | 9520 /* |
9287 ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator | 9521 ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator |
9522 ** METHOD: sqlite3_changeset_iter | |
9288 ** | 9523 ** |
9289 ** The pIter argument passed to this function may either be an iterator | 9524 ** The pIter argument passed to this function may either be an iterator |
9290 ** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator | 9525 ** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator |
9291 ** created by [sqlite3changeset_start()]. In the latter case, the most recent | 9526 ** created by [sqlite3changeset_start()]. In the latter case, the most recent |
9292 ** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this | 9527 ** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this |
9317 int *pbIndirect /* OUT: True for an 'indirect' change */ | 9552 int *pbIndirect /* OUT: True for an 'indirect' change */ |
9318 ); | 9553 ); |
9319 | 9554 |
9320 /* | 9555 /* |
9321 ** CAPI3REF: Obtain The Primary Key Definition Of A Table | 9556 ** CAPI3REF: Obtain The Primary Key Definition Of A Table |
9557 ** METHOD: sqlite3_changeset_iter | |
9322 ** | 9558 ** |
9323 ** For each modified table, a changeset includes the following: | 9559 ** For each modified table, a changeset includes the following: |
9324 ** | 9560 ** |
9325 ** <ul> | 9561 ** <ul> |
9326 ** <li> The number of columns in the table, and | 9562 ** <li> The number of columns in the table, and |
9348 int *pnCol /* OUT: Number of entries in output array */ | 9584 int *pnCol /* OUT: Number of entries in output array */ |
9349 ); | 9585 ); |
9350 | 9586 |
9351 /* | 9587 /* |
9352 ** CAPI3REF: Obtain old.* Values From A Changeset Iterator | 9588 ** CAPI3REF: Obtain old.* Values From A Changeset Iterator |
9589 ** METHOD: sqlite3_changeset_iter | |
9353 ** | 9590 ** |
9354 ** The pIter argument passed to this function may either be an iterator | 9591 ** The pIter argument passed to this function may either be an iterator |
9355 ** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator | 9592 ** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator |
9356 ** created by [sqlite3changeset_start()]. In the latter case, the most recent | 9593 ** created by [sqlite3changeset_start()]. In the latter case, the most recent |
9357 ** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. | 9594 ** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. |
9378 sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ | 9615 sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ |
9379 ); | 9616 ); |
9380 | 9617 |
9381 /* | 9618 /* |
9382 ** CAPI3REF: Obtain new.* Values From A Changeset Iterator | 9619 ** CAPI3REF: Obtain new.* Values From A Changeset Iterator |
9620 ** METHOD: sqlite3_changeset_iter | |
9383 ** | 9621 ** |
9384 ** The pIter argument passed to this function may either be an iterator | 9622 ** The pIter argument passed to this function may either be an iterator |
9385 ** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator | 9623 ** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator |
9386 ** created by [sqlite3changeset_start()]. In the latter case, the most recent | 9624 ** created by [sqlite3changeset_start()]. In the latter case, the most recent |
9387 ** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. | 9625 ** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. |
9411 sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ | 9649 sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ |
9412 ); | 9650 ); |
9413 | 9651 |
9414 /* | 9652 /* |
9415 ** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator | 9653 ** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator |
9654 ** METHOD: sqlite3_changeset_iter | |
9416 ** | 9655 ** |
9417 ** This function should only be used with iterator objects passed to a | 9656 ** This function should only be used with iterator objects passed to a |
9418 ** conflict-handler callback by [sqlite3changeset_apply()] with either | 9657 ** conflict-handler callback by [sqlite3changeset_apply()] with either |
9419 ** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function | 9658 ** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function |
9420 ** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue | 9659 ** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue |
9438 sqlite3_value **ppValue /* OUT: Value from conflicting row */ | 9677 sqlite3_value **ppValue /* OUT: Value from conflicting row */ |
9439 ); | 9678 ); |
9440 | 9679 |
9441 /* | 9680 /* |
9442 ** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations | 9681 ** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations |
9682 ** METHOD: sqlite3_changeset_iter | |
9443 ** | 9683 ** |
9444 ** This function may only be called with an iterator passed to an | 9684 ** This function may only be called with an iterator passed to an |
9445 ** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case | 9685 ** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case |
9446 ** it sets the output variable to the total number of known foreign key | 9686 ** it sets the output variable to the total number of known foreign key |
9447 ** violations in the destination database and returns SQLITE_OK. | 9687 ** violations in the destination database and returns SQLITE_OK. |
9454 ); | 9694 ); |
9455 | 9695 |
9456 | 9696 |
9457 /* | 9697 /* |
9458 ** CAPI3REF: Finalize A Changeset Iterator | 9698 ** CAPI3REF: Finalize A Changeset Iterator |
9699 ** METHOD: sqlite3_changeset_iter | |
9459 ** | 9700 ** |
9460 ** This function is used to finalize an iterator allocated with | 9701 ** This function is used to finalize an iterator allocated with |
9461 ** [sqlite3changeset_start()]. | 9702 ** [sqlite3changeset_start()]. |
9462 ** | 9703 ** |
9463 ** This function should only be called on iterators created using the | 9704 ** This function should only be called on iterators created using the |
9470 ** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an | 9711 ** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an |
9471 ** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding | 9712 ** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding |
9472 ** to that error is returned by this function. Otherwise, SQLITE_OK is | 9713 ** to that error is returned by this function. Otherwise, SQLITE_OK is |
9473 ** returned. This is to allow the following pattern (pseudo-code): | 9714 ** returned. This is to allow the following pattern (pseudo-code): |
9474 ** | 9715 ** |
9716 ** <pre> | |
9475 ** sqlite3changeset_start(); | 9717 ** sqlite3changeset_start(); |
9476 ** while( SQLITE_ROW==sqlite3changeset_next() ){ | 9718 ** while( SQLITE_ROW==sqlite3changeset_next() ){ |
9477 ** // Do something with change. | 9719 ** // Do something with change. |
9478 ** } | 9720 ** } |
9479 ** rc = sqlite3changeset_finalize(); | 9721 ** rc = sqlite3changeset_finalize(); |
9480 ** if( rc!=SQLITE_OK ){ | 9722 ** if( rc!=SQLITE_OK ){ |
9481 ** // An error has occurred | 9723 ** // An error has occurred |
9482 ** } | 9724 ** } |
9725 ** </pre> | |
9483 */ | 9726 */ |
9484 SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); | 9727 SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); |
9485 | 9728 |
9486 /* | 9729 /* |
9487 ** CAPI3REF: Invert A Changeset | 9730 ** CAPI3REF: Invert A Changeset |
9525 ** | 9768 ** |
9526 ** This function combines the two input changesets using an | 9769 ** This function combines the two input changesets using an |
9527 ** sqlite3_changegroup object. Calling it produces similar results as the | 9770 ** sqlite3_changegroup object. Calling it produces similar results as the |
9528 ** following code fragment: | 9771 ** following code fragment: |
9529 ** | 9772 ** |
9773 ** <pre> | |
9530 ** sqlite3_changegroup *pGrp; | 9774 ** sqlite3_changegroup *pGrp; |
9531 ** rc = sqlite3_changegroup_new(&pGrp); | 9775 ** rc = sqlite3_changegroup_new(&pGrp); |
9532 ** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA); | 9776 ** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA); |
9533 ** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB); | 9777 ** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB); |
9534 ** if( rc==SQLITE_OK ){ | 9778 ** if( rc==SQLITE_OK ){ |
9535 ** rc = sqlite3changegroup_output(pGrp, pnOut, ppOut); | 9779 ** rc = sqlite3changegroup_output(pGrp, pnOut, ppOut); |
9536 ** }else{ | 9780 ** }else{ |
9537 ** *ppOut = 0; | 9781 ** *ppOut = 0; |
9538 ** *pnOut = 0; | 9782 ** *pnOut = 0; |
9539 ** } | 9783 ** } |
9784 ** </pre> | |
9540 ** | 9785 ** |
9541 ** Refer to the sqlite3_changegroup documentation below for details. | 9786 ** Refer to the sqlite3_changegroup documentation below for details. |
9542 */ | 9787 */ |
9543 SQLITE_API int sqlite3changeset_concat( | 9788 SQLITE_API int sqlite3changeset_concat( |
9544 int nA, /* Number of bytes in buffer pA */ | 9789 int nA, /* Number of bytes in buffer pA */ |
9550 ); | 9795 ); |
9551 | 9796 |
9552 | 9797 |
9553 /* | 9798 /* |
9554 ** CAPI3REF: Changegroup Handle | 9799 ** CAPI3REF: Changegroup Handle |
9800 ** | |
9801 ** A changegroup is an object used to combine two or more | |
9802 ** [changesets] or [patchsets] | |
9555 */ | 9803 */ |
9556 typedef struct sqlite3_changegroup sqlite3_changegroup; | 9804 typedef struct sqlite3_changegroup sqlite3_changegroup; |
9557 | 9805 |
9558 /* | 9806 /* |
9559 ** CAPI3REF: Create A New Changegroup Object | 9807 ** CAPI3REF: Create A New Changegroup Object |
9808 ** CONSTRUCTOR: sqlite3_changegroup | |
9560 ** | 9809 ** |
9561 ** An sqlite3_changegroup object is used to combine two or more changesets | 9810 ** An sqlite3_changegroup object is used to combine two or more changesets |
9562 ** (or patchsets) into a single changeset (or patchset). A single changegroup | 9811 ** (or patchsets) into a single changeset (or patchset). A single changegroup |
9563 ** object may combine changesets or patchsets, but not both. The output is | 9812 ** object may combine changesets or patchsets, but not both. The output is |
9564 ** always in the same format as the input. | 9813 ** always in the same format as the input. |
9592 */ | 9841 */ |
9593 SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); | 9842 SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); |
9594 | 9843 |
9595 /* | 9844 /* |
9596 ** CAPI3REF: Add A Changeset To A Changegroup | 9845 ** CAPI3REF: Add A Changeset To A Changegroup |
9846 ** METHOD: sqlite3_changegroup | |
9597 ** | 9847 ** |
9598 ** Add all changes within the changeset (or patchset) in buffer pData (size | 9848 ** Add all changes within the changeset (or patchset) in buffer pData (size |
9599 ** nData bytes) to the changegroup. | 9849 ** nData bytes) to the changegroup. |
9600 ** | 9850 ** |
9601 ** If the buffer contains a patchset, then all prior calls to this function | 9851 ** If the buffer contains a patchset, then all prior calls to this function |
9669 */ | 9919 */ |
9670 SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); | 9920 SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); |
9671 | 9921 |
9672 /* | 9922 /* |
9673 ** CAPI3REF: Obtain A Composite Changeset From A Changegroup | 9923 ** CAPI3REF: Obtain A Composite Changeset From A Changegroup |
9924 ** METHOD: sqlite3_changegroup | |
9674 ** | 9925 ** |
9675 ** Obtain a buffer containing a changeset (or patchset) representing the | 9926 ** Obtain a buffer containing a changeset (or patchset) representing the |
9676 ** current contents of the changegroup. If the inputs to the changegroup | 9927 ** current contents of the changegroup. If the inputs to the changegroup |
9677 ** were themselves changesets, the output is a changeset. Or, if the | 9928 ** were themselves changesets, the output is a changeset. Or, if the |
9678 ** inputs were patchsets, the output is also a patchset. | 9929 ** inputs were patchsets, the output is also a patchset. |
9699 void **ppData /* OUT: Pointer to output buffer */ | 9950 void **ppData /* OUT: Pointer to output buffer */ |
9700 ); | 9951 ); |
9701 | 9952 |
9702 /* | 9953 /* |
9703 ** CAPI3REF: Delete A Changegroup Object | 9954 ** CAPI3REF: Delete A Changegroup Object |
9955 ** DESTRUCTOR: sqlite3_changegroup | |
9704 */ | 9956 */ |
9705 SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); | 9957 SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); |
9706 | 9958 |
9707 /* | 9959 /* |
9708 ** CAPI3REF: Apply A Changeset To A Database | 9960 ** CAPI3REF: Apply A Changeset To A Database |
9709 ** | 9961 ** |
9710 ** Apply a changeset to a database. This function attempts to update the | 9962 ** Apply a changeset or patchset to a database. These functions attempt to |
9711 ** "main" database attached to handle db with the changes found in the | 9963 ** update the "main" database attached to handle db with the changes found in |
9712 ** changeset passed via the second and third arguments. | 9964 ** the changeset passed via the second and third arguments. |
9713 ** | 9965 ** |
9714 ** The fourth argument (xFilter) passed to this function is the "filter | 9966 ** The fourth argument (xFilter) passed to these functions is the "filter |
9715 ** callback". If it is not NULL, then for each table affected by at least one | 9967 ** callback". If it is not NULL, then for each table affected by at least one |
9716 ** change in the changeset, the filter callback is invoked with | 9968 ** change in the changeset, the filter callback is invoked with |
9717 ** the table name as the second argument, and a copy of the context pointer | 9969 ** the table name as the second argument, and a copy of the context pointer |
9718 ** passed as the sixth argument to this function as the first. If the "filter | 9970 ** passed as the sixth argument as the first. If the "filter callback" |
9719 ** callback" returns zero, then no attempt is made to apply any changes to | 9971 ** returns zero, then no attempt is made to apply any changes to the table. |
9720 ** the table. Otherwise, if the return value is non-zero or the xFilter | 9972 ** Otherwise, if the return value is non-zero or the xFilter argument to |
9721 ** argument to this function is NULL, all changes related to the table are | 9973 ** is NULL, all changes related to the table are attempted. |
9722 ** attempted. | |
9723 ** | 9974 ** |
9724 ** For each table that is not excluded by the filter callback, this function | 9975 ** For each table that is not excluded by the filter callback, this function |
9725 ** tests that the target database contains a compatible table. A table is | 9976 ** tests that the target database contains a compatible table. A table is |
9726 ** considered compatible if all of the following are true: | 9977 ** considered compatible if all of the following are true: |
9727 ** | 9978 ** |
9762 ** the documentation for the three | 10013 ** the documentation for the three |
9763 ** [SQLITE_CHANGESET_OMIT|available return values] for details. | 10014 ** [SQLITE_CHANGESET_OMIT|available return values] for details. |
9764 ** | 10015 ** |
9765 ** <dl> | 10016 ** <dl> |
9766 ** <dt>DELETE Changes<dd> | 10017 ** <dt>DELETE Changes<dd> |
9767 ** For each DELETE change, this function checks if the target database | 10018 ** For each DELETE change, the function checks if the target database |
9768 ** contains a row with the same primary key value (or values) as the | 10019 ** contains a row with the same primary key value (or values) as the |
9769 ** original row values stored in the changeset. If it does, and the values | 10020 ** original row values stored in the changeset. If it does, and the values |
9770 ** stored in all non-primary key columns also match the values stored in | 10021 ** stored in all non-primary key columns also match the values stored in |
9771 ** the changeset the row is deleted from the target database. | 10022 ** the changeset the row is deleted from the target database. |
9772 ** | 10023 ** |
9807 ** This includes the case where the INSERT operation is re-attempted because | 10058 ** This includes the case where the INSERT operation is re-attempted because |
9808 ** an earlier call to the conflict handler function returned | 10059 ** an earlier call to the conflict handler function returned |
9809 ** [SQLITE_CHANGESET_REPLACE]. | 10060 ** [SQLITE_CHANGESET_REPLACE]. |
9810 ** | 10061 ** |
9811 ** <dt>UPDATE Changes<dd> | 10062 ** <dt>UPDATE Changes<dd> |
9812 ** For each UPDATE change, this function checks if the target database | 10063 ** For each UPDATE change, the function checks if the target database |
9813 ** contains a row with the same primary key value (or values) as the | 10064 ** contains a row with the same primary key value (or values) as the |
9814 ** original row values stored in the changeset. If it does, and the values | 10065 ** original row values stored in the changeset. If it does, and the values |
9815 ** stored in all modified non-primary key columns also match the values | 10066 ** stored in all modified non-primary key columns also match the values |
9816 ** stored in the changeset the row is updated within the target database. | 10067 ** stored in the changeset the row is updated within the target database. |
9817 ** | 10068 ** |
9838 ** It is safe to execute SQL statements, including those that write to the | 10089 ** It is safe to execute SQL statements, including those that write to the |
9839 ** table that the callback related to, from within the xConflict callback. | 10090 ** table that the callback related to, from within the xConflict callback. |
9840 ** This can be used to further customize the applications conflict | 10091 ** This can be used to further customize the applications conflict |
9841 ** resolution strategy. | 10092 ** resolution strategy. |
9842 ** | 10093 ** |
9843 ** All changes made by this function are enclosed in a savepoint transaction. | 10094 ** All changes made by these functions are enclosed in a savepoint transaction. |
9844 ** If any other error (aside from a constraint failure when attempting to | 10095 ** If any other error (aside from a constraint failure when attempting to |
9845 ** write to the target database) occurs, then the savepoint transaction is | 10096 ** write to the target database) occurs, then the savepoint transaction is |
9846 ** rolled back, restoring the target database to its original state, and an | 10097 ** rolled back, restoring the target database to its original state, and an |
9847 ** SQLite error code returned. | 10098 ** SQLite error code returned. |
10099 ** | |
10100 ** If the output parameters (ppRebase) and (pnRebase) are non-NULL and | |
10101 ** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2() | |
10102 ** may set (*ppRebase) to point to a "rebase" that may be used with the | |
10103 ** sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) | |
10104 ** is set to the size of the buffer in bytes. It is the responsibility of the | |
10105 ** caller to eventually free any such buffer using sqlite3_free(). The buffer | |
10106 ** is only allocated and populated if one or more conflicts were encountered | |
10107 ** while applying the patchset. See comments surrounding the sqlite3_rebaser | |
10108 ** APIs for further details. | |
10109 ** | |
10110 ** The behavior of sqlite3changeset_apply_v2() and its streaming equivalent | |
10111 ** may be modified by passing a combination of | |
10112 ** [SQLITE_CHANGESETAPPLY_NOSAVEPOINT | supported flags] as the 9th parameter. | |
10113 ** | |
10114 ** Note that the sqlite3changeset_apply_v2() API is still <b>experimental</b> | |
10115 ** and therefore subject to change. | |
9848 */ | 10116 */ |
9849 SQLITE_API int sqlite3changeset_apply( | 10117 SQLITE_API int sqlite3changeset_apply( |
9850 sqlite3 *db, /* Apply change to "main" db of this handle */ | 10118 sqlite3 *db, /* Apply change to "main" db of this handle */ |
9851 int nChangeset, /* Size of changeset in bytes */ | 10119 int nChangeset, /* Size of changeset in bytes */ |
9852 void *pChangeset, /* Changeset blob */ | 10120 void *pChangeset, /* Changeset blob */ |
9859 int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ | 10127 int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ |
9860 sqlite3_changeset_iter *p /* Handle describing change and conflict */ | 10128 sqlite3_changeset_iter *p /* Handle describing change and conflict */ |
9861 ), | 10129 ), |
9862 void *pCtx /* First argument passed to xConflict */ | 10130 void *pCtx /* First argument passed to xConflict */ |
9863 ); | 10131 ); |
10132 SQLITE_API int sqlite3changeset_apply_v2( | |
10133 sqlite3 *db, /* Apply change to "main" db of this handle */ | |
10134 int nChangeset, /* Size of changeset in bytes */ | |
10135 void *pChangeset, /* Changeset blob */ | |
10136 int(*xFilter)( | |
10137 void *pCtx, /* Copy of sixth arg to _apply() */ | |
10138 const char *zTab /* Table name */ | |
10139 ), | |
10140 int(*xConflict)( | |
10141 void *pCtx, /* Copy of sixth arg to _apply() */ | |
10142 int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ | |
10143 sqlite3_changeset_iter *p /* Handle describing change and conflict */ | |
10144 ), | |
10145 void *pCtx, /* First argument passed to xConflict */ | |
10146 void **ppRebase, int *pnRebase, /* OUT: Rebase data */ | |
10147 int flags /* Combination of SESSION_APPLY_* flags */ | |
10148 ); | |
10149 | |
10150 /* | |
10151 ** CAPI3REF: Flags for sqlite3changeset_apply_v2 | |
10152 ** | |
10153 ** The following flags may passed via the 9th parameter to | |
10154 ** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: | |
10155 ** | |
10156 ** <dl> | |
10157 ** <dt>SQLITE_CHANGESETAPPLY_NOSAVEPOINT <dd> | |
10158 ** Usually, the sessions module encloses all operations performed by | |
10159 ** a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The | |
10160 ** SAVEPOINT is committed if the changeset or patchset is successfully | |
10161 ** applied, or rolled back if an error occurs. Specifying this flag | |
10162 ** causes the sessions module to omit this savepoint. In this case, if the | |
10163 ** caller has an open transaction or savepoint when apply_v2() is called, | |
10164 ** it may revert the partially applied changeset by rolling it back. | |
10165 */ | |
10166 #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 | |
9864 | 10167 |
9865 /* | 10168 /* |
9866 ** CAPI3REF: Constants Passed To The Conflict Handler | 10169 ** CAPI3REF: Constants Passed To The Conflict Handler |
9867 ** | 10170 ** |
9868 ** Values that may be passed as the second argument to a conflict-handler. | 10171 ** Values that may be passed as the second argument to a conflict-handler. |
9956 */ | 10259 */ |
9957 #define SQLITE_CHANGESET_OMIT 0 | 10260 #define SQLITE_CHANGESET_OMIT 0 |
9958 #define SQLITE_CHANGESET_REPLACE 1 | 10261 #define SQLITE_CHANGESET_REPLACE 1 |
9959 #define SQLITE_CHANGESET_ABORT 2 | 10262 #define SQLITE_CHANGESET_ABORT 2 |
9960 | 10263 |
10264 /* | |
10265 ** CAPI3REF: Rebasing changesets | |
10266 ** EXPERIMENTAL | |
10267 ** | |
10268 ** Suppose there is a site hosting a database in state S0. And that | |
10269 ** modifications are made that move that database to state S1 and a | |
10270 ** changeset recorded (the "local" changeset). Then, a changeset based | |
10271 ** on S0 is received from another site (the "remote" changeset) and | |
10272 ** applied to the database. The database is then in state | |
10273 ** (S1+"remote"), where the exact state depends on any conflict | |
10274 ** resolution decisions (OMIT or REPLACE) made while applying "remote". | |
10275 ** Rebasing a changeset is to update it to take those conflict | |
10276 ** resolution decisions into account, so that the same conflicts | |
10277 ** do not have to be resolved elsewhere in the network. | |
10278 ** | |
10279 ** For example, if both the local and remote changesets contain an | |
10280 ** INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": | |
10281 ** | |
10282 ** local: INSERT INTO t1 VALUES(1, 'v1'); | |
10283 ** remote: INSERT INTO t1 VALUES(1, 'v2'); | |
10284 ** | |
10285 ** and the conflict resolution is REPLACE, then the INSERT change is | |
10286 ** removed from the local changeset (it was overridden). Or, if the | |
10287 ** conflict resolution was "OMIT", then the local changeset is modified | |
10288 ** to instead contain: | |
10289 ** | |
10290 ** UPDATE t1 SET b = 'v2' WHERE a=1; | |
10291 ** | |
10292 ** Changes within the local changeset are rebased as follows: | |
10293 ** | |
10294 ** <dl> | |
10295 ** <dt>Local INSERT<dd> | |
10296 ** This may only conflict with a remote INSERT. If the conflict | |
10297 ** resolution was OMIT, then add an UPDATE change to the rebased | |
10298 ** changeset. Or, if the conflict resolution was REPLACE, add | |
10299 ** nothing to the rebased changeset. | |
10300 ** | |
10301 ** <dt>Local DELETE<dd> | |
10302 ** This may conflict with a remote UPDATE or DELETE. In both cases the | |
10303 ** only possible resolution is OMIT. If the remote operation was a | |
10304 ** DELETE, then add no change to the rebased changeset. If the remote | |
10305 ** operation was an UPDATE, then the old.* fields of change are updated | |
10306 ** to reflect the new.* values in the UPDATE. | |
10307 ** | |
10308 ** <dt>Local UPDATE<dd> | |
10309 ** This may conflict with a remote UPDATE or DELETE. If it conflicts | |
10310 ** with a DELETE, and the conflict resolution was OMIT, then the update | |
10311 ** is changed into an INSERT. Any undefined values in the new.* record | |
10312 ** from the update change are filled in using the old.* values from | |
10313 ** the conflicting DELETE. Or, if the conflict resolution was REPLACE, | |
10314 ** the UPDATE change is simply omitted from the rebased changeset. | |
10315 ** | |
10316 ** If conflict is with a remote UPDATE and the resolution is OMIT, then | |
10317 ** the old.* values are rebased using the new.* values in the remote | |
10318 ** change. Or, if the resolution is REPLACE, then the change is copied | |
10319 ** into the rebased changeset with updates to columns also updated by | |
10320 ** the conflicting remote UPDATE removed. If this means no columns would | |
10321 ** be updated, the change is omitted. | |
10322 ** </dl> | |
10323 ** | |
10324 ** A local change may be rebased against multiple remote changes | |
10325 ** simultaneously. If a single key is modified by multiple remote | |
10326 ** changesets, they are combined as follows before the local changeset | |
10327 ** is rebased: | |
10328 ** | |
10329 ** <ul> | |
10330 ** <li> If there has been one or more REPLACE resolutions on a | |
10331 ** key, it is rebased according to a REPLACE. | |
10332 ** | |
10333 ** <li> If there have been no REPLACE resolutions on a key, then | |
10334 ** the local changeset is rebased according to the most recent | |
10335 ** of the OMIT resolutions. | |
10336 ** </ul> | |
10337 ** | |
10338 ** Note that conflict resolutions from multiple remote changesets are | |
10339 ** combined on a per-field basis, not per-row. This means that in the | |
10340 ** case of multiple remote UPDATE operations, some fields of a single | |
10341 ** local change may be rebased for REPLACE while others are rebased for | |
10342 ** OMIT. | |
10343 ** | |
10344 ** In order to rebase a local changeset, the remote changeset must first | |
10345 ** be applied to the local database using sqlite3changeset_apply_v2() and | |
10346 ** the buffer of rebase information captured. Then: | |
10347 ** | |
10348 ** <ol> | |
10349 ** <li> An sqlite3_rebaser object is created by calling | |
10350 ** sqlite3rebaser_create(). | |
10351 ** <li> The new object is configured with the rebase buffer obtained from | |
10352 ** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). | |
10353 ** If the local changeset is to be rebased against multiple remote | |
10354 ** changesets, then sqlite3rebaser_configure() should be called | |
10355 ** multiple times, in the same order that the multiple | |
10356 ** sqlite3changeset_apply_v2() calls were made. | |
10357 ** <li> Each local changeset is rebased by calling sqlite3rebaser_rebase(). | |
10358 ** <li> The sqlite3_rebaser object is deleted by calling | |
10359 ** sqlite3rebaser_delete(). | |
10360 ** </ol> | |
10361 */ | |
10362 typedef struct sqlite3_rebaser sqlite3_rebaser; | |
10363 | |
10364 /* | |
10365 ** CAPI3REF: Create a changeset rebaser object. | |
10366 ** EXPERIMENTAL | |
10367 ** | |
10368 ** Allocate a new changeset rebaser object. If successful, set (*ppNew) to | |
10369 ** point to the new object and return SQLITE_OK. Otherwise, if an error | |
10370 ** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew) | |
10371 ** to NULL. | |
10372 */ | |
10373 SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser **ppNew); | |
10374 | |
10375 /* | |
10376 ** CAPI3REF: Configure a changeset rebaser object. | |
10377 ** EXPERIMENTAL | |
10378 ** | |
10379 ** Configure the changeset rebaser object to rebase changesets according | |
10380 ** to the conflict resolutions described by buffer pRebase (size nRebase | |
10381 ** bytes), which must have been obtained from a previous call to | |
10382 ** sqlite3changeset_apply_v2(). | |
10383 */ | |
10384 SQLITE_API int sqlite3rebaser_configure( | |
10385 sqlite3_rebaser*, | |
10386 int nRebase, const void *pRebase | |
10387 ); | |
10388 | |
10389 /* | |
10390 ** CAPI3REF: Rebase a changeset | |
10391 ** EXPERIMENTAL | |
10392 ** | |
10393 ** Argument pIn must point to a buffer containing a changeset nIn bytes | |
10394 ** in size. This function allocates and populates a buffer with a copy | |
10395 ** of the changeset rebased rebased according to the configuration of the | |
10396 ** rebaser object passed as the first argument. If successful, (*ppOut) | |
10397 ** is set to point to the new buffer containing the rebased changset and | |
10398 ** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the | |
10399 ** responsibility of the caller to eventually free the new buffer using | |
10400 ** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) | |
10401 ** are set to zero and an SQLite error code returned. | |
10402 */ | |
10403 SQLITE_API int sqlite3rebaser_rebase( | |
10404 sqlite3_rebaser*, | |
10405 int nIn, const void *pIn, | |
10406 int *pnOut, void **ppOut | |
10407 ); | |
10408 | |
10409 /* | |
10410 ** CAPI3REF: Delete a changeset rebaser object. | |
10411 ** EXPERIMENTAL | |
10412 ** | |
10413 ** Delete the changeset rebaser object and all associated resources. There | |
10414 ** should be one call to this function for each successful invocation | |
10415 ** of sqlite3rebaser_create(). | |
10416 */ | |
10417 SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p); | |
10418 | |
9961 /* | 10419 /* |
9962 ** CAPI3REF: Streaming Versions of API functions. | 10420 ** CAPI3REF: Streaming Versions of API functions. |
9963 ** | 10421 ** |
9964 ** The six streaming API xxx_strm() functions serve similar purposes to the | 10422 ** The six streaming API xxx_strm() functions serve similar purposes to the |
9965 ** corresponding non-streaming API functions: | 10423 ** corresponding non-streaming API functions: |
9966 ** | 10424 ** |
9967 ** <table border=1 style="margin-left:8ex;margin-right:8ex"> | 10425 ** <table border=1 style="margin-left:8ex;margin-right:8ex"> |
9968 ** <tr><th>Streaming function<th>Non-streaming equivalent</th> | 10426 ** <tr><th>Streaming function<th>Non-streaming equivalent</th> |
9969 ** <tr><td>sqlite3changeset_apply_str<td>[sqlite3changeset_apply] | 10427 ** <tr><td>sqlite3changeset_apply_strm<td>[sqlite3changeset_apply] |
9970 ** <tr><td>sqlite3changeset_concat_str<td>[sqlite3changeset_concat] | 10428 ** <tr><td>sqlite3changeset_apply_strm_v2<td>[sqlite3changeset_apply_v2] |
9971 ** <tr><td>sqlite3changeset_invert_str<td>[sqlite3changeset_invert] | 10429 ** <tr><td>sqlite3changeset_concat_strm<td>[sqlite3changeset_concat] |
9972 ** <tr><td>sqlite3changeset_start_str<td>[sqlite3changeset_start] | 10430 ** <tr><td>sqlite3changeset_invert_strm<td>[sqlite3changeset_invert] |
9973 ** <tr><td>sqlite3session_changeset_str<td>[sqlite3session_changeset] | 10431 ** <tr><td>sqlite3changeset_start_strm<td>[sqlite3changeset_start] |
9974 ** <tr><td>sqlite3session_patchset_str<td>[sqlite3session_patchset] | 10432 ** <tr><td>sqlite3session_changeset_strm<td>[sqlite3session_changeset] |
10433 ** <tr><td>sqlite3session_patchset_strm<td>[sqlite3session_patchset] | |
9975 ** </table> | 10434 ** </table> |
9976 ** | 10435 ** |
9977 ** Non-streaming functions that accept changesets (or patchsets) as input | 10436 ** Non-streaming functions that accept changesets (or patchsets) as input |
9978 ** require that the entire changeset be stored in a single buffer in memory. | 10437 ** require that the entire changeset be stored in a single buffer in memory. |
9979 ** Similarly, those that return a changeset or patchset do so by returning | 10438 ** Similarly, those that return a changeset or patchset do so by returning |
10059 void *pCtx, /* Copy of sixth arg to _apply() */ | 10518 void *pCtx, /* Copy of sixth arg to _apply() */ |
10060 int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ | 10519 int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ |
10061 sqlite3_changeset_iter *p /* Handle describing change and conflict */ | 10520 sqlite3_changeset_iter *p /* Handle describing change and conflict */ |
10062 ), | 10521 ), |
10063 void *pCtx /* First argument passed to xConflict */ | 10522 void *pCtx /* First argument passed to xConflict */ |
10523 ); | |
10524 SQLITE_API int sqlite3changeset_apply_v2_strm( | |
10525 sqlite3 *db, /* Apply change to "main" db of this handle */ | |
10526 int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ | |
10527 void *pIn, /* First arg for xInput */ | |
10528 int(*xFilter)( | |
10529 void *pCtx, /* Copy of sixth arg to _apply() */ | |
10530 const char *zTab /* Table name */ | |
10531 ), | |
10532 int(*xConflict)( | |
10533 void *pCtx, /* Copy of sixth arg to _apply() */ | |
10534 int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ | |
10535 sqlite3_changeset_iter *p /* Handle describing change and conflict */ | |
10536 ), | |
10537 void *pCtx, /* First argument passed to xConflict */ | |
10538 void **ppRebase, int *pnRebase, | |
10539 int flags | |
10064 ); | 10540 ); |
10065 SQLITE_API int sqlite3changeset_concat_strm( | 10541 SQLITE_API int sqlite3changeset_concat_strm( |
10066 int (*xInputA)(void *pIn, void *pData, int *pnData), | 10542 int (*xInputA)(void *pIn, void *pData, int *pnData), |
10067 void *pInA, | 10543 void *pInA, |
10068 int (*xInputB)(void *pIn, void *pData, int *pnData), | 10544 int (*xInputB)(void *pIn, void *pData, int *pnData), |
10097 ); | 10573 ); |
10098 SQLITE_API int sqlite3changegroup_output_strm(sqlite3_changegroup*, | 10574 SQLITE_API int sqlite3changegroup_output_strm(sqlite3_changegroup*, |
10099 int (*xOutput)(void *pOut, const void *pData, int nData), | 10575 int (*xOutput)(void *pOut, const void *pData, int nData), |
10100 void *pOut | 10576 void *pOut |
10101 ); | 10577 ); |
10578 SQLITE_API int sqlite3rebaser_rebase_strm( | |
10579 sqlite3_rebaser *pRebaser, | |
10580 int (*xInput)(void *pIn, void *pData, int *pnData), | |
10581 void *pIn, | |
10582 int (*xOutput)(void *pOut, const void *pData, int nData), | |
10583 void *pOut | |
10584 ); | |
10102 | 10585 |
10103 | 10586 |
10104 /* | 10587 /* |
10105 ** Make sure we can call this stuff from C++. | 10588 ** Make sure we can call this stuff from C++. |
10106 */ | 10589 */ |