hoonsbara / octalforty-wizardby

Automatically exported from code.google.com/p/octalforty-wizardby
1 stars 0 forks source link

Native SQL "GO" keyword is unnecessarily case sensitive #34

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Create a WizardBy configuration that includes a native SQL script. The 
native SQL script should alter the database schema (i.e., add a column), use 
the "GO" keyword (as uppercase), and attempt to insert into the new column.

2. Use WizardBy to apply the new script: wizardby up.

3. Observe error message.

What is the expected output? What do you see instead?

Alas, since native SQL commands are generally case in-sensitive, I expected the 
GO keyword to also be case in-sensitive.  I expected the GO keyword to properly 
separate statements in the SQL batch.

Instead, this error message is produced:

 ---> octalforty.Wizardby.Core.Db.DbPlatformException: An error occured at at line 21:Incorrect syntax near 'GO'.
 ---> System.Data.SqlClient.SqlException: Incorrect syntax near 'GO'.

The problem appears to be on line 76 of 
src/octalforty.Wizardby.Core/Migration/Impl/FilesystemNativeSqlResourceProvider.
cs.  The regular expression would be more correct if it included the 
RegexOptions.IgnoreCase option.

http://code.google.com/p/octalforty-wizardby/source/browse/src/octalforty.Wizard
by.Core/Migration/Impl/FilesystemNativeSqlResourceProvider.cs#76

As a side note, the error message is also flawed: "occurred" is spelled 
incorrectly, and the word "at" is repeated: "An error occured at at line..."

This appears to be on line 27 of 
http://code.google.com/p/octalforty-wizardby/source/browse/src/octalforty.Wizard
by.Db/SqlServer2000/SqlServer2000ExceptionTranslator.cs#27

Original issue reported on code.google.com by nielsen....@gmail.com on 19 Oct 2012 at 6:28

GoogleCodeExporter commented 8 years ago
I have attached a patch that addresses this issue.

Original comment by nielsen....@gmail.com on 24 Oct 2012 at 1:46

Attachments: