|
|
| The stupid question is the question not asked | |
| PerlMonks |
Re^2: Regex: Identifying commentsby pvaldes (Hermit) |
| on Aug 30, 2012 at 18:29 UTC ( #990816=note: print w/ replies, xml ) | Need Help?? |
|
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:
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
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||