RE: [PHP] Re: [new version] Re: [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI

2005-08-26 Thread Jay Blanchard
[top-snip] nice! I'll give it a look this morning [/snip] This is another rather hackish attempt at using the tokeniser. It turns this: into this: SELECT * FROM my_table WHERE (up = 'down') ORDER BY my_column $banana ASC strtoupper( group by something) Which isn't perfect by a long shot, bu

Re: [PHP] Re: [new version] Re: [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI

2005-08-26 Thread Jochem Maas
Robin Vickery wrote: This is another rather hackish attempt at using the tokeniser. you beast ;-) apart from the fact that I don't use mysql this is really cool. I have no time to play right now (gotta catcha plana) but I have it on my to do list of things I need to take apart and understand p

Re: [PHP] Re: [new version] Re: [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI

2005-08-25 Thread Robin Vickery
This is another rather hackish attempt at using the tokeniser. It turns this: into this: SELECT * FROM my_table WHERE (up = 'down') ORDER BY my_column $banana ASC strtoupper( group by something) Which isn't perfect by a long shot, but I'm away home now so it'll have to do. I'd be interested

Re: [PHP] Getting queries from files FYI

2005-08-25 Thread Robin Vickery
On 8/23/05, Jay Blanchard <[EMAIL PROTECTED]> wrote: > You may (or may not) remember me posting to the list a couple of weeks > ago asking about using REGEX to get queries out of PHP files for a > migration project. I had to let it go for several days, but started > working on it again yesterday, h

[PHP] Re: [new version] Re: [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI

2005-08-24 Thread Jochem Maas
Jay Blanchard wrote: [top-snip, because it makes sense in the context] On line 98 I changed from echo "Line " . str_pad($lineNo, 4, ' ', PAD_LEFT) . ": " . $fileLine; to echo "Line " . str_pad($lineNo, 4, ' ', PAD_LEFT) . ": " . ltrim($fileLine); to account for indented code, lines ev

[PHP] RE: [new version] Re: [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI

2005-08-24 Thread Jay Blanchard
[top-snip, because it makes sense in the context] On line 98 I changed from echo "Line " . str_pad($lineNo, 4, ' ', PAD_LEFT) . ": " . $fileLine; to echo "Line " . str_pad($lineNo, 4, ' ', PAD_LEFT) . ": " . ltrim($fileLine); to account for indented code, lines everything up neatly. Al

[PHP] RE: [new version] Re: [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI

2005-08-24 Thread Jay Blanchard
[snip] here is a new and improved version: http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] [new version] Re: [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI

2005-08-24 Thread Jochem Maas
hi Jay, here is a new and improved version: */ /* script help message */ if (in_array('--help', $_SERVER['argv']) || in_array('-h', $_SERVER['argv']) || in_array('-?', $_SERVER['argv'])) { echo ' Use this command to search for SQL query strings inside php files. call from command

Re: [PHP] [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI

2005-08-23 Thread Robin Vickery
On 8/23/05, Jochem Maas <[EMAIL PROTECTED]> wrote: > Jay Blanchard wrote: > > > > Also, sweet move with the array_reverse... > > > > $fileParts = array_reverse(explode('.', $theFile)); > > if("php" == $fileParts[0]){ > > > > ...it prevents problems with funky file names containing more

Re: [PHP] Getting queries from files FYI

2005-08-23 Thread Jochem Maas
Jay Blanchard wrote: You may (or may not) remember me posting to the list a couple of weeks ago asking about using REGEX to get queries out of PHP files for a migration project. I had to let it go for several days, but started working on it again yesterday, here is the code (no REGEX was used in

[PHP] RE: [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI

2005-08-23 Thread Jay Blanchard
[snip] > argv[] is always available [/snip] As an example you could something like this... $requestedDatabase = $argv[1]; so that [EMAIL PROTECTED]:/usr/myApp/whatever php chaFinder.php CHA > output.txt will have $requestedDatabase == 'CHA' [snip] btw if my file names are funky I am too? [/sni

[PHP] [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI

2005-08-23 Thread Jochem Maas
Jay Blanchard wrote: [snip] I figured as much - I was think of adding an optional param so that you can optionally add such an extra limit e,g: cd /my/projects/stuff; php findqry.php --limit CHA > ./results.txt [/snip] argv[] is always available indeed - I'll add something for that... Also

RE: [PHP] Getting queries from files FYI

2005-08-23 Thread Jay Blanchard
[snip] I figured as much - I was think of adding an optional param so that you can optionally add such an extra limit e,g: cd /my/projects/stuff; php findqry.php --limit CHA > ./results.txt [/snip] argv[] is always available Also, sweet move with the array_reverse... $fileParts = array_reverse(

Re: [PHP] Getting queries from files FYI

2005-08-23 Thread Jochem Maas
Jay Blanchard wrote: [snip] heh Jay, I have been playing with this ... I rewrote your code abit (including removing the check for the string 'CHA' - cos that was limiting my search too much ;-) [/snip] Cool, I'll have a look. I was using the 'CHA' because I was looking for queries to the specifi

RE: [PHP] Getting queries from files FYI

2005-08-23 Thread Jay Blanchard
[snip] heh Jay, I have been playing with this ... I rewrote your code abit (including removing the check for the string 'CHA' - cos that was limiting my search too much ;-) [/snip] Cool, I'll have a look. I was using the 'CHA' because I was looking for queries to the specific database. -- PHP Gen

Re: [PHP] Getting queries from files FYI

2005-08-23 Thread Jochem Maas
Jay Blanchard wrote: You may (or may not) remember me posting to the list a couple of weeks I am a goldfish. hi my name is 10second Tom ;-) ago asking about using REGEX to get queries out of PHP files for a migration project. I had to let it go for several days, but started working on it