RE: Problems with mysql_fetch_row()

2005-05-31 Thread Bradley Kite
Hi there.

I've been having this problem when retrieving rows from a table
using mysql_fetch_row(). The problem is that sometimes it returns
null when I know that there are more records available. The behaviour
is intermittent too so its really difficult to track down.

I've tried it with MySQL Version 4.1.4 and also 4.1.12 and I get
the same behaviour (on Suse Linux, i386 architecture).

The select statement is as follows:

SELECT
raw_id,forename,surname,addr1,addr2,addr3,addr4,addr5,addr6,postal_area,
dob,email
FROM `ssain` WHERE (matched IS NULL);

However, looping through mysql_fetch_row() - after mysql_use_result() -
with:

while((MySqlRow = mysql_fetch_row(MySqlResult)) != NULL)

The while loop intermittently terminates early.  When the loop does
terminate early, it is usually (but not always) after it has correctly
processed record number 664, but I dont know if this is of any
significance.

if I run:

SELECT count(*) FROM ssain WHERE (matched IS NULL);

then I get 2027085 (just over 2 million) so I know that it should be
able
to pull the records themselves.

When the mysql_fetch_row() loop does break out early, the next time the
database handle is used (for another SQL statement), the following error
is reported:

Error 2006 (MySQL server has gone away)

and I also get this message when I check mysql_error() with:

if(strcmp(mysql_error(MySqlConn),)!=0)

I've turned on as many logging options on the server as I can find but
no
errors are reported. I've also looked on various places on the internet
to any possible solutions, all to no avail. All references to
MySQL server has gone away on google mention various time-out
settings,
however I get the issue after a few minutes in total, and the statement
handle is in use any way so there is no time for a time-out to occur?

I'm really at the last of my tethers with this one so any help or
suggestions
will be gratefully received.

Many thanks in advance!!


Bradley Kite
Software Developer/Data Management Specialist
alchemetrics - smarter data, faster
Tel: 0118 902 9043 (direct line)
Email: [EMAIL PROTECTED]
Web: http://www.alchemetrics.co.uk



**
ALCHEMETRICS LIMITED (ALCHEMETRICS)
Mulberry Park, Fishponds Road, Wokingham, Berkshire, RG41 2GX
Tel:  +44 (0) 118 902 9000Fax:  +44 (0) 118 902 9001
This e-mail is confidential and is intended for the use of the addressee only.
If you are not the intended recipient, you are hereby notified that you must 
not use, copy, disclose, otherwise disseminate or take any action based on 
this e-mail or any information herein.
If you receive this transmission in error, please notify the sender
immediately by reply e-mail or by using the contact details above and then
delete this e-mail.
Please note that e-mail may be susceptible to data corruption, interception 
and unauthorised amendment.  Alchemetrics does not accept any liability for 
any such corruption, interception, amendment or the consequences thereof.
**


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Problems with mysql_fetch_row()

2005-05-31 Thread Gleb Paharenko
Hello.





You may debug your client. See:

  http://dev.mysql.com/doc/mysql/en/debugging-client.html



Have you been at:

  http://dev.mysql.com/doc/mysql/en/gone-away.html



Increase your packet size. See:

  http://dev.mysql.com/doc/mysql/en/packet-too-large.html









Bradley Kite [EMAIL PROTECTED] wrote:

 Hi there.

 

 I've been having this problem when retrieving rows from a table

 using mysql_fetch_row(). The problem is that sometimes it returns

 null when I know that there are more records available. The behaviour

 is intermittent too so its really difficult to track down.

 

 I've tried it with MySQL Version 4.1.4 and also 4.1.12 and I get

 the same behaviour (on Suse Linux, i386 architecture).

 

 The select statement is as follows:

 

 SELECT

 raw_id,forename,surname,addr1,addr2,addr3,addr4,addr5,addr6,postal_area,

 dob,email

 FROM `ssain` WHERE (matched IS NULL);

 

 However, looping through mysql_fetch_row() - after mysql_use_result() -

 with:

 

 while((MySqlRow = mysql_fetch_row(MySqlResult)) != NULL)

 

 The while loop intermittently terminates early.  When the loop does

 terminate early, it is usually (but not always) after it has correctly

 processed record number 664, but I dont know if this is of any

 significance.

 

 if I run:

 

 SELECT count(*) FROM ssain WHERE (matched IS NULL);

 

 then I get 2027085 (just over 2 million) so I know that it should be

 able

 to pull the records themselves.

 

 When the mysql_fetch_row() loop does break out early, the next time the

 database handle is used (for another SQL statement), the following error

 is reported:

 

 Error 2006 (MySQL server has gone away)

 

 and I also get this message when I check mysql_error() with:

 

 if(strcmp(mysql_error(MySqlConn),)!=0)

 

 I've turned on as many logging options on the server as I can find but

 no

 errors are reported. I've also looked on various places on the internet

 to any possible solutions, all to no avail. All references to

 MySQL server has gone away on google mention various time-out

 settings,

 however I get the issue after a few minutes in total, and the statement

 handle is in use any way so there is no time for a time-out to occur?

 

 I'm really at the last of my tethers with this one so any help or

 suggestions

 will be gratefully received.

 

 Many thanks in advance!!

 

 

 Bradley Kite

 Software Developer/Data Management Specialist

 alchemetrics - smarter data, faster

 Tel: 0118 902 9043 (direct line)

 Email: [EMAIL PROTECTED]

 Web: http://www.alchemetrics.co.uk

 

 

 

 **

 ALCHEMETRICS LIMITED (ALCHEMETRICS)

 Mulberry Park, Fishponds Road, Wokingham, Berkshire, RG41 2GX

 Tel:  +44 (0) 118 902 9000Fax:  +44 (0) 118 902 9001

 This e-mail is confidential and is intended for the use of the addressee only.

 If you are not the intended recipient, you are hereby notified that you must 

 not use, copy, disclose, otherwise disseminate or take any action based on 

 this e-mail or any information herein.

 If you receive this transmission in error, please notify the sender

 immediately by reply e-mail or by using the contact details above and then

 delete this e-mail.

 Please note that e-mail may be susceptible to data corruption, interception 

 and unauthorised amendment.  Alchemetrics does not accept any liability for 

 any such corruption, interception, amendment or the consequences thereof.

 **

 

 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
   ___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]