Re: Re: mysql and unbuffered queries
| From: | Zeev Suraski | Date: | Mon, 07 May 2001 11:22:13 +0000 |
| Subject: | Re: Re: mysql and unbuffered queries | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-54205@lists.php.net to get a copy of this message | ||
At 12:23 7/5/2001, Wez Furlong wrote:
On 2001-05-07 00:26:02, "Zeev Suraski" <zeev@zend.com> wrote: At 02:16 7/5/2001, Wez Furlong wrote:It's going to be a bit complex to explain why I didn't want this patch, but I'll give it a try :) First off, my personal preference was always to nuke mysql_db_query() altogether, as it encourages slow code (very rarely do you get to specify different databases on every query, so setting the database once and for all is much faster, using mysql_select_db()). mysql_db_query(), which is the rename of PHP/FI 2.0's mysql(), is available for downwards compatibility purposes only :) Secondly, the reason I didn't implement unbuffered results as an extra flag to mysql_query(), is that it would have then broke the API rule, that any function that accepts a MySQL link resource, can have this link omitted, and it'd behave in the same way with the default link. That's why adding an optional 3rd argument to mysql_query() wasn't an option. Now, your patch adds a 4th argument to mysql_db_query(), and thus breaks that rule. I think it's not a good way to go from an API-cleanliness perspective (requiring people to specify the link for certain functionality). Adding a new function (mysql_unbuffered_db_query()) seems very odd considering the fact that mysql_db_query() itself is there just for downwards compatibility purposes. After this whole explanation, I hope you understand why I asked you whether you really need it (I knew it was already 'prepared' for such a patch :) So the question remains - why do you need it? If it's for performance reasons, I'd recommend dropping mysql_db_query() altogether, and use mysql_query(). ZeevShould I create a patch that enables the parameter?Probably... Are you sure you can't use mysql_unbuffered_query(), though? If you're really used to supplying the database argument, you can easily write a 2 line PHP function that does the same thing... It's only a half-dozen line patch to enable the functionality for mysql_db_query - it looks like it was prepared for the change. I'll commit it a little later. For speed purposes, I prefer that code to be in C. (I know - it's probably only a marginal difference).