[ 
https://issues.apache.org/jira/browse/TUSCANY-1464?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Amita Vadhavkar updated TUSCANY-1464:
-------------------------------------

    Attachment: 1464.patch

1)In case of if (columnName.indexOf("_ID") >= 0), and indeed if column name in 
database table is  just "_ID", then later in the same class,
String pkTableName = columnName.substring(0, columnName.indexOf("_ID")); 
will give null value to pkTableName and so List pkTableProperties = (List) 
tableToPropertyMap.get(pkTableName); will have null list pkTableProperties.
So, if ((pkTableProperties != null) && (pkTableProperties.contains("ID"))) {
        configWrapper.addImpliedRelationship(pkTableName, fkTableName, 
columnName);
}
will do nothing as first condition will fail.

So, I guess we are safe here. As anyways, COC will not be able to do anything 
with a column "_ID"
___________________________________________________________________________________________________
2)case sensitivity, this is a good point, as just below this code, we are 
liberal about it for detecting COC based PK (allow any case) and as you said, 
for FK purpose, we are not allowing only _ID. I can fix this, even though this 
is not part of the problem statement of this patch, in 
ResultMetadata. (Our documentation does not talk anything about case, but at 
least
we should treat both PK and FK in same manner, so if PK is allowed id,Id,iD, 
ID, same should be with FK)
___________________________________________________________________________________________________
3)
if (!rawDataFromRow.hasValidPrimaryKey() ||
(rawDataFromRow.hasNullPrimaryKey() && !rawDataFromRow.isTableEmpty()))

The above check is for case, when any one PK in table has null Data , but there 
are other not null data columns in the row, this should be exception case
---------------------------------------------------------------------
if (tableObject == null
&& rawDataFromRow.getPrimaryKeyValues() != null
&& !rawDataFromRow.getPrimaryKeyValues().contains(null)
&& rawDataFromRow.getPrimaryKeyValues().size() >0)

The above check, it can be modified/simplified as below, as 
getPrimaryKeyValues() can never be  null (see  constructor of TableData) and 
with new hasNullPrimaryKey() check, PrimaryKeyValues will not contain null  and 
as hasValidPK is true, getPrimaryKeyValues().size() will be >0

if (tableObject == null
&& !rawDataFromRow.hasNullPrimaryKey())
___________________________________________________________________________________________________
4) I took a clean base from trunk and applied 1464 and 1465 to it.
The problem was in the test cases of 1465 and I am creating new patch for it.
(As 1464 is now catching absence of PK from select, the 2 cases were failing in 
1465, as in converter column name should match table (dbms) column name and can 
not be aby arbitrary names)

Please see the 1464.patch dated Aug 10 for fixes of 2) and 3) above.

> Wrong query results when SELECT misses PKs
> ------------------------------------------
>
>                 Key: TUSCANY-1464
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1464
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java DAS RDB
>    Affects Versions: Java-DAS-Next
>            Reporter: Amita Vadhavkar
>            Assignee: Amita Vadhavkar
>             Fix For: Java-DAS-Next
>
>         Attachments: 1464.patch, 1464.patch, 1464.patch, 1464.patch
>
>
> http://www.mail-archive.com/[email protected]/msg20322.html
> Fix the bug uncovered in above mail discussion.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to