Dear brethren,
I am trying to find a Perl fix for a Mysql problem. We are trying to migrate from Mysql 4.0something to Mysql 5.1.
Our application has grown organically and is using a couple of thousands of statement of which some have the ugly form:
select * from table1 a,
table2 b left join table3 c on b.id = c.id
where a.id = b.id
Statements like this are running with 4.0 smooth but cause errors with 5.1. The problem is caused by the mix of two join syntaxes:
comma and "left join".
Since most of our statements are executed by a library function, we had the idea of identifying and fixing these statements on the fly.
The fix would be transforming the above statement to:
select * from table1 a inner join
table2 b left join table3 c on b.id = c.id
where a.id = b.id
which is not causing problems.
Did somebody run already in the same problem and has a neat regexp to identify and fix?
Is there a enlightened brother who could give me a hint for a regexp, that does the job?
Humbly yours
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.