Re: MDB2 and single INSERT statement, prepare+execute or just query?
| From: | Lukas Smith | Date: | Sat, 22 May 2004 07:47:57 +0000 |
| Subject: | Re: MDB2 and single INSERT statement, prepare+execute or just query? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12676@lists.php.net to get a copy of this message | ||
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