in reply to Re: Regex: Identifying comments
in thread Regex: Identifying comments
IMHO the basic problem with your sql files is that don't look really like sql files, thus anything can be a comment and anything can be wrong, even if perl is acting fine.
I don't know all databases in the whole world so don't take this advice as immutable, of course, but sql sentences normally aren't complete (and don't run) until you find a semicolon. Is also surprising that you could select a field named '--foo' when you can't even create a table like this:
create table (--foo int); # error create table ('--foo' int); # error create table ("--foo" int); # error create table (\-\-foo int); # big error
So you are probably trying to solve a nonexistent problem. Comments are always after a semicolon or in your own line. And it you have i.e this:
-- ; select * from mytable where foo = "--34"; -- hi ', hi'. "hi'The complete line IS a comment here. I'm quoting lines that I don't want to run (temporally) all the time in sql files, it's not unusual to see something like this.
So you should be pointing your arrows to ";" instead to "'". You probably should check and sanitize first what's in your files, before to pass this files to perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regex: Identifying comments
by remiah (Hermit) on Aug 30, 2012 at 21:58 UTC | |
by pvaldes (Chaplain) on Aug 30, 2012 at 23:42 UTC | |
by remiah (Hermit) on Aug 31, 2012 at 05:37 UTC | |
by pvaldes (Chaplain) on Aug 31, 2012 at 15:32 UTC | |
by hbm (Hermit) on Sep 01, 2012 at 14:49 UTC | |
|