Re: Question re:DB package interaction with MySQL
| From: | Frank F | Date: | Fri, 24 Feb 2006 18:19:09 +0000 |
| Subject: | Re: Question re:DB package interaction with MySQL | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-41473@lists.php.net to get a copy of this message | ||
Ben XO wrote:
There is a very slight "gotcha" with the 2nd insert syntax: it's very easy to make a query so long that it fails (mysql gives an error about "max_packet exceeded" I think) so you have to make sure you limit the size of your insert.Yes, it's not very hard to hit the default limit. It's fairly trivial to get the configured max_packet size from the database, and break an insert up into several smaller queries, however.
Well you are combining two separate methods. How should autoPrepare() know how many rows you want to insert?Admittedly, it may not be practical to use autoPrepare() in this context (I only used it in my example for simplicity's sake), but as far as I can discern, there's no practical way to use the DB package to efficiently insert large numbers of rows, using autoPrepare() OR prepare(). I'd imagine at least a few of the other databases other than MySQL suffer from the same problem, as well. Slightly off topic, but is MDB2 the database abstraction package of choice now?