amalgalite 0.4.2-x86-mswin32-60 → 0.5.0-x86-mswin32-60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY +12 -0
- data/bin/amalgalite-pack +121 -0
- data/examples/blob.rb +18 -35
- data/examples/bootstrap.rb +6 -6
- data/examples/require_me.rb +11 -0
- data/examples/requires.rb +23 -35
- data/ext/amalgalite3.h +3 -0
- data/ext/amalgalite3_requires_bootstrap.c +17 -15
- data/ext/sqlite3.c +4684 -3983
- data/ext/sqlite3.h +301 -96
- data/ext/sqlite3ext.h +9 -1
- data/lib/amalgalite/blob.rb +1 -1
- data/lib/amalgalite/core_ext/kernel/require.rb +11 -4
- data/lib/amalgalite/packer.rb +221 -0
- data/lib/amalgalite/requires.rb +60 -52
- data/lib/amalgalite/statement.rb +5 -2
- data/lib/amalgalite/version.rb +2 -2
- data/lib/amalgalite3.so +0 -0
- data/spec/packer_spec.rb +50 -0
- data/spec/requires_spec.rb +23 -0
- data/spec/sqlite3/version_spec.rb +2 -2
- data/spec/version_spec.rb +6 -0
- data/tasks/config.rb +4 -5
- data/tasks/extension.rake +4 -1
- metadata +10 -6
- data/bin/amalgalite-pack-into-db +0 -155
- data/ext/rbconfig-mingw.rb +0 -178
data/ext/sqlite3.h
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
** the version number) and changes its name to "sqlite3.h" as
|
31
31
|
** part of the build process.
|
32
32
|
**
|
33
|
-
** @(#) $Id: sqlite.h.in,v 1.
|
33
|
+
** @(#) $Id: sqlite.h.in,v 1.412 2008/11/10 23:54:06 drh Exp $
|
34
34
|
*/
|
35
35
|
#ifndef _SQLITE3_H_
|
36
36
|
#define _SQLITE3_H_
|
@@ -52,29 +52,20 @@ extern "C" {
|
|
52
52
|
#endif
|
53
53
|
|
54
54
|
/*
|
55
|
-
**
|
55
|
+
** These no-op macros are used in front of interfaces to mark those
|
56
|
+
** interfaces as either deprecated or experimental. New applications
|
57
|
+
** should not use deprecated intrfaces - they are support for backwards
|
58
|
+
** compatibility only. Application writers should be aware that
|
59
|
+
** experimental interfaces are subject to change in point releases.
|
60
|
+
**
|
61
|
+
** These macros used to resolve to various kinds of compiler magic that
|
62
|
+
** would generate warning messages when they were used. But that
|
63
|
+
** compiler magic ended up generating such a flurry of bug reports
|
64
|
+
** that we have taken it all out and gone back to using simple
|
65
|
+
** noop macros.
|
56
66
|
*/
|
57
|
-
#
|
58
|
-
|
59
|
-
#define SQLITE_DEPRECATED __attribute__ ((deprecated))
|
60
|
-
#elif defined(_MSC_VER) && (_MSC_VER>1200)
|
61
|
-
#define SQLITE_DEPRECATED __declspec(deprecated)
|
62
|
-
#else
|
63
|
-
#define SQLITE_DEPRECATED
|
64
|
-
#endif
|
65
|
-
|
66
|
-
/*
|
67
|
-
** Add the ability to mark interfaces as experimental.
|
68
|
-
*/
|
69
|
-
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
70
|
-
/* I can confirm that it does not work on version 4.1.0... */
|
71
|
-
/* First appears in GCC docs for version 4.3.0 */
|
72
|
-
#define SQLITE_EXPERIMENTAL __attribute__ ((warning ("is experimental")))
|
73
|
-
#elif defined(_MSC_VER) && (_MSC_VER>1200)
|
74
|
-
#define SQLITE_EXPERIMENTAL __declspec(deprecated("was declared experimental"))
|
75
|
-
#else
|
76
|
-
#define SQLITE_EXPERIMENTAL
|
77
|
-
#endif
|
67
|
+
#define SQLITE_DEPRECATED
|
68
|
+
#define SQLITE_EXPERIMENTAL
|
78
69
|
|
79
70
|
/*
|
80
71
|
** Ensure these symbols were not defined by some previous header file.
|
@@ -116,8 +107,8 @@ extern "C" {
|
|
116
107
|
** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z
|
117
108
|
** are the major version, minor version, and release number.
|
118
109
|
*/
|
119
|
-
#define SQLITE_VERSION "3.6.
|
120
|
-
#define SQLITE_VERSION_NUMBER
|
110
|
+
#define SQLITE_VERSION "3.6.5"
|
111
|
+
#define SQLITE_VERSION_NUMBER 3006005
|
121
112
|
|
122
113
|
/*
|
123
114
|
** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
|
@@ -182,16 +173,11 @@ int sqlite3_libversion_number(void);
|
|
182
173
|
**
|
183
174
|
** INVARIANTS:
|
184
175
|
**
|
185
|
-
** {H10101} The [sqlite3_threadsafe()] function shall return
|
186
|
-
** and only if
|
187
|
-
** SQLite was compiled with the its mutexes enabled by default.
|
176
|
+
** {H10101} The [sqlite3_threadsafe()] function shall return zero if
|
177
|
+
** and only if SQLite was compiled with mutexing code omitted.
|
188
178
|
**
|
189
179
|
** {H10102} The value returned by the [sqlite3_threadsafe()] function
|
190
|
-
** shall
|
191
|
-
** runtime using the [sqlite3_config()] interface and
|
192
|
-
** especially the [SQLITE_CONFIG_SINGLETHREAD],
|
193
|
-
** [SQLITE_CONFIG_MULTITHREAD], [SQLITE_CONFIG_SERIALIZED],
|
194
|
-
** and [SQLITE_CONFIG_MUTEX] verbs.
|
180
|
+
** shall remain the same across calls to [sqlite3_config()].
|
195
181
|
*/
|
196
182
|
int sqlite3_threadsafe(void);
|
197
183
|
|
@@ -288,7 +274,7 @@ typedef sqlite_uint64 sqlite3_uint64;
|
|
288
274
|
** an [SQLITE_BUSY] error code.
|
289
275
|
**
|
290
276
|
** {H12015} A call to [sqlite3_close(C)] where C is a NULL pointer shall
|
291
|
-
**
|
277
|
+
** be a harmless no-op returning SQLITE_OK.
|
292
278
|
**
|
293
279
|
** {H12019} When [sqlite3_close(C)] is invoked on a [database connection] C
|
294
280
|
** that has a pending transaction, the transaction shall be
|
@@ -392,12 +378,14 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
|
392
378
|
** *E to NULL if E is not NULL and there are no errors.
|
393
379
|
**
|
394
380
|
** {H12137} The [sqlite3_exec(D,S,C,A,E)] function shall set the [error code]
|
395
|
-
** and message accessible via [sqlite3_errcode()],
|
381
|
+
** and message accessible via [sqlite3_errcode()],
|
382
|
+
** [sqlite3_extended_errcode()],
|
396
383
|
** [sqlite3_errmsg()], and [sqlite3_errmsg16()].
|
397
384
|
**
|
398
385
|
** {H12138} If the S parameter to [sqlite3_exec(D,S,C,A,E)] is NULL or an
|
399
386
|
** empty string or contains nothing other than whitespace, comments,
|
400
387
|
** and/or semicolons, then results of [sqlite3_errcode()],
|
388
|
+
** [sqlite3_extended_errcode()],
|
401
389
|
** [sqlite3_errmsg()], and [sqlite3_errmsg16()]
|
402
390
|
** shall reset to indicate no errors.
|
403
391
|
**
|
@@ -599,7 +587,7 @@ int sqlite3_exec(
|
|
599
587
|
** sync operation only needs to flush data to mass storage. Inode
|
600
588
|
** information need not be flushed. The SQLITE_SYNC_NORMAL flag means
|
601
589
|
** to use normal fsync() semantics. The SQLITE_SYNC_FULL flag means
|
602
|
-
** to use Mac OS
|
590
|
+
** to use Mac OS X style fullsync instead of fsync().
|
603
591
|
*/
|
604
592
|
#define SQLITE_SYNC_NORMAL 0x00002
|
605
593
|
#define SQLITE_SYNC_FULL 0x00003
|
@@ -631,7 +619,7 @@ struct sqlite3_file {
|
|
631
619
|
**
|
632
620
|
** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
|
633
621
|
** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().
|
634
|
-
** The second choice is a Mac OS
|
622
|
+
** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY]
|
635
623
|
** flag may be ORed in to indicate that only the data of the file
|
636
624
|
** and not its inode needs to be synced.
|
637
625
|
**
|
@@ -694,6 +682,12 @@ struct sqlite3_file {
|
|
694
682
|
** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
|
695
683
|
** information is written to disk in the same order as calls
|
696
684
|
** to xWrite().
|
685
|
+
**
|
686
|
+
** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
|
687
|
+
** in the unread portions of the buffer with zeros. A VFS that
|
688
|
+
** fails to zero-fill short reads might seem to work. However,
|
689
|
+
** failure to zero-fill short reads will eventually lead to
|
690
|
+
** database corruption.
|
697
691
|
*/
|
698
692
|
typedef struct sqlite3_io_methods sqlite3_io_methods;
|
699
693
|
struct sqlite3_io_methods {
|
@@ -920,24 +914,24 @@ struct sqlite3_vfs {
|
|
920
914
|
** sqlite3_os_init(). Similarly, sqlite3_shutdown()
|
921
915
|
** shall invoke sqlite3_os_end().
|
922
916
|
**
|
923
|
-
** The sqlite3_initialize() routine returns SQLITE_OK on success.
|
917
|
+
** The sqlite3_initialize() routine returns [SQLITE_OK] on success.
|
924
918
|
** If for some reason, sqlite3_initialize() is unable to initialize
|
925
919
|
** the library (perhaps it is unable to allocate a needed resource such
|
926
|
-
** as a mutex) it returns an [error code] other than SQLITE_OK.
|
920
|
+
** as a mutex) it returns an [error code] other than [SQLITE_OK].
|
927
921
|
**
|
928
922
|
** The sqlite3_initialize() routine is called internally by many other
|
929
923
|
** SQLite interfaces so that an application usually does not need to
|
930
924
|
** invoke sqlite3_initialize() directly. For example, [sqlite3_open()]
|
931
925
|
** calls sqlite3_initialize() so the SQLite library will be automatically
|
932
926
|
** initialized when [sqlite3_open()] is called if it has not be initialized
|
933
|
-
** already. However, if SQLite is compiled with the SQLITE_OMIT_AUTOINIT
|
927
|
+
** already. However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
|
934
928
|
** compile-time option, then the automatic calls to sqlite3_initialize()
|
935
929
|
** are omitted and the application must call sqlite3_initialize() directly
|
936
930
|
** prior to using any other SQLite interface. For maximum portability,
|
937
931
|
** it is recommended that applications always invoke sqlite3_initialize()
|
938
932
|
** directly prior to using any other SQLite interface. Future releases
|
939
933
|
** of SQLite may require this. In other words, the behavior exhibited
|
940
|
-
** when SQLite is compiled with SQLITE_OMIT_AUTOINIT might become the
|
934
|
+
** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the
|
941
935
|
** default behavior in some future release of SQLite.
|
942
936
|
**
|
943
937
|
** The sqlite3_os_init() routine does operating-system specific
|
@@ -955,11 +949,11 @@ struct sqlite3_vfs {
|
|
955
949
|
** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate
|
956
950
|
** implementations for sqlite3_os_init() and sqlite3_os_end()
|
957
951
|
** are built into SQLite when it is compiled for unix, windows, or os/2.
|
958
|
-
** When built for other platforms (using the SQLITE_OS_OTHER=1 compile-time
|
952
|
+
** When built for other platforms (using the [SQLITE_OS_OTHER=1] compile-time
|
959
953
|
** option) the application must supply a suitable implementation for
|
960
954
|
** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
|
961
955
|
** implementation of sqlite3_os_init() or sqlite3_os_end()
|
962
|
-
** must return SQLITE_OK on success and some other [error code] upon
|
956
|
+
** must return [SQLITE_OK] on success and some other [error code] upon
|
963
957
|
** failure.
|
964
958
|
*/
|
965
959
|
int sqlite3_initialize(void);
|
@@ -968,7 +962,7 @@ int sqlite3_os_init(void);
|
|
968
962
|
int sqlite3_os_end(void);
|
969
963
|
|
970
964
|
/*
|
971
|
-
** CAPI3REF: Configuring The SQLite Library {
|
965
|
+
** CAPI3REF: Configuring The SQLite Library {H14100} <S20000><S30200>
|
972
966
|
** EXPERIMENTAL
|
973
967
|
**
|
974
968
|
** The sqlite3_config() interface is used to make global configuration
|
@@ -991,14 +985,103 @@ int sqlite3_os_end(void);
|
|
991
985
|
** vary depending on the [SQLITE_CONFIG_SINGLETHREAD | configuration option]
|
992
986
|
** in the first argument.
|
993
987
|
**
|
994
|
-
** When a configuration option is set, sqlite3_config() returns SQLITE_OK.
|
988
|
+
** When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
|
995
989
|
** If the option is unknown or SQLite is unable to set the option
|
996
990
|
** then this routine returns a non-zero [error code].
|
991
|
+
**
|
992
|
+
** INVARIANTS:
|
993
|
+
**
|
994
|
+
** {H14103} A successful invocation of [sqlite3_config()] shall return
|
995
|
+
** [SQLITE_OK].
|
996
|
+
**
|
997
|
+
** {H14106} The [sqlite3_config()] interface shall return [SQLITE_MISUSE]
|
998
|
+
** if it is invoked in between calls to [sqlite3_initialize()] and
|
999
|
+
** [sqlite3_shutdown()].
|
1000
|
+
**
|
1001
|
+
** {H14120} A successful call to [sqlite3_config]([SQLITE_CONFIG_SINGLETHREAD])
|
1002
|
+
** shall set the default [threading mode] to Single-thread.
|
1003
|
+
**
|
1004
|
+
** {H14123} A successful call to [sqlite3_config]([SQLITE_CONFIG_MULTITHREAD])
|
1005
|
+
** shall set the default [threading mode] to Multi-thread.
|
1006
|
+
**
|
1007
|
+
** {H14126} A successful call to [sqlite3_config]([SQLITE_CONFIG_SERIALIZED])
|
1008
|
+
** shall set the default [threading mode] to Serialized.
|
1009
|
+
**
|
1010
|
+
** {H14129} A successful call to [sqlite3_config]([SQLITE_CONFIG_MUTEX],X)
|
1011
|
+
** where X is a pointer to an initialized [sqlite3_mutex_methods]
|
1012
|
+
** object shall cause all subsequent mutex operations performed
|
1013
|
+
** by SQLite to use the mutex methods that were present in X
|
1014
|
+
** during the call to [sqlite3_config()].
|
1015
|
+
**
|
1016
|
+
** {H14132} A successful call to [sqlite3_config]([SQLITE_CONFIG_GETMUTEX],X)
|
1017
|
+
** where X is a pointer to an [sqlite3_mutex_methods] object
|
1018
|
+
** shall overwrite the content of [sqlite3_mutex_methods] object
|
1019
|
+
** with the mutex methods currently in use by SQLite.
|
1020
|
+
**
|
1021
|
+
** {H14135} A successful call to [sqlite3_config]([SQLITE_CONFIG_MALLOC],M)
|
1022
|
+
** where M is a pointer to an initialized [sqlite3_mem_methods]
|
1023
|
+
** object shall cause all subsequent memory allocation operations
|
1024
|
+
** performed by SQLite to use the methods that were present in
|
1025
|
+
** M during the call to [sqlite3_config()].
|
1026
|
+
**
|
1027
|
+
** {H14138} A successful call to [sqlite3_config]([SQLITE_CONFIG_GETMALLOC],M)
|
1028
|
+
** where M is a pointer to an [sqlite3_mem_methods] object shall
|
1029
|
+
** overwrite the content of [sqlite3_mem_methods] object with
|
1030
|
+
** the memory allocation methods currently in use by
|
1031
|
+
** SQLite.
|
1032
|
+
**
|
1033
|
+
** {H14141} A successful call to [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],1)
|
1034
|
+
** shall enable the memory allocation status collection logic.
|
1035
|
+
**
|
1036
|
+
** {H14144} A successful call to [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],0)
|
1037
|
+
** shall disable the memory allocation status collection logic.
|
1038
|
+
**
|
1039
|
+
** {H14147} The memory allocation status collection logic shall be
|
1040
|
+
** enabled by default.
|
1041
|
+
**
|
1042
|
+
** {H14150} A successful call to [sqlite3_config]([SQLITE_CONFIG_SCRATCH],S,Z,N)
|
1043
|
+
** where Z and N are non-negative integers and
|
1044
|
+
** S is a pointer to an aligned memory buffer not less than
|
1045
|
+
** Z*N bytes in size shall cause S to be used by the
|
1046
|
+
** [scratch memory allocator] for as many as N simulataneous
|
1047
|
+
** allocations each of size Z.
|
1048
|
+
**
|
1049
|
+
** {H14153} A successful call to [sqlite3_config]([SQLITE_CONFIG_SCRATCH],S,Z,N)
|
1050
|
+
** where S is a NULL pointer shall disable the
|
1051
|
+
** [scratch memory allocator].
|
1052
|
+
**
|
1053
|
+
** {H14156} A successful call to
|
1054
|
+
** [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],S,Z,N)
|
1055
|
+
** where Z and N are non-negative integers and
|
1056
|
+
** S is a pointer to an aligned memory buffer not less than
|
1057
|
+
** Z*N bytes in size shall cause S to be used by the
|
1058
|
+
** [pagecache memory allocator] for as many as N simulataneous
|
1059
|
+
** allocations each of size Z.
|
1060
|
+
**
|
1061
|
+
** {H14159} A successful call to
|
1062
|
+
** [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],S,Z,N)
|
1063
|
+
** where S is a NULL pointer shall disable the
|
1064
|
+
** [pagecache memory allocator].
|
1065
|
+
**
|
1066
|
+
** {H14162} A successful call to [sqlite3_config]([SQLITE_CONFIG_HEAP],H,Z,N)
|
1067
|
+
** where Z and N are non-negative integers and
|
1068
|
+
** H is a pointer to an aligned memory buffer not less than
|
1069
|
+
** Z bytes in size shall enable the [memsys5] memory allocator
|
1070
|
+
** and cause it to use buffer S as its memory source and to use
|
1071
|
+
** a minimum allocation size of N.
|
1072
|
+
**
|
1073
|
+
** {H14165} A successful call to [sqlite3_config]([SQLITE_CONFIG_HEAP],H,Z,N)
|
1074
|
+
** where H is a NULL pointer shall disable the
|
1075
|
+
** [memsys5] memory allocator.
|
1076
|
+
**
|
1077
|
+
** {H14168} A successful call to [sqlite3_config]([SQLITE_CONFIG_LOOKASIDE],Z,N)
|
1078
|
+
** shall cause the default [lookaside memory allocator] configuration
|
1079
|
+
** for new [database connections] to be N slots of Z bytes each.
|
997
1080
|
*/
|
998
1081
|
SQLITE_EXPERIMENTAL int sqlite3_config(int, ...);
|
999
1082
|
|
1000
1083
|
/*
|
1001
|
-
** CAPI3REF: Configure database connections {
|
1084
|
+
** CAPI3REF: Configure database connections {H14200} <S20000>
|
1002
1085
|
** EXPERIMENTAL
|
1003
1086
|
**
|
1004
1087
|
** The sqlite3_db_config() interface is used to make configuration
|
@@ -1015,6 +1098,38 @@ SQLITE_EXPERIMENTAL int sqlite3_config(int, ...);
|
|
1015
1098
|
** The only choice for this value is [SQLITE_DBCONFIG_LOOKASIDE].
|
1016
1099
|
** New verbs are likely to be added in future releases of SQLite.
|
1017
1100
|
** Additional arguments depend on the verb.
|
1101
|
+
**
|
1102
|
+
** INVARIANTS:
|
1103
|
+
**
|
1104
|
+
** {H14203} A call to [sqlite3_db_config(D,V,...)] shall return [SQLITE_OK]
|
1105
|
+
** if and only if the call is successful.
|
1106
|
+
**
|
1107
|
+
** {H14206} If one or more slots of the [lookaside memory allocator] for
|
1108
|
+
** [database connection] D are in use, then a call to
|
1109
|
+
** [sqlite3_db_config](D,[SQLITE_DBCONFIG_LOOKASIDE],...) shall
|
1110
|
+
** fail with an [SQLITE_BUSY] return code.
|
1111
|
+
**
|
1112
|
+
** {H14209} A successful call to
|
1113
|
+
** [sqlite3_db_config](D,[SQLITE_DBCONFIG_LOOKASIDE],B,Z,N) where
|
1114
|
+
** D is an open [database connection] and Z and N are positive
|
1115
|
+
** integers and B is an aligned buffer at least Z*N bytes in size
|
1116
|
+
** shall cause the [lookaside memory allocator] for D to use buffer B
|
1117
|
+
** with N slots of Z bytes each.
|
1118
|
+
**
|
1119
|
+
** {H14212} A successful call to
|
1120
|
+
** [sqlite3_db_config](D,[SQLITE_DBCONFIG_LOOKASIDE],B,Z,N) where
|
1121
|
+
** D is an open [database connection] and Z and N are positive
|
1122
|
+
** integers and B is NULL pointer shall cause the
|
1123
|
+
** [lookaside memory allocator] for D to a obtain Z*N byte buffer
|
1124
|
+
** from the primary memory allocator and use that buffer
|
1125
|
+
** with N lookaside slots of Z bytes each.
|
1126
|
+
**
|
1127
|
+
** {H14215} A successful call to
|
1128
|
+
** [sqlite3_db_config](D,[SQLITE_DBCONFIG_LOOKASIDE],B,Z,N) where
|
1129
|
+
** D is an open [database connection] and Z and N are zero shall
|
1130
|
+
** disable the [lookaside memory allocator] for D.
|
1131
|
+
**
|
1132
|
+
**
|
1018
1133
|
*/
|
1019
1134
|
SQLITE_EXPERIMENTAL int sqlite3_db_config(sqlite3*, int op, ...);
|
1020
1135
|
|
@@ -1217,7 +1332,7 @@ struct sqlite3_mem_methods {
|
|
1217
1332
|
#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
|
1218
1333
|
#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
|
1219
1334
|
#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
|
1220
|
-
|
1335
|
+
/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
|
1221
1336
|
#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
|
1222
1337
|
|
1223
1338
|
/*
|
@@ -1280,17 +1395,17 @@ int sqlite3_extended_result_codes(sqlite3*, int onoff);
|
|
1280
1395
|
** is another alias for the rowid.
|
1281
1396
|
**
|
1282
1397
|
** This routine returns the rowid of the most recent
|
1283
|
-
** successful INSERT into the database from the [database connection]
|
1284
|
-
** in the first argument. If no successful
|
1398
|
+
** successful [INSERT] into the database from the [database connection]
|
1399
|
+
** in the first argument. If no successful [INSERT]s
|
1285
1400
|
** have ever occurred on that database connection, zero is returned.
|
1286
1401
|
**
|
1287
|
-
** If an INSERT occurs within a trigger, then the rowid of the inserted
|
1402
|
+
** If an [INSERT] occurs within a trigger, then the rowid of the inserted
|
1288
1403
|
** row is returned by this routine as long as the trigger is running.
|
1289
1404
|
** But once the trigger terminates, the value returned by this routine
|
1290
1405
|
** reverts to the last value inserted before the trigger fired.
|
1291
1406
|
**
|
1292
|
-
** An INSERT that fails due to a constraint violation is not a
|
1293
|
-
** successful INSERT and does not change the value returned by this
|
1407
|
+
** An [INSERT] that fails due to a constraint violation is not a
|
1408
|
+
** successful [INSERT] and does not change the value returned by this
|
1294
1409
|
** routine. Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,
|
1295
1410
|
** and INSERT OR ABORT make no changes to the return value of this
|
1296
1411
|
** routine when their insertion fails. When INSERT OR REPLACE
|
@@ -1299,23 +1414,24 @@ int sqlite3_extended_result_codes(sqlite3*, int onoff);
|
|
1299
1414
|
** the constraint problem so INSERT OR REPLACE will always change
|
1300
1415
|
** the return value of this interface.
|
1301
1416
|
**
|
1302
|
-
** For the purposes of this routine, an INSERT is considered to
|
1417
|
+
** For the purposes of this routine, an [INSERT] is considered to
|
1303
1418
|
** be successful even if it is subsequently rolled back.
|
1304
1419
|
**
|
1305
1420
|
** INVARIANTS:
|
1306
1421
|
**
|
1307
|
-
** {H12221} The [sqlite3_last_insert_rowid()] function
|
1308
|
-
** of the most recent successful INSERT performed on the same
|
1422
|
+
** {H12221} The [sqlite3_last_insert_rowid()] function shall return the rowid
|
1423
|
+
** of the most recent successful [INSERT] performed on the same
|
1309
1424
|
** [database connection] and within the same or higher level
|
1310
|
-
** trigger context, or zero if there have been no qualifying
|
1425
|
+
** trigger context, or zero if there have been no qualifying
|
1426
|
+
** [INSERT] statements.
|
1311
1427
|
**
|
1312
|
-
** {H12223} The [sqlite3_last_insert_rowid()] function
|
1428
|
+
** {H12223} The [sqlite3_last_insert_rowid()] function shall return the
|
1313
1429
|
** same value when called from the same trigger context
|
1314
|
-
** immediately before and after a ROLLBACK.
|
1430
|
+
** immediately before and after a [ROLLBACK].
|
1315
1431
|
**
|
1316
1432
|
** ASSUMPTIONS:
|
1317
1433
|
**
|
1318
|
-
** {A12232} If a separate thread performs a new INSERT on the same
|
1434
|
+
** {A12232} If a separate thread performs a new [INSERT] on the same
|
1319
1435
|
** database connection while the [sqlite3_last_insert_rowid()]
|
1320
1436
|
** function is running and thus changes the last insert rowid,
|
1321
1437
|
** then the value returned by [sqlite3_last_insert_rowid()] is
|
@@ -1330,8 +1446,8 @@ sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
|
|
1330
1446
|
** This function returns the number of database rows that were changed
|
1331
1447
|
** or inserted or deleted by the most recently completed SQL statement
|
1332
1448
|
** on the [database connection] specified by the first parameter.
|
1333
|
-
** Only changes that are directly specified by the INSERT, UPDATE,
|
1334
|
-
** or DELETE statement are counted. Auxiliary changes caused by
|
1449
|
+
** Only changes that are directly specified by the [INSERT], [UPDATE],
|
1450
|
+
** or [DELETE] statement are counted. Auxiliary changes caused by
|
1335
1451
|
** triggers are not counted. Use the [sqlite3_total_changes()] function
|
1336
1452
|
** to find the total number of changes including changes caused by triggers.
|
1337
1453
|
**
|
@@ -1365,13 +1481,15 @@ sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
|
|
1365
1481
|
** caused by subtriggers since those have their own context.
|
1366
1482
|
**
|
1367
1483
|
** SQLite implements the command "DELETE FROM table" without a WHERE clause
|
1368
|
-
** by dropping and recreating the table.
|
1369
|
-
** through and deleting individual elements from the table.
|
1484
|
+
** by dropping and recreating the table. Doing so is much faster than going
|
1485
|
+
** through and deleting individual elements from the table. Because of this
|
1370
1486
|
** optimization, the deletions in "DELETE FROM table" are not row changes and
|
1371
1487
|
** will not be counted by the sqlite3_changes() or [sqlite3_total_changes()]
|
1372
1488
|
** functions, regardless of the number of elements that were originally
|
1373
1489
|
** in the table. To get an accurate count of the number of rows deleted, use
|
1374
|
-
** "DELETE FROM table WHERE 1" instead.
|
1490
|
+
** "DELETE FROM table WHERE 1" instead. Or recompile using the
|
1491
|
+
** [SQLITE_OMIT_TRUNCATE_OPTIMIZATION] compile-time option to disable the
|
1492
|
+
** optimization on all queries.
|
1375
1493
|
**
|
1376
1494
|
** INVARIANTS:
|
1377
1495
|
**
|
@@ -1413,7 +1531,9 @@ int sqlite3_changes(sqlite3*);
|
|
1413
1531
|
** will not be counted by the sqlite3_changes() or [sqlite3_total_changes()]
|
1414
1532
|
** functions, regardless of the number of elements that were originally
|
1415
1533
|
** in the table. To get an accurate count of the number of rows deleted, use
|
1416
|
-
** "DELETE FROM table WHERE 1" instead.
|
1534
|
+
** "DELETE FROM table WHERE 1" instead. Or recompile using the
|
1535
|
+
** [SQLITE_OMIT_TRUNCATE_OPTIMIZATION] compile-time option to disable the
|
1536
|
+
** optimization on all queries.
|
1417
1537
|
**
|
1418
1538
|
** See also the [sqlite3_changes()] interface.
|
1419
1539
|
**
|
@@ -1892,7 +2012,7 @@ char *sqlite3_snprintf(int,char*,const char*, ...);
|
|
1892
2012
|
** memory might result in a segmentation fault or other severe error.
|
1893
2013
|
** Memory corruption, a segmentation fault, or other severe error
|
1894
2014
|
** might result if sqlite3_free() is called with a non-NULL pointer that
|
1895
|
-
** was not obtained from sqlite3_malloc() or
|
2015
|
+
** was not obtained from sqlite3_malloc() or sqlite3_realloc().
|
1896
2016
|
**
|
1897
2017
|
** The sqlite3_realloc() interface attempts to resize a
|
1898
2018
|
** prior memory allocation to be at least N bytes, where N is the
|
@@ -2263,7 +2383,7 @@ int sqlite3_set_authorizer(
|
|
2263
2383
|
#define SQLITE_ANALYZE 28 /* Table Name NULL */
|
2264
2384
|
#define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */
|
2265
2385
|
#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */
|
2266
|
-
#define SQLITE_FUNCTION 31 /* Function Name
|
2386
|
+
#define SQLITE_FUNCTION 31 /* NULL Function Name */
|
2267
2387
|
#define SQLITE_COPY 0 /* No longer used */
|
2268
2388
|
|
2269
2389
|
/*
|
@@ -2546,7 +2666,10 @@ int sqlite3_open_v2(
|
|
2546
2666
|
** [extended result code] for the most recent failed sqlite3_* API call
|
2547
2667
|
** associated with a [database connection]. If a prior API call failed
|
2548
2668
|
** but the most recent API call succeeded, the return value from
|
2549
|
-
** sqlite3_errcode() is undefined.
|
2669
|
+
** sqlite3_errcode() is undefined. The sqlite3_extended_errcode()
|
2670
|
+
** interface is the same except that it always returns the
|
2671
|
+
** [extended result code] even when extended result codes are
|
2672
|
+
** disabled.
|
2550
2673
|
**
|
2551
2674
|
** The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
|
2552
2675
|
** text that describes the error, as either UTF-8 or UTF-16 respectively.
|
@@ -2555,6 +2678,16 @@ int sqlite3_open_v2(
|
|
2555
2678
|
** However, the error string might be overwritten or deallocated by
|
2556
2679
|
** subsequent calls to other SQLite interface functions.
|
2557
2680
|
**
|
2681
|
+
** When the serialized [threading mode] is in use, it might be the
|
2682
|
+
** case that a second error occurs on a separate thread in between
|
2683
|
+
** the time of the first error and the call to these interfaces.
|
2684
|
+
** When that happens, the second error will be reported since these
|
2685
|
+
** interfaces always report the most recent result. To avoid
|
2686
|
+
** this, each thread can obtain exclusive use of the [database connection] D
|
2687
|
+
** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning
|
2688
|
+
** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after
|
2689
|
+
** all calls to the interfaces listed here are completed.
|
2690
|
+
**
|
2558
2691
|
** If an interface fails with SQLITE_MISUSE, that means the interface
|
2559
2692
|
** was invoked incorrectly by the application. In that case, the
|
2560
2693
|
** error code and message may or may not be set.
|
@@ -2565,6 +2698,10 @@ int sqlite3_open_v2(
|
|
2565
2698
|
** [result code] or [extended result code] for the most recently
|
2566
2699
|
** failed interface call associated with the [database connection] D.
|
2567
2700
|
**
|
2701
|
+
** {H12802} The [sqlite3_extended_errcode(D)] interface returns the numeric
|
2702
|
+
** [extended result code] for the most recently
|
2703
|
+
** failed interface call associated with the [database connection] D.
|
2704
|
+
**
|
2568
2705
|
** {H12803} The [sqlite3_errmsg(D)] and [sqlite3_errmsg16(D)]
|
2569
2706
|
** interfaces return English-language text that describes
|
2570
2707
|
** the error in the mostly recently failed interface call,
|
@@ -2576,15 +2713,18 @@ int sqlite3_open_v2(
|
|
2576
2713
|
** {H12808} Calls to API routines that do not return an error code
|
2577
2714
|
** (example: [sqlite3_data_count()]) do not
|
2578
2715
|
** change the error code or message returned by
|
2579
|
-
** [sqlite3_errcode()], [
|
2716
|
+
** [sqlite3_errcode()], [sqlite3_extended_errcode()],
|
2717
|
+
** [sqlite3_errmsg()], or [sqlite3_errmsg16()].
|
2580
2718
|
**
|
2581
2719
|
** {H12809} Interfaces that are not associated with a specific
|
2582
2720
|
** [database connection] (examples:
|
2583
2721
|
** [sqlite3_mprintf()] or [sqlite3_enable_shared_cache()]
|
2584
2722
|
** do not change the values returned by
|
2585
|
-
** [sqlite3_errcode()], [
|
2723
|
+
** [sqlite3_errcode()], [sqlite3_extended_errcode()],
|
2724
|
+
** [sqlite3_errmsg()], or [sqlite3_errmsg16()].
|
2586
2725
|
*/
|
2587
2726
|
int sqlite3_errcode(sqlite3 *db);
|
2727
|
+
int sqlite3_extended_errcode(sqlite3 *db);
|
2588
2728
|
const char *sqlite3_errmsg(sqlite3*);
|
2589
2729
|
const void *sqlite3_errmsg16(sqlite3*);
|
2590
2730
|
|
@@ -2853,7 +2993,7 @@ int sqlite3_prepare16_v2(
|
|
2853
2993
|
);
|
2854
2994
|
|
2855
2995
|
/*
|
2856
|
-
**
|
2996
|
+
** CAPI3REF: Retrieving Statement SQL {H13100} <H13000>
|
2857
2997
|
**
|
2858
2998
|
** This interface can be used to retrieve a saved copy of the original
|
2859
2999
|
** SQL text used to create a [prepared statement] if that statement was
|
@@ -4011,14 +4151,16 @@ int sqlite3_create_function16(
|
|
4011
4151
|
** backwards compatibility with older code, these functions continue
|
4012
4152
|
** to be supported. However, new applications should avoid
|
4013
4153
|
** the use of these functions. To help encourage people to avoid
|
4014
|
-
** using these functions, we are not going to tell you
|
4154
|
+
** using these functions, we are not going to tell you what they do.
|
4015
4155
|
*/
|
4156
|
+
#ifndef SQLITE_OMIT_DEPRECATED
|
4016
4157
|
SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
|
4017
4158
|
SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
|
4018
4159
|
SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
|
4019
4160
|
SQLITE_DEPRECATED int sqlite3_global_recover(void);
|
4020
4161
|
SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
|
4021
4162
|
SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64);
|
4163
|
+
#endif
|
4022
4164
|
|
4023
4165
|
/*
|
4024
4166
|
** CAPI3REF: Obtaining SQL Function Parameter Values {H15100} <S20200>
|
@@ -5651,6 +5793,7 @@ typedef struct sqlite3_blob sqlite3_blob;
|
|
5651
5793
|
**
|
5652
5794
|
** {H17821} If an error occurs during evaluation of [sqlite3_blob_open(D,...)]
|
5653
5795
|
** then subsequent calls to [sqlite3_errcode(D)],
|
5796
|
+
** [sqlite3_extended_errcode()],
|
5654
5797
|
** [sqlite3_errmsg(D)], and [sqlite3_errmsg16(D)] shall return
|
5655
5798
|
** information appropriate for that error.
|
5656
5799
|
**
|
@@ -5764,6 +5907,7 @@ int sqlite3_blob_bytes(sqlite3_blob *);
|
|
5764
5907
|
**
|
5765
5908
|
** {H17868} If an error occurs during evaluation of [sqlite3_blob_read(P,...)]
|
5766
5909
|
** then subsequent calls to [sqlite3_errcode(D)],
|
5910
|
+
** [sqlite3_extended_errcode()],
|
5767
5911
|
** [sqlite3_errmsg(D)], and [sqlite3_errmsg16(D)] shall return
|
5768
5912
|
** information appropriate for that error, where D is the
|
5769
5913
|
** [database connection] that was used to open the [BLOB handle] P.
|
@@ -5833,6 +5977,7 @@ int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
|
|
5833
5977
|
**
|
5834
5978
|
** {H17888} If an error occurs during evaluation of [sqlite3_blob_write(D,...)]
|
5835
5979
|
** then subsequent calls to [sqlite3_errcode(D)],
|
5980
|
+
** [sqlite3_extended_errcode()],
|
5836
5981
|
** [sqlite3_errmsg(D)], and [sqlite3_errmsg16(D)] shall return
|
5837
5982
|
** information appropriate for that error.
|
5838
5983
|
*/
|
@@ -6130,6 +6275,17 @@ int sqlite3_mutex_notheld(sqlite3_mutex*);
|
|
6130
6275
|
#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
|
6131
6276
|
#define SQLITE_MUTEX_STATIC_LRU2 7 /* lru page list */
|
6132
6277
|
|
6278
|
+
/*
|
6279
|
+
** CAPI3REF: Retrieve the mutex for a database connection {H17002} <H17000>
|
6280
|
+
**
|
6281
|
+
** This interface returns a pointer the [sqlite3_mutex] object that
|
6282
|
+
** serializes access to the [database connection] given in the argument
|
6283
|
+
** when the [threading mode] is Serialized.
|
6284
|
+
** If the [threading mode] is Single-thread or Multi-thread then this
|
6285
|
+
** routine returns a NULL pointer.
|
6286
|
+
*/
|
6287
|
+
sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
|
6288
|
+
|
6133
6289
|
/*
|
6134
6290
|
** CAPI3REF: Low-Level Control Of Database Files {H11300} <S30800>
|
6135
6291
|
**
|
@@ -6225,29 +6381,6 @@ int sqlite3_test_control(int op, ...);
|
|
6225
6381
|
*/
|
6226
6382
|
SQLITE_EXPERIMENTAL int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
|
6227
6383
|
|
6228
|
-
/*
|
6229
|
-
** CAPI3REF: Database Connection Status {H17201} <S60200>
|
6230
|
-
** EXPERIMENTAL
|
6231
|
-
**
|
6232
|
-
** This interface is used to retrieve runtime status information
|
6233
|
-
** about a single [database connection]. The first argument is the
|
6234
|
-
** database connection object to be interrogated. The second argument
|
6235
|
-
** is the parameter to interrogate. Currently, the only allowed value
|
6236
|
-
** for the second parameter is [SQLITE_DBSTATUS_LOOKASIDE_USED].
|
6237
|
-
** Additional options will likely appear in future releases of SQLite.
|
6238
|
-
**
|
6239
|
-
** The current value of the request parameter is written into *pCur
|
6240
|
-
** and the highest instantaneous value is written into *pHiwtr. If
|
6241
|
-
** the resetFlg is true, then the highest instantaneous value is
|
6242
|
-
** reset back down to the current value.
|
6243
|
-
**
|
6244
|
-
** See also: [sqlite3_status()].
|
6245
|
-
*/
|
6246
|
-
SQLITE_EXPERIMENTAL int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
|
6247
|
-
|
6248
|
-
|
6249
|
-
int sqlite3_wsd_init(int N, int J);
|
6250
|
-
void *sqlite3_wsd_find(void *K, int L);
|
6251
6384
|
|
6252
6385
|
/*
|
6253
6386
|
** CAPI3REF: Status Parameters {H17250} <H17200>
|
@@ -6337,7 +6470,27 @@ void *sqlite3_wsd_find(void *K, int L);
|
|
6337
6470
|
#define SQLITE_STATUS_SCRATCH_SIZE 8
|
6338
6471
|
|
6339
6472
|
/*
|
6340
|
-
** CAPI3REF:
|
6473
|
+
** CAPI3REF: Database Connection Status {H17500} <S60200>
|
6474
|
+
** EXPERIMENTAL
|
6475
|
+
**
|
6476
|
+
** This interface is used to retrieve runtime status information
|
6477
|
+
** about a single [database connection]. The first argument is the
|
6478
|
+
** database connection object to be interrogated. The second argument
|
6479
|
+
** is the parameter to interrogate. Currently, the only allowed value
|
6480
|
+
** for the second parameter is [SQLITE_DBSTATUS_LOOKASIDE_USED].
|
6481
|
+
** Additional options will likely appear in future releases of SQLite.
|
6482
|
+
**
|
6483
|
+
** The current value of the requested parameter is written into *pCur
|
6484
|
+
** and the highest instantaneous value is written into *pHiwtr. If
|
6485
|
+
** the resetFlg is true, then the highest instantaneous value is
|
6486
|
+
** reset back down to the current value.
|
6487
|
+
**
|
6488
|
+
** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
|
6489
|
+
*/
|
6490
|
+
SQLITE_EXPERIMENTAL int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
|
6491
|
+
|
6492
|
+
/*
|
6493
|
+
** CAPI3REF: Status Parameters for database connections {H17520} <H17500>
|
6341
6494
|
** EXPERIMENTAL
|
6342
6495
|
**
|
6343
6496
|
** Status verbs for [sqlite3_db_status()].
|
@@ -6350,6 +6503,58 @@ void *sqlite3_wsd_find(void *K, int L);
|
|
6350
6503
|
*/
|
6351
6504
|
#define SQLITE_DBSTATUS_LOOKASIDE_USED 0
|
6352
6505
|
|
6506
|
+
|
6507
|
+
/*
|
6508
|
+
** CAPI3REF: Prepared Statement Status {H17550} <S60200>
|
6509
|
+
** EXPERIMENTAL
|
6510
|
+
**
|
6511
|
+
** Each prepared statement maintains various
|
6512
|
+
** [SQLITE_STMTSTATUS_SORT | counters] that measure the number
|
6513
|
+
** of times it has performed specific operations. These counters can
|
6514
|
+
** be used to monitor the performance characteristics of the prepared
|
6515
|
+
** statements. For example, if the number of table steps greatly exceeds
|
6516
|
+
** the number of table searches or result rows, that would tend to indicate
|
6517
|
+
** that the prepared statement is using a full table scan rather than
|
6518
|
+
** an index.
|
6519
|
+
**
|
6520
|
+
** This interface is used to retrieve and reset counter values from
|
6521
|
+
** a [prepared statement]. The first argument is the prepared statement
|
6522
|
+
** object to be interrogated. The second argument
|
6523
|
+
** is an integer code for a specific [SQLITE_STMTSTATUS_SORT | counter]
|
6524
|
+
** to be interrogated.
|
6525
|
+
** The current value of the requested counter is returned.
|
6526
|
+
** If the resetFlg is true, then the counter is reset to zero after this
|
6527
|
+
** interface call returns.
|
6528
|
+
**
|
6529
|
+
** See also: [sqlite3_status()] and [sqlite3_db_status()].
|
6530
|
+
*/
|
6531
|
+
SQLITE_EXPERIMENTAL int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
6532
|
+
|
6533
|
+
/*
|
6534
|
+
** CAPI3REF: Status Parameters for prepared statements {H17570} <H17550>
|
6535
|
+
** EXPERIMENTAL
|
6536
|
+
**
|
6537
|
+
** These preprocessor macros define integer codes that name counter
|
6538
|
+
** values associated with the [sqlite3_stmt_status()] interface.
|
6539
|
+
** The meanings of the various counters are as follows:
|
6540
|
+
**
|
6541
|
+
** <dl>
|
6542
|
+
** <dt>SQLITE_STMTSTATUS_FULLSCAN_STEP</dt>
|
6543
|
+
** <dd>This is the number of times that SQLite has stepped forward in
|
6544
|
+
** a table as part of a full table scan. Large numbers for this counter
|
6545
|
+
** may indicate opportunities for performance improvement through
|
6546
|
+
** careful use of indices.</dd>
|
6547
|
+
**
|
6548
|
+
** <dt>SQLITE_STMTSTATUS_SORT</dt>
|
6549
|
+
** <dd>This is the number of sort operations that have occurred.
|
6550
|
+
** A non-zero value in this counter may indicate an opportunity to
|
6551
|
+
** improvement performance through careful use of indices.</dd>
|
6552
|
+
**
|
6553
|
+
** </dl>
|
6554
|
+
*/
|
6555
|
+
#define SQLITE_STMTSTATUS_FULLSCAN_STEP 1
|
6556
|
+
#define SQLITE_STMTSTATUS_SORT 2
|
6557
|
+
|
6353
6558
|
/*
|
6354
6559
|
** Undo the hack that converts floating point types to integer for
|
6355
6560
|
** builds on processors without floating point support.
|