Handling illegal column names

View: New views
2 Messages — Rating Filter:   Alert me  

Handling illegal column names

by drmorbius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


        Hi all,
       
        I'm rewriting a PHP application in Java and have come across a
        problem with the legacy MySQL database.  Given the complexity of
        the data model, I'd like to use dbunit to setup test data, but
        they have used a reserved word (Primary) as a column name in one
        of the tables. When loading the data I get an invalid SQL
        statement exception because of the reserved word.
       
        Obviously the original app used backticks in the hand coded SQL
        queries to escape the invalid column name. And changing the
        column name impacts other systems, so that's a last resort.
       
        Is there any way to get dbunit to handle this situation?
       
        Thanx

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
dbunit-user mailing list
dbunit-user@...
https://lists.sourceforge.net/lists/listinfo/dbunit-user

Re: Handling illegal column names

by mario h.c.t. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think a simple "solution" could be to copy this table  to another one, change the column name and setup dbUnit with this new table.

Perhaps you could create a view of this table too, but this would involve some dbunit configuration.

best regards.
mario h.c.t.

On Mon, Jun 2, 2008 at 6:47 PM, rdietz <rdietz@...> wrote:

       Hi all,

       I'm rewriting a PHP application in Java and have come across a
       problem with the legacy MySQL database.  Given the complexity of
       the data model, I'd like to use dbunit to setup test data, but
       they have used a reserved word (Primary) as a column name in one
       of the tables. When loading the data I get an invalid SQL
       statement exception because of the reserved word.

       Obviously the original app used backticks in the hand coded SQL
       queries to escape the invalid column name. And changing the
       column name impacts other systems, so that's a last resort.

       Is there any way to get dbunit to handle this situation?

       Thanx

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
dbunit-user mailing list
dbunit-user@...
https://lists.sourceforge.net/lists/listinfo/dbunit-user


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
dbunit-user mailing list
dbunit-user@...
https://lists.sourceforge.net/lists/listinfo/dbunit-user
LightInTheBox - Buy quality products at wholesale price