]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fixes and test improvements resulting from code coverage testing. (CVS 716)
authordrh <drh@noemail.net>
Thu, 15 Aug 2002 01:26:09 +0000 (01:26 +0000)
committerdrh <drh@noemail.net>
Thu, 15 Aug 2002 01:26:09 +0000 (01:26 +0000)
FossilOrigin-Name: 66a0f6a8e25e3eeed78eba4b63b097f921c79d99

manifest
manifest.uuid
src/build.c
src/vdbe.c
test/expr.test
test/intpkey.test

index 02c74ffc398ea85adb65cdcbd899d4f15f106d02..8af6e9e72c46da2f69adb7b5f83581f71b713940 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sfor\sticket\s#134:\sChange\sthe\slemon.c\ssources\sto\swork\saround\sa\sproblem\swith\nthe\sAIX\sC\scompiler.\s(CVS\s715)
-D 2002-08-14T23:18:57
+C Fixes\sand\stest\simprovements\sresulting\sfrom\scode\scoverage\stesting.\s(CVS\s716)
+D 2002-08-15T01:26:09
 F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -20,7 +20,7 @@ F spec.template 238f7db425a78dc1bb7682e56e3834c7270a3f5e
 F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
 F src/btree.c 16d1712321e91e77562ffc673ed97b0b1a791db4
 F src/btree.h 0ca6c2631338df62e4f7894252d9347ae234eda9
-F src/build.c 0d661e653e02ce8037917c35403d9f0ff4418e6e
+F src/build.c 35d7ec1e3d377b19a9af38617b50600f63ce1015
 F src/delete.c c9f59ee217e062eb9de7b64b76b5cfff42b2f028
 F src/encode.c 346b12b46148506c32038524b95c4631ab46d760
 F src/expr.c 8a6b669ba5d6cd2810e8671f918ddb0fac3dd1b1
@@ -52,7 +52,7 @@ F src/tokenize.c b5500e193a82b5b9888fbf947efd90d3b4858178
 F src/trigger.c d88ab4d68d68955c217b38fb6717e090fbbf54a4
 F src/update.c f07e6ed2c517c92871e54d3f5886d1cf56121b11
 F src/util.c bdbf0aedcec21ede2248126bbbe734bcc070b7c8
-F src/vdbe.c aad57e622827dc864529f1609a8e94240d4ed92a
+F src/vdbe.c 5b3bb8ac3bb8dd777abd9fae64a293bfdcc13c54
 F src/vdbe.h a9292f2b5fcecef924fa255fb74609e9cbc776c2
 F src/where.c 68ac5d2066da7a9a1aac98ecaebe6187d85137ed
 F test/all.test 9a6eb262393f74cb7fb09b17156491a34b941fe3
@@ -63,13 +63,13 @@ F test/btree3.test 9caa9e22491dd8cd8aa36d7ac3b48b089817c895
 F test/conflict.test 4518cc3c1c40c4ba74220d9ee814257ae7d09c47
 F test/copy.test 55d60a4d5ed342a0fa08b7cd07d46d43ea0d0d7f
 F test/delete.test 5821a95a66061ae09723a88938f23d10d8a881ad
-F test/expr.test 565feb81bd39f703d4f9f9fa3534f05fae5094fe
+F test/expr.test dea1cd62684a8bf116426447c948f5e8fb2c84b6
 F test/func.test bed7ae7a3482df05db0f5eed2debdf25ac2d07fc
 F test/in.test e59461f1702b7387880bf08a0ce6bb777925d282
 F test/index.test 2a5a1b654f50ca0768fb10ae44b72e6a776b1f18
 F test/insert.test a122afb86911e77c181d912348866a5b1a61eeab
 F test/insert2.test c288375a64dad3295044714f0dfed4a193cf067f
-F test/intpkey.test 69a6a9b41e541f27a2ffcd20264fb35adc3c2680
+F test/intpkey.test f3620158fd7963af1306b01047277f10ae91a30b
 F test/ioerr.test 57d9bffaca18b34f9e976f786eadc2591d6efc6a
 F test/join.test 90a620f2a2d015e5139d5a4cde0eeb4cf62523bf
 F test/limit.test dd932f7572fe78e82ef621ef62f0cc480c7e541e
@@ -145,7 +145,7 @@ F www/speed.tcl 7fc83f1b018e1ecc451838449542c3079ed12425
 F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 2127de3f03537ef2f18120e773f7603e0984ff81
-R 7b9d14f25b49a3a4845ff8b962285057
+P 07f6020bb56d6d1bffdd936017f61cfae5bd134b
+R 9cedd757d76753c6b434284c8a29f442
 U drh
-Z c3b9f5c917c9c33ab25ee4f00b0cc805
+Z 60f9f150ddc50216dbbd17469130080e
index 8b18f840a27849595275dbf0dac8024e558c6373..3e7370fe97fa7354c1212b98373ecf1c82a2ab4b 100644 (file)
@@ -1 +1 @@
-07f6020bb56d6d1bffdd936017f61cfae5bd134b
\ No newline at end of file
+66a0f6a8e25e3eeed78eba4b63b097f921c79d99
\ No newline at end of file
index 31c16db5ec6b5c0b4d2a1b54076d63db1e9b2d8d..2d2d55bc356611e546fa04d0f800e8e9b9104a5e 100644 (file)
@@ -25,7 +25,7 @@
 **     ROLLBACK
 **     PRAGMA
 **
-** $Id: build.c,v 1.107 2002/08/02 10:36:09 drh Exp $
+** $Id: build.c,v 1.108 2002/08/15 01:26:09 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -461,35 +461,37 @@ void sqliteAddColumnType(Parse *pParse, Token *pFirst, Token *pLast){
   }
   z[j] = 0;
   pCol->sortOrder = SQLITE_SO_NUM;
-  for(i=0; z[i]; i++){
-    switch( z[i] ){
-      case 'b':
-      case 'B': {
-        if( sqliteStrNICmp(&z[i],"blob",4)==0 ){
-          pCol->sortOrder = SQLITE_SO_TEXT;
-          return;
+  if( pParse->db->file_format>=4 ){
+    for(i=0; z[i]; i++){
+      switch( z[i] ){
+        case 'b':
+        case 'B': {
+          if( sqliteStrNICmp(&z[i],"blob",4)==0 ){
+            pCol->sortOrder = SQLITE_SO_TEXT;
+            return;
+          }
+          break;
         }
-        break;
-      }
-      case 'c':
-      case 'C': {
-        if( sqliteStrNICmp(&z[i],"char",4)==0 ||
-                sqliteStrNICmp(&z[i],"clob",4)==0 ){
-          pCol->sortOrder = SQLITE_SO_TEXT;
-          return;
+        case 'c':
+        case 'C': {
+          if( sqliteStrNICmp(&z[i],"char",4)==0 ||
+                  sqliteStrNICmp(&z[i],"clob",4)==0 ){
+            pCol->sortOrder = SQLITE_SO_TEXT;
+            return;
+          }
+          break;
         }
-        break;
-      }
-      case 'x':
-      case 'X': {
-        if( i>=2 && sqliteStrNICmp(&z[i-2],"text",4)==0 ){
-          pCol->sortOrder = SQLITE_SO_TEXT;
-          return;
+        case 'x':
+        case 'X': {
+          if( i>=2 && sqliteStrNICmp(&z[i-2],"text",4)==0 ){
+            pCol->sortOrder = SQLITE_SO_TEXT;
+            return;
+          }
+          break;
+        }
+        default: {
+          break;
         }
-        break;
-      }
-      default: {
-        break;
       }
     }
   }
index 637905c425487a4c66ce60730de3843442ed9673..6923951f94ba8b6f231d4c2e21c35e24528a6be4 100644 (file)
@@ -30,7 +30,7 @@
 ** But other routines are also provided to help in building up
 ** a program instruction by instruction.
 **
-** $Id: vdbe.c,v 1.168 2002/08/13 23:02:57 drh Exp $
+** $Id: vdbe.c,v 1.169 2002/08/15 01:26:10 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -2806,10 +2806,11 @@ case OP_IncrKey: {
   VERIFY( if( tos<0 ) goto bad_instruction );
   if( Stringify(p, tos) ) goto no_mem;
   if( aStack[tos].flags & STK_Static ){
-    char *zNew = sqliteMalloc( aStack[tos].n );
-    memcpy(zNew, zStack[tos], aStack[tos].n);
-    zStack[tos] = zNew;
-    aStack[tos].flags = STK_Str | STK_Dyn;
+    /* CANT HAPPEN.  The IncrKey opcode is only applied to keys
+    ** generated by MakeKey or MakeIdxKey and the results of those
+    ** operands are always dynamic strings.
+    */
+    goto abort_due_to_error;
   }
   zStack[tos][aStack[tos].n-1]++;
   break;
index 8ec0c83d1473d5fc4855a405f8fa11dc7de4ebad..292bf4c32d26af2beb16ae5c4b18cceaa6452f84 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing expressions.
 #
-# $Id: expr.test,v 1.26 2002/08/13 23:02:58 drh Exp $
+# $Id: expr.test,v 1.27 2002/08/15 01:26:11 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -122,7 +122,10 @@ test_expr expr-1.94 {i1=NULL, i2=8} {2 between i1 and i2} {{}}
 test_expr expr-1.95 {i1=NULL, i2=8} {2 not between i1 and i2} {{}}
 test_expr expr-1.94 {i1=NULL, i2=8} {55 between i1 and i2} 0
 test_expr expr-1.95 {i1=NULL, i2=8} {55 not between i1 and i2} 1
-
+test_expr expr-1.96 {i1=NULL, i2=3} {coalesce(i1<<i2,99)} 99
+test_expr expr-1.97 {i1=32, i2=NULL} {coalesce(i1>>i2,99)} 99
+test_expr expr-1.98 {i1=NULL, i2=NULL} {coalesce(i1|i2,99)} 99
+test_expr expr-1.99 {i1=32, i2=NULL} {coalesce(i1&i2,99)} 99
 
 test_expr expr-2.1 {r1=1.23, r2=2.34} {r1+r2} 3.57
 test_expr expr-2.2 {r1=1.23, r2=2.34} {r1-r2} -1.11
@@ -184,6 +187,19 @@ test_expr expr-3.29 {t1='xyz', t2='abc'} {t1||t2} {xyzabc}
 test_expr expr-3.30 {t1=NULL, t2='abc'} {t1||t2} {{}}
 test_expr expr-3.31 {t1='xyz', t2=NULL} {t1||t2} {{}}
 test_expr expr-3.32 {t1='xyz', t2='abc'} {t1||' hi '||t2} {{xyz hi abc}}
+test_expr epxr-3.33 {t1='abc', t2=NULL} {coalesce(t1<t2,99)} 99
+test_expr epxr-3.34 {t1='abc', t2=NULL} {coalesce(t2<t1,99)} 99
+test_expr epxr-3.35 {t1='abc', t2=NULL} {coalesce(t1>t2,99)} 99
+test_expr epxr-3.36 {t1='abc', t2=NULL} {coalesce(t2>t1,99)} 99
+test_expr epxr-3.37 {t1='abc', t2=NULL} {coalesce(t1<=t2,99)} 99
+test_expr epxr-3.38 {t1='abc', t2=NULL} {coalesce(t2<=t1,99)} 99
+test_expr epxr-3.39 {t1='abc', t2=NULL} {coalesce(t1>=t2,99)} 99
+test_expr epxr-3.40 {t1='abc', t2=NULL} {coalesce(t2>=t1,99)} 99
+test_expr epxr-3.41 {t1='abc', t2=NULL} {coalesce(t1==t2,99)} 99
+test_expr epxr-3.42 {t1='abc', t2=NULL} {coalesce(t2==t1,99)} 99
+test_expr epxr-3.43 {t1='abc', t2=NULL} {coalesce(t1!=t2,99)} 99
+test_expr epxr-3.44 {t1='abc', t2=NULL} {coalesce(t2!=t1,99)} 99
+
 
 test_expr expr-4.1 {t1='abc', t2='Abc'} {t1<t2} 0
 test_expr expr-4.2 {t1='abc', t2='Abc'} {t1>t2} 1
@@ -439,6 +455,10 @@ test_expr2 expr-7.39 {a<2 OR (b=0 AND a<0)} {1}
 test_expr2 expr-7.40 {((a<2 OR a IS NULL) AND b<3) OR b>1e10} {{} 1}
 test_expr2 expr-7.41 {a BETWEEN -1 AND 1} {1}
 test_expr2 expr-7.42 {a NOT BETWEEN 2 AND 100} {1}
+test_expr2 expr-7.43 {(b+1234)||'this is a string that is at least 32 characters long' BETWEEN 1 AND 2} {}
+test_expr2 expr-7.44 {123||'xabcdefghijklmnopqrstuvwyxz01234567890'||a BETWEEN '123a' AND '123b'} {}
+test_expr2 expr-7.45 {((123||'xabcdefghijklmnopqrstuvwyxz01234567890'||a) BETWEEN '123a' AND '123b')<0} {}
+test_expr2 expr-7.46 {((123||'xabcdefghijklmnopqrstuvwyxz01234567890'||a) BETWEEN '123a' AND '123z')>0} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20}
 
 test_expr2 expr-7.50 {((a between 1 and 2 OR 0) AND 1) OR 0} {1 2}
 test_expr2 expr-7.51 {((a not between 3 and 100 OR 0) AND 1) OR 0} {1 2}
@@ -450,6 +470,6 @@ test_expr2 expr-7.56 {((a not in (3,4,5,6,7,8,9,10) IS NULL OR 0) AND 1) OR 0} \
    {{}}
 test_expr2 expr-7.57 {((a>0 IS NULL OR 0) AND 1) OR 0} {{}}
 
-
+test_expr2 expr-7.58  {(a||'')<='1'}                  {1}
 
 finish_test
index 033cc2a60c35dc3b4acd7c6fae3618ec51b054b1..1118001b158933f34410dc600d0d9a63a0a1c286 100644 (file)
@@ -13,7 +13,7 @@
 # This file implements tests for the special processing associated
 # with INTEGER PRIMARY KEY columns.
 #
-# $Id: intpkey.test,v 1.10 2002/06/19 20:32:45 drh Exp $
+# $Id: intpkey.test,v 1.11 2002/08/15 01:26:11 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -462,4 +462,18 @@ do_test intpkey-10.3 {
   }
 } {1 1 2 2 2 3 3 2 1 4 3 2}
 
+# This tests checks to see if a floating point number can be used
+# to reference an integer primary key.
+#
+do_test intpkey-11.1 {
+  execsql {
+    SELECT b FROM t1 WHERE a=2.0+3.0;
+  }
+} {hello}
+do_test intpkey-11.1 {
+  execsql {
+    SELECT b FROM t1 WHERE a=2.0+3.5;
+  }
+} {}
+
 finish_test