Compare commits
11 Commits
dev
...
branch-3.6.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a8a3a97ce | |||
| 317ef6aabe | |||
| 1b47beaef8 | |||
| 90e38fde18 | |||
| 733db4c5df | |||
| acea85e6cf | |||
| b54e09173f | |||
| d1a590780b | |||
| 99c0401e5e | |||
| 9f4c890005 | |||
| 68608dc2e8 |
Regular → Executable
@@ -1,5 +1,5 @@
|
||||
C Version\s3.6.1\s(CVS\s5540)
|
||||
D 2008-08-06T10:50:00
|
||||
C Backport\sthe\slocaltime()\sfailure\spatch\sfrom\strunk.
|
||||
D 2011-06-21T15:34:05.185
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in 2713ea64947be3b35f35d9a3158bb8299c90b019
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@@ -74,7 +74,7 @@ F ext/rtree/rtree5.test 7d0643482829038f0263881ddf7e2d51bff1d60f
|
||||
F ext/rtree/rtree_perf.tcl 0fabb6d5c48cb8024e042ce5d4bb88998b6ec1cb
|
||||
F ext/rtree/rtree_util.tcl ee0a0311eb12175319d78bfb37302320496cee6e
|
||||
F ext/rtree/viewrtree.tcl 09526398dae87a5a87c5aac2b3854dbaf8376869
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 09fe5815427dc7d0abb188bbcdf0e34896577210
|
||||
F main.mk eace65a99d12045ca496069dc707405a63197006
|
||||
F mkdll.sh 79d1ed6ae221c10589dd969f130f8a3cccfffbb7
|
||||
@@ -90,32 +90,32 @@ F sqlite.pc.in c322c6244c6395955dca34d87955aabde7df7623
|
||||
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
|
||||
F sqlite3.def a1be7b9a4b8b51ac41c6ff6e8e44a14ef66b338b
|
||||
F sqlite3.pc.in 32b8a014799c2028c8e0c9cc5659718262fc493f
|
||||
F src/alter.c 2c541aaa88d720301253f181799d4af7bb9ddf1c
|
||||
F src/alter.c f1c7a868b72dda8ce72c1292479c6e8979924a74
|
||||
F src/analyze.c 747ce8cb6b318bb0d0576cfb5277aed98cbbeb5c
|
||||
F src/attach.c a85c14612e7e3410e0c3d2e0241832fa9688bd14
|
||||
F src/attach.c c4adb24b40039bf6fcb091db7db51524e44c5505
|
||||
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
|
||||
F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d
|
||||
F src/btmutex.c 709cad2cdca0afd013f0f612363810e53f59ec53
|
||||
F src/btree.c da7491ef06c0209da962e1520bfc5c90b5c5cc96
|
||||
F src/btree.c 171eceee4a8d8eac8fbd35858ed116489f695638
|
||||
F src/btree.h 03256ed7ee42b5ecacbe887070b0f8249e7d069d
|
||||
F src/btreeInt.h ab18c7b4980314e9e4b402e5dcde09f3c2545576
|
||||
F src/build.c f774f01e10885319d8f839cf00f25cc6a8a7d605
|
||||
F src/build.c d8fe03f76229e333c9e1989eb22b4120f1f46376
|
||||
F src/callback.c c9f75a4c403f166af3761df47d78a806587d63af
|
||||
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
|
||||
F src/date.c 52a54811218a76da6235420f532ece841159a96d
|
||||
F src/delete.c 0d115c173863b3c688c3083ef7857c7f2e9f7a18
|
||||
F src/expr.c 4f5221197384d923525fdfd117298eab073e9539
|
||||
F src/date.c 1478fb55fa23cc9b4d50341668c26f8a0d291abb
|
||||
F src/delete.c 28595a17b73d40e35fd285cd3741e9f5bade6b1d
|
||||
F src/expr.c d2046feae56970f15dd6fc89fb9193d973fbb644
|
||||
F src/fault.c 3638519d1e0b82bccfafcb9f5ff491918b28f8e1
|
||||
F src/func.c 54efe220cc1ef3859a4b738011621b63a0d697c5
|
||||
F src/func.c 596688b58c289e922e40139d030f847d1f82bf34
|
||||
F src/global.c b9c96ee2317a6e1391763c7db1098a6473a91863
|
||||
F src/hash.c eb64e48f3781100e5934f759fbe72a63a8fe78cb
|
||||
F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
|
||||
F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb
|
||||
F src/insert.c 89cd9af52a5ea6fb7d0cfc9c3b935d6406c360c4
|
||||
F src/insert.c 223a368a9e0d1e446a8df091a5b65189df4c5704
|
||||
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
|
||||
F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3
|
||||
F src/loadext.c eb1fe4f44d7c8ff53fc0c6a4388ab79fbd34cd64
|
||||
F src/main.c d750c6c0d381252851401f6ea2ee72185de005ed
|
||||
F src/main.c bafdff2621497d602a5010a8700297d5fd8a9792
|
||||
F src/malloc.c 22c68fc62f0c2df0f1deb8cd9a5ea968f995cac2
|
||||
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
|
||||
F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd
|
||||
@@ -133,18 +133,18 @@ F src/os.c 939ae7690a01d9401685ba124b4ba45fd4a7a2ad
|
||||
F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892
|
||||
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
|
||||
F src/os_os2.c 676ed273b17bd260f905df81375c9f9950d85517
|
||||
F src/os_unix.c fe0dbc35bcd3de49e46b132abfc0f45d6dd6a864
|
||||
F src/os_unix.c 23b64faec0762bdc878c8ea61ab38d4ae9575318
|
||||
F src/os_win.c aefe9ee26430678a19a058a874e4e2bd91398142
|
||||
F src/pager.c b6a366f2343e7f127d7e70dbe76cd664336143cd
|
||||
F src/pager.c e6b49d1b0116c186694093169d3c7199b0a72e4d
|
||||
F src/pager.h 588c1ac195228b2da45c4e5f7ab6c2fd253d1751
|
||||
F src/parse.y d962e544d9953289db23c1d4cc2dab514c7136fa
|
||||
F src/pragma.c 6e207b4f69901089758c02c02e0bf86ed12a4d8f
|
||||
F src/prepare.c d9f420808f7d2802258f0bf64103271311e2d87f
|
||||
F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
|
||||
F src/printf.c fd40f2fe2951b34290ad1c2d8b65a375b7ea2194
|
||||
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
|
||||
F src/select.c c1899b14f5eb3d3b71aeb02d541d6c5052ad3b70
|
||||
F src/select.c c5d15b97a5a26b34f83b0109e4bca398b703164b
|
||||
F src/shell.c 4b835fe734304ac22a3385868cd3790c1e4f7aa1
|
||||
F src/sqlite.h.in 157cd9932c2747a6ef3cb091e006185f4f9105d3
|
||||
F src/sqlite.h.in b6f0bb400e82d271709412ab59ee898d6a4c196a
|
||||
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
|
||||
F src/sqliteInt.h 685b9cf6537e59e4453269b43acb33c59b566346
|
||||
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
|
||||
@@ -179,18 +179,18 @@ F src/test_tclvar.c 73530070df8378571c8ce6bbbbb993236ae3ad0b
|
||||
F src/test_thread.c e297dd41db0b249646e69f97d36ec13e56e8b730
|
||||
F src/tokenize.c bfdc945527a4645bf54c8bf34d1f18c019b37117
|
||||
F src/trigger.c b61aaf7bff8e3763b234dbf46a1a64fb88a34e64
|
||||
F src/update.c 79b77a3cc8ed5f8903a7f37055fcedd69388dcae
|
||||
F src/update.c 1d7d70ac77b4e2fd9004f1279ed5dc645599ece9
|
||||
F src/utf.c a7004436a6ef2aee012ace93de274dd0f3c7624e
|
||||
F src/util.c afe659ccc05d1f8af9e8631dabfec3ee3a7144af
|
||||
F src/util.c 2f10789f4b25f36822d663773f56ce9d33c7ea11
|
||||
F src/vacuum.c ef342828002debc97514617af3424aea8ef8522c
|
||||
F src/vdbe.c 96e0527ad121b1308ed4ab5d02ff5b8a5f434e7f
|
||||
F src/vdbe.c 412c486b22f29cfdf922c6588c209f35127c3962
|
||||
F src/vdbe.h 647fcf33a551ba10a974162c56846cb9aef2276b
|
||||
F src/vdbeInt.h 6f04c2bf65a0d5c2bb8318b226278a35d1f7a8f5
|
||||
F src/vdbeapi.c 803f365b77a22c1b2680a0dee9202bc75c02bf4a
|
||||
F src/vdbeapi.c e61d3fffead73ae85df922fc4656793023f71b83
|
||||
F src/vdbeaux.c 21126e0d319e19125f5e42fceafb17eafe58721c
|
||||
F src/vdbeblob.c f93110888ddc246215e9ba1f831d3d375bfd8355
|
||||
F src/vdbefifo.c 20fda2a7c4c0bcee1b90eb7e545fefcdbf2e1de7
|
||||
F src/vdbemem.c c37b2a266a49eaf0c0f5080157f9f1a908fdaac3
|
||||
F src/vdbemem.c d637ff35a41aea7b72977488284ffc52e3791495
|
||||
F src/vtab.c 9c1bbb54d8b29a3412bff4eee32e9be309d85727
|
||||
F src/where.c a800184a2d023b15d6f2758b7a6c7ab011258fee
|
||||
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
|
||||
@@ -207,7 +207,7 @@ F test/async3.test 9ffa0977a78cc6351862a1583be2b1eecd41736d
|
||||
F test/attach.test 75a5d22f88e730967d68f2c9f95e786e3953d8e3
|
||||
F test/attach2.test a295d2d7061adcee5884ef4a93c7c96a82765437
|
||||
F test/attach3.test 7b92dc8e40c1ebca9732ca6f2d3fefbd46f196df
|
||||
F test/attachmalloc.test ccbde53bcb0a61020afa3e0670ca9c6c5b99af32
|
||||
F test/attachmalloc.test 95826e77cad2507b2b260b8fa6e4ec624e20c345
|
||||
F test/auth.test 9eb4b6b99eee54c95711c74c4b9694acf4d850ed
|
||||
F test/auth2.test ee3ba272e2b975e913afc9b041ee75706e190005
|
||||
F test/autoinc.test 42af2c407c4e37d0626f9cda57ed381e94522c9d
|
||||
@@ -283,7 +283,7 @@ F test/exclusive2.test d13bf66753dca46e61241d35d36ab7c868b0d313
|
||||
F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
|
||||
F test/expr.test a47d304a90c75def083cce3b1cd6c282842e6bbe
|
||||
F test/filectrl.test 524853082d5d7fb442599730ec3a0f3f84a3a936
|
||||
F test/filefmt.test 053b622009fbbb74dd37921ffad374d852c13cd8
|
||||
F test/filefmt.test f0e14d428fe33c5199de59a7b640041bd4fc6082
|
||||
F test/fkey1.test dcb4f28eb22d5141f15161d6bdca9a4f58c95729
|
||||
F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
|
||||
F test/fts1a.test 46090311f85da51bb33bd5ce84f7948359c6d8d7
|
||||
@@ -368,7 +368,7 @@ F test/insert4.test 6e382eaf7295a4463e6f29ea20fcd8e63d097eeb
|
||||
F test/insert5.test 1f93cbe9742110119133d7e8e3ccfe6d7c249766
|
||||
F test/interrupt.test 42e7cf98646fd9cb4a3b131a93ed3c50b9e149f1
|
||||
F test/intpkey.test 537669fd535f62632ca64828e435b9e54e8d677f
|
||||
F test/io.test 23c52939ebf90f00d9cbd819ced6daa9f21445fa
|
||||
F test/io.test fb8b310ff1bb9bedf2b66f7e8c01b48cf980b28f
|
||||
F test/ioerr.test b42f249c9181b5864e53fdae38ef75475d71c66f
|
||||
F test/ioerr2.test 5598405c48842c6c0187daad9eb49eff2c54f80d
|
||||
F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
|
||||
@@ -445,7 +445,7 @@ F test/permutations.test 4ad59e4489255b025aac0cc661789d35a83d87ec
|
||||
F test/pragma.test 2c675ed9a288094ed62bf55b35fbc749e25670fb
|
||||
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
|
||||
F test/printf.test 262a5acd3158f788e9bdf7f18d718f3af32ff6ef
|
||||
F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 x
|
||||
F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301
|
||||
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
|
||||
F test/quick.test 3dba257b9d4e06e1b0199bc1401052f554ab5f14
|
||||
F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6
|
||||
@@ -568,7 +568,7 @@ F test/utf16align.test 7360e84472095518c56746f76b1f9d4dce99fb4d
|
||||
F test/vacuum.test 0bc75ee74ab9c69322d6563aa2287375697e630b
|
||||
F test/vacuum2.test d3b9691541fe6ed5c711f547a1c7d70e9760ac6f
|
||||
F test/vacuum3.test 306b65554980d8d4a3b6eeb7b3ccd11c65ebb540
|
||||
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
|
||||
F test/varint.test bbce22cda8fc4d135bcc2b589574be8410614e62
|
||||
F test/veryquick.test e265401afefa994cdf2fe4b6f286b1e87c2f9b9d
|
||||
F test/view.test 5799906511d6c77cfe3516d3d1189224350ef732
|
||||
F test/vtab1.test e321e3c80434fe8de97fa4ad815882d2c7838d21
|
||||
@@ -601,7 +601,7 @@ F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133
|
||||
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
|
||||
F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
|
||||
F tool/mkkeywordhash.c ef93810fc41fb3d3dbacf9a33a29be88ea99ffa9
|
||||
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
|
||||
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
|
||||
F tool/mksqlite3c.tcl bc5a951735e78eb37cd47f539b2400318c436872
|
||||
F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87
|
||||
F tool/omittest.tcl 5a25ea687df5da8dd9b94bf1683f5cf2c210e51d
|
||||
@@ -617,7 +617,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
P 01fb8a0d2ca1d7ac31316cef1675dc9852265db6
|
||||
R f1679cb1675cee37fa12d4fa26f13c35
|
||||
P df3436405e423436f75ead99c8ec70494c32ccca
|
||||
R 3fa15598d551e87da4b14a0afdfbde4b
|
||||
U drh
|
||||
Z 56e89e221c5215782fe30888ef49647e
|
||||
Z 22d55452306cbf44a4a74b182bcaa66c
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
65ab777fd0a29ca99a240411b94ac83041f90c98
|
||||
2f5b37122b720505707814d08471e3ac3bdf3cb5
|
||||
+2
-2
@@ -46,7 +46,7 @@ static void renameTableFunc(
|
||||
unsigned char const *zTableName = sqlite3_value_text(argv[1]);
|
||||
|
||||
int token;
|
||||
Token tname;
|
||||
Token tname = {0,0,0}; /* Initialized to placate warning */
|
||||
unsigned char const *zCsr = zSql;
|
||||
int len = 0;
|
||||
char *zRet;
|
||||
@@ -101,7 +101,7 @@ static void renameTriggerFunc(
|
||||
unsigned char const *zTableName = sqlite3_value_text(argv[1]);
|
||||
|
||||
int token;
|
||||
Token tname;
|
||||
Token tname = {0,0,0}; /* Initialized to placate warning */
|
||||
int dist = 3;
|
||||
unsigned char const *zCsr = zSql;
|
||||
int len = 0;
|
||||
|
||||
+4
-1
@@ -144,8 +144,11 @@ static void attachFunc(
|
||||
sqlite3PagerLockingMode(pPager, db->dfltLockMode);
|
||||
sqlite3PagerJournalMode(pPager, db->dfltJournalMode);
|
||||
}
|
||||
aNew->zName = sqlite3DbStrDup(db, zName);
|
||||
aNew->safety_level = 3;
|
||||
aNew->zName = sqlite3DbStrDup(db, zName);
|
||||
if( rc==SQLITE_OK && aNew->zName==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
#if SQLITE_HAS_CODEC
|
||||
{
|
||||
|
||||
+1
-1
@@ -3021,7 +3021,7 @@ static int getOverflowPage(
|
||||
Pgno *pPgnoNext /* OUT: Next overflow page number */
|
||||
){
|
||||
Pgno next = 0;
|
||||
int rc;
|
||||
int rc = SQLITE_OK; /* Initialized to placate warning */
|
||||
|
||||
assert( sqlite3_mutex_held(pBt->mutex) );
|
||||
/* One of these must not be NULL. Otherwise, why call this function? */
|
||||
|
||||
+2
-1
@@ -2754,7 +2754,8 @@ void sqlite3CreateIndex(
|
||||
/* Clean up before exiting */
|
||||
exit_create_index:
|
||||
if( pIndex ){
|
||||
freeIndex(pIndex);
|
||||
sqlite3_free(pIndex->zColAff);
|
||||
sqlite3DbFree(db, pIndex);
|
||||
}
|
||||
sqlite3ExprListDelete(db, pList);
|
||||
sqlite3SrcListDelete(db, pTblName);
|
||||
|
||||
+74
-60
@@ -53,23 +53,6 @@
|
||||
|
||||
#ifndef SQLITE_OMIT_DATETIME_FUNCS
|
||||
|
||||
/*
|
||||
** On recent Windows platforms, the localtime_s() function is available
|
||||
** as part of the "Secure CRT". It is essentially equivalent to
|
||||
** localtime_r() available under most POSIX platforms, except that the
|
||||
** order of the parameters is reversed.
|
||||
**
|
||||
** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
|
||||
**
|
||||
** If the user has not indicated to use localtime_r() or localtime_s()
|
||||
** already, check for an MSVC build environment that provides
|
||||
** localtime_s().
|
||||
*/
|
||||
#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
|
||||
defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
|
||||
#define HAVE_LOCALTIME_S 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
** A structure for holding a single date and time.
|
||||
*/
|
||||
@@ -423,15 +406,67 @@ static void clearYMD_HMS_TZ(DateTime *p){
|
||||
p->validTZ = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** On recent Windows platforms, the localtime_s() function is available
|
||||
** as part of the "Secure CRT". It is essentially equivalent to
|
||||
** localtime_r() available under most POSIX platforms, except that the
|
||||
** order of the parameters is reversed.
|
||||
**
|
||||
** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
|
||||
**
|
||||
** If the user has not indicated to use localtime_r() or localtime_s()
|
||||
** already, check for an MSVC build environment that provides
|
||||
** localtime_s().
|
||||
*/
|
||||
#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
|
||||
defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
|
||||
#define HAVE_LOCALTIME_S 1
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_OMIT_LOCALTIME
|
||||
/*
|
||||
** The following routine implements the rough equivalent of localtime_r()
|
||||
** using whatever operating-system specific localtime facility that
|
||||
** is available. This routine returns 0 on success and
|
||||
** non-zero on any kind of error.
|
||||
*/
|
||||
int osLocaltime(time_t *t, struct tm *pTm){
|
||||
int rc;
|
||||
#if (!defined(HAVE_LOCALTIME_R) || !HAVE_LOCALTIME_R) \
|
||||
&& (!defined(HAVE_LOCALTIME_S) || !HAVE_LOCALTIME_S)
|
||||
struct tm *pX;
|
||||
sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
|
||||
sqlite3_mutex_enter(mutex);
|
||||
pX = localtime(t);
|
||||
if( pX ) *pTm = *pX;
|
||||
sqlite3_mutex_leave(mutex);
|
||||
rc = pX==0;
|
||||
#else
|
||||
#if defined(HAVE_LOCALTIME_R) && HAVE_LOCALTIME_R
|
||||
rc = localtime_r(t, pTm)==0;
|
||||
#else
|
||||
rc = localtime_s(pTm, t);
|
||||
#endif /* HAVE_LOCALTIME_R */
|
||||
#endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */
|
||||
return rc;
|
||||
}
|
||||
#endif /* SQLITE_OMIT_LOCALTIME */
|
||||
|
||||
#ifndef SQLITE_OMIT_LOCALTIME
|
||||
/*
|
||||
** Compute the difference (in milliseconds)
|
||||
** between localtime and UTC (a.k.a. GMT)
|
||||
** for the time value p where p is in UTC.
|
||||
*/
|
||||
static int localtimeOffset(DateTime *p){
|
||||
static sqlite3_int64 localtimeOffset(
|
||||
DateTime *p, /* Date at which to calculate offset */
|
||||
sqlite3_context *pCtx, /* Write error here if one occurs */
|
||||
int *pRc /* OUT: Error code. SQLITE_OK or ERROR */
|
||||
){
|
||||
DateTime x, y;
|
||||
time_t t;
|
||||
struct tm sLocal;
|
||||
|
||||
x = *p;
|
||||
computeYMD_HMS(&x);
|
||||
if( x.Y<1971 || x.Y>=2038 ){
|
||||
@@ -449,42 +484,17 @@ static int localtimeOffset(DateTime *p){
|
||||
x.validJD = 0;
|
||||
computeJD(&x);
|
||||
t = x.iJD/1000 - 2440587.5*86400.0;
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
{
|
||||
struct tm sLocal;
|
||||
localtime_r(&t, &sLocal);
|
||||
y.Y = sLocal.tm_year + 1900;
|
||||
y.M = sLocal.tm_mon + 1;
|
||||
y.D = sLocal.tm_mday;
|
||||
y.h = sLocal.tm_hour;
|
||||
y.m = sLocal.tm_min;
|
||||
y.s = sLocal.tm_sec;
|
||||
if( osLocaltime(&t, &sLocal) ){
|
||||
sqlite3_result_error(pCtx, "local time unavailable", -1);
|
||||
*pRc = SQLITE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
#elif defined(HAVE_LOCALTIME_S)
|
||||
{
|
||||
struct tm sLocal;
|
||||
localtime_s(&sLocal, &t);
|
||||
y.Y = sLocal.tm_year + 1900;
|
||||
y.M = sLocal.tm_mon + 1;
|
||||
y.D = sLocal.tm_mday;
|
||||
y.h = sLocal.tm_hour;
|
||||
y.m = sLocal.tm_min;
|
||||
y.s = sLocal.tm_sec;
|
||||
}
|
||||
#else
|
||||
{
|
||||
struct tm *pTm;
|
||||
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
|
||||
pTm = localtime(&t);
|
||||
y.Y = pTm->tm_year + 1900;
|
||||
y.M = pTm->tm_mon + 1;
|
||||
y.D = pTm->tm_mday;
|
||||
y.h = pTm->tm_hour;
|
||||
y.m = pTm->tm_min;
|
||||
y.s = pTm->tm_sec;
|
||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
|
||||
}
|
||||
#endif
|
||||
y.Y = sLocal.tm_year + 1900;
|
||||
y.M = sLocal.tm_mon + 1;
|
||||
y.D = sLocal.tm_mday;
|
||||
y.h = sLocal.tm_hour;
|
||||
y.m = sLocal.tm_min;
|
||||
y.s = sLocal.tm_sec;
|
||||
y.validYMD = 1;
|
||||
y.validHMS = 1;
|
||||
y.validJD = 0;
|
||||
@@ -515,7 +525,7 @@ static int localtimeOffset(DateTime *p){
|
||||
**
|
||||
** Return 0 on success and 1 if there is any kind of error.
|
||||
*/
|
||||
static int parseModifier(const char *zMod, DateTime *p){
|
||||
static int parseModifier(sqlite3_context *pCtx, const char *zMod, DateTime *p){
|
||||
int rc = 1;
|
||||
int n;
|
||||
double r;
|
||||
@@ -535,9 +545,8 @@ static int parseModifier(const char *zMod, DateTime *p){
|
||||
*/
|
||||
if( strcmp(z, "localtime")==0 ){
|
||||
computeJD(p);
|
||||
p->iJD += localtimeOffset(p);
|
||||
p->iJD += localtimeOffset(p, pCtx, &rc);
|
||||
clearYMD_HMS_TZ(p);
|
||||
rc = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -558,11 +567,15 @@ static int parseModifier(const char *zMod, DateTime *p){
|
||||
else if( strcmp(z, "utc")==0 ){
|
||||
double c1;
|
||||
computeJD(p);
|
||||
c1 = localtimeOffset(p);
|
||||
c1 = localtimeOffset(p, pCtx, &rc);
|
||||
p->iJD -= c1;
|
||||
clearYMD_HMS_TZ(p);
|
||||
p->iJD += c1 - localtimeOffset(p);
|
||||
rc = 0;
|
||||
c1 = localtimeOffset(p, pCtx, &rc);
|
||||
if( rc==SQLITE_OK ){
|
||||
p->iJD -= c1;
|
||||
clearYMD_HMS_TZ(p);
|
||||
p->iJD += c1 - localtimeOffset(p, pCtx, &rc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@@ -733,7 +746,8 @@ static int isDate(
|
||||
}
|
||||
}
|
||||
for(i=1; i<argc; i++){
|
||||
if( (z = sqlite3_value_text(argv[i]))==0 || parseModifier((char*)z, p) ){
|
||||
z = sqlite3_value_text(argv[i]);
|
||||
if( z==0 || parseModifier(context, (char*)z, p) ){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -143,10 +143,10 @@ void sqlite3DeleteFrom(
|
||||
int isView; /* True if attempting to delete from a view */
|
||||
int triggers_exist = 0; /* True if any triggers exist */
|
||||
#endif
|
||||
int iBeginAfterTrigger; /* Address of after trigger program */
|
||||
int iEndAfterTrigger; /* Exit of after trigger program */
|
||||
int iBeginBeforeTrigger; /* Address of before trigger program */
|
||||
int iEndBeforeTrigger; /* Exit of before trigger program */
|
||||
int iBeginAfterTrigger = 0; /* Address of after trigger program */
|
||||
int iEndAfterTrigger = 0; /* Exit of after trigger program */
|
||||
int iBeginBeforeTrigger = 0; /* Address of before trigger program */
|
||||
int iEndBeforeTrigger = 0; /* Exit of before trigger program */
|
||||
u32 old_col_mask = 0; /* Mask of OLD.* columns in use */
|
||||
|
||||
sContext.pParse = 0;
|
||||
|
||||
+1
-1
@@ -2737,7 +2737,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
|
||||
Expr opCompare; /* The X==Ei expression */
|
||||
Expr cacheX; /* Cached expression X */
|
||||
Expr *pX; /* The X expression */
|
||||
Expr *pTest; /* X==Ei (form A) or just Ei (form B) */
|
||||
Expr *pTest = 0; /* X==Ei (form A) or just Ei (form B) */
|
||||
|
||||
assert(pExpr->pList);
|
||||
assert((pExpr->pList->nExpr % 2) == 0);
|
||||
|
||||
+2
-2
@@ -911,7 +911,7 @@ static void trimFunc(
|
||||
flags = SQLITE_PTR_TO_INT(sqlite3_user_data(context));
|
||||
if( flags & 1 ){
|
||||
while( nIn>0 ){
|
||||
int len;
|
||||
int len = 0; /* Initialized to placate warning. */
|
||||
for(i=0; i<nChar; i++){
|
||||
len = aLen[i];
|
||||
if( memcmp(zIn, azChar[i], len)==0 ) break;
|
||||
@@ -923,7 +923,7 @@ static void trimFunc(
|
||||
}
|
||||
if( flags & 2 ){
|
||||
while( nIn>0 ){
|
||||
int len;
|
||||
int len = 0; /* Initialized to placate warning. */
|
||||
for(i=0; i<nChar; i++){
|
||||
len = aLen[i];
|
||||
if( len<=nIn && memcmp(&zIn[nIn-len],azChar[i],len)==0 ) break;
|
||||
|
||||
+4
-3
@@ -388,14 +388,14 @@ void sqlite3Insert(
|
||||
int appendFlag = 0; /* True if the insert is likely to be an append */
|
||||
|
||||
/* Register allocations */
|
||||
int regFromSelect; /* Base register for data coming from SELECT */
|
||||
int regFromSelect = 0;/* Base register for data coming from SELECT */
|
||||
int regAutoinc = 0; /* Register holding the AUTOINCREMENT counter */
|
||||
int regRowCount = 0; /* Memory cell used for the row counter */
|
||||
int regIns; /* Block of regs holding rowid+data being inserted */
|
||||
int regRowid; /* registers holding insert rowid */
|
||||
int regData; /* register holding first column to insert */
|
||||
int regRecord; /* Holds the assemblied row record */
|
||||
int regEof; /* Register recording end of SELECT data */
|
||||
int regEof = 0; /* Register recording end of SELECT data */
|
||||
int *aRegIdx = 0; /* One register allocated to each index */
|
||||
|
||||
|
||||
@@ -1095,7 +1095,8 @@ void sqlite3GenerateConstraintChecks(
|
||||
Vdbe *v;
|
||||
int nCol;
|
||||
int onError;
|
||||
int j1, j2, j3; /* Addresses of jump instructions */
|
||||
int j1, j3; /* Addresses of jump instructions */
|
||||
int j2 = 0; /* Initialized to placate warning */
|
||||
int regData; /* Register containing first data column */
|
||||
int iCur;
|
||||
Index *pIdx;
|
||||
|
||||
+11
-18
@@ -1131,31 +1131,24 @@ const char *sqlite3_errmsg(sqlite3 *db){
|
||||
** error.
|
||||
*/
|
||||
const void *sqlite3_errmsg16(sqlite3 *db){
|
||||
/* Because all the characters in the string are in the unicode
|
||||
** range 0x00-0xFF, if we pad the big-endian string with a
|
||||
** zero byte, we can obtain the little-endian string with
|
||||
** &big_endian[1].
|
||||
*/
|
||||
static const char outOfMemBe[] = {
|
||||
0, 'o', 0, 'u', 0, 't', 0, ' ',
|
||||
0, 'o', 0, 'f', 0, ' ',
|
||||
0, 'm', 0, 'e', 0, 'm', 0, 'o', 0, 'r', 0, 'y', 0, 0, 0
|
||||
static const u16 outOfMem[] = {
|
||||
'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
|
||||
};
|
||||
static const char misuseBe [] = {
|
||||
0, 'l', 0, 'i', 0, 'b', 0, 'r', 0, 'a', 0, 'r', 0, 'y', 0, ' ',
|
||||
0, 'r', 0, 'o', 0, 'u', 0, 't', 0, 'i', 0, 'n', 0, 'e', 0, ' ',
|
||||
0, 'c', 0, 'a', 0, 'l', 0, 'l', 0, 'e', 0, 'd', 0, ' ',
|
||||
0, 'o', 0, 'u', 0, 't', 0, ' ',
|
||||
0, 'o', 0, 'f', 0, ' ',
|
||||
0, 's', 0, 'e', 0, 'q', 0, 'u', 0, 'e', 0, 'n', 0, 'c', 0, 'e', 0, 0, 0
|
||||
static const u16 misuse[] = {
|
||||
'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ',
|
||||
'r', 'o', 'u', 't', 'i', 'n', 'e', ' ',
|
||||
'c', 'a', 'l', 'l', 'e', 'd', ' ',
|
||||
'o', 'u', 't', ' ',
|
||||
'o', 'f', ' ',
|
||||
's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0
|
||||
};
|
||||
|
||||
const void *z;
|
||||
if( !db ){
|
||||
return (void *)(&outOfMemBe[SQLITE_UTF16NATIVE==SQLITE_UTF16LE?1:0]);
|
||||
return (void *)outOfMem;
|
||||
}
|
||||
if( !sqlite3SafetyCheckSickOrOk(db) ){
|
||||
return (void *)(&misuseBe[SQLITE_UTF16NATIVE==SQLITE_UTF16LE?1:0]);
|
||||
return (void *)misuse;
|
||||
}
|
||||
sqlite3_mutex_enter(db->mutex);
|
||||
assert( !db->mallocFailed );
|
||||
|
||||
@@ -2055,6 +2055,12 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
|
||||
*(int*)pArg = ((unixFile*)id)->locktype;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
case SQLITE_FCNTL_SIZE_HINT: {
|
||||
sqlite3_int64 szFile = *(sqlite3_int64*)pArg;
|
||||
unixFile *pFile = (unixFile*)id;
|
||||
ftruncate(pFile->h, szFile);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
}
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
|
||||
+17
-9
@@ -3062,15 +3062,23 @@ static int pager_write_pagelist(PgHdr *pList){
|
||||
assert( p->dirty );
|
||||
p->dirty = 0;
|
||||
}
|
||||
|
||||
/* If the file has not yet been opened, open it now. */
|
||||
if( !pPager->fd->pMethods ){
|
||||
assert(pPager->tempFile);
|
||||
rc = sqlite3PagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);
|
||||
if( rc ) return rc;
|
||||
}
|
||||
|
||||
/* Before the first write, give the VFS a hint of what the final
|
||||
** file size will be.
|
||||
*/
|
||||
if( pPager->dbSize > (pPager->origDbSize+1) ){
|
||||
sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize;
|
||||
sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile);
|
||||
}
|
||||
|
||||
while( pList ){
|
||||
|
||||
/* If the file has not yet been opened, open it now. */
|
||||
if( !pPager->fd->pMethods ){
|
||||
assert(pPager->tempFile);
|
||||
rc = sqlite3PagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);
|
||||
if( rc ) return rc;
|
||||
}
|
||||
|
||||
/* If there are dirty pages in the page cache with page numbers greater
|
||||
** than Pager.dbSize, this means sqlite3PagerTruncate() was called to
|
||||
** make the file smaller (presumably by auto-vacuum code). Do not write
|
||||
@@ -3655,7 +3663,7 @@ static int pagerAllocatePage(Pager *pPager, PgHdr **ppPg){
|
||||
|| MEMDB
|
||||
|| (pPager->lru.pFirstSynced==0 && pPager->doNotSync)
|
||||
){
|
||||
void *pData;
|
||||
void *pData = 0; /* Initialized to placate warning */
|
||||
if( pPager->nPage>=pPager->nHash ){
|
||||
pager_resize_hash_table(pPager,
|
||||
pPager->nHash<256 ? 256 : pPager->nHash*2);
|
||||
|
||||
+1
-1
@@ -247,7 +247,7 @@ void sqlite3VXPrintf(
|
||||
char buf[etBUFSIZE]; /* Conversion buffer */
|
||||
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
|
||||
etByte errorflag = 0; /* True if an error is encountered */
|
||||
etByte xtype; /* Conversion paradigm */
|
||||
etByte xtype = 0; /* Conversion paradigm */
|
||||
char *zExtra; /* Extra memory used for etTCLESCAPE conversions */
|
||||
#ifndef SQLITE_OMIT_FLOATING_POINT
|
||||
int exp, e2; /* exponent of real numbers */
|
||||
|
||||
+2
-2
@@ -2467,7 +2467,7 @@ static int multiSelectOrderBy(
|
||||
int regOutA; /* Address register for the output-A subroutine */
|
||||
int regOutB; /* Address register for the output-B subroutine */
|
||||
int addrOutA; /* Address of the output-A subroutine */
|
||||
int addrOutB; /* Address of the output-B subroutine */
|
||||
int addrOutB = 0; /* Address of the output-B subroutine */
|
||||
int addrEofA; /* Address of the select-A-exhausted subroutine */
|
||||
int addrEofB; /* Address of the select-B-exhausted subroutine */
|
||||
int addrAltB; /* Address of the A<B subroutine */
|
||||
@@ -2482,7 +2482,7 @@ static int multiSelectOrderBy(
|
||||
int labelEnd; /* Label for the end of the overall SELECT stmt */
|
||||
int j1; /* Jump instructions that get retargetted */
|
||||
int op; /* One of TK_ALL, TK_UNION, TK_EXCEPT, TK_INTERSECT */
|
||||
KeyInfo *pKeyDup; /* Comparison information for duplicate removal */
|
||||
KeyInfo *pKeyDup = 0; /* Comparison information for duplicate removal */
|
||||
KeyInfo *pKeyMerge; /* Comparison information for merging rows */
|
||||
sqlite3 *db; /* Database connection */
|
||||
ExprList *pOrderBy; /* The ORDER BY clause */
|
||||
|
||||
@@ -698,8 +698,16 @@ struct sqlite3_io_methods {
|
||||
** into an integer that the pArg argument points to. This capability
|
||||
** is used during testing and only needs to be supported when SQLITE_TEST
|
||||
** is defined.
|
||||
**
|
||||
** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
|
||||
** layer a hint of how large the database file will grow to be during the
|
||||
** current transaction. This hint is not guaranteed to be accurate but it
|
||||
** is often close. The underlying VFS might choose to preallocate database
|
||||
** file space based on this hint in order to help writes to the database
|
||||
** file run faster.
|
||||
*/
|
||||
#define SQLITE_FCNTL_LOCKSTATE 1
|
||||
#define SQLITE_FCNTL_SIZE_HINT 2
|
||||
|
||||
/*
|
||||
** CAPI3REF: Mutex Handle {H17110} <S20130>
|
||||
|
||||
+4
-4
@@ -109,10 +109,10 @@ void sqlite3Update(
|
||||
int isView; /* Trying to update a view */
|
||||
int triggers_exist = 0; /* True if any row triggers exist */
|
||||
#endif
|
||||
int iBeginAfterTrigger; /* Address of after trigger program */
|
||||
int iEndAfterTrigger; /* Exit of after trigger program */
|
||||
int iBeginBeforeTrigger; /* Address of before trigger program */
|
||||
int iEndBeforeTrigger; /* Exit of before trigger program */
|
||||
int iBeginAfterTrigger = 0; /* Address of after trigger program */
|
||||
int iEndAfterTrigger = 0; /* Exit of after trigger program */
|
||||
int iBeginBeforeTrigger = 0; /* Address of before trigger program */
|
||||
int iEndBeforeTrigger = 0; /* Exit of before trigger program */
|
||||
u32 old_col_mask = 0; /* Mask of OLD.* columns in use */
|
||||
u32 new_col_mask = 0; /* Mask of NEW.* columns in use */
|
||||
|
||||
|
||||
+29
-12
@@ -545,6 +545,19 @@ int sqlite3PutVarint32(unsigned char *p, u32 v){
|
||||
return sqlite3PutVarint(p, v);
|
||||
}
|
||||
|
||||
/*
|
||||
** Bitmasks used by sqlite3GetVarint(). These precomputed constants
|
||||
** are defined here rather than simply putting the constant expressions
|
||||
** inline in order to work around bugs in the RVT compiler.
|
||||
**
|
||||
** SLOT_2_0 A mask for (0x7f<<14) | 0x7f
|
||||
**
|
||||
** SLOT_4_2_0 A mask for (0x7f<<28) | SLOT_2_0
|
||||
*/
|
||||
#define SLOT_2_0 0x001fc07f
|
||||
#define SLOT_4_2_0 0xf01fc07f
|
||||
|
||||
|
||||
/*
|
||||
** Read a 64-bit variable-length integer from memory starting at p[0].
|
||||
** Return the number of bytes read. The value is stored in *v.
|
||||
@@ -572,13 +585,17 @@ int sqlite3GetVarint(const unsigned char *p, u64 *v){
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Verify that constants are precomputed correctly */
|
||||
assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
|
||||
assert( SLOT_4_2_0 == ((0xf<<28) | (0x7f<<14) | (0x7f)) );
|
||||
|
||||
p++;
|
||||
a = a<<14;
|
||||
a |= *p;
|
||||
/* a: p0<<14 | p2 (unmasked) */
|
||||
if (!(a&0x80))
|
||||
{
|
||||
a &= (0x7f<<14)|(0x7f);
|
||||
a &= SLOT_2_0;
|
||||
b &= 0x7f;
|
||||
b = b<<7;
|
||||
a |= b;
|
||||
@@ -587,14 +604,14 @@ int sqlite3GetVarint(const unsigned char *p, u64 *v){
|
||||
}
|
||||
|
||||
/* CSE1 from below */
|
||||
a &= (0x7f<<14)|(0x7f);
|
||||
a &= SLOT_2_0;
|
||||
p++;
|
||||
b = b<<14;
|
||||
b |= *p;
|
||||
/* b: p1<<14 | p3 (unmasked) */
|
||||
if (!(b&0x80))
|
||||
{
|
||||
b &= (0x7f<<14)|(0x7f);
|
||||
b &= SLOT_2_0;
|
||||
/* moved CSE1 up */
|
||||
/* a &= (0x7f<<14)|(0x7f); */
|
||||
a = a<<7;
|
||||
@@ -608,7 +625,7 @@ int sqlite3GetVarint(const unsigned char *p, u64 *v){
|
||||
/* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
|
||||
/* moved CSE1 up */
|
||||
/* a &= (0x7f<<14)|(0x7f); */
|
||||
b &= (0x7f<<14)|(0x7f);
|
||||
b &= SLOT_2_0;
|
||||
s = a;
|
||||
/* s: p0<<14 | p2 (masked) */
|
||||
|
||||
@@ -641,7 +658,7 @@ int sqlite3GetVarint(const unsigned char *p, u64 *v){
|
||||
{
|
||||
/* we can skip this cause it was (effectively) done above in calc'ing s */
|
||||
/* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
|
||||
a &= (0x7f<<14)|(0x7f);
|
||||
a &= SLOT_2_0;
|
||||
a = a<<7;
|
||||
a |= b;
|
||||
s = s>>18;
|
||||
@@ -655,8 +672,8 @@ int sqlite3GetVarint(const unsigned char *p, u64 *v){
|
||||
/* a: p2<<28 | p4<<14 | p6 (unmasked) */
|
||||
if (!(a&0x80))
|
||||
{
|
||||
a &= (0x7f<<28)|(0x7f<<14)|(0x7f);
|
||||
b &= (0x7f<<14)|(0x7f);
|
||||
a &= SLOT_4_2_0;
|
||||
b &= SLOT_2_0;
|
||||
b = b<<7;
|
||||
a |= b;
|
||||
s = s>>11;
|
||||
@@ -665,14 +682,14 @@ int sqlite3GetVarint(const unsigned char *p, u64 *v){
|
||||
}
|
||||
|
||||
/* CSE2 from below */
|
||||
a &= (0x7f<<14)|(0x7f);
|
||||
a &= SLOT_2_0;
|
||||
p++;
|
||||
b = b<<14;
|
||||
b |= *p;
|
||||
/* b: p3<<28 | p5<<14 | p7 (unmasked) */
|
||||
if (!(b&0x80))
|
||||
{
|
||||
b &= (0x7f<<28)|(0x7f<<14)|(0x7f);
|
||||
b &= SLOT_4_2_0;
|
||||
/* moved CSE2 up */
|
||||
/* a &= (0x7f<<14)|(0x7f); */
|
||||
a = a<<7;
|
||||
@@ -689,7 +706,7 @@ int sqlite3GetVarint(const unsigned char *p, u64 *v){
|
||||
|
||||
/* moved CSE2 up */
|
||||
/* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */
|
||||
b &= (0x7f<<14)|(0x7f);
|
||||
b &= SLOT_2_0;
|
||||
b = b<<8;
|
||||
a |= b;
|
||||
|
||||
@@ -767,8 +784,8 @@ int sqlite3GetVarint32(const unsigned char *p, u32 *v){
|
||||
/* a: p0<<28 | p2<<14 | p4 (unmasked) */
|
||||
if (!(a&0x80))
|
||||
{
|
||||
a &= (0x7f<<28)|(0x7f<<14)|(0x7f);
|
||||
b &= (0x7f<<28)|(0x7f<<14)|(0x7f);
|
||||
a &= SLOT_4_2_0;
|
||||
b &= SLOT_4_2_0;
|
||||
b = b<<7;
|
||||
*v = a | b;
|
||||
return 5;
|
||||
|
||||
+5
-3
@@ -543,8 +543,10 @@ int sqlite3VdbeExec(
|
||||
int rc = SQLITE_OK; /* Value to return */
|
||||
sqlite3 *db = p->db; /* The database */
|
||||
u8 encoding = ENC(db); /* The database encoding */
|
||||
Mem *pIn1, *pIn2, *pIn3; /* Input operands */
|
||||
Mem *pOut; /* Output operand */
|
||||
Mem *pIn1 = 0; /* Input operands */
|
||||
Mem *pIn2 = 0; /* Input operands */
|
||||
Mem *pIn3 = 0; /* Input operands */
|
||||
Mem *pOut = 0; /* Output operand */
|
||||
u8 opProperty;
|
||||
int iCompare = 0; /* Result of last OP_Compare operation */
|
||||
int *aPermute = 0; /* Permuation of columns for OP_Compare */
|
||||
@@ -3532,7 +3534,7 @@ case OP_Insert: {
|
||||
*/
|
||||
case OP_Delete: {
|
||||
int i = pOp->p1;
|
||||
i64 iKey;
|
||||
i64 iKey = 0;
|
||||
Cursor *pC;
|
||||
|
||||
assert( i>=0 && i<p->nCursor );
|
||||
|
||||
+1
-1
@@ -744,7 +744,7 @@ static Mem *columnMem(sqlite3_stmt *pStmt, int i){
|
||||
pOut = &pVm->pResultSet[i];
|
||||
}else{
|
||||
static const Mem nullMem = {{0}, 0.0, 0, "", 0, MEM_Null, SQLITE_NULL, 0, 0, 0 };
|
||||
if( pVm->db ){
|
||||
if( pVm && pVm->db ){
|
||||
sqlite3_mutex_enter(pVm->db->mutex);
|
||||
sqlite3Error(pVm->db, SQLITE_RANGE, 0);
|
||||
}
|
||||
|
||||
+13
-14
@@ -15,7 +15,7 @@
|
||||
** only within the VDBE. Interface routines refer to a Mem using the
|
||||
** name sqlite_value
|
||||
**
|
||||
** $Id: vdbemem.c,v 1.121 2008/08/01 20:10:09 drh Exp $
|
||||
** $Id: vdbemem.c,v 1.123 2008/09/16 12:06:08 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -739,22 +739,21 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
|
||||
** comparison function directly */
|
||||
return pColl->xCmp(pColl->pUser,pMem1->n,pMem1->z,pMem2->n,pMem2->z);
|
||||
}else{
|
||||
u8 origEnc = pMem1->enc;
|
||||
const void *v1, *v2;
|
||||
int n1, n2;
|
||||
/* Convert the strings into the encoding that the comparison
|
||||
** function expects */
|
||||
v1 = sqlite3ValueText((sqlite3_value*)pMem1, pColl->enc);
|
||||
n1 = v1==0 ? 0 : pMem1->n;
|
||||
assert( n1==sqlite3ValueBytes((sqlite3_value*)pMem1, pColl->enc) );
|
||||
v2 = sqlite3ValueText((sqlite3_value*)pMem2, pColl->enc);
|
||||
n2 = v2==0 ? 0 : pMem2->n;
|
||||
assert( n2==sqlite3ValueBytes((sqlite3_value*)pMem2, pColl->enc) );
|
||||
/* Do the comparison */
|
||||
Mem c1;
|
||||
Mem c2;
|
||||
memset(&c1, 0, sizeof(c1));
|
||||
memset(&c2, 0, sizeof(c2));
|
||||
sqlite3VdbeMemShallowCopy(&c1, pMem1, MEM_Ephem);
|
||||
sqlite3VdbeMemShallowCopy(&c2, pMem2, MEM_Ephem);
|
||||
v1 = sqlite3ValueText((sqlite3_value*)&c1, pColl->enc);
|
||||
n1 = v1==0 ? 0 : c1.n;
|
||||
v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc);
|
||||
n2 = v2==0 ? 0 : c2.n;
|
||||
rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2);
|
||||
/* Convert the strings back into the database encoding */
|
||||
sqlite3ValueText((sqlite3_value*)pMem1, origEnc);
|
||||
sqlite3ValueText((sqlite3_value*)pMem2, origEnc);
|
||||
sqlite3VdbeMemRelease(&c1);
|
||||
sqlite3VdbeMemRelease(&c2);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,16 @@ do_malloc_test attachmalloc-1 -tclprep {
|
||||
CREATE TABLE four.t1(x);
|
||||
}
|
||||
|
||||
set enable_shared_cache [sqlite3_enable_shared_cache 1]
|
||||
sqlite3 dbaux test2.db
|
||||
dbaux eval {SELECT * FROM sqlite_master}
|
||||
do_malloc_test attachmalloc-2 -sqlbody {
|
||||
SELECT * FROM sqlite_master;
|
||||
ATTACH 'test2.db' AS two;
|
||||
} -cleanup {
|
||||
db eval { DETACH two }
|
||||
}
|
||||
dbaux close
|
||||
sqlite3_enable_shared_cache $enable_shared_cache
|
||||
|
||||
finish_test
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ ifcapable pager_pragmas {
|
||||
db eval "PRAGMA page_size=$pagesize"
|
||||
db eval {CREATE TABLE t1(x)}
|
||||
file size test.db
|
||||
} [expr $pagesize*2]
|
||||
} [expr {$pagesize*2<$sqlite_pending_byte ? $pagesize*2 : $pagesize*3}]
|
||||
do_test filefmt-1.5.$pagesize.2 {
|
||||
hexio_get_int [hexio_read test.db 16 2]
|
||||
} $pagesize
|
||||
|
||||
+1
-1
@@ -401,7 +401,7 @@ ifcapable pager_pragmas {
|
||||
# File has grown - showing there was a cache-spill - but there
|
||||
# have been no calls to fsync():
|
||||
list [file size test.db] [nSync]
|
||||
} {31744 0}
|
||||
} {38912 0}
|
||||
do_test io-3.3 {
|
||||
# The COMMIT requires a single fsync() - to the database file.
|
||||
execsql { COMMIT }
|
||||
|
||||
Executable → Regular
@@ -30,3 +30,5 @@ foreach start {0 100 10000 1000000 0x10000000} {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
Executable → Regular
Reference in New Issue
Block a user