First time I hear about this function. I've never seen anyone using this function and after reading the manual it seems to me that it has great advantages, are there any disadvantages/reasons as to why no one is using it (at least I've never seen anyone
mysql_unbuffered_query()
Moderator: General Moderators
mysql_unbuffered_query()
mysql_unbuffered_query()
First time I hear about this function. I've never seen anyone using this function and after reading the manual it seems to me that it has great advantages, are there any disadvantages/reasons as to why no one is using it (at least I've never seen anyone
).
First time I hear about this function. I've never seen anyone using this function and after reading the manual it seems to me that it has great advantages, are there any disadvantages/reasons as to why no one is using it (at least I've never seen anyone
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
If you are talking about the fact that you can't use mysql_num_rows(), I've already read that in the manual and that's not a problem.feyd wrote:take a look at the user comments.
If you are talking about something else, please tell me what exactly.
I see no reason why not using it instead of mysql_query(), but since I've never seen anyone using it, I assume there must be a good reason after all.
Does anyone know what this reason might be?
Thanks.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
You may use a DB class which opens a connection while it runs a query then sends you the result and closes the connection. You'd then be working with a buffered result after the connection is closed which would be fine, but with mysql_unbuffered_query() it just wouldn't work. I'm not saying you should use it, I'm just providing an exampleOren wrote:Then why it isn't used at all (I think)?d11wtq wrote:Apart from that it seems fairly sensible to use for large resultsets.
Since when you close the connection before you finish to work with the database?
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Yep this is a well known performance booster.Jenk wrote:It may be a good idea to only use mysql_pconnect and mysql_close if you are going to use unbuffered query.
Change to use a destructor to close the connection.You may use a DB class which opens a connection while it runs a query then sends you the result and closes the connection.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I believe it's the use of pconnect at all, mysql_unbuffered_query() or not.Jenk wrote:Is that true for mysql_pconnect on it's own, or in conjunction with mysql_unbuffered_query()? I'm unable to test atm.