awferreira / c5-db-migration

Automatically exported from code.google.com/p/c5-db-migration
0 stars 0 forks source link

"DELIMITER" meta-keyword should be configurable in pom.xml file #29

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. N/A

What is the expected output? What do you see instead?
N/A

What version of the product are you using? On what operating system?
9.7 on Windows XP and Linux

Please provide any additional information below.

From reading the sources of com.carbonfive.db.jdbc.ScriptRunnerImpl it is
apparent that a proprietary "DELIMITER" meta-keyword may be used to
configure the statement delimiter character.  This requires that
proprietary syntax be used in the migration scripts for the project using
the migration framework.  An appropriate default of ";" is included in the
sources. It would be much more useful to include an ability to override
default via the configurations of the migration plug-in in the pom.xml
file, and then document this ability in the user documentation.  This would
allow the migration scripts to remain framework independant.

Original issue reported on code.google.com by mattheww...@gmail.com on 22 Dec 2009 at 10:20

GoogleCodeExporter commented 8 years ago
What underlying database are you running against?

DELIMITER isn't completely propriety as it's the default for MySQL, which 
happens to
be the most popular database used with db-migrations.  So, for MySQL users 
scripts
are completely native.

As it turns out, the problem is bigger than simply extracting the string into a
configuration setting.  PostgreSQL for example, uses a different syntax which
requires a significant changes to the script parser.  There's a separate issue 
for
postgresql support 
(http://code.google.com/p/c5-db-migration/issues/detail?id=9).

I'd like to rework this issue into adding support for your particular database
vendor's 'deliminter'.  Let me know what you're using and I'll make the changes.

Original comment by christia...@gmail.com on 30 Dec 2009 at 11:29

GoogleCodeExporter commented 8 years ago
The database that I'm using is DB2 for i Series (newest general availability 
release
for AS/400) via the JT400 JDBC driver.

Original comment by mattheww...@gmail.com on 31 Dec 2009 at 1:05

GoogleCodeExporter commented 8 years ago
Matthew,

Any chance you can give me an example of a script that needs to make use of the 
DB2 equivalent of DELIMITER?

Thanks!
Christian

Original comment by christia...@gmail.com on 31 Dec 2009 at 2:05

GoogleCodeExporter commented 8 years ago
Hello,

I am running Oracle 11g and I am getting the same error.  Here is a copy of the
script I am trying to run:

DECLARE
  -- --------------------------------------------------------------------------
  -- Proc to do inserts into AOR Table
  -- --------------------------------------------------------------------------
  PROCEDURE sync_aor (
            i_aor_id   casm_owner.aor.aor_id%TYPE
          , i_aor_name casm_owner.aor.aor_name%TYPE  
  ) IS
  BEGIN
    MERGE INTO casm_owner.aor  aor
      USING (SELECT i_aor_id   AS aor_id
                  , i_aor_name AS aor_name
               FROM DUAL) sq
         ON (sq.aor_id = aor.aor_id)
         WHEN MATCHED THEN
           -- basically a dummy statement here.  don't nned to do anything
           -- if we have a match.  Just leave this as they are.
           UPDATE SET aor.aor_name = sq.aor_name
         WHEN NOT MATCHED THEN
           -- Record doesn't exists so add it to the table
           INSERT (aor_id, aor_name, created_dt, created_by)
             VALUES (sq.aor_id, sq.aor_name, SYSTIMESTAMP, USER);
  END;

BEGIN
-- AORS FROM THE CASM DEVELOPMENT CLIENT
  sync_aor('E85E6CEB1AF28590092FBADAAC4C8FB0', 'Work Flow Test');

  COMMIT;
END;
/

Please, let me know if you have any questions.

Original comment by globobla...@gmail.com on 28 Jan 2010 at 11:37

GoogleCodeExporter commented 8 years ago
The script example that globoblanco posted is an exact example of why I 
originally
opened the bug.  In the case of my scripts I just threw in a "DELIMITER /" as 
the
first line and things worked fine.  The DELIMITER meta-keyword is not supported 
by
DB2 and is therefore a proprietary keyword.

My reason for opening the bug in the first place is that I don't want anything 
in the
scripts that is specific to the migrations plugin.  If it could be defined in 
the
pom.xml it would allow the scripts to remain pristine and correct operation of 
the
scripts can still happen without a syntax error due to statement truncation.

Original comment by mattheww...@gmail.com on 1 Mar 2010 at 11:26