mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Remove support for the Oracle8 outer join syntax. (CVS 1106)
FossilOrigin-Name: 824430b3ce435386b83ceb882f1510ac9f27d8fa
This commit is contained in:
59
src/select.c
59
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; idx<pSrc->nSrc; idx++){
|
||||
if( pSrc->a[idx].iCursor==pWhere->iTable ) break;
|
||||
}
|
||||
assert( idx>=0 && idx<pSrc->nSrc );
|
||||
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; i<pList->nExpr && 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 ){
|
||||
|
||||
Reference in New Issue
Block a user