You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Florian Pinel (JIRA)" <de...@tuscany.apache.org> on 2008/08/18 19:13:44 UTC

[jira] Updated: (TUSCANY-2551) UpdateGenerator creates some invalid SQL statements

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

Florian Pinel updated TUSCANY-2551:
-----------------------------------

    Attachment: jira.patch

In addition to the attached path, UpdateGenerator.getUpdateCommand() should be changed as follows:

   public UpdateCommandImpl getUpdateCommand(MappingWrapper mapping, DataObject changedObject, Table table) {      
        List parameters = new ArrayList();
        Type type = changedObject.getType();
        TableWrapper tableWrapper = new TableWrapper(table);
        // get changed fields
        ChangeSummary summary = changedObject.getDataGraph().getChangeSummary();
        HashSet changedFields = getChangedFields(mapping, summary, changedObject, tableWrapper);
        // if there are no changed fields return null
        if (changedFields.size() == 0) return null;
        // compose statement
        StringBuffer statement = new StringBuffer("update ");
        if(mapping.getConfig().isDatabaseSchemaNameSupported()){
        	statement.append(table.getSchemaName()+"."+table.getTableName());
        }
        else{
        statement.append(table.getTableName());
        }
        statement.append(" set ");

        Iterator i = changedFields.iterator();


(no changes beyond this point)

> UpdateGenerator creates some invalid SQL statements
> ---------------------------------------------------
>
>                 Key: TUSCANY-2551
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2551
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java DAS RDB
>    Affects Versions: Java-DAS-beta1
>            Reporter: Florian Pinel
>         Attachments: jira.patch
>
>
> When the data object has no changed fields, UpdateGenerator.getUpdateCommand() generates an SQL statement with an empty SET clause. It should return null instead. ChangeFactory and ChangeSummarizer should be updated to handle null values.

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