mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-24 14:17:58 +03:00
Add the --script option to speedtest1.
FossilOrigin-Name: 1c87d7c58d5aec83f9e2ae3771a81aa17cfae0cf06169025a5db085e2d5749f9
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
||||
C Remove\sa\sNEVER()\smacro\sfor\sa\scondition\sthat\sis\sactually\sreachable\sfollowing\san\sOOM.\sdbsqlfuzz\scrash-6ef3cd3b18ccc5de86120950a0498641acd90a33.txt.
|
||||
D 2022-08-25T13:32:55.636
|
||||
C Add\sthe\s--script\soption\sto\sspeedtest1.
|
||||
D 2022-08-25T19:19:25.119
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -1480,7 +1480,7 @@ F test/speed3.test 694affeb9100526007436334cf7d08f3d74b85ef
|
||||
F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
|
||||
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
|
||||
F test/speed4p.test 377a0c48e5a92e0b11c1c5ebb1bc9d83a7312c922bc0cb05970ef5d6a96d1f0c
|
||||
F test/speedtest1.c 61f8a72bbcc80edb0b95e957f108feb4013ff3d08721cc87ae1865fd4d20652d
|
||||
F test/speedtest1.c 8146658813bb1451369258dbb525d6176001265861845e51e5c120f708111749
|
||||
F test/spellfix.test 951a6405d49d1a23d6b78027d3877b4a33eeb8221dcab5704b499755bb4f552e
|
||||
F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
|
||||
F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33
|
||||
@@ -1999,8 +1999,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 459ad8846ee1ee2d3b277a291c47121692bdf477e779b06e77be8338f62237a6
|
||||
R c074d758a3f9086fc4005e904b417c57
|
||||
U dan
|
||||
Z 63f19aa3edc2a77d03599cb0f52bdf8f
|
||||
P b573e2cffa5fedc893ed30e76e47022b3617ac5583e1eb486afa810b2514c419
|
||||
R 23f5860feef99c79720c0e0c9fd78020
|
||||
U drh
|
||||
Z c96eb730eff0b666933a1a2c900265aa
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
@@ -1 +1 @@
|
||||
b573e2cffa5fedc893ed30e76e47022b3617ac5583e1eb486afa810b2514c419
|
||||
1c87d7c58d5aec83f9e2ae3771a81aa17cfae0cf06169025a5db085e2d5749f9
|
||||
@@ -29,6 +29,7 @@ static const char zHelp[] =
|
||||
" --repeat N Repeat each SELECT N times (default: 1)\n"
|
||||
" --reprepare Reprepare each statement upon every invocation\n"
|
||||
" --reserve N Reserve N bytes on each database page\n"
|
||||
" --script FILE Write an SQL script for the test into FILE\n"
|
||||
" --serialized Set serialized threading mode\n"
|
||||
" --singlethread Set single-threaded mode - disables all mutexing\n"
|
||||
" --sqlonly No-op. Only show the SQL that would have been run.\n"
|
||||
@@ -103,6 +104,7 @@ static struct Global {
|
||||
u64 nResByte; /* Total number of result bytes */
|
||||
int nResult; /* Size of the current result */
|
||||
char zResult[3000]; /* Text of the current result */
|
||||
FILE *pScript; /* Write an SQL script into this file */
|
||||
#ifndef SPEEDTEST_OMIT_HASH
|
||||
FILE *hashFile; /* Store all hash results in this file */
|
||||
HashContext hash; /* Hash of all output */
|
||||
@@ -473,7 +475,11 @@ void speedtest1_exec(const char *zFormat, ...){
|
||||
printSql(zSql);
|
||||
}else{
|
||||
char *zErrMsg = 0;
|
||||
int rc = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
|
||||
int rc;
|
||||
if( g.pScript ){
|
||||
fprintf(g.pScript,"%s;\n",zSql);
|
||||
}
|
||||
rc = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
|
||||
if( zErrMsg ) fatal_error("SQL error: %s\n%s\n", zErrMsg, zSql);
|
||||
if( rc!=SQLITE_OK ) fatal_error("exec error: %s\n", sqlite3_errmsg(g.db));
|
||||
}
|
||||
@@ -500,6 +506,11 @@ char *speedtest1_once(const char *zFormat, ...){
|
||||
if( rc ){
|
||||
fatal_error("SQL error: %s\n", sqlite3_errmsg(g.db));
|
||||
}
|
||||
if( g.pScript ){
|
||||
char *z = sqlite3_expanded_sql(pStmt);
|
||||
fprintf(g.pScript,"%s\n",z);
|
||||
sqlite3_free(z);
|
||||
}
|
||||
if( sqlite3_step(pStmt)==SQLITE_ROW ){
|
||||
const char *z = (const char*)sqlite3_column_text(pStmt, 0);
|
||||
if( z ) zResult = sqlite3_mprintf("%s", z);
|
||||
@@ -537,6 +548,11 @@ void speedtest1_run(void){
|
||||
if( g.bSqlOnly ) return;
|
||||
assert( g.pStmt );
|
||||
g.nResult = 0;
|
||||
if( g.pScript ){
|
||||
char *z = sqlite3_expanded_sql(g.pStmt);
|
||||
fprintf(g.pScript,"%s\n",z);
|
||||
sqlite3_free(z);
|
||||
}
|
||||
while( sqlite3_step(g.pStmt)==SQLITE_ROW ){
|
||||
n = sqlite3_column_count(g.pStmt);
|
||||
for(i=0; i<n; i++){
|
||||
@@ -2281,6 +2297,13 @@ int main(int argc, char **argv){
|
||||
}else if( strcmp(z,"singlethread")==0 ){
|
||||
sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
|
||||
#endif
|
||||
}else if( strcmp(z,"script")==0 ){
|
||||
if( i>=argc-1 ) fatal_error("missing arguments on %s\n", argv[i]);
|
||||
if( g.pScript ) fclose(g.pScript);
|
||||
g.pScript = fopen(argv[++i], "wb");
|
||||
if( g.pScript==0 ){
|
||||
fatal_error("unable to open output file \"%s\"\n", argv[i]);
|
||||
}
|
||||
}else if( strcmp(z,"sqlonly")==0 ){
|
||||
g.bSqlOnly = 1;
|
||||
}else if( strcmp(z,"shrink-memory")==0 ){
|
||||
@@ -2547,6 +2570,9 @@ int main(int argc, char **argv){
|
||||
displayLinuxIoStats(stdout);
|
||||
}
|
||||
#endif
|
||||
if( g.pScript ){
|
||||
fclose(g.pScript);
|
||||
}
|
||||
|
||||
/* Release memory */
|
||||
free( pLook );
|
||||
|
||||
Reference in New Issue
Block a user