From dab35188805d23c09bdeb41b3ddb9cb131a6b7a4 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 27 Sep 2003 13:39:38 +0000 Subject: [PATCH] Remove support for the Oracle8 outer join syntax. (CVS 1106) FossilOrigin-Name: 824430b3ce435386b83ceb882f1510ac9f27d8fa --- manifest | 22 +++++++++--------- manifest.uuid | 2 +- src/parse.y | 5 +---- src/select.c | 59 +------------------------------------------------ src/sqliteInt.h | 3 +-- src/tokenize.c | 15 +++++-------- src/where.c | 4 +--- test/join.test | 54 +------------------------------------------- 8 files changed, 22 insertions(+), 142 deletions(-) diff --git a/manifest b/manifest index 2e3826829b..358dd3af6c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\stest\scase\sfor\sticket\s#464\sbut\sleave\sit\scommented\sout\sfor\snow.\s\sWe\nwill\sfix\sthis\sproblem\swhen\sVACUUM\sis\srewritten.\s(CVS\s1105) -D 2003-09-27T01:08:38 +C Remove\ssupport\sfor\sthe\sOracle8\souter\sjoin\ssyntax.\s(CVS\s1106) +D 2003-09-27T13:39:39 F Makefile.in ab585a91e34bc33928a1b6181fa2f6ebd4fb17e1 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -41,22 +41,22 @@ F src/os.c 97df440bc71f65e22df5d3d920ce39551c0a5f5a F src/os.h 729395fefcca4b81ae056aa9ff67b72bb40dd9e0 F src/pager.c 62702dff51d50694d039bc210f31990d1fbba2dd F src/pager.h 5da62c83443f26b1792cfd72c96c422f91aadd31 -F src/parse.y 121daf2125dc2023029398a2ef38feb86cb5306a +F src/parse.y 8ef7f4e09bfa28d9b545ae9c3f2338532264d4cd F src/pragma.c cee60f17679210e8acd30d5bdee855716d0c898c F src/printf.c 12e45d482ac8abcc6f786fc99e5bed7dd9a51af0 F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe -F src/select.c 2fa83d6c972d3e3f379faee32e3621411490dedb +F src/select.c d79ac60ba1595ff3c94b12892e87098329776482 F src/shell.c c2ba26c850874964f5ec1ebf6c43406f28e44c4a F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e F src/sqlite.h.in f8ae61546942e5a81df0ce3118048bec8dc87be4 -F src/sqliteInt.h 8901c15945b3b0f7ef4c13ebbc2deeb4765014d5 +F src/sqliteInt.h 5f706313beafcc2da8102c807c35e18b2b0a3572 F src/table.c 4301926464d88d2c2c7cd21c3360aa75bf068b95 F src/tclsqlite.c ec9e5b796bf9ec1483927e986828a205d4a7422a F src/test1.c f9d5816610f7ec4168ab7b098d5207a5708712b6 F src/test2.c 5014337d8576b731cce5b5a14bec4f0daf432700 F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5 F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e -F src/tokenize.c 8df640021c7a18f75411a8fd25adbb76bf528e7e +F src/tokenize.c e14db6bfa972a7c449c80788fcdbc0fdc11b17d7 F src/trigger.c 474581eaab388233df01bb019e558af2965decbf F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397 F src/util.c f16efa2d60bfd4e31ae06b07ed149557e828d294 @@ -65,7 +65,7 @@ F src/vdbe.c a9923a38a24ee86dd2e237c9f7e9d0116e329394 F src/vdbe.h 3957844e46fea71fd030e78f6a3bd2f7e320fb43 F src/vdbeInt.h 2824bf88895b901b3a8c9e44527c67530e1c0dcb F src/vdbeaux.c 1145fa169021d7fb3962fab6e99f5f8fc2608f8a -F src/where.c 1e8d20d3997b5231f25b1f377fefe58aa49bf604 +F src/where.c 6bd1d2a9c70af63a6e47b0ab0c181d501b12514f F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 F test/attach.test c26848402e7ac829e043e1fa5e0eb87032e5d81d F test/attach2.test 6f98cc2b929d88dc5f82d95d04e9b89b3b5dead3 @@ -93,7 +93,7 @@ F test/insert.test a17b7f7017097afb2727aa5b67ceeb7ab0a120a1 F test/insert2.test c288375a64dad3295044714f0dfed4a193cf067f F test/intpkey.test 9320af48415c594afd4e15f8ef0daa272e05502e F test/ioerr.test 5dbaf09f96b56ee01cf3edd762b96eb4ad2c9ca4 -F test/join.test 54e770b74fc8cfc7769d5d0bb05657085641b3c4 +F test/join.test 9ef6aabaac9de51d5fc41e68d1f4355da05a84cd F test/limit.test fa2a8b3fe377ebe60e0bc9a6a35af9ac4eb3d2b3 F test/lock.test 388a3a10962d2d571c0c1821cc35bf069ee73473 F test/main.test 6a851b5992c4881a725a3d9647e629199df8de9d @@ -173,7 +173,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3 F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 -P 70a50bdda318f353c8be1ba200f9aedc34642c93 -R 50a4bcfb552b00bc9b0eb7d25299b64b +P 7ba8dc9b1e5c788f2c0ab32314754324c86aaa49 +R d4965d04af9f20f2d75ac0d6d17708ce U drh -Z 6825cd4a85a62f9514c9cd13ae2aebc8 +Z 567bb6ac7132028bfeb59eb0a4fa6475 diff --git a/manifest.uuid b/manifest.uuid index 64f6bee165..14fbf2f1e0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7ba8dc9b1e5c788f2c0ab32314754324c86aaa49 \ No newline at end of file +824430b3ce435386b83ceb882f1510ac9f27d8fa \ No newline at end of file diff --git a/src/parse.y b/src/parse.y index 21c033b103..22931b37d1 100644 --- a/src/parse.y +++ b/src/parse.y @@ -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.101 2003/09/06 22:18:08 drh Exp $ +** @(#) $Id: parse.y,v 1.102 2003/09/27 13:39:39 drh Exp $ */ %token_prefix TK_ %token_type {Token} @@ -515,7 +515,6 @@ inscollist(A) ::= nm(Y). {A = sqliteIdListAppend(0,&Y);} %left STAR SLASH REM. %left CONCAT. %right UMINUS UPLUS BITNOT. -%right ORACLE_OUTER_JOIN. %type expr {Expr*} %destructor expr {sqliteExprDelete($$);} @@ -536,8 +535,6 @@ expr(A) ::= nm(X) DOT nm(Y) DOT nm(Z). { Expr *temp4 = sqliteExpr(TK_DOT, temp2, temp3, 0); A = sqliteExpr(TK_DOT, temp1, temp4, 0); } -expr(A) ::= expr(B) ORACLE_OUTER_JOIN. - {A = B; ExprSetProperty(A,EP_Oracle8Join);} expr(A) ::= INTEGER(X). {A = sqliteExpr(TK_INTEGER, 0, 0, &X);} expr(A) ::= FLOAT(X). {A = sqliteExpr(TK_FLOAT, 0, 0, &X);} expr(A) ::= STRING(X). {A = sqliteExpr(TK_STRING, 0, 0, &X);} diff --git a/src/select.c b/src/select.c index e648df2daf..ae41de7ca3 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.145 2003/07/20 01:16:47 drh Exp $ +** $Id: select.c,v 1.146 2003/09/27 13:39:39 drh Exp $ */ #include "sqliteInt.h" @@ -278,62 +278,6 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){ return 0; } -/* -** This routine implements a minimal Oracle8 join syntax immulation. -** The precise oracle8 syntax is not implemented - it is easy enough -** to get this routine confused. But this routine does make it possible -** to write a single SQL statement that does a left outer join in both -** oracle8 and in SQLite. -** -** This routine looks for TK_COLUMN expression nodes that are marked -** with the EP_Oracle8Join property. Such nodes are generated by a -** column name (either "column" or "table.column") that is followed by -** the special "(+)" operator. If the table of the column marked with -** the (+) operator is the second are subsequent table in a join, then -** that table becomes the left table in a LEFT OUTER JOIN. The expression -** that uses that table becomes part of the ON clause for the join. -** -** It is important to enphasize that this is not exactly how oracle8 -** works. But it is close enough so that one can construct queries that -** will work correctly for both SQLite and Oracle8. -*/ -static int sqliteOracle8JoinFixup( - SrcList *pSrc, /* List of tables being joined */ - Expr *pWhere /* The WHERE clause of the SELECT statement */ -){ - int rc = 0; - if( ExprHasProperty(pWhere, EP_Oracle8Join) && pWhere->op==TK_COLUMN ){ - int idx; - for(idx=0; idxnSrc; idx++){ - if( pSrc->a[idx].iCursor==pWhere->iTable ) break; - } - assert( idx>=0 && idxnSrc ); - if( idx>0 ){ - pSrc->a[idx-1].jointype &= ~JT_INNER; - pSrc->a[idx-1].jointype |= JT_OUTER|JT_LEFT; - return 1; - } - } - if( pWhere->pRight ){ - rc = sqliteOracle8JoinFixup(pSrc, pWhere->pRight); - } - if( pWhere->pLeft ){ - rc |= sqliteOracle8JoinFixup(pSrc, pWhere->pLeft); - } - if( pWhere->pList ){ - int i; - ExprList *pList = pWhere->pList; - for(i=0; inExpr && rc==0; i++){ - rc |= sqliteOracle8JoinFixup(pSrc, pList->a[i].pExpr); - } - } - if( rc==1 && (pWhere->op==TK_AND || pWhere->op==TK_EQ) ){ - setJoinExpr(pWhere); - rc = 0; - } - return rc; -} - /* ** Delete the given Select structure and all of its substructures. */ @@ -2125,7 +2069,6 @@ int sqliteSelect( if( sqliteExprCheck(pParse, pWhere, 0, 0) ){ goto select_end; } - sqliteOracle8JoinFixup(pTabList, pWhere); } if( pHaving ){ if( pGroupBy==0 ){ diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 500bcf4751..1b9322b052 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.198 2003/09/06 22:18:08 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.199 2003/09/27 13:39:39 drh Exp $ */ #include "config.h" #include "sqlite.h" @@ -635,7 +635,6 @@ struct Expr { ** The following are the meanings of bits in the Expr.flags field. */ #define EP_FromJoin 0x0001 /* Originated in ON or USING clause of a join */ -#define EP_Oracle8Join 0x0002 /* Carries the Oracle8 "(+)" join operator */ /* ** These macros can be used to test, set, or clear bits in the diff --git a/src/tokenize.c b/src/tokenize.c index f99cb7131f..d83d3cabf5 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -15,7 +15,7 @@ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** -** $Id: tokenize.c,v 1.63 2003/09/12 02:08:15 drh Exp $ +** $Id: tokenize.c,v 1.64 2003/09/27 13:39:39 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -29,8 +29,8 @@ typedef struct Keyword Keyword; struct Keyword { char *zName; /* The keyword name */ - int len; /* Number of characters in the keyword */ - int tokenType; /* The token value for this keyword */ + u16 len; /* Number of characters in the keyword */ + u16 tokenType; /* The token value for this keyword */ Keyword *pNext; /* Next keyword with the same hash */ }; @@ -235,13 +235,8 @@ static int sqliteGetToken(const unsigned char *z, int *tokenType){ return 1; } case '(': { - if( z[1]=='+' && z[2]==')' ){ - *tokenType = TK_ORACLE_OUTER_JOIN; - return 3; - }else{ - *tokenType = TK_LP; - return 1; - } + *tokenType = TK_LP; + return 1; } case ')': { *tokenType = TK_RP; diff --git a/src/where.c b/src/where.c index 226c841dfd..6505b28864 100644 --- a/src/where.c +++ b/src/where.c @@ -12,7 +12,7 @@ ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. ** -** $Id: where.c,v 1.82 2003/09/27 00:41:28 drh Exp $ +** $Id: where.c,v 1.83 2003/09/27 13:39:39 drh Exp $ */ #include "sqliteInt.h" @@ -25,8 +25,6 @@ typedef struct ExprInfo ExprInfo; struct ExprInfo { Expr *p; /* Pointer to the subexpression */ u8 indexable; /* True if this subexprssion is usable by an index */ - u8 oracle8join; /* -1 if left side contains "(+)". +1 if right side - ** contains "(+)". 0 if neither contains "(+)" */ short int idxLeft; /* p->pLeft is a column in this table number. -1 if ** p->pLeft is not the column of any table */ short int idxRight; /* p->pRight is a column in this table number. -1 if diff --git a/test/join.test b/test/join.test index c7b4835f46..03766cac9c 100644 --- a/test/join.test +++ b/test/join.test @@ -12,7 +12,7 @@ # # This file implements tests for joins, including outer joins. # -# $Id: join.test,v 1.10 2003/06/16 00:40:35 drh Exp $ +# $Id: join.test,v 1.11 2003/09/27 13:39:40 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -300,58 +300,6 @@ do_test join-5.1 { } } {1 a xxx 2 b xxx 3 c {}} -# Test the goofy Oracle8 outer join syntax. -# -do_test join-6.1 { - execsql { - DELETE FROM t1; - INSERT INTO t1 VALUES(1,2,3); - INSERT INTO t1 VALUES(2,3,4); - INSERT INTO t1 VALUES(3,4,5); - SELECT * FROM t1; - } -} {1 2 3 2 3 4 3 4 5} -do_test join-6.2 { - execsql { - DELETE FROM t2; - INSERT INTO t2 VALUES(1,2,3); - INSERT INTO t2 VALUES(2,3,4); - INSERT INTO t2 VALUES(3,4,5); - SELECT * FROM t2; - } -} {1 2 3 2 3 4 3 4 5} -do_test join-6.3 { - execsql { - SELECT * FROM t1 LEFT OUTER JOIN t2 ON (t1.a=t2.c); - } -} {1 2 3 {} {} {} 2 3 4 1 2 3 3 4 5 2 3 4} -do_test join-6.4 { - execsql { - SELECT * FROM t1, t2 WHERE t1.a=t2.c(+); - } -} {1 2 3 {} {} {} 2 3 4 1 2 3 3 4 5 2 3 4} -do_test join-6.5 { - execsql { - SELECT * FROM t1 LEFT OUTER JOIN t2 ON (t1.a=t2.c) WHERE t1.b=2 - } -} {1 2 3 {} {} {}} -do_test join-6.6 { - execsql { - SELECT * FROM t1, t2 WHERE t1.a=t2.c(+) AND t1.b=2; - } -} {1 2 3 {} {} {}} -do_test join-6.7 { - execsql { - SELECT * FROM t1 LEFT OUTER JOIN t2 ON (t1.b=t2.b AND t1.c=t2.c) - } -} {1 2 3 2 3 4 2 3 4 3 4 5 3 4 5 {} {} {}} -do_test join-6.8 { - execsql { - SELECT * FROM t1, t2 WHERE t1.b=t2.b(+) AND t1.c=t2.c(+); - } -} {1 2 3 2 3 4 2 3 4 3 4 5 3 4 5 {} {} {}} - - # A test for ticket #247. # do_test join-7.1 {