FK columns name retrieved by dbms contain invalid characters
------------------------------------------------------------

                 Key: TUSCANY-1220
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1220
             Project: Tuscany
          Issue Type: Task
          Components: C++ DAS
    Affects Versions: Wish list
            Reporter: Adriano Crestani
            Priority: Minor
             Fix For: Wish list


The method ResultSet* Database::getFKs(std::string tableName) const returns a 
ResultSet containing information about the tableName foreign keys. When getting 
specially the pk column name and fk column name, it is returning the column 
name surrounded by " ' ". For example:

std::cout << "FK Column Name = " << fksResultSet->getSQLVarchar(7); // 7th 
column contains the fk column name
std::cout << "\nPK Column Name = " << fksResultSet->getSQLVarchar(3); // 3th 
column contains the fk column name
std::cout << "\nPK Table Name = " << fksResultSet->getSQLVarchar(2); // 2nd 
column contains the pk table name

output:
FK Column Name = 'COMPANY_ID'
PK Column Name = 'ID'
PK Table Name = DEPARTMENT

As seen on the output, only the pk and fk column name are surrounded by " ' " . 
 I'm actually solving this problem removing the " ' " from the string:

std::string fkColumnName = fksResultSet->getSQLVarchar(7);
std::string pkTableName = fksResultSet->getSQLVarchar(2);
std::string pkColumnName = fksResultSet->getSQLVarchar(3);

fkColumnName = fkColumnName.substr(1, fkColumnName.size() - 2); 
pkColumnName = pkColumnName.substr(1, pkColumnName.size() - 2); 

I'm using MySQL server. I don't know if it happens only with MySQL server or if 
there are others which do the same.

I propose to test it using others DBMSs to test if it happens only on MySQL 
server or not.


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