Closed GoogleCodeExporter closed 9 years ago
The "\sGO\s" regex isn't a bulletproof solution.
It would be better if it is changed to "[\f\n\r]GO[\f\n\r]".
Original comment by jochen.j...@gmail.com
on 16 Feb 2010 at 3:44
I actually do this with the OleDB because different databases may not allow
more
than one statement to execute at a time. I will port that over.
It uses both ; and GO as valid statements to split.
Original comment by trueblu...@gmail.com
on 16 Feb 2010 at 5:57
Original comment by trueblu...@gmail.com
on 16 Feb 2010 at 5:59
It does this:
string[] separation_characters = new string[] { ";", "GO" };
return sql_to_run.Split(separation_characters,
StringSplitOptions.RemoveEmptyEntries);
Original comment by trueblu...@gmail.com
on 16 Feb 2010 at 6:08
It may not be as fast as the RegEx, but it will catch them.
Of course, I am looking at the way I do it currently and seeing a possible bug.
Hmmmmm.....
Original comment by trueblu...@gmail.com
on 16 Feb 2010 at 6:10
This looks like it will address both.
Has to break a line afterwards
[(GO)(\;)]+[\f\n\r]
Original comment by trueblu...@gmail.com
on 16 Feb 2010 at 6:30
Fixed in revision 110. Ended up with this: [GO|;]+[\f\n\r]
Original comment by trueblu...@gmail.com
on 16 Feb 2010 at 11:56
After testing the new version it didn't work. While I was working on the path
yesterday somebody else dropped all our scripts in the RH test project and when
I
tried to use the new version of RH it didn't work anymore.
It was a good test and I had to change the code again. The problem is that RH
now
splits the scipts on GO and ;, but for T-SQL this isn't correct. I found an
article
that explains this,
http://www.sqlservercentral.com/articles/SQL+Puzzles/thegocommandandthesemicolon
terminator/2200/.
(Use BugMeNot to login).
In short the GO is a batch separator and the ; isn't. So for T-SQL, RH shouldn't
split on ;. I think for Oracle and other database systems a split will not be
necessary.
I made a patch with the changes. The version of RH with this path works for all
the
scripts we have so far.
Original comment by jochen.j...@gmail.com
on 17 Feb 2010 at 9:40
Attachments:
Btw changed the regex also, because it was splitting on G and O also.
Original comment by jochen.j...@gmail.com
on 17 Feb 2010 at 9:43
I can't get to the site - email?
Original comment by trueblu...@gmail.com
on 17 Feb 2010 at 3:39
re opening the issue...
Original comment by trueblu...@gmail.com
on 17 Feb 2010 at 5:11
Patch applied in revision 113.
Original comment by trueblu...@gmail.com
on 17 Feb 2010 at 10:46
Original comment by trueblu...@gmail.com
on 17 Feb 2010 at 10:47
In the next revision 114, I moved those separators to the SQLScripts section
since
it was more a concern for TSQL and PLSQL than for the database type. It also
helps
for OleDB to not have to know about both/multiple types.
Original comment by trueblu...@gmail.com
on 17 Feb 2010 at 11:04
Original issue reported on code.google.com by
jochen.j...@gmail.com
on 16 Feb 2010 at 3:16Attachments: