Re: Executing sql scripts with MDB2

From: Date: Wed, 16 Jul 2008 15:46:56 +0000
Subject: Re: Executing sql scripts with MDB2
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-50411@lists.php.net to get a copy of this message
Hi all! I've submitted a patch about this: http://pear.php.net/bugs/bug.php?id=14070 You should find only the patch, because the issue tracker seems to allow to upload only one text file for issue. I've tried to implement the second approach suggested by Lukas using reg_exp. Actually it fails if: - the query contains a comment in a delimited string: INSERT INTO a_table (id, val) VALUES (1, 'abc -- def'); - the query contains multiple spaces in a delimited string INSERT INTO a_table (id, val) VALUES (2, 'abc def'); - the query contains ";\n" in a delimited string. To fix this, as suggested by Lorenzo Alberton, I'll try to implement a method that skips the delimeted strings in according with $db->sql_comments defined for each RDBMS type. Any suggestion or comment is always welcome :-) Regards, Luca > If you find that it is useful, maybe you should fill a feature request >> for MDB2 or contact the project leaders ? What do you say ? >> >> Also, help is always apreciated ;) >> >> Best regards, >> Igor. >> >> On 5/27/08, Luca Corbo <lu.corbo@gmail.com> wrote: >> >>> Hello all, >>> anyone out there have any work done allows to execute sql scripts using >>> MDB2? >>> It seems this feature is not supported actually in the MDB2 package and >>> IMHO >>> it could be useful to add it. >>> Please let me know what you think about this and if you need some help to >>> improve it ;-). >>> >>> > > its non trivial .. > > one approach would be using the ability from some API's to execute multiple > SQL statements in one call. This is however not supported by all RDBMS and > is subject to maximum packet size per query etc. > > the other approach would require a reliable delimiter for statements or > even more extreme a SQL parser. > > regards, > Lukas Kahwe Smith > mls@pooteeweet.org > > > >

« previous php.pear.dev (#50411) next »