mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Add a new api sqlite3_randomness() for providing access to SQLite's
internal PRNG. Add sqlite3_test_control() verbs for controlling the PRNG. (CVS 4882) FossilOrigin-Name: 15110ea02768bfe977a57eccd6b941a36ebd6b32
This commit is contained in:
48
manifest
48
manifest
@ -1,5 +1,5 @@
|
|||||||
C When\sa\sparse\sof\sthe\ssqlite_master\stable\sfails,\sinclude\sthe\sname\sof\sthe\nobject\sbeing\sparsed\sas\spart\sof\sthe\serror\smessage.\s(CVS\s4881)
|
C Add\sa\snew\sapi\ssqlite3_randomness()\sfor\sproviding\saccess\sto\sSQLite's\ninternal\sPRNG.\s\sAdd\ssqlite3_test_control()\sverbs\sfor\scontrolling\sthe\sPRNG.\s(CVS\s4882)
|
||||||
D 2008-03-19T13:03:34
|
D 2008-03-19T14:15:34
|
||||||
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
|
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
|
||||||
F Makefile.in 5be94fea84f1599672e5041de03b97990baca593
|
F Makefile.in 5be94fea84f1599672e5041de03b97990baca593
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@ -96,16 +96,16 @@ F src/date.c 187cad26eaaecd7bcdccd49d5a70c5aa3010bc74
|
|||||||
F src/delete.c fa13c296262e89c32d28949f15be275e52d7f524
|
F src/delete.c fa13c296262e89c32d28949f15be275e52d7f524
|
||||||
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
|
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
|
||||||
F src/expr.c 242f2f57a32f6909270e4a22ce1c810a150f5a17
|
F src/expr.c 242f2f57a32f6909270e4a22ce1c810a150f5a17
|
||||||
F src/fault.c 049b88b8ba0a1db3240aeaf9695cd08b9a3ba9e1
|
F src/fault.c 039abb45c9dbcbdf575ec2a23ae38db01bc2f7b2
|
||||||
F src/func.c a4f06d8a1d7e4c8c8755a59d1310141b7c090bd9
|
F src/func.c 1832b2fd1742f6a3adc0ff3c73e75274a7b52435
|
||||||
F src/hash.c 53655c312280211444bfe23af6490a460aec2980
|
F src/hash.c 53655c312280211444bfe23af6490a460aec2980
|
||||||
F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
|
F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
|
||||||
F src/insert.c 3eb3d0b739eb318c7435b9da35330e2e893e3b78
|
F src/insert.c 3eb3d0b739eb318c7435b9da35330e2e893e3b78
|
||||||
F src/journal.c 807bed7a158979ac8d63953e1774e8d85bff65e2
|
F src/journal.c 807bed7a158979ac8d63953e1774e8d85bff65e2
|
||||||
F src/legacy.c cb1939fdeb91ea88fb44fbd2768a10e14bc44650
|
F src/legacy.c cb1939fdeb91ea88fb44fbd2768a10e14bc44650
|
||||||
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
|
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
|
||||||
F src/loadext.c eceaebcff9807519ed9494056648d0d879f93ed3
|
F src/loadext.c 41bb393d74362f84d4ca751a761667187d4cff51
|
||||||
F src/main.c 39fb36d59289a4c0f425bbde57a6d3d044b2fb9a
|
F src/main.c b0c3b5f0728ccfe8ca8809baf629ad354ed6be6d
|
||||||
F src/malloc.c 60e392a4c12c839517f9b0db7b995f825444fb35
|
F src/malloc.c 60e392a4c12c839517f9b0db7b995f825444fb35
|
||||||
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
|
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
|
||||||
F src/mem1.c fc716ff521b6dd3e43eaa211967383308800e70a
|
F src/mem1.c fc716ff521b6dd3e43eaa211967383308800e70a
|
||||||
@ -121,43 +121,43 @@ F src/mutex_w32.c 6e197765f283815496193e78e9548b5d0e53b68e
|
|||||||
F src/os.c 2f2753b8d33f79d169c43d6bb0b25b3c58fd33de
|
F src/os.c 2f2753b8d33f79d169c43d6bb0b25b3c58fd33de
|
||||||
F src/os.h d04706d54a072c7a30ab9e346ad916ef28c842d5
|
F src/os.h d04706d54a072c7a30ab9e346ad916ef28c842d5
|
||||||
F src/os_common.h e8b748b2f2ecc8a498e50bfe5d8721f189c19d2a
|
F src/os_common.h e8b748b2f2ecc8a498e50bfe5d8721f189c19d2a
|
||||||
F src/os_os2.c 10b23539e0050bdfc9f136242086a5c18c70c6f8
|
F src/os_os2.c 85c443333761d5b58f041489a7b21ae918993e4f
|
||||||
F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
|
F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
|
||||||
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
|
F src/os_test.c 3074b10357ab6175caaab808c780e5e1f94a20b8
|
||||||
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
|
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
|
||||||
F src/os_unix.c 4cdd17e768888b865047805ca49beeacf0929683
|
F src/os_unix.c fdec4e5ee5dd555a6ad4a69f38ab35f0788536b4
|
||||||
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
||||||
F src/os_win.c aa3f4bbee3b8c182d25a33fbc319f486857c12c1
|
F src/os_win.c 3a60bddd07ea6f8adb2314dd5996ac97b988f403
|
||||||
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||||
F src/pager.c 2ebd895730163721d0b470aca47afbe28039c5e7
|
F src/pager.c ed2fc0ff7297001d17e299f976e9167f265ad2a6
|
||||||
F src/pager.h 8174615ffd14ccc2cad2b081b919a398fa95e3f9
|
F src/pager.h 8174615ffd14ccc2cad2b081b919a398fa95e3f9
|
||||||
F src/parse.y 00f2698c8ae84f315be5e3f10b63c94f531fdd6d
|
F src/parse.y 00f2698c8ae84f315be5e3f10b63c94f531fdd6d
|
||||||
F src/pragma.c 09128fe3e2b5108d322a66b19a6f2974dac64479
|
F src/pragma.c 09128fe3e2b5108d322a66b19a6f2974dac64479
|
||||||
F src/prepare.c 88e32e985921e9fb5d3ca22ccc74e054ebfe49f2
|
F src/prepare.c 88e32e985921e9fb5d3ca22ccc74e054ebfe49f2
|
||||||
F src/printf.c eb27822ba2eec669161409ca31279a24c26ac910
|
F src/printf.c eb27822ba2eec669161409ca31279a24c26ac910
|
||||||
F src/random.c 02ef38b469237482f1ea14a78b2087cfbaec48bd
|
F src/random.c 8b6ab5418cf0f4dde551730825d67da1457c2b3c
|
||||||
F src/select.c d0a1e01a2a6c05bd60324e843c7e4581d3605950
|
F src/select.c d0a1e01a2a6c05bd60324e843c7e4581d3605950
|
||||||
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
||||||
F src/shell.c 22297fffa6f00a6c6d44020fa13b1184a1bb372d
|
F src/shell.c 22297fffa6f00a6c6d44020fa13b1184a1bb372d
|
||||||
F src/sqlite.h.in 34368f76fb43122dffb97188c2a5166aa11ad8e5
|
F src/sqlite.h.in 7f1438fb2bef8eb1fdd4f09b4e709a39d53e6963
|
||||||
F src/sqlite3ext.h 50c70a894ffe8e6ada5948c89b91db0a80a6b2a7
|
F src/sqlite3ext.h 0d07b81ce98fb4d7d331961feeedfdb274266908
|
||||||
F src/sqliteInt.h 2726f01ca494e518542732ee57a490806f92bace
|
F src/sqliteInt.h e7596d5491f65aafe00c0f63f41aedf2a8e007a3
|
||||||
F src/sqliteLimit.h ee4430f88f69bf63527967bb35ca52af7b0ccb1e
|
F src/sqliteLimit.h ee4430f88f69bf63527967bb35ca52af7b0ccb1e
|
||||||
F src/table.c 2c48c575dd59b3a6c5c306bc55f51a9402cf429a
|
F src/table.c 2c48c575dd59b3a6c5c306bc55f51a9402cf429a
|
||||||
F src/tclsqlite.c d95e0e74c7167b2807f9f4f73bf45f7c58096297
|
F src/tclsqlite.c d95e0e74c7167b2807f9f4f73bf45f7c58096297
|
||||||
F src/test1.c c3d43a6bd299f3c115f6617af6715004819ca5cb
|
F src/test1.c 935f327fe989694a3aa07ab78ae5c00705651b34
|
||||||
F src/test2.c 443ccc1bd5717b1001e5558b6f6b33bd34f8b81b
|
F src/test2.c 443ccc1bd5717b1001e5558b6f6b33bd34f8b81b
|
||||||
F src/test3.c 5c7452038ab27aa698070799b10132f26cdd2a80
|
F src/test3.c 5c7452038ab27aa698070799b10132f26cdd2a80
|
||||||
F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
|
F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
|
||||||
F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
|
F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
|
||||||
F src/test6.c f8b34a6ff04937092327798ddf0ab46863535bc5
|
F src/test6.c 62281c0a9ac0265e579065942f7de4e080f8eb05
|
||||||
F src/test7.c acec2256c7c2d279db5a8b5fa1a2a68fcc942c67
|
F src/test7.c acec2256c7c2d279db5a8b5fa1a2a68fcc942c67
|
||||||
F src/test8.c 7933b27f8d300512546ef6bdd25f2fe64c3c13f3
|
F src/test8.c 7933b27f8d300512546ef6bdd25f2fe64c3c13f3
|
||||||
F src/test9.c 4615ef08750245a2d96aaa7cbe2fb4aff2b57acc
|
F src/test9.c 4615ef08750245a2d96aaa7cbe2fb4aff2b57acc
|
||||||
F src/test_async.c 3147c64c34721f088d5ab20f85dabd5d7732c007
|
F src/test_async.c 3147c64c34721f088d5ab20f85dabd5d7732c007
|
||||||
F src/test_autoext.c 855157d97aa28cf84233847548bfacda21807436
|
F src/test_autoext.c 855157d97aa28cf84233847548bfacda21807436
|
||||||
F src/test_btree.c c1308ba0b88ab577fa56c9e493a09829dfcded9c
|
F src/test_btree.c c1308ba0b88ab577fa56c9e493a09829dfcded9c
|
||||||
F src/test_config.c 9223ff4a7b8b97c9d12965b0123db1cbd6757efb
|
F src/test_config.c 4c1fe5184b1e9db8a4bb130889f3a2e91f07508b
|
||||||
F src/test_devsym.c cee1aecaa90c895030399ca4ae38f84a08038f8a
|
F src/test_devsym.c cee1aecaa90c895030399ca4ae38f84a08038f8a
|
||||||
F src/test_hexio.c 1a1cd8324d57585ea86b922f609fa1fbaaf9662d
|
F src/test_hexio.c 1a1cd8324d57585ea86b922f609fa1fbaaf9662d
|
||||||
F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8
|
F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8
|
||||||
@ -174,11 +174,11 @@ F src/update.c 9b3be169cd2a0b065717164aa0f90aa48f34aed1
|
|||||||
F src/utf.c 32b00d6e19010025e58f2ecb2f921d5e126771b4
|
F src/utf.c 32b00d6e19010025e58f2ecb2f921d5e126771b4
|
||||||
F src/util.c dba9e04121eb17ec4643d6ca231ff859452cf0e2
|
F src/util.c dba9e04121eb17ec4643d6ca231ff859452cf0e2
|
||||||
F src/vacuum.c 3f34f278809bf3eb0b62ec46ff779e9c385b28f0
|
F src/vacuum.c 3f34f278809bf3eb0b62ec46ff779e9c385b28f0
|
||||||
F src/vdbe.c c63fcb1c1259e59477f1312e0a868d148f23a148
|
F src/vdbe.c aaf93d6de79d2a2481a232e9a3a6b182632233d7
|
||||||
F src/vdbe.h 58a7d931ffb704e034b2a725981cfa5bd406fad9
|
F src/vdbe.h 58a7d931ffb704e034b2a725981cfa5bd406fad9
|
||||||
F src/vdbeInt.h 76c81d057a39813de0fda3cad1498655d53ec69d
|
F src/vdbeInt.h 76c81d057a39813de0fda3cad1498655d53ec69d
|
||||||
F src/vdbeapi.c cf9fc963efae3cdf5de08e2a9718b487059c7fc5
|
F src/vdbeapi.c cf9fc963efae3cdf5de08e2a9718b487059c7fc5
|
||||||
F src/vdbeaux.c 83e34e38706889a16fbd77fce3777390d425af79
|
F src/vdbeaux.c 82f3c8913e68b4928de28c3fa117464356d59df6
|
||||||
F src/vdbeblob.c 63c750acc7b5012479f508c0e9627372a82cb65d
|
F src/vdbeblob.c 63c750acc7b5012479f508c0e9627372a82cb65d
|
||||||
F src/vdbefifo.c a30c237b2a3577e1415fb6e288cbb6b8ed1e5736
|
F src/vdbefifo.c a30c237b2a3577e1415fb6e288cbb6b8ed1e5736
|
||||||
F src/vdbemem.c 2aff1e7cf3755c332819ef1e573d66a7fefd9c9a
|
F src/vdbemem.c 2aff1e7cf3755c332819ef1e573d66a7fefd9c9a
|
||||||
@ -389,7 +389,7 @@ F test/mallocD.test f78c295e8e18ea3029e65ca08278690e00c22100
|
|||||||
F test/mallocE.test db1ed69d7eded1b080952e2a7c37f364ad241b08
|
F test/mallocE.test db1ed69d7eded1b080952e2a7c37f364ad241b08
|
||||||
F test/mallocF.test 2d5c590ebc2fc7f0dcebdf5aa8498b9aed69107e
|
F test/mallocF.test 2d5c590ebc2fc7f0dcebdf5aa8498b9aed69107e
|
||||||
F test/mallocG.test b295dc03b6d8d705ce425ff4d1ce6bbeb1c5ab33
|
F test/mallocG.test b295dc03b6d8d705ce425ff4d1ce6bbeb1c5ab33
|
||||||
F test/malloc_common.tcl 5f7b853b2203bd61c9e3c504d461bc3202d13972
|
F test/malloc_common.tcl ed56c8cdb9a435c5fd1b209b3ad3c5093a8ecc10
|
||||||
F test/manydb.test 8de36b8d33aab5ef295b11d9e95310aeded31af8
|
F test/manydb.test 8de36b8d33aab5ef295b11d9e95310aeded31af8
|
||||||
F test/memdb.test a67bda4ff90a38f2b19f6c7f95aa7289e051d893
|
F test/memdb.test a67bda4ff90a38f2b19f6c7f95aa7289e051d893
|
||||||
F test/memleak.test d2d2a1ff7105d32dc3fdf691458cf6cba58c7217
|
F test/memleak.test d2d2a1ff7105d32dc3fdf691458cf6cba58c7217
|
||||||
@ -623,7 +623,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
|||||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||||
P 24e769972eb6052b82dc94d20444c186a213e104
|
P 57805b588f6b6d070918102a0ff096ade674279a
|
||||||
R 4b77bcd32296c6d86f572479659c9d8c
|
R 643303f05474f1b897ac49030799d91c
|
||||||
U drh
|
U drh
|
||||||
Z a9c107b0ba3f9820562b16ec8e95592e
|
Z a32ad7ac0402c464aaeb1823ba25215a
|
||||||
|
@ -1 +1 @@
|
|||||||
57805b588f6b6d070918102a0ff096ade674279a
|
15110ea02768bfe977a57eccd6b941a36ebd6b32
|
@ -19,7 +19,7 @@
|
|||||||
** allocation failures or I/O errors.
|
** allocation failures or I/O errors.
|
||||||
**
|
**
|
||||||
** The fault injector is omitted from the code if SQLite is
|
** The fault injector is omitted from the code if SQLite is
|
||||||
** compiled with -DSQLITE_OMIT_FAULTINJECTOR=1. There is a very
|
** compiled with -DSQLITE_OMIT_TESTLOGIC=1. There is a very
|
||||||
** small performance hit for leaving the fault injector in the code.
|
** small performance hit for leaving the fault injector in the code.
|
||||||
** Commerical products will probably want to omit the fault injector
|
** Commerical products will probably want to omit the fault injector
|
||||||
** from production builds. But safety-critical systems who work
|
** from production builds. But safety-critical systems who work
|
||||||
@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
#ifndef SQLITE_OMIT_FAULTINJECTOR
|
#ifndef SQLITE_OMIT_TESTLOGIC
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** There can be various kinds of faults. For example, there can be
|
** There can be various kinds of faults. For example, there can be
|
||||||
@ -144,4 +144,4 @@ int sqlite3FaultStep(int id){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SQLITE_OMIT_FAULTINJECTOR */
|
#endif /* SQLITE_OMIT_TESTLOGIC */
|
||||||
|
10
src/func.c
10
src/func.c
@ -16,7 +16,7 @@
|
|||||||
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||||
** All other code has file scope.
|
** All other code has file scope.
|
||||||
**
|
**
|
||||||
** $Id: func.c,v 1.186 2008/03/06 09:58:50 mlcreech Exp $
|
** $Id: func.c,v 1.187 2008/03/19 14:15:34 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -323,7 +323,7 @@ static void randomFunc(
|
|||||||
sqlite3_value **argv
|
sqlite3_value **argv
|
||||||
){
|
){
|
||||||
sqlite_int64 r;
|
sqlite_int64 r;
|
||||||
sqlite3Randomness(sizeof(r), &r);
|
sqlite3_randomness(sizeof(r), &r);
|
||||||
if( (r<<1)==0 ) r = 0; /* Prevent 0x8000.... as the result so that we */
|
if( (r<<1)==0 ) r = 0; /* Prevent 0x8000.... as the result so that we */
|
||||||
/* can always do abs() of the result */
|
/* can always do abs() of the result */
|
||||||
sqlite3_result_int64(context, r);
|
sqlite3_result_int64(context, r);
|
||||||
@ -351,7 +351,7 @@ static void randomBlob(
|
|||||||
}
|
}
|
||||||
p = contextMalloc(context, n);
|
p = contextMalloc(context, n);
|
||||||
if( p ){
|
if( p ){
|
||||||
sqlite3Randomness(n, p);
|
sqlite3_randomness(n, p);
|
||||||
sqlite3_result_blob(context, (char*)p, n, sqlite3_free);
|
sqlite3_result_blob(context, (char*)p, n, sqlite3_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1047,12 +1047,12 @@ static void randStr(sqlite3_context *context, int argc, sqlite3_value **argv){
|
|||||||
if( iMax>=sizeof(zBuf) ) iMax = sizeof(zBuf)-1;
|
if( iMax>=sizeof(zBuf) ) iMax = sizeof(zBuf)-1;
|
||||||
n = iMin;
|
n = iMin;
|
||||||
if( iMax>iMin ){
|
if( iMax>iMin ){
|
||||||
sqlite3Randomness(sizeof(r), &r);
|
sqlite3_randomness(sizeof(r), &r);
|
||||||
r &= 0x7fffffff;
|
r &= 0x7fffffff;
|
||||||
n += r%(iMax + 1 - iMin);
|
n += r%(iMax + 1 - iMin);
|
||||||
}
|
}
|
||||||
assert( n<sizeof(zBuf) );
|
assert( n<sizeof(zBuf) );
|
||||||
sqlite3Randomness(n, zBuf);
|
sqlite3_randomness(n, zBuf);
|
||||||
for(i=0; i<n; i++){
|
for(i=0; i<n; i++){
|
||||||
zBuf[i] = zSrc[zBuf[i]%(sizeof(zSrc)-1)];
|
zBuf[i] = zSrc[zBuf[i]%(sizeof(zSrc)-1)];
|
||||||
}
|
}
|
||||||
|
@ -292,6 +292,11 @@ const sqlite3_api_routines sqlite3Apis = {
|
|||||||
sqlite3_vfs_find,
|
sqlite3_vfs_find,
|
||||||
sqlite3_vfs_register,
|
sqlite3_vfs_register,
|
||||||
sqlite3_vfs_unregister,
|
sqlite3_vfs_unregister,
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Added for 3.5.8
|
||||||
|
*/
|
||||||
|
sqlite3_randomness,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
20
src/main.c
20
src/main.c
@ -14,7 +14,7 @@
|
|||||||
** other files are for internal use by SQLite and should not be
|
** other files are for internal use by SQLite and should not be
|
||||||
** accessed by users of the library.
|
** accessed by users of the library.
|
||||||
**
|
**
|
||||||
** $Id: main.c,v 1.422 2008/03/18 13:01:38 drh Exp $
|
** $Id: main.c,v 1.423 2008/03/19 14:15:34 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -1490,11 +1490,11 @@ int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
|
|||||||
** Interface to the testing logic.
|
** Interface to the testing logic.
|
||||||
*/
|
*/
|
||||||
int sqlite3_test_control(int op, ...){
|
int sqlite3_test_control(int op, ...){
|
||||||
va_list ap;
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
#ifndef SQLITE_OMIT_TESTLOGIC
|
||||||
|
va_list ap;
|
||||||
va_start(ap, op);
|
va_start(ap, op);
|
||||||
switch( op ){
|
switch( op ){
|
||||||
#ifndef SQLITE_OMIT_FAULTINJECTOR
|
|
||||||
case SQLITE_TESTCTRL_FAULT_CONFIG: {
|
case SQLITE_TESTCTRL_FAULT_CONFIG: {
|
||||||
int id = va_arg(ap, int);
|
int id = va_arg(ap, int);
|
||||||
int nDelay = va_arg(ap, int);
|
int nDelay = va_arg(ap, int);
|
||||||
@ -1517,8 +1517,20 @@ int sqlite3_test_control(int op, ...){
|
|||||||
rc = sqlite3FaultPending(id);
|
rc = sqlite3FaultPending(id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* SQLITE_OMIT_FAULTINJECTOR */
|
case SQLITE_TESTCTRL_PRNG_SAVE: {
|
||||||
|
sqlite3PrngSaveState();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SQLITE_TESTCTRL_PRNG_RESTORE: {
|
||||||
|
sqlite3PrngRestoreState();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SQLITE_TESTCTRL_PRNG_RESET: {
|
||||||
|
sqlite3PrngResetState();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
#endif /* SQLITE_OMIT_TESTLOGIC */
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -758,7 +758,7 @@ static int os2GetTempname( sqlite3_vfs *pVfs, int nBuf, char *zBuf ){
|
|||||||
sqlite3_snprintf( nBuf-30, zBuf,
|
sqlite3_snprintf( nBuf-30, zBuf,
|
||||||
"%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath );
|
"%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath );
|
||||||
j = strlen( zBuf );
|
j = strlen( zBuf );
|
||||||
sqlite3Randomness( 20, &zBuf[j] );
|
sqlite3_randomness( 20, &zBuf[j] );
|
||||||
for( i = 0; i < 20; i++, j++ ){
|
for( i = 0; i < 20; i++, j++ ){
|
||||||
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
|
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ static int writeCache2(OsTestFile *pFile, int crash){
|
|||||||
int trash = 0;
|
int trash = 0;
|
||||||
if( crash ){
|
if( crash ){
|
||||||
char random;
|
char random;
|
||||||
sqlite3Randomness(1, &random);
|
sqlite3_randomness(1, &random);
|
||||||
if( random & 0x01 ){
|
if( random & 0x01 ){
|
||||||
if( random & 0x02 ){
|
if( random & 0x02 ){
|
||||||
trash = 1;
|
trash = 1;
|
||||||
@ -241,7 +241,7 @@ printf("Writing block %d of %s\n", i, pFile->zName);
|
|||||||
}
|
}
|
||||||
if( len>0 ){
|
if( len>0 ){
|
||||||
if( trash ){
|
if( trash ){
|
||||||
sqlite3Randomness(len, p);
|
sqlite3_randomness(len, p);
|
||||||
}
|
}
|
||||||
rc = sqlite3RealWrite(&pFile->fd, p, len);
|
rc = sqlite3RealWrite(&pFile->fd, p, len);
|
||||||
}
|
}
|
||||||
|
@ -2527,7 +2527,7 @@ static int unixGetTempname(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
|
|||||||
assert( pVfs->mxPathname==MAX_PATHNAME );
|
assert( pVfs->mxPathname==MAX_PATHNAME );
|
||||||
sqlite3_snprintf(nBuf-17, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir);
|
sqlite3_snprintf(nBuf-17, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir);
|
||||||
j = strlen(zBuf);
|
j = strlen(zBuf);
|
||||||
sqlite3Randomness(15, &zBuf[j]);
|
sqlite3_randomness(15, &zBuf[j]);
|
||||||
for(i=0; i<15; i++, j++){
|
for(i=0; i<15; i++, j++){
|
||||||
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
|
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
|
||||||
}
|
}
|
||||||
|
@ -780,7 +780,7 @@ static int getReadLock(winFile *pFile){
|
|||||||
0, SHARED_SIZE, 0, &ovlp);
|
0, SHARED_SIZE, 0, &ovlp);
|
||||||
}else{
|
}else{
|
||||||
int lk;
|
int lk;
|
||||||
sqlite3Randomness(sizeof(lk), &lk);
|
sqlite3_randomness(sizeof(lk), &lk);
|
||||||
pFile->sharedLockByte = (lk & 0x7fffffff)%(SHARED_SIZE - 1);
|
pFile->sharedLockByte = (lk & 0x7fffffff)%(SHARED_SIZE - 1);
|
||||||
res = LockFile(pFile->h, SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0);
|
res = LockFile(pFile->h, SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0);
|
||||||
}
|
}
|
||||||
@ -1314,7 +1314,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
|
|||||||
sqlite3_snprintf(nBuf-30, zBuf,
|
sqlite3_snprintf(nBuf-30, zBuf,
|
||||||
"%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath);
|
"%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath);
|
||||||
j = strlen(zBuf);
|
j = strlen(zBuf);
|
||||||
sqlite3Randomness(20, &zBuf[j]);
|
sqlite3_randomness(20, &zBuf[j]);
|
||||||
for(i=0; i<20; i++, j++){
|
for(i=0; i<20; i++, j++){
|
||||||
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
|
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
** file simultaneously, or one process from reading the database while
|
** file simultaneously, or one process from reading the database while
|
||||||
** another is writing.
|
** another is writing.
|
||||||
**
|
**
|
||||||
** @(#) $Id: pager.c,v 1.417 2008/03/17 13:50:58 drh Exp $
|
** @(#) $Id: pager.c,v 1.418 2008/03/19 14:15:35 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef SQLITE_OMIT_DISKIO
|
#ifndef SQLITE_OMIT_DISKIO
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
@ -1017,7 +1017,7 @@ static int writeJournalHdr(Pager *pPager){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The random check-hash initialiser */
|
/* The random check-hash initialiser */
|
||||||
sqlite3Randomness(sizeof(pPager->cksumInit), &pPager->cksumInit);
|
sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit);
|
||||||
put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit);
|
put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit);
|
||||||
/* The initial database size */
|
/* The initial database size */
|
||||||
put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbSize);
|
put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbSize);
|
||||||
|
16
src/random.c
16
src/random.c
@ -15,7 +15,7 @@
|
|||||||
** Random numbers are used by some of the database backends in order
|
** Random numbers are used by some of the database backends in order
|
||||||
** to generate random integer keys for tables or random filenames.
|
** to generate random integer keys for tables or random filenames.
|
||||||
**
|
**
|
||||||
** $Id: random.c,v 1.21 2008/01/16 17:46:38 drh Exp $
|
** $Id: random.c,v 1.22 2008/03/19 14:15:35 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ static int randomByte(void){
|
|||||||
/*
|
/*
|
||||||
** Return N random bytes.
|
** Return N random bytes.
|
||||||
*/
|
*/
|
||||||
void sqlite3Randomness(int N, void *pBuf){
|
void sqlite3_randomness(int N, void *pBuf){
|
||||||
unsigned char *zBuf = pBuf;
|
unsigned char *zBuf = pBuf;
|
||||||
static sqlite3_mutex *mutex = 0;
|
static sqlite3_mutex *mutex = 0;
|
||||||
if( mutex==0 ){
|
if( mutex==0 ){
|
||||||
@ -103,19 +103,21 @@ void sqlite3Randomness(int N, void *pBuf){
|
|||||||
sqlite3_mutex_leave(mutex);
|
sqlite3_mutex_leave(mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SQLITE_TEST
|
#ifndef SQLITE_OMIT_TESTLOGIC
|
||||||
/*
|
/*
|
||||||
** For testing purposes, we sometimes want to preserve the state of
|
** For testing purposes, we sometimes want to preserve the state of
|
||||||
** PRNG and restore the PRNG to its saved state at a later time.
|
** PRNG and restore the PRNG to its saved state at a later time.
|
||||||
|
** The sqlite3_test_control() interface calls these routines to
|
||||||
|
** control the PRNG.
|
||||||
*/
|
*/
|
||||||
static struct sqlite3PrngType sqlite3SavedPrng;
|
static struct sqlite3PrngType sqlite3SavedPrng;
|
||||||
void sqlite3SavePrngState(void){
|
void sqlite3PrngSaveState(void){
|
||||||
memcpy(&sqlite3SavedPrng, &sqlite3Prng, sizeof(sqlite3Prng));
|
memcpy(&sqlite3SavedPrng, &sqlite3Prng, sizeof(sqlite3Prng));
|
||||||
}
|
}
|
||||||
void sqlite3RestorePrngState(void){
|
void sqlite3PrngRestoreState(void){
|
||||||
memcpy(&sqlite3Prng, &sqlite3SavedPrng, sizeof(sqlite3Prng));
|
memcpy(&sqlite3Prng, &sqlite3SavedPrng, sizeof(sqlite3Prng));
|
||||||
}
|
}
|
||||||
void sqlite3ResetPrngState(void){
|
void sqlite3PrngResetState(void){
|
||||||
sqlite3Prng.isInit = 0;
|
sqlite3Prng.isInit = 0;
|
||||||
}
|
}
|
||||||
#endif /* SQLITE_TEST */
|
#endif /* SQLITE_OMIT_TESTLOGIC */
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
** the version number) and changes its name to "sqlite3.h" as
|
** the version number) and changes its name to "sqlite3.h" as
|
||||||
** part of the build process.
|
** part of the build process.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqlite.h.in,v 1.292 2008/03/18 13:47:21 drh Exp $
|
** @(#) $Id: sqlite.h.in,v 1.293 2008/03/19 14:15:35 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITE3_H_
|
#ifndef _SQLITE3_H_
|
||||||
#define _SQLITE3_H_
|
#define _SQLITE3_H_
|
||||||
@ -1590,6 +1590,31 @@ void sqlite3_free(void*);
|
|||||||
sqlite3_int64 sqlite3_memory_used(void);
|
sqlite3_int64 sqlite3_memory_used(void);
|
||||||
sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
|
sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CAPI3REF: Pseudo-Random Number Generator {F17390}
|
||||||
|
**
|
||||||
|
** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
|
||||||
|
** select random ROWIDs when inserting new records into a table that
|
||||||
|
** already uses the largest possible ROWID. The PRNG is also used for
|
||||||
|
** the build-in random() and randomblob() SQL functions. This interface allows
|
||||||
|
** appliations to access the same PRNG for other purposes.
|
||||||
|
**
|
||||||
|
** A call to this routine stores N bytes of randomness into buffer P.
|
||||||
|
**
|
||||||
|
** The first time this routine is invoked (either internally or by
|
||||||
|
** the application) the PRNG is seeded using randomness obtained
|
||||||
|
** from the xRandomness method of the default [sqlite3_vfs] object.
|
||||||
|
** On all subsequent invocations, the pseudo-randomness is generated
|
||||||
|
** internally and without recourse to the [sqlite3_vfs] xRandomness
|
||||||
|
** method.
|
||||||
|
**
|
||||||
|
** INVARIANTS:
|
||||||
|
**
|
||||||
|
** {F17392} The [sqlite3_randomness(N,P)] interface writes N bytes of
|
||||||
|
** high-quality pseudo-randomness into buffer P.
|
||||||
|
*/
|
||||||
|
void sqlite3_randomness(int N, void *P);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Compile-Time Authorization Callbacks {F12500}
|
** CAPI3REF: Compile-Time Authorization Callbacks {F12500}
|
||||||
**
|
**
|
||||||
@ -5445,9 +5470,9 @@ int sqlite3_test_control(int op, ...);
|
|||||||
#define SQLITE_TESTCTRL_FAULT_FAILURES 2
|
#define SQLITE_TESTCTRL_FAULT_FAILURES 2
|
||||||
#define SQLITE_TESTCTRL_FAULT_BENIGN_FAILURES 3
|
#define SQLITE_TESTCTRL_FAULT_BENIGN_FAILURES 3
|
||||||
#define SQLITE_TESTCTRL_FAULT_PENDING 4
|
#define SQLITE_TESTCTRL_FAULT_PENDING 4
|
||||||
|
#define SQLITE_TESTCTRL_PRNG_SAVE 5
|
||||||
|
#define SQLITE_TESTCTRL_PRNG_RESTORE 6
|
||||||
|
#define SQLITE_TESTCTRL_PRNG_RESET 7
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
** as extensions by SQLite should #include this file instead of
|
** as extensions by SQLite should #include this file instead of
|
||||||
** sqlite3.h.
|
** sqlite3.h.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqlite3ext.h,v 1.18 2008/03/02 03:32:05 mlcreech Exp $
|
** @(#) $Id: sqlite3ext.h,v 1.19 2008/03/19 14:15:35 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITE3EXT_H_
|
#ifndef _SQLITE3EXT_H_
|
||||||
#define _SQLITE3EXT_H_
|
#define _SQLITE3EXT_H_
|
||||||
@ -182,6 +182,7 @@ struct sqlite3_api_routines {
|
|||||||
sqlite3_vfs *(*vfs_find)(const char*);
|
sqlite3_vfs *(*vfs_find)(const char*);
|
||||||
int (*vfs_register)(sqlite3_vfs*,int);
|
int (*vfs_register)(sqlite3_vfs*,int);
|
||||||
int (*vfs_unregister)(sqlite3_vfs*);
|
int (*vfs_unregister)(sqlite3_vfs*);
|
||||||
|
void (*randomness)(int,void*);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -342,6 +343,7 @@ struct sqlite3_api_routines {
|
|||||||
#define sqlite3_vfs_find sqlite3_api->vfs_find
|
#define sqlite3_vfs_find sqlite3_api->vfs_find
|
||||||
#define sqlite3_vfs_register sqlite3_api->vfs_register
|
#define sqlite3_vfs_register sqlite3_api->vfs_register
|
||||||
#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister
|
#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister
|
||||||
|
#define sqlite3_randomness sqlite3_api->randomness
|
||||||
#endif /* SQLITE_CORE */
|
#endif /* SQLITE_CORE */
|
||||||
|
|
||||||
#define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api;
|
#define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** Internal interface definitions for SQLite.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqliteInt.h,v 1.673 2008/03/14 13:02:08 mlcreech Exp $
|
** @(#) $Id: sqliteInt.h,v 1.674 2008/03/19 14:15:35 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITEINT_H_
|
#ifndef _SQLITEINT_H_
|
||||||
#define _SQLITEINT_H_
|
#define _SQLITEINT_H_
|
||||||
@ -1883,7 +1883,9 @@ void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
|
|||||||
void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
|
void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
|
||||||
Vdbe *sqlite3GetVdbe(Parse*);
|
Vdbe *sqlite3GetVdbe(Parse*);
|
||||||
Expr *sqlite3CreateIdExpr(Parse *, const char*);
|
Expr *sqlite3CreateIdExpr(Parse *, const char*);
|
||||||
void sqlite3Randomness(int, void*);
|
void sqlite3PrngSaveState(void);
|
||||||
|
void sqlite3PrngRestoreState(void);
|
||||||
|
void sqlite3PrngResetState(void);
|
||||||
void sqlite3RollbackAll(sqlite3*);
|
void sqlite3RollbackAll(sqlite3*);
|
||||||
void sqlite3CodeVerifySchema(Parse*, int);
|
void sqlite3CodeVerifySchema(Parse*, int);
|
||||||
void sqlite3BeginTransaction(Parse*, int);
|
void sqlite3BeginTransaction(Parse*, int);
|
||||||
@ -2119,7 +2121,7 @@ CollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *);
|
|||||||
** mechanism is disabled at compile-time then set up macros so that no
|
** mechanism is disabled at compile-time then set up macros so that no
|
||||||
** unnecessary code is generated.
|
** unnecessary code is generated.
|
||||||
*/
|
*/
|
||||||
#ifndef SQLITE_OMIT_FAULTINJECTOR
|
#ifndef SQLITE_OMIT_TESTLOGIC
|
||||||
void sqlite3FaultConfig(int,int,int);
|
void sqlite3FaultConfig(int,int,int);
|
||||||
int sqlite3FaultFailures(int);
|
int sqlite3FaultFailures(int);
|
||||||
int sqlite3FaultBenignFailures(int);
|
int sqlite3FaultBenignFailures(int);
|
||||||
|
11
src/test1.c
11
src/test1.c
@ -13,7 +13,7 @@
|
|||||||
** is not included in the SQLite library. It is used for automated
|
** is not included in the SQLite library. It is used for automated
|
||||||
** testing of the SQLite library.
|
** testing of the SQLite library.
|
||||||
**
|
**
|
||||||
** $Id: test1.c,v 1.292 2008/03/04 17:45:02 mlcreech Exp $
|
** $Id: test1.c,v 1.293 2008/03/19 14:15:35 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "tcl.h"
|
#include "tcl.h"
|
||||||
@ -4329,8 +4329,7 @@ static int save_prng_state(
|
|||||||
int objc, /* Number of arguments */
|
int objc, /* Number of arguments */
|
||||||
Tcl_Obj *CONST objv[] /* Command arguments */
|
Tcl_Obj *CONST objv[] /* Command arguments */
|
||||||
){
|
){
|
||||||
extern void sqlite3SavePrngState(void);
|
sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SAVE);
|
||||||
sqlite3SavePrngState();
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -4342,8 +4341,7 @@ static int restore_prng_state(
|
|||||||
int objc, /* Number of arguments */
|
int objc, /* Number of arguments */
|
||||||
Tcl_Obj *CONST objv[] /* Command arguments */
|
Tcl_Obj *CONST objv[] /* Command arguments */
|
||||||
){
|
){
|
||||||
extern void sqlite3RestorePrngState(void);
|
sqlite3_test_control(SQLITE_TESTCTRL_PRNG_RESTORE);
|
||||||
sqlite3RestorePrngState();
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -4355,8 +4353,7 @@ static int reset_prng_state(
|
|||||||
int objc, /* Number of arguments */
|
int objc, /* Number of arguments */
|
||||||
Tcl_Obj *CONST objv[] /* Command arguments */
|
Tcl_Obj *CONST objv[] /* Command arguments */
|
||||||
){
|
){
|
||||||
extern void sqlite3ResetPrngState(void);
|
sqlite3_test_control(SQLITE_TESTCTRL_PRNG_RESET);
|
||||||
sqlite3ResetPrngState();
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ static int writeListSync(CrashFile *pFile, int isCrash){
|
|||||||
int nWrite = 0;
|
int nWrite = 0;
|
||||||
int iFinal;
|
int iFinal;
|
||||||
for(pWrite=g.pWriteList; pWrite; pWrite=pWrite->pNext) nWrite++;
|
for(pWrite=g.pWriteList; pWrite; pWrite=pWrite->pNext) nWrite++;
|
||||||
sqlite3Randomness(sizeof(int), &iFinal);
|
sqlite3_randomness(sizeof(int), &iFinal);
|
||||||
iFinal = ((iFinal<0)?-1*iFinal:iFinal)%nWrite;
|
iFinal = ((iFinal<0)?-1*iFinal:iFinal)%nWrite;
|
||||||
for(pWrite=g.pWriteList; iFinal>0; pWrite=pWrite->pNext) iFinal--;
|
for(pWrite=g.pWriteList; iFinal>0; pWrite=pWrite->pNext) iFinal--;
|
||||||
pFinal = pWrite;
|
pFinal = pWrite;
|
||||||
@ -220,7 +220,7 @@ static int writeListSync(CrashFile *pFile, int isCrash){
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
char random;
|
char random;
|
||||||
sqlite3Randomness(1, &random);
|
sqlite3_randomness(1, &random);
|
||||||
|
|
||||||
/* Do not select option 3 (sector trashing) if the IOCAP_ATOMIC flag
|
/* Do not select option 3 (sector trashing) if the IOCAP_ATOMIC flag
|
||||||
** is set or this is an OsTruncate(), not an Oswrite().
|
** is set or this is an OsTruncate(), not an Oswrite().
|
||||||
@ -304,7 +304,7 @@ static int writeListSync(CrashFile *pFile, int isCrash){
|
|||||||
if( zGarbage ){
|
if( zGarbage ){
|
||||||
sqlite3_int64 i;
|
sqlite3_int64 i;
|
||||||
for(i=iFirst; rc==SQLITE_OK && i<=iLast; i++){
|
for(i=iFirst; rc==SQLITE_OK && i<=iLast; i++){
|
||||||
sqlite3Randomness(g.iSectorSize, zGarbage);
|
sqlite3_randomness(g.iSectorSize, zGarbage);
|
||||||
rc = sqlite3OsWrite(
|
rc = sqlite3OsWrite(
|
||||||
pRealFile, zGarbage, g.iSectorSize, i*g.iSectorSize
|
pRealFile, zGarbage, g.iSectorSize, i*g.iSectorSize
|
||||||
);
|
);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
** The focus of this file is providing the TCL testing layer
|
** The focus of this file is providing the TCL testing layer
|
||||||
** access to compile-time constants.
|
** access to compile-time constants.
|
||||||
**
|
**
|
||||||
** $Id: test_config.c,v 1.20 2008/02/16 16:21:46 drh Exp $
|
** $Id: test_config.c,v 1.21 2008/03/19 14:15:35 drh Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sqliteLimit.h"
|
#include "sqliteLimit.h"
|
||||||
@ -213,12 +213,6 @@ static void set_options(Tcl_Interp *interp){
|
|||||||
Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SQLITE_OMIT_FAULTINJECTOR
|
|
||||||
Tcl_SetVar2(interp, "sqlite_options", "faultinjector", "0", TCL_GLOBAL_ONLY);
|
|
||||||
#else
|
|
||||||
Tcl_SetVar2(interp, "sqlite_options", "faultinjector", "1", TCL_GLOBAL_ONLY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_OMIT_FLOATING_POINT
|
#ifdef SQLITE_OMIT_FLOATING_POINT
|
||||||
Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY);
|
||||||
#else
|
#else
|
||||||
@ -374,6 +368,12 @@ Tcl_SetVar2(interp, "sqlite_options", "long_double",
|
|||||||
Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SQLITE_OMIT_TESTLOGIC
|
||||||
|
Tcl_SetVar2(interp, "sqlite_options", "testlogic", "0", TCL_GLOBAL_ONLY);
|
||||||
|
#else
|
||||||
|
Tcl_SetVar2(interp, "sqlite_options", "testlogic", "1", TCL_GLOBAL_ONLY);
|
||||||
|
#endif
|
||||||
|
|
||||||
rc = sqlite3_threadsafe();
|
rc = sqlite3_threadsafe();
|
||||||
#if SQLITE_THREADSAFE
|
#if SQLITE_THREADSAFE
|
||||||
Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "1", TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "1", TCL_GLOBAL_ONLY);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
** in this file for details. If in doubt, do not deviate from existing
|
** in this file for details. If in doubt, do not deviate from existing
|
||||||
** commenting and indentation practices when changing or adding code.
|
** commenting and indentation practices when changing or adding code.
|
||||||
**
|
**
|
||||||
** $Id: vdbe.c,v 1.711 2008/03/17 17:18:38 drh Exp $
|
** $Id: vdbe.c,v 1.712 2008/03/19 14:15:35 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -3157,7 +3157,7 @@ case OP_NewRowid: { /* out2-prerelease */
|
|||||||
if( cnt==0 && (v&0xffffff)==v ){
|
if( cnt==0 && (v&0xffffff)==v ){
|
||||||
v++;
|
v++;
|
||||||
}else{
|
}else{
|
||||||
sqlite3Randomness(sizeof(v), &v);
|
sqlite3_randomness(sizeof(v), &v);
|
||||||
if( cnt<5 ) v &= 0xffffff;
|
if( cnt<5 ) v &= 0xffffff;
|
||||||
}
|
}
|
||||||
if( v==0 ) continue;
|
if( v==0 ) continue;
|
||||||
|
@ -1251,7 +1251,7 @@ static int vdbeCommit(sqlite3 *db){
|
|||||||
do {
|
do {
|
||||||
u32 random;
|
u32 random;
|
||||||
sqlite3_free(zMaster);
|
sqlite3_free(zMaster);
|
||||||
sqlite3Randomness(sizeof(random), &random);
|
sqlite3_randomness(sizeof(random), &random);
|
||||||
zMaster = sqlite3MPrintf(db, "%s-mj%08X", zMainFile, random&0x7fffffff);
|
zMaster = sqlite3MPrintf(db, "%s-mj%08X", zMainFile, random&0x7fffffff);
|
||||||
if( !zMaster ){
|
if( !zMaster ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
# This file contains common code used by many different malloc tests
|
# This file contains common code used by many different malloc tests
|
||||||
# within the test suite.
|
# within the test suite.
|
||||||
#
|
#
|
||||||
# $Id: malloc_common.tcl,v 1.14 2008/03/18 00:07:11 drh Exp $
|
# $Id: malloc_common.tcl,v 1.15 2008/03/19 14:15:35 drh Exp $
|
||||||
|
|
||||||
# If we did not compile with malloc testing enabled, then do nothing.
|
# If we did not compile with malloc testing enabled, then do nothing.
|
||||||
#
|
#
|
||||||
ifcapable faultinjector {
|
ifcapable testlogic {
|
||||||
set MEMDEBUG 1
|
set MEMDEBUG 1
|
||||||
} else {
|
} else {
|
||||||
set MEMDEBUG 0
|
set MEMDEBUG 0
|
||||||
|
Reference in New Issue
Block a user