Add #ifdefs to some features speedtest1.c so that it compiles with

older versions of SQLite, going back to version 3.5.1.

FossilOrigin-Name: f50dd154d33c58d7a9aa1852fdc362c2e81feef2
This commit is contained in:
drh 2015-06-18 12:37:32 +00:00
parent 14e067455e
commit 5995e292e6
3 changed files with 18 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Performance\simprovement\sin\ssqlite3VdbeMemShallowCopy()\sfor\sthe\scommon\ncase\swhere\sthe\sreceiver\sdoes\snot\srequire\sprior\sresource\sdeallocation.
D 2015-06-17T23:28:03.205
C Add\s#ifdefs\sto\ssome\sfeatures\sspeedtest1.c\sso\sthat\sit\scompiles\swith\s\nolder\sversions\sof\sSQLite,\sgoing\sback\sto\sversion\s3.5.1.
D 2015-06-18T12:37:32.427
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 1063c58075b7400d93326b0eb332b48a54f53025
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -928,7 +928,7 @@ F test/speed3.test d32043614c08c53eafdc80f33191d5bd9b920523
F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
F test/speedtest1.c 9f1b745c24886cced3f70ffc666300152a39013c
F test/speedtest1.c 613e7f6064123068049ffd9b74a60b3c8d51e8ab
F test/spellfix.test 24f676831acddd2f4056a598fd731a72c6311f49
F test/sqldiff1.test 8f6bc7c6a5b3585d350d779c6078869ba402f8f5
F test/sqllimits1.test e05786eaed7950ff6a2d00031d001d8a26131e68
@ -1286,7 +1286,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 5b547da00d131a494a6b348339af3d91dfa6e3b6
R 8b11dda5b48978322f8411a0ee077b21
P d718ea36dce8cf1684c8bcda457fee87f8f8c4e2
R 2fec93a2150d7ae7b09d15812bf76e79
U drh
Z c4d66c4cd049a599b9f894238778087c
Z 189f0c4fbb00b22a5016916932c6c3ba

View File

@ -1 +1 @@
d718ea36dce8cf1684c8bcda457fee87f8f8c4e2
f50dd154d33c58d7a9aa1852fdc362c2e81feef2

View File

@ -306,7 +306,7 @@ static void printSql(const char *zSql){
if( g.bExplain ) printf("EXPLAIN ");
printf("%.*s;\n", n, zSql);
if( g.bExplain
#if SQLITE_VERSION_NUMBER>=3007010
#if SQLITE_VERSION_NUMBER>=3007017
&& ( sqlite3_strglob("CREATE *", zSql)==0
|| sqlite3_strglob("DROP *", zSql)==0
|| sqlite3_strglob("ALTER *", zSql)==0
@ -374,12 +374,15 @@ void speedtest1_run(void){
}
}
}
#if SQLITE_VERSION_NUMBER>=3006001
if( g.bReprepare ){
sqlite3_stmt *pNew;
sqlite3_prepare_v2(g.db, sqlite3_sql(g.pStmt), -1, &pNew, 0);
sqlite3_finalize(g.pStmt);
g.pStmt = pNew;
}else{
}else
#endif
{
sqlite3_reset(g.pStmt);
}
}
@ -1273,6 +1276,7 @@ int main(int argc, char **argv){
fatal_error(zHelp, argv[0]);
}
#endif
#if SQLITE_VERSION_NUMBER>=3006001
if( nHeap>0 ){
pHeap = malloc( nHeap );
if( pHeap==0 ) fatal_error("cannot allocate %d-byte heap\n", nHeap);
@ -1296,16 +1300,19 @@ int main(int argc, char **argv){
if( nLook>0 ){
sqlite3_config(SQLITE_CONFIG_LOOKASIDE, 0, 0);
}
#endif
/* Open the database and the input file */
if( sqlite3_open(zDbName, &g.db) ){
fatal_error("Cannot open database file: %s\n", zDbName);
}
#if SQLITE_VERSION_NUMBER>=3006001
if( nLook>0 && szLook>0 ){
pLook = malloc( nLook*szLook );
rc = sqlite3_db_config(g.db, SQLITE_DBCONFIG_LOOKASIDE, pLook, szLook,nLook);
if( rc ) fatal_error("lookaside configuration failed: %d\n", rc);
}
#endif
/* Set database connection options */
sqlite3_create_function(g.db, "random", 0, SQLITE_UTF8, 0, randomFunc, 0, 0);
@ -1387,6 +1394,7 @@ int main(int argc, char **argv){
sqlite3_close(g.db);
#if SQLITE_VERSION_NUMBER>=3006001
/* Global memory usage statistics printed after the database connection
** has closed. Memory usage should be zero at this point. */
if( showStats ){
@ -1407,6 +1415,7 @@ int main(int argc, char **argv){
sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHi, 0);
printf("-- Largest Scratch Allocation: %d bytes\n", iHi);
}
#endif
/* Release memory */
free( pLook );