empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eike Kettner (JIRA)" <empire-db-...@incubator.apache.org>
Subject [jira] [Created] (EMPIREDB-155) DDL Generation for dropping a database not working with HSQL
Date Thu, 09 Aug 2012 15:32:18 GMT
Eike Kettner created EMPIREDB-155:
-------------------------------------

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

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



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

        

Mime
View raw message