You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@manifoldcf.apache.org by "lelelombardi@libero.it" <le...@libero.it> on 2011/06/20 16:08:48 UTC
MySql DBInterface problem on getTableSchema
Hi,
i'm working on MySql implementation of DBinferface, I have found a problem in
the current implementation of getTableSchema. I don't know if the DESCRIBE is
part of the SQL standard o not, but in MySql after the execution of the query
the result is a "virtual table" populated with the data taken from the database
metadata.
The problem is that; the ResultSet contain the column name of the original
table, but the findColum method on the "virtual table" with the original table
name triggers one SQLException because there is no column with this name. We
need to use the label.
I have thought 2 solution
1) Modify the signature of org.apache.manifoldcf.core.database.findColumn from
findColumn(ResultSet rs, String name) to findColumn(ResultSet rs, String
columnName, String labelKey). The implementation is equals to the oldest one,
but when you fail to retrieve the columnIndex you can try with the label, it it
fails to return -1.
2) Make an override on org.apache.manifoldcf.core.database.getData in MySql
implementation just doing copy and paste of the current code and change the
findColumn implementation with the implementation described above.
What do you think?
Emanuele
Re: MySql DBInterface problem on getTableSchema
Posted by Karl Wright <da...@gmail.com>.
Has there been any further progress/issues here?
Karl
On Mon, Jun 20, 2011 at 10:19 AM, Karl Wright <da...@gmail.com> wrote:
> Rather than change the database contract, which would have
> far-reaching effects, is there any way to simply implement
> getTableSchema to work properly with the abstraction? For example,
> read the result of the DESCRIBE within the getTableSchema method and
> translate it in whatever manner is needed.
>
> If this is a broader issue with the way the MySQL JDBC driver works
> for all queries, then overriding getData() within DBInterfaceMySQL
> would seem like the right way to go.
>
> Karl
>
>
> On Mon, Jun 20, 2011 at 10:08 AM, lelelombardi@libero.it
> <le...@libero.it> wrote:
>> Hi,
>> i'm working on MySql implementation of DBinferface, I have found a problem in
>> the current implementation of getTableSchema. I don't know if the DESCRIBE is
>> part of the SQL standard o not, but in MySql after the execution of the query
>> the result is a "virtual table" populated with the data taken from the database
>> metadata.
>> The problem is that; the ResultSet contain the column name of the original
>> table, but the findColum method on the "virtual table" with the original table
>> name triggers one SQLException because there is no column with this name. We
>> need to use the label.
>>
>> I have thought 2 solution
>>
>> 1) Modify the signature of org.apache.manifoldcf.core.database.findColumn from
>> findColumn(ResultSet rs, String name) to findColumn(ResultSet rs, String
>> columnName, String labelKey). The implementation is equals to the oldest one,
>> but when you fail to retrieve the columnIndex you can try with the label, it it
>> fails to return -1.
>>
>> 2) Make an override on org.apache.manifoldcf.core.database.getData in MySql
>> implementation just doing copy and paste of the current code and change the
>> findColumn implementation with the implementation described above.
>>
>> What do you think?
>>
>> Emanuele
>>
>
Re: MySql DBInterface problem on getTableSchema
Posted by Karl Wright <da...@gmail.com>.
Rather than change the database contract, which would have
far-reaching effects, is there any way to simply implement
getTableSchema to work properly with the abstraction? For example,
read the result of the DESCRIBE within the getTableSchema method and
translate it in whatever manner is needed.
If this is a broader issue with the way the MySQL JDBC driver works
for all queries, then overriding getData() within DBInterfaceMySQL
would seem like the right way to go.
Karl
On Mon, Jun 20, 2011 at 10:08 AM, lelelombardi@libero.it
<le...@libero.it> wrote:
> Hi,
> i'm working on MySql implementation of DBinferface, I have found a problem in
> the current implementation of getTableSchema. I don't know if the DESCRIBE is
> part of the SQL standard o not, but in MySql after the execution of the query
> the result is a "virtual table" populated with the data taken from the database
> metadata.
> The problem is that; the ResultSet contain the column name of the original
> table, but the findColum method on the "virtual table" with the original table
> name triggers one SQLException because there is no column with this name. We
> need to use the label.
>
> I have thought 2 solution
>
> 1) Modify the signature of org.apache.manifoldcf.core.database.findColumn from
> findColumn(ResultSet rs, String name) to findColumn(ResultSet rs, String
> columnName, String labelKey). The implementation is equals to the oldest one,
> but when you fail to retrieve the columnIndex you can try with the label, it it
> fails to return -1.
>
> 2) Make an override on org.apache.manifoldcf.core.database.getData in MySql
> implementation just doing copy and paste of the current code and change the
> findColumn implementation with the implementation described above.
>
> What do you think?
>
> Emanuele
>