Re: MDB2 and single INSERT statement, prepare+execute or just query?

From: Date: Sat, 22 May 2004 10:21:22 +0000
Subject: Re: MDB2 and single INSERT statement, prepare+execute or just query?
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12680@lists.php.net to get a copy of this message
"Lukas Smith" <smith@backendmedia.com> wrote in message news:40AF05AD.70006@backendmedia.com... > Michael Hanney wrote: > > > What I really > > want to know is - does the prepare method offer any compatibility advantage > > (escaping depending on types?), > > or is it just for speeding up multiple inserts i.e. prepare once, execute > > many. The docs explain how, but not always why. Inserts don't happen very > > often in my apps so compatibility accross multiple dbs is more important to > > me than speed. > > no prepared queries offer no speed advantage as the native php API's > lack the necessary features. moreover for single prepare/execute/free it > will always be slower. the advantage of prepare in theory is to reduce > the parsing efforts if you intent to submit a query multiple times. > > the main reason why people use prepare in a DBAL atm thought is > separating the query from the data. sort of as a cheap sql builder. > > the type conversion is possible without prepare as well using the > quote($value, $type) method which needs to be called on every value you > insert into the query separately. > > regards, > Lukas Smith > smith@backendmedia.com > _______________________________ > BackendMedia > www.backendmedia.com > berlin@backendmedia.com > > Linn Zwoch Smith GbR > Pariser Str. 44 > D-10707 Berlin > > Tel +49 30 83 22 50 00 > Fax +49 30 83 22 50 07 Thank you Lukas for a very clear and detailed answer. Michael.

« previous php.pear.general (#12680) next »