]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix problems with types and the recognition of BLOB as having no affinity. (CVS 1418)
authordrh <drh@noemail.net>
Thu, 20 May 2004 12:41:19 +0000 (12:41 +0000)
committerdrh <drh@noemail.net>
Thu, 20 May 2004 12:41:19 +0000 (12:41 +0000)
FossilOrigin-Name: 8411718f0ac17e9c2376fdf8b5fa0cc5fc88be9b

manifest
manifest.uuid
src/build.c
src/parse.y
test/types.test
test/types2.test

index 2cc7ca341fd074d64b546a71b83f75158d04188c..27ab9e542f0885d194e7e5ed089c0af472e8b073 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Default\stype\saffinity\sis\snow\sNUMERIC.\s\sThe\saffinity.html\sfile\schecked\sinto\nthe\sdoc\sdirectory.\s(CVS\s1417)
-D 2004-05-20T12:10:20
+C Fix\sproblems\swith\stypes\sand\sthe\srecognition\sof\sBLOB\sas\shaving\sno\saffinity.\s(CVS\s1418)
+D 2004-05-20T12:41:20
 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -27,7 +27,7 @@ F src/auth.c 5c2f0bea4729c98c2be3b69d6b466fc51448fe79
 F src/btree.c 7abf1261c204e23aeeef12ec1bf75f5eca57d469
 F src/btree.h b65140b5ae891f30d2a39e64b9f0343225553545
 F src/btree_rb.c 9d7973e266ee6f9c61ce592f68742ce9cd5b10e5
-F src/build.c c3e7b98a5b4de896fdb6cfe749518902baed66fe
+F src/build.c 7310eb68de59281c6dbfe49b728200e3d89b91dd
 F src/copy.c 4d2038602fd0549d80c59bda27d96f13ea9b5e29
 F src/date.c 0eb0a89960bb45c7f7e768748605a7a97b0c8064
 F src/delete.c 2e1dda38345416a1ea1c0a6468589a7472334dac
@@ -43,7 +43,7 @@ F src/os.c ddcda92f7fd71b4513c57c1ec797917f206d504e
 F src/os.h 6e446a17cbeb6c2ce470683a0bb8d9c63abe8607
 F src/pager.c 6ff6b906427d4824099140776cb8768f922f3dc5
 F src/pager.h 78a00ac280899bcba1a89dc51585dcae6b7b3253
-F src/parse.y d2e226650738931c047c2562326ed05882af2330
+F src/parse.y 4ed66f12583796dd4d5fff6860dc7e16f1d15cae
 F src/pragma.c 2332e7fa9d7cd4b21f30583a696bee36628404ca
 F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53
 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
@@ -146,8 +146,8 @@ F test/trigger1.test 4538c1c7d6bbca5dfe619ea6e1682b07ece95b21
 F test/trigger2.test 0767ab30cb5a2c8402c8524f3d566b410b6f5263
 F test/trigger3.test a95ccace88291449f5eae7139ec438a42f90654d
 F test/trigger4.test 542afce45774e8f8e1130b96b8675f414d6e4bd8
-F test/types.test a16dad25e2a7591ddbca206b465a963953f5e10f
-F test/types2.test b9b528e5ec6c5d8ee149ff27d48a23ce3f6075d9
+F test/types.test e1e0d71c8e65f8aa5d9a36751f4c8cbce6f01f7a
+F test/types2.test 5d725fcb68dbd032c6d4950d568d75fa33872687
 F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
 F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217
 F test/vacuum.test a2a44544df719666efb51afbfeb6062fd59a672a
@@ -195,7 +195,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 2821767b947ae1a70e98dd7f47d69e424c37947f
-R 47e063b297603452597f44008f0d5f06
+P 948307f07d6f8cc1cc186167ff7aaa5dfd5d8a2e
+R 59f05a5952887901890856f7cd04108e
 U drh
-Z f81faf25453e97891fc89436b647ef37
+Z 90bb81f98be65daf25dbb23b209b7296
index 98ae4dbb81dae3d87ba5e526989a680e41426e03..ba13805a3723f4ce8900d611c62882994aea4542 100644 (file)
@@ -1 +1 @@
-948307f07d6f8cc1cc186167ff7aaa5dfd5d8a2e
\ No newline at end of file
+8411718f0ac17e9c2376fdf8b5fa0cc5fc88be9b
\ No newline at end of file
index 1a59e6a7c75414177505cd94866c5e982d42a645..cd9bac81b2cccd5b0fbe07399b2020bae54c737f 100644 (file)
@@ -23,7 +23,7 @@
 **     ROLLBACK
 **     PRAGMA
 **
-** $Id: build.c,v 1.188 2004/05/20 12:10:20 drh Exp $
+** $Id: build.c,v 1.189 2004/05/20 12:41:20 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -587,10 +587,10 @@ void sqlite3AddColumn(Parse *pParse, Token *pName){
   pCol->zName = z;
  
   /* If there is no type specified, columns have the default affinity
-  ** 'NONE'. If there is a type specified, then sqlite3AddColumnType()
+  ** 'NUMERIC'. If there is a type specified, then sqlite3AddColumnType()
   ** will be called next to set pCol->affinity correctly.
   */
-  pCol->affinity = SQLITE_AFF_NONE;
+  pCol->affinity = SQLITE_AFF_NUMERIC;
   p->nCol++;
 }
 
index 952175ad5dcc0e6243ad1d73a484279e56cb621c..c4dad6906c8101feb6a5176fcd5985d5e8e5a612 100644 (file)
@@ -14,7 +14,7 @@
 ** the parser.  Lemon will also generate a header file containing
 ** numeric codes for all of the tokens.
 **
-** @(#) $Id: parse.y,v 1.114 2004/05/18 10:06:25 danielk1977 Exp $
+** @(#) $Id: parse.y,v 1.115 2004/05/20 12:41:20 drh Exp $
 */
 %token_prefix TK_
 %token_type {Token}
@@ -162,8 +162,8 @@ type ::= typename(X) LP signed RP(Y).    {sqlite3AddColumnType(pParse,&X,&Y);}
 type ::= typename(X) LP signed COMMA signed RP(Y).
                                          {sqlite3AddColumnType(pParse,&X,&Y);}
 %type typename {Token}
-typename(A) ::= ids(X).           {A = X;}
-typename(A) ::= typename(X) ids.  {A = X;}
+typename(A) ::= ids(X).             {A = X;}
+typename(A) ::= typename(X) ids(Y). {A.z=X.z; A.n=X.n+Addr(Y.z)-Addr(X.z);}
 %type signed {int}
 signed(A) ::= INTEGER(X).         { A = atoi(X.z); }
 signed(A) ::= PLUS INTEGER(X).    { A = atoi(X.z); }
@@ -895,6 +895,3 @@ database_kw_opt ::= .
 cmd ::= DETACH database_kw_opt nm(D). {
   sqlite3Detach(pParse, &D);
 }
-
-
-
index ed6d2f6261c73c03d426827b7e4aeef264781533..e37bdb475370f82a1fefa830198f792774f548ab 100644 (file)
@@ -12,7 +12,7 @@
 # it tests that the different storage classes (integer, real, text etc.)
 # all work correctly.
 #
-# $Id: types.test,v 1.4 2004/05/18 10:06:26 danielk1977 Exp $
+# $Id: types.test,v 1.5 2004/05/20 12:41:20 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -41,7 +41,7 @@ source $testdir/tester.tcl
 # Create a table with one column for each type of affinity
 do_test types-1.1.0 {
   execsql {
-    CREATE TABLE t1(i integer, n numeric, t text, o);
+    CREATE TABLE t1(i integer, n numeric, t text, o blob);
   }
 } {}
 
@@ -51,16 +51,16 @@ do_test types-1.1.0 {
 # four value are the storage classes that would be used if the
 # literal were inserted into a column with affinity INTEGER, NUMERIC, TEXT
 # or NONE, respectively.
-set values [list \
-  [list 5.0   INTEGER REAL    TEXT REAL] \
-  [list 5     INTEGER INTEGER TEXT INTEGER] \
-  [list '5.0' INTEGER REAL    TEXT TEXT] \
-  [list '-5.0' INTEGER REAL    TEXT TEXT] \
-  [list '-5.0' INTEGER REAL    TEXT TEXT] \
-  [list '5'   INTEGER INTEGER TEXT TEXT] \
-  [list 'abc' TEXT    TEXT    TEXT TEXT] \
-  [list NULL  NULL    NULL    NULL NULL] \
-]
+set values {
+  { 5.0    INTEGER REAL    TEXT REAL    }
+  { 5      INTEGER INTEGER TEXT INTEGER }
+  { '5.0'  INTEGER REAL    TEXT TEXT    }
+  { '-5.0' INTEGER REAL    TEXT TEXT    }
+  { '-5.0' INTEGER REAL    TEXT TEXT    }
+  { '5'    INTEGER INTEGER TEXT TEXT    }
+  { 'abc'  TEXT    TEXT    TEXT TEXT    }
+  { NULL   NULL    NULL    NULL NULL    }
+}
 
 # This code tests that the storage classes specified above (in the $values
 # table) are correctly assigned when values are inserted using a statement
@@ -291,4 +291,3 @@ do_test types-2.5.3 {
 } [list {} $string10 4000 $string500 4000 {} 4000 {} $string500000]
 
 finish_test
-
index 10846779997bc204127abf68dc985ea5693ee71e..c74d0b16492186192c1f27fa5f911251c96c4917 100644 (file)
@@ -12,7 +12,7 @@
 # of this file is testing the interaction of manifest types, type affinity
 # and comparison expressions.
 #
-# $Id: types2.test,v 1.2 2004/05/17 10:48:58 danielk1977 Exp $
+# $Id: types2.test,v 1.3 2004/05/20 12:41:20 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -40,8 +40,8 @@ execsql {
     n2 NUMERIC,
     t1 TEXT,
     t2 TEXT,
-    o1,
-    o2
+    o1 BLOB,
+    o2 BLOB
   );
   INSERT INTO t1 VALUES(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 }
@@ -99,7 +99,7 @@ set vals [list 10 10.0 '10' '10.0' 20 20.0 '20' '20.0' 30 30.0 '30' '30.0']
 #              1  2    3    4      5  6    7    8      9  10   11   12
 
 execsql {
-  CREATE TABLE t2(i INTEGER, n NUMERIC, t TEXT, o);
+  CREATE TABLE t2(i INTEGER, n NUMERIC, t TEXT, o XBLOBY);
   CREATE INDEX t2i1 ON t2(i);
   CREATE INDEX t2i2 ON t2(n);
   CREATE INDEX t2i3 ON t2(t);
@@ -247,7 +247,7 @@ test_boolset types2-6.9 {rowid IN (1, 6, 10)} {1 6 10}
 # Tests types2-7.* concentrate on expressions of the form 
 # "x IN (SELECT...)" with no index.
 execsql {
-  CREATE TABLE t3(i INTEGER, n NUMERIC, t TEXT, o);
+  CREATE TABLE t3(i INTEGER, n NUMERIC, t TEXT, o BLOB);
   INSERT INTO t3 VALUES(1, 1, 1, 1);
   INSERT INTO t3 VALUES(2, 2, 2, 2);
   INSERT INTO t3 VALUES(3, 3, 3, 3);
@@ -282,7 +282,7 @@ test_bool types2-7.15 {o1='2'} {o1 IN (SELECT o||'' FROM t3)} 1
 # set vals [list 10 10.0 '10' '10.0' 20 20.0 '20' '20.0' 30 30.0 '30' '30.0']
 #                1  2    3    4      5  6    7    8      9  10   11   12
 execsql {
-  CREATE TABLE t4(i INTEGER, n NUMERIC, t TEXT, o);
+  CREATE TABLE t4(i INTEGER, n NUMERIC, t VARCHAR(20), o LARGE BLOB);
   INSERT INTO t4 VALUES(10, 20, 20, 30);
 }
 test_boolset types2-8.1 {i IN (SELECT i FROM t4)} {1 2 3 4}
@@ -299,10 +299,3 @@ test_boolset types2-8.7 {t IN (SELECT o FROM t4)} {9 11}
 test_boolset types2-8.8 {o IN (SELECT o FROM t4)} {9 10}
 
 finish_test
-
-
-
-
-
-
-