aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/auth.c5
-rw-r--r--src/expr.c11
-rw-r--r--src/sqliteInt.h8
3 files changed, 13 insertions, 11 deletions
diff --git a/src/auth.c b/src/auth.c
index 9ae4fe97a..5630c239f 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -14,7 +14,7 @@
** systems that do not need this facility may omit it by recompiling
** the library with -DSQLITE_OMIT_AUTHORIZATION=1
**
-** $Id: auth.c,v 1.28 2007/09/01 18:24:55 danielk1977 Exp $
+** $Id: auth.c,v 1.29 2007/09/18 15:55:07 drh Exp $
*/
#include "sqliteInt.h"
@@ -105,6 +105,7 @@ static void sqliteAuthBadReturnCode(Parse *pParse, int rc){
void sqlite3AuthRead(
Parse *pParse, /* The parser context */
Expr *pExpr, /* The expression to check authorization on */
+ Schema *pSchema, /* The schema of the expression */
SrcList *pTabList /* All table that pExpr might refer to */
){
sqlite3 *db = pParse->db;
@@ -118,7 +119,7 @@ void sqlite3AuthRead(
if( db->xAuth==0 ) return;
if( pExpr->op!=TK_COLUMN ) return;
- iDb = sqlite3SchemaToIndex(pParse->db, pExpr->pSchema);
+ iDb = sqlite3SchemaToIndex(pParse->db, pSchema);
if( iDb<0 ){
/* An attempt to read a column out of a subquery or other
** temporary table. */
diff --git a/src/expr.c b/src/expr.c
index 5281c6a0e..0a7091a09 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.312 2007/09/01 18:24:55 danielk1977 Exp $
+** $Id: expr.c,v 1.313 2007/09/18 15:55:07 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -1014,6 +1014,7 @@ static int lookupName(
struct SrcList_item *pItem; /* Use for looping over pSrcList items */
struct SrcList_item *pMatch = 0; /* The matching pSrcList item */
NameContext *pTopNC = pNC; /* First namecontext in the list */
+ Schema *pSchema = 0; /* Schema of the expression */
assert( pColumnToken && pColumnToken->z ); /* The Z in X.Y.Z cannot be NULL */
zDb = sqlite3NameFromToken(db, pDbToken);
@@ -1052,7 +1053,7 @@ static int lookupName(
}
if( 0==(cntTab++) ){
pExpr->iTable = pItem->iCursor;
- pExpr->pSchema = pTab->pSchema;
+ pSchema = pTab->pSchema;
pMatch = pItem;
}
for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){
@@ -1062,7 +1063,7 @@ static int lookupName(
cnt++;
pExpr->iTable = pItem->iCursor;
pMatch = pItem;
- pExpr->pSchema = pTab->pSchema;
+ pSchema = pTab->pSchema;
/* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
pExpr->iColumn = j==pTab->iPKey ? -1 : j;
pExpr->affinity = pTab->aCol[j].affinity;
@@ -1116,7 +1117,7 @@ static int lookupName(
int iCol;
Column *pCol = pTab->aCol;
- pExpr->pSchema = pTab->pSchema;
+ pSchema = pTab->pSchema;
cntTab++;
for(iCol=0; iCol < pTab->nCol; iCol++, pCol++) {
if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
@@ -1263,7 +1264,7 @@ lookupname_end_2:
sqlite3_free(zCol);
if( cnt==1 ){
assert( pNC!=0 );
- sqlite3AuthRead(pParse, pExpr, pNC->pSrcList);
+ sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
if( pMatch && !pMatch->pSelect ){
pExpr->pTab = pMatch->pTab;
}
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index e342c527b..a336e58cb 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.608 2007/09/03 15:19:35 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.609 2007/09/18 15:55:07 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -736,7 +736,7 @@ struct Table {
int nModuleArg; /* Number of arguments to the module */
char **azModuleArg; /* Text of all module args. [0] is module name */
#endif
- Schema *pSchema;
+ Schema *pSchema; /* Schema that contains this table */
};
/*
@@ -1015,7 +1015,7 @@ struct Expr {
Select *pSelect; /* When the expression is a sub-select. Also the
** right side of "<expr> IN (<select>)" */
Table *pTab; /* Table for OP_Column expressions. */
- Schema *pSchema;
+/* Schema *pSchema; */
#if defined(SQLITE_TEST) || SQLITE_MAX_EXPR_DEPTH>0
int nHeight; /* Height of the tree headed by this node */
#endif
@@ -1746,7 +1746,7 @@ int sqlite3JoinType(Parse*, Token*, Token*, Token*);
void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
void sqlite3DeferForeignKey(Parse*, int);
#ifndef SQLITE_OMIT_AUTHORIZATION
- void sqlite3AuthRead(Parse*,Expr*,SrcList*);
+ void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*);
void sqlite3AuthContextPush(Parse*, AuthContext*, const char*);
void sqlite3AuthContextPop(AuthContext*);