]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Report errors from sqlite3_exec() and sqlite3_config() in speedtest1. Fix
authordrh <drh@noemail.net>
Sat, 23 Nov 2013 11:45:58 +0000 (11:45 +0000)
committerdrh <drh@noemail.net>
Sat, 23 Nov 2013 11:45:58 +0000 (11:45 +0000)
a bug in the main testing logic that was found by these error reports.

FossilOrigin-Name: 659f1a98ae698d062269f8fdac84f733a460f5de

manifest
manifest.uuid
test/speedtest1.c

index 41d7d5d0bc2067f947b22c709cf2394db655296b..29763122bce5ba9836f5a00dcf63b67fe11f97ec 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sthe\sorder\sof\sparameters\sto\sSQLITE_CONFIG_PAGECACHE\sin\sthe\nspeedtest1.exe\sprogram.
-D 2013-11-23T04:32:18.644
+C Report\serrors\sfrom\ssqlite3_exec()\sand\ssqlite3_config()\sin\sspeedtest1.\s\sFix\na\sbug\sin\sthe\smain\stesting\slogic\sthat\swas\sfound\sby\sthese\serror\sreports.
+D 2013-11-23T11:45:58.348
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in e1a9b4258bbde53f5636f4e238c65b7e11459e2b
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -819,7 +819,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 19ceb72f81d831bbd22c18d20a5d452075efaf1b
+F test/speedtest1.c 34dfd9e87c6361fd5ddaed32470d72296a4d8f9e
 F test/spellfix.test 8c40b169b104086d8795781f670ba3c786d6d8be
 F test/sqllimits1.test b1aae27cc98eceb845e7f7adf918561256e31298
 F test/stat.test c8eccfe8fcd3f3cfc864ce22d5b9e803a3c69940
@@ -1142,7 +1142,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P facf6deaa61ed2e1744711d621d7f50fe2067803
-R 5a8018cc116cdda5096d79d3f410c8a0
+P dbe85ef6d265ed31f4b56dfc0c72bad6adcfd7f0
+R 3c84733d697c289c6df74ff384038ce3
 U drh
-Z 81842b72e206955befee47563d6c51e0
+Z 1e02960cbed70b5ceeaded68b201375e
index 6348d3fdae60c85f7ae9f34d3b044f51579039ec..52732edbe98de6657b151c74a3b5e673971e667f 100644 (file)
@@ -1 +1 @@
-dbe85ef6d265ed31f4b56dfc0c72bad6adcfd7f0
\ No newline at end of file
+659f1a98ae698d062269f8fdac84f733a460f5de
\ No newline at end of file
index abc1e7fc66e056c5df4bf910875cefc29777b287..96694953479a1fcf3ebdf6d1390abea1db5a31f2 100644 (file)
@@ -377,7 +377,10 @@ void speedtest1_exec(const char *zFormat, ...){
     while( n>0 && (zSql[n-1]==';' || isspace(zSql[n-1])) ){ n--; }
     printf("%.*s;\n", n, zSql);
   }else{
-    sqlite3_exec(g.db, zSql, 0, 0, 0);
+    char *zErrMsg = 0;
+    int 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));
   }
   sqlite3_free(zSql);
 }
@@ -731,8 +734,8 @@ void testset_main(void){
 
 
   speedtest1_begin_test(290, "Refill two %d-row tables using REPLACE", sz);
-  speedtest1_exec("REPLACE INTO t2 SELECT * FROM t1");
-  speedtest1_exec("REPLACE INTO t3 SELECT * FROM t1");
+  speedtest1_exec("REPLACE INTO t2(a,b,c) SELECT a,b,c FROM t1");
+  speedtest1_exec("REPLACE INTO t3(a,b,c) SELECT a,b,c FROM t1");
   speedtest1_end_test();
 
 
@@ -807,7 +810,8 @@ int main(int argc, char **argv){
   void *pLook = 0;              /* Allocated lookaside space */
   void *pPCache = 0;            /* Allocated storage for pcache */
   int iCur, iHi;                /* Stats values, current and "highwater" */
-  int i;
+  int i;                        /* Loop counter */
+  int rc;                       /* API return code */
 
   /* Process command-line arguments */
   g.zWR = "";
@@ -901,13 +905,15 @@ int main(int argc, char **argv){
   if( nHeap>0 ){
     pHeap = malloc( nHeap );
     if( pHeap==0 ) fatal_error("cannot allocate %d-byte heap\n", nHeap);
-    sqlite3_config(SQLITE_CONFIG_HEAP, pHeap, nHeap, mnHeap);
+    rc = sqlite3_config(SQLITE_CONFIG_HEAP, pHeap, nHeap, mnHeap);
+    if( rc ) fatal_error("heap configuration failed: %d", rc);
   }
   if( nPCache>0 && szPCache>0 ){
     pPCache = malloc( nPCache*szPCache );
     if( pPCache==0 ) fatal_error("cannot allocate %d-byte pcache\n",
                                  nPCache*szPCache);
-    sqlite3_config(SQLITE_CONFIG_PAGECACHE, pPCache, szPCache, nPCache);
+    rc = sqlite3_config(SQLITE_CONFIG_PAGECACHE, pPCache, szPCache, nPCache);
+    if( rc ) fatal_error("pcache configuration failed: %d", rc);
   }
   if( nLook>0 ){
     sqlite3_config(SQLITE_CONFIG_LOOKASIDE, 0, 0);
@@ -919,7 +925,8 @@ int main(int argc, char **argv){
   }
   if( nLook>0 && szLook>0 ){
     pLook = malloc( nLook*szLook );
-    sqlite3_db_config(g.db, SQLITE_DBCONFIG_LOOKASIDE, pLook, szLook, nLook);
+    rc = sqlite3_db_config(g.db, SQLITE_DBCONFIG_LOOKASIDE, pLook, szLook,nLook);
+    if( rc ) fatal_error("lookaside configuration failed: %d", rc);
   }
 
   /* Set database connection options */