Re: Unbuffered Query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think mysql_data_seek throws this warning also if there is no data in
the result object at all, so I would check the result before positioning

greets
Zoltán Németh

2007. 01. 12, péntek keltezéssel 23.30-kor Richard Lynch ezt írta:
> I have this process that dumps out database records to static HTML pages.
> 
> The basic algorithm goes like:
> 
> //Set any un-parented item (a root in the thread) to be its own parent:
> update entry set original_id = entry_id where original_id is null
> 
> //collect any "dirty" entries (changed in db, need to re-publish)
> $dirty = select entry_id from entry where dirty = 1
> 
> while (list($entry_id) = mysql_fetch_row($dirty)){
>   //find the whole thread:
>   $followups = select entry_id, X, Y from entry where original_id =
> $dirty_id
>   //there is an ORDER BY which is not relevant
> 
>   //get some thread metadata from the first row's X field
>   list($junk, $X) = mysql_fetch_row($followups);
>   //$X is the same for all rows...
>   echo "<h1>$X</h1>\n";
> 
>   //reset to row 0
>   mysql_data_seek($followups, 0);
>   while (list($entry_id, $X, $Y) = mysql_fetch_row($followups)){
>     echo "<p>$Y</p>\n";
>   }
> }
> 
> So, how come *SOMETIMES*, seemingly at random, I get:
> 
> Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index
> 116 (or the
> query data is unbuffered) in
> /www/acousticdemo.com/web/complaints/publish.cron on
> line 26
> 
> Line 26 is, obviously, the mysql_data_seek call above...
> 
> I do not *THINK* there is any other process anywhere deleting rows
> from the table -- it should be an ever-growing table...
> 
> So is the query data being unbuffered out from under me due to some
> my.cnf setting?...
> 
> Or am I just plain wrong, and *something* is deleting from the entry
> table?
> 
> I Googled for the error message, and found about a 26,000 web sites
> that are exhibiting this error, rather than the folks discussing this
> error. :-v
> 
> The few I was able to weed out were obvious logic errors, which I
> don't think I have.
> 
> I've read the mysql_unbuffered_query on php.net and think I understand
> it in respect to mysql_query et al.
> 
> I guess I'm looking for reassurance that it's definitely my mistake
> somewhere in the mess I've made, and that I'm looking for a delete
> query, and it's not a subtle bug or feature I'm failing to understand.
> 
> :-)
> 
> -- 
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux