|
|
Sponsor |
Re: [jira] Commented: (DERBY-18) Exposed name matching has bugs when the co: msg#00402apache.db.derby.devel
I am attaching the latest diffs for Derby-18. This tries to address Dan's comments in his previous mails. Let me know the whether the extra checks that I have added, in comparision to the diffs I sent out earlier are correct/sufficient. thanks Shreyas Shreyas Kaushik wrote: My answers inline.Index: java/engine/org/apache/derby/impl/sql/compile/FromList.java =================================================================== --- java/engine/org/apache/derby/impl/sql/compile/FromList.java (revision 148848) +++ java/engine/org/apache/derby/impl/sql/compile/FromList.java (working copy) @@ -138,6 +138,7 @@ */ TableName leftTable = null; TableName rightTable = null; + if (! (fromTable instanceof TableOperatorNode)) { /* Check for duplicate table name in FROM list */ @@ -146,12 +147,18 @@ { leftTable = fromTable.getTableName(); + if(leftTable.getSchemaName() == null && fromTable.correlationName == null) + leftTable.bind(this.getDataDictionary()); + if(((FromTable) elementAt(index)) instanceof TableOperatorNode) { continue; } - else { + else { rightTable = ((FromTable) elementAt(index)).getTableName(); + + if(rightTable.getSchemaName() == null && ((FromTable) elementAt(index)).correlationName == null) + rightTable.bind(this.getDataDictionary()); } if(leftTable.equals(rightTable)) { @@ -291,6 +298,7 @@ { fromTable = (FromTable) elementAt(index); setElementAt(fromTable.bindNonVTITables(dataDictionary, fromListParam), index); + } for (int index = 0; index < size; index++) { @@ -499,9 +507,9 @@ int size = size(); for (int index = 0; index < size; index++) { - fromTable = (FromTable) elementAt(index); + fromTable = (FromTable) elementAt(index); - /* We can stop if we've found a matching column or table name + /* We can stop if we've found a matching column or table name * at the previous nesting level. */ currentLevel = fromTable.getLevel(); Index: java/engine/org/apache/derby/impl/sql/compile/FromVTI.java =================================================================== --- java/engine/org/apache/derby/impl/sql/compile/FromVTI.java (revision 148848) +++ java/engine/org/apache/derby/impl/sql/compile/FromVTI.java (working copy) @@ -988,6 +988,13 @@ columnsTableName = columnReference.getTableNameNode(); + if(columnsTableName != null) + if(columnsTableName.getSchemaName() == null && correlationName == null) + columnsTableName.bind(this.getDataDictionary()); + + if(exposedName != null) + if(exposedName.getSchemaName() == null && correlationName == null) + exposedName.bind(this.getDataDictionary()); /* ** If the column did not specify a name, or the specified name ** matches the table we're looking at, see whether the column Index: java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java =================================================================== --- java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java (revision 148848) +++ java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java (working copy) @@ -2125,6 +2125,7 @@ { TableDescriptor tableDescriptor = bindTableDescriptor(); + /* if (tableDescriptor.getTableType() == TableDescriptor.VTI_TYPE) { ResultSetNode vtiNode = getNodeFactory().mapTableAsVTI(getContextManager(), tableDescriptor); return vtiNode.bindNonVTITables(dataDictionary, fromListParam); @@ -2445,6 +2446,10 @@ columnsTableName = columnReference.getTableNameNode(); + if(columnsTableName != null) { + if(columnsTableName.getSchemaName() == null && correlationName == null) + columnsTableName.bind(this.getDataDictionary()); + } /* ** If there is a correlation name, use that instead of the ** table name. @@ -2458,6 +2463,8 @@ exposedTableName = tableName; } + if(exposedTableName.getSchemaName() == null && correlationName == null) + exposedTableName.bind(this.getDataDictionary()); /* ** If the column did not specify a name, or the specified name ** matches the table we're looking at, see whether the column @@ -2465,6 +2472,7 @@ */ if (columnsTableName == null || columnsTableName.equals(exposedTableName)) { + resultColumn = resultColumns.getResultColumn(columnReference.getColumnName()); /* Did we find a match? */ if (resultColumn != null) @@ -2480,8 +2488,7 @@ tableDescriptor.setReferencedColumnMap(referencedColumnMap); } } - } - + } return resultColumn; } Index: java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java =================================================================== --- java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java (revision 148848) +++ java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java (working copy) @@ -305,6 +305,10 @@ columnsTableName = columnReference.getTableNameNode(); + if(columnsTableName != null) + if(columnsTableName.getSchemaName() == null && correlationName == null) + columnsTableName.bind(this.getDataDictionary()); + if (SanityManager.DEBUG) { SanityManager.ASSERT(preStmt!=null, "must have prepared statement"); @@ -324,6 +328,11 @@ SanityManager.ASSERT(baseTableName!=null,"no name on target table"); } + if(baseTableName != null) + if(baseTableName.getSchemaName() == null && correlationName == null) + baseTableName.bind(this.getDataDictionary()); + + /* * If the column did not specify a name, or the specified name * matches the table we're looking at, see whether the column
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: Derby home page now blank??, Brian Abbott |
|---|---|
| Next by Date: | Updating JIRA for resolved bugs, Shreyas Kaushik |
| Previous by Thread: | Re: [jira] Commented: (DERBY-18) Exposed name matching has bugs when the column name is qualified with a schema name., Shreyas Kaushik |
| Next by Thread: | [jira] Created: (DERBY-132) in place table/index compress which returns space to OS, Mike Matrigali (JIRA) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|