db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shreyas Kaushik <Shreyas.Kaus...@Sun.COM>
Subject Re: [jira] Commented: (DERBY-18) Exposed name matching has bugs when the column name is qualified with a schema name.
Date Tue, 08 Feb 2005 05:47:50 GMT
Any updates here?

~ Shreyas

Shreyas Kaushik wrote:

> Dan,
>
>  Attached is the new patch and answesr are inline.
>
> ~ Shreyas.
>
> Daniel John Debrunner wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Shreyas Kaushik wrote:
>>  
>>
>>> Any updates on this??
>>>
>>> thanks
>>> Shreyas
>>>
>>> Shreyas Kaushik wrote:
>>>
>>>   
>>>
>>>> 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.
>>>>     
>>>
>>
>> I've been busy doing other stuff, from a quick look at this I'm was more
>> thinking that the schema name in TableName would be filled in at a
>> single point, rather than on each use of it. This latter approach tends
>> to increase code size and be more buggy as there is potential for some
>> uses to be missed. I would expect that this could be encapsulated in
>> FromTable or FromBaseTable, maybe additional checks in the getTableName
>> method?
>>  
>>
> Ok I guess you are right, a good appraoch at doing things more 
> concisely. I have made the changes
> in FromBaseTableName and CurrentOfNode.
>
>> Dan.
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.2.5 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFCAB/dIv0S4qsbfuQRAjRlAJ9ujj9gLG7mnuDmi2UMbVIHV/aDpACePKas
>> s8t0EM82u63D1UST+24LQSk=
>> =+rpI
>> -----END PGP SIGNATURE-----
>>
>>  
>>
>------------------------------------------------------------------------
>
>Index: java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
>===================================================================
>--- java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java	(revision 149478)
>+++ 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;
> 	}
> 
>@@ -3572,6 +3579,13 @@
> 		TableName tn;
> 
> 		tn = super.getTableName();
>+
>+        if(tn != null) {
>+            if(tn.getSchemaName() == null &&
>+               correlationName == null)
>+                   tn.bind(this.getDataDictionary());
>+        }
>+
> 		return (tn != null ? tn : tableName);
> 	}
> 
>Index: java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java
>===================================================================
>--- java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java	(revision 149478)
>+++ 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,7 +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
> 		 * is in this table, and also whether it is in the for update list.
>  
>

Mime
View raw message