#24 Qualify table name in SQLScript

closed
nobody
None
5
2009-07-01
2008-11-30
Johann Geyer
No

Hi!

Thank you for SQuirreL. It is a cool and useful tool. This is my first patch I ever created. So please be patient and give me hints when I did something wrong.

The SQL Script Plugin has a global Preference "Qualify table names in generated scripts with the schema name", which is active.

Defect:
When I enter "select * from test.table" in the SQL Tab and create a data script from this sql, I get "insert into table ..." without the schema-name. This is not ok.

Analysis:
When create data script is chosen on a table in CreateDataScriptCommand the line String sTable = ScriptUtil.getTableName(ti); sets the correct table name. In the class CreateDataScriptOfCurrentSQLCommand, which is used in the SQL Tab, the table name is taken from the JDBC object ResultSetMetaData (String sTable = metaData.getTableName(1);).

Solution:
In the patch attached in the CreateDataScriptOfCurrentSQLCommand class I create a TableInfo from the ResulSetMetaData and also use the ScriptUtil.GetTableName Method.

Regards
Joe Geyer

Discussion

  • Gerd Wagner
    Gerd Wagner
    2009-07-01

    • status: open --> closed
     
  • Gerd Wagner
    Gerd Wagner
    2009-07-01

    Has been applied.

    Thanks

    Gerd