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

Adriano Crestani commented on TUSCANY-952:
------------------------------------------

Amita, I was revising your classes and found some problems:

 - The following constructor:

...
    public QualifiedColumn(String name, boolean isDatabaseSchemaNameSupported) {
        int index = name.indexOf('.');
        if ( index == -1 ) {
            throw new RuntimeException("Column " + name + " must be qualified 
with a table name and optional schema name");
        }
...

If a new QualifiedColumn("table", false) is invoked, it will throw an 
RuntimeException because it doesn't check if on the first condition the 
variable isDatabaseSchemaNameSupported.

I suggest a modification on the first condition:

...
if ( index == -1 && !isDatabaseSchemaNameSupported) {
            throw new RuntimeException("Column " + name + " must be qualified 
with a table name and optional schema name");
        }
...

-------------------------------------

Another doubt on MappingWrapper.addRelationship(Vector parentNames, Vector 
childNames) that you create two Vector<QualifiedColumn> and add new 
QualifiedColumns are being created with QualifiedColumn(String tableName) 
constructor. This way it will not load the schema name. I commented it on the 
code bellow:

...
public Relationship addRelationship(Vector parentNames, Vector childNames) {
        //create vector for each
        if(parentNames.size() != childNames.size()){
            throw new RuntimeException("Can not for relationship for multiple 
keys, different sizes");
        }
        
        Vector parentColumns = new Vector();
        Vector childColumns = new Vector();
        
        for(int i=0; i<parentNames.size(); i++){
            //>>>> it should be checked if the schema name is supported and use 
another constructor for it  
            QualifiedColumn parent = new 
QualifiedColumn((String)parentNames.get(i));
            QualifiedColumn child = new 
QualifiedColumn((String)childNames.get(i));
            
            parentColumns.add(parent);
            childColumns.add(child);
        }

        //all parent columns should be from same table and schema
        //all child columns should be from same table and schema
        checkTableNames(parentColumns);
        checkSchemaNames(parentColumns);
        
        checkTableNames(childColumns);
        checkSchemaNames(childColumns);
        
        Relationship r = FACTORY.createRelationship();
        //JIRA-952
        if(this.config.isDatabaseSchemaNameSupported()){      
 
           //>>>>> As the QualifiedColumns are being created with 
QualifiedName(String name) constructor, the method getShemaName will always 
return ""
        
            r.setName(((QualifiedColumn)childColumns.get(0)).getSchemaName()+"."
                        +((QualifiedColumn)childColumns.get(0)).getTableName());
            
r.setPrimaryKeyTable(((QualifiedColumn)parentColumns.get(0)).getSchemaName()+"."
                        
+((QualifiedColumn)parentColumns.get(0)).getTableName());
            
r.setForeignKeyTable(((QualifiedColumn)childColumns.get(0)).getSchemaName()+"."
                        
+((QualifiedColumn)childColumns.get(0)).getTableName());                
        }
        else{
        r.setName(((QualifiedColumn)childColumns.get(0)).getTableName());
        
r.setPrimaryKeyTable(((QualifiedColumn)parentColumns.get(0)).getTableName());
        
r.setForeignKeyTable(((QualifiedColumn)childColumns.get(0)).getTableName());
        }
...

-----------------------------

I didn't check all your code yet, I will wait for clarifications ; )

Adriano Crestani

> DAS must support queries that reference tables in different "schemas"
> ---------------------------------------------------------------------
>
>                 Key: TUSCANY-952
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-952
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java DAS RDB
>            Reporter: Kevin Williams
>             Fix For: Java-DAS-Mx
>
>         Attachments: DAS-JIRA-952-Apr24-Amita.txt, JIRA-952-Details.doc, 
> JIRA-952-Feb16-Amita.jar, JIRA-952-Mar01-Amita.jar
>
>
> The DAS is curently ignorant of database schema designations.  This means the 
> DAS will generate incorrect write statements when it processes the change 
> summary from a data graph that originated from a query that uses schema names 
> that are different from the default schema.

-- 
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