You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by "Eike Kettner (JIRA)" <em...@incubator.apache.org> on 2012/08/09 17:38:18 UTC

[jira] [Updated] (EMPIREDB-155) DDL Generation for dropping a database not working with HSQL

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

Eike Kettner updated EMPIREDB-155:
----------------------------------

    Description: 
When dropping a whole database a SQL script can be generated like this

    driver.getDDLScript(DBCmdType.DROP, db, script); // db is a DBDatabase

In case for HSQL the script 

    DROP USER <schema>

is created. If no schema has been provided to the DBDatabase, an IllegalArgumentException is thrown because the scheman name is missing. This is probably doing something else than dropping a database, but syntactically correct as HSQL doesn't complain if the schema name is valid.

The correct way to drop a database in HSQL is

    DROP SCHEMA <schema> CASCADE

Refer to the following thread on the user mailing list:

http://mail-archives.apache.org/mod_mbox/empire-user/201208.mbox/<03E491A3-CDB3-4079-97A1-85334256C945%40j-b-s.de>

The wrong script is created on DBDDLGenerator:219 (v2.4.0). 

I suppose that needs to be fixed in either the HSqlDDLGenerator or DBDDLGenerator. I'm not quite sure what to do, but I found some inconsistencies:

* DBDDLGenerator has a protected method "dropDatabase" that is unused (as reported by IDEA) but overriden in OracleDDLGenerator. So maybe line 219 in DBDDLGenerator should call "dropDatabase" instead? This could then be overriden in HSqlDDLGenerator.
* right now line 219 in DBDDLGenerator says 

      dropObject(((DBDatabase) dbo).getSchema(), "USER", script);

  which is exactly how the {{dropDatabase}} method is overriden in OracleDDLGenerator. I suspect this is the correct way to drop a database for Oracle dbs?



  was:
When dropping a whole database a SQL script can be generated like this

{code}
    driver.getDDLScript(DBCmdType.DROP, db, script); // db is a DBDatabase
{code}

In case for HSQL the script 

{code:sql}
DROP USER <schema>
{code}

is created. If no schema has been provided to the DBDatabase, an IllegalArgumentException is thrown because the scheman name is missing. This is probably doing something else than dropping a database, but syntactically correct as HSQL doesn't complain -- iff the schema name is "public".

The correct way to drop a database in HSQL is

{code}
DROP SCHEMA <schema> CASCADE
{code}

Refer to the following thread on the user mailing list:

http://mail-archives.apache.org/mod_mbox/empire-user/201208.mbox/<03E491A3-CDB3-4079-97A1-85334256C945%40j-b-s.de

The wrong script is created on DBDDLGenerator:219 (v2.4.0). 

I suppose that needs to be fixed in either the HSqlDDLGenerator or DBDDLGenerator. I'm not quite sure what to do, but I found some inconsistencies:

* {{DBDDLGenerator}} has a protected method "dropDatabase" that is unused (as reported by IDEA) but overriden in OracleDDLGenerator. So maybe line 219 in DBDDLGenerator should call "dropDatabase" instead? This could then be overriden in HSqlDDLGenerator.
* right now line 219 in DBDDLGenerator says {{dropObject(((DBDatabase) dbo).getSchema(), "USER", script); }}  which is exactly how the {{dropDatabase}} method is overriden in OracleDDLGenerator. I suspect this is the correct way to drop a database for Oracle dbs?



    
> DDL Generation for dropping a database not working with HSQL
> ------------------------------------------------------------
>
>                 Key: EMPIREDB-155
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-155
>             Project: Empire-DB
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: empire-db-2.4.0
>            Reporter: Eike Kettner
>
> When dropping a whole database a SQL script can be generated like this
>     driver.getDDLScript(DBCmdType.DROP, db, script); // db is a DBDatabase
> In case for HSQL the script 
>     DROP USER <schema>
> is created. If no schema has been provided to the DBDatabase, an IllegalArgumentException is thrown because the scheman name is missing. This is probably doing something else than dropping a database, but syntactically correct as HSQL doesn't complain if the schema name is valid.
> The correct way to drop a database in HSQL is
>     DROP SCHEMA <schema> CASCADE
> Refer to the following thread on the user mailing list:
> http://mail-archives.apache.org/mod_mbox/empire-user/201208.mbox/<03E491A3-CDB3-4079-97A1-85334256C945%40j-b-s.de>
> The wrong script is created on DBDDLGenerator:219 (v2.4.0). 
> I suppose that needs to be fixed in either the HSqlDDLGenerator or DBDDLGenerator. I'm not quite sure what to do, but I found some inconsistencies:
> * DBDDLGenerator has a protected method "dropDatabase" that is unused (as reported by IDEA) but overriden in OracleDDLGenerator. So maybe line 219 in DBDDLGenerator should call "dropDatabase" instead? This could then be overriden in HSqlDDLGenerator.
> * right now line 219 in DBDDLGenerator says 
>       dropObject(((DBDatabase) dbo).getSchema(), "USER", script);
>   which is exactly how the {{dropDatabase}} method is overriden in OracleDDLGenerator. I suspect this is the correct way to drop a database for Oracle dbs?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira