diff options
author | drh <drh@noemail.net> | 2002-05-25 00:18:20 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2002-05-25 00:18:20 +0000 |
commit | 195e6967fb489401471c7ab99e3c4042d07347f4 (patch) | |
tree | 41d1a548d97a4bef7a7232f7dfc6414a9c57c137 /src | |
parent | ad2d8307aceaab85fbf827338bb8274dbf7c36de (diff) | |
download | sqlite-195e6967fb489401471c7ab99e3c4042d07347f4.tar.gz sqlite-195e6967fb489401471c7ab99e3c4042d07347f4.zip |
Additional testing of LEFT OUTER JOIN. (CVS 588)
FossilOrigin-Name: d8d04c14f18d1feba89ccea0be70530a18248c51
Diffstat (limited to 'src')
-rw-r--r-- | src/select.c | 18 | ||||
-rw-r--r-- | src/sqliteInt.h | 7 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/select.c b/src/select.c index f6b719984..e4117f9d6 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.84 2002/05/24 20:31:37 drh Exp $ +** $Id: select.c,v 1.85 2002/05/25 00:18:21 drh Exp $ */ #include "sqliteInt.h" @@ -81,9 +81,9 @@ int sqliteJoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){ int code; } keywords[] = { { "natural", 7, JT_NATURAL }, - { "left", 4, JT_LEFT }, - { "right", 5, JT_RIGHT }, - { "full", 4, JT_FULL }, + { "left", 4, JT_LEFT|JT_OUTER }, + { "right", 5, JT_RIGHT|JT_OUTER }, + { "full", 4, JT_LEFT|JT_RIGHT|JT_OUTER }, { "outer", 5, JT_OUTER }, { "inner", 5, JT_INNER }, { "cross", 5, JT_INNER }, @@ -92,7 +92,7 @@ int sqliteJoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){ apAll[0] = pA; apAll[1] = pB; apAll[2] = pC; - for(i=0; apAll[i]; i++){ + for(i=0; i<3 && apAll[i]; i++){ p = apAll[i]; for(j=0; j<sizeof(keywords)/sizeof(keywords[0]); j++){ if( p->n==keywords[j].nChar @@ -108,8 +108,7 @@ int sqliteJoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){ } if( (jointype & (JT_INNER|JT_OUTER))==(JT_INNER|JT_OUTER) || - (jointype & JT_ERROR)!=0 || - (jointype & JT_RIGHT)==JT_RIGHT + (jointype & JT_ERROR)!=0 ){ static Token dummy = { 0, 0 }; char *zSp1 = " ", *zSp2 = " "; @@ -119,6 +118,11 @@ int sqliteJoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){ pA->z, pA->n, zSp1, 1, pB->z, pB->n, zSp2, 1, pC->z, pC->n, 0); pParse->nErr++; jointype = JT_INNER; + }else if( jointype & JT_RIGHT ){ + sqliteSetString(&pParse->zErrMsg, + "RIGHT and FULL OUTER JOINs are not currently supported", 0); + pParse->nErr++; + jointype = JT_INNER; } return jointype; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index d323174e7..77cfe6282 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.115 2002/05/24 20:31:37 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.116 2002/05/25 00:18:21 drh Exp $ */ #include "sqlite.h" #include "hash.h" @@ -461,9 +461,8 @@ struct SrcList { */ #define JT_INNER 0x0001 /* Any kind of inner or cross join */ #define JT_NATURAL 0x0002 /* True for a "natural" join */ -#define JT_LEFT 0x0014 /* Left outer join */ -#define JT_RIGHT 0x0018 /* Right outer join */ -#define JT_FULL 0x001a /* Combination of left and right outer join */ +#define JT_LEFT 0x0004 /* Left outer join */ +#define JT_RIGHT 0x0008 /* Right outer join */ #define JT_OUTER 0x0010 /* The "OUTER" keyword is present */ #define JT_ERROR 0x0020 /* unknown or unsupported join type */ |