tuscany-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adriano Crestani (JIRA)" <tuscany-...@ws.apache.org>
Subject [jira] Commented: (TUSCANY-1464) Wrong query results when SELECT misses PKs
Date Thu, 09 Aug 2007 09:29:42 GMT

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

Adriano Crestani commented on TUSCANY-1464:
-------------------------------------------

- On code below, it checks for the fk COC that is table_id, however this code will take "_id"
as fk, but there is no table name before the '_'. I think the condition below should be >=
1 instead of 0.

ResultMetadata Constructor:
	...
            String colName = "";
            if (columnName.indexOf("_ID") >= 0) {            	
	...

-Another doubt, is the String column name always upper case? Otherwise the indexof will look
for the "_ID" on sensitive case mode, when it shouldn't.

- Why do you check for null pks twice on method ResultSetProcessor.addRowToGraph?

            if (!rawDataFromRow.hasValidPrimaryKey() ||
            		(rawDataFromRow.hasNullPrimaryKey() && !rawDataFromRow.isTableEmpty()))
{//some PK null , but other data present
            	//continue; - need to throw exception as anyway the result will give a wrong
impression
            	//when any one table in result set misses PK column or has null value in PK column
            	throw new RuntimeException("Table "+rawDataFromRow.getTableName()+" in query
does not include Primary Key "+
            			"column or has null value in it, can not proceed!");
            }

            String tableName = rawDataFromRow.getTableName();
            DataObject tableObject = registry.get(tableName, rawDataFromRow.getPrimaryKeyValues());
            if (tableObject == null
            		&& rawDataFromRow.getPrimaryKeyValues() != null
            		&& !rawDataFromRow.getPrimaryKeyValues().contains(null)
            		&& rawDataFromRow.getPrimaryKeyValues().size() >0) {//2nd check for
null data in PK,
            	//as TableData.addData() - hasValidPrimaryKey=false is commented for a reason
            	//with this, DataObjs with null PK will not be added to registry and tableObjects
                tableObject = doMaker.createAndAddDataObject(rawDataFromRow, resultMetadata);

                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Putting table " + tableName + " with PK "
                            + rawDataFromRow.getPrimaryKeyValues() + " into registry");
                }

                registry.put(tableName, rawDataFromRow.getPrimaryKeyValues(), tableObject);
            }
            else{
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Not Null tableObject or NULL PK");
                }
            }

I applied the patch on trunk, but when mvn compiled there was a class using ResultDescriptor.getColumnIndex
method, but this getter was only added on patch from JIRA 1465. Then I applied both, 1464
and then 1465, is it ok? Perhaps, the mvn tests failed on test:

 FAILURE!
testReplaceResultDescriptor(org.apache.tuscany.das.rdb.test.DynamicResultDescrip
torTests)  Time elapsed: 0.02 sec  <<< FAILURE!
junit.framework.AssertionFailedError
        at junit.framework.Assert.fail(Assert.java:47)
        at junit.framework.Assert.assertTrue(Assert.java:20)
        at junit.framework.Assert.assertTrue(Assert.java:27)
        at org.apache.tuscany.das.rdb.test.DynamicResultDescriptorTests.testRepl
aceResultDescriptor(DynamicResultDescriptorTests.java:147)
        at org.apache.tuscany.das.rdb.test.DynamicResultDescriptorTests.testRepl
aceResultDescriptor(DynamicResultDescriptorTests.java:147)

I don't know if I did something wrong, but I will try it tomorrow, needing to sleep now ;
)

Regards,
Adriano Crestani
 

> 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
>
>
> http://www.mail-archive.com/tuscany-dev@ws.apache.org/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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Mime
View raw message