You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2007/05/02 14:46:35 UTC

[jira] Resolved: (SM-911) JDBCComponent: The first column index is 1 in a result from sql query (non zero)

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

Guillaume Nodet resolved SM-911.
--------------------------------

    Resolution: Fixed
      Assignee: Guillaume Nodet

Thanks a lot for this fixes !

URL: http://svn.apache.org/viewvc?view=rev&rev=534429
URL: http://svn.apache.org/viewvc?view=rev&rev=534430



> JDBCComponent: The first column index is 1 in a result from sql query (non zero)
> --------------------------------------------------------------------------------
>
>                 Key: SM-911
>                 URL: https://issues.apache.org/activemq/browse/SM-911
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-components
>    Affects Versions: 3.1
>         Environment: apache-servicemix-3.1-incubating
> database: mysql (with mysql-connector-java-5.0.3 driver)
>            Reporter: Jorge Rodríguez Pedrianes
>         Assigned To: Guillaume Nodet
>             Fix For: 3.1.1, 3.2
>
>   Original Estimate: 10 minutes
>  Remaining Estimate: 10 minutes
>
> The first column index in a result from a sql query to database is 1, non 0.
> So, 
>    1) in 'getUniqueColumnNames()' method, when we want to get column names from 'metaData' result, we must to start the count in i = 1
>         [ * metaData.getColumnName(i ); ---> the first column is 1, the second column is 2...]  : 
>             BUG:
> {noformat} 
> for (int i = 0; i < metaData.getColumnCount(); i++)
> {noformat} 
>             IT SHOULD BE:
> {noformat} 
> for (int i = 1; i <= metaData.getColumnCount(); i++) {
> {noformat} 
>  
>     2) in 'toXmlSource()' method:
>           BUG:   
> {noformat} 
>  for (int i=1; i<=colCount; i++) {
>       buff.append(colNames[i].toLowerCase() + "='" + rs.getString(i) + "' ");
> {noformat} 
>          IT SHOULD BE:
> {noformat} 
> for (int i=0; i<colCount; i++) { 
>      buff.append(colNames[i].toLowerCase() + "='" + rs.getString(i + 1) + "' ");   
>                              --> index in 'colNames' starts in 0 and index in 'rs' starts in 1
> {noformat}            

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