awferreira / c5-db-migration

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

Migration fails on sql with the word "DELIMITER" at the beginning of a line #46

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a migration that includes this sql (from postgis):

CREATE TYPE geometry (
    INTERNALLENGTH = variable,
    INPUT = geometry_in,
    OUTPUT = geometry_out,
    DELIMITER = ':'
);

2. Migrate

What is the expected output? What do you see instead?
I expect the migration to work.
The migration fails.

What version of the product are you using? On what operating system?
0.9.9-SNAPSHOT, mac os x snow leopard.

Please provide any additional information below.
The DEFAULT_DELIMITER_KEYWORD is not quite rare enough.  I can see a few 
options to fix this:

1) Allow the user to change the keyword in the pom.xml
2) Change the keyword to something else.
3) Change line 86 in ScriptRunner to this:
if (startsWithIgnoreCase(line, DEFAULT_DELIMITER_KEYWORD) && command.length() 
== 0)

This would ensure that the keyword would only be read before any of the sql 
command has started to be run.  I can't think of a use case when someone would 
try to define an alternate delimiter in the middle of a sql statement (and 
there aren't any tests for this), but I could be missing something.

Original issue reported on code.google.com by jer...@musicsmith.net on 8 Jul 2011 at 5:02

GoogleCodeExporter commented 8 years ago
See issue 47 for a patch to fix and test this, using option #3.

Original comment by jer...@musicsmith.net on 8 Jul 2011 at 5:15