Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > fetchrow not proceeding beyond 9th record

Reply
Thread Tools

fetchrow not proceeding beyond 9th record

 
 
dn_perl@hotmail.com
Guest
Posts: n/a
 
      11-12-2003
I am trying to fetch rows using $sth->fetchrow.
If I run my sql query from 'sqlplus' prompt, it returns 58 unique
records. But if I do :

while ($sth->fetchrow())

the loop is terminated after processing only 9 (not 5 records.

Why could this be happening? Is there any variable associated with
Perl DBI which is set to 9 and fetches only 9 rows by default.
If the number was 8 or 16, that would be less of a surprise.
But I am unable to make out while the loop exits too early
and why it exists after fetching 9 records.

Please advise.
 
Reply With Quote
 
 
 
 
Thomas Kratz
Guest
Posts: n/a
 
      11-12-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> I am trying to fetch rows using $sth->fetchrow.
> If I run my sql query from 'sqlplus' prompt, it returns 58 unique
> records. But if I do :
>
> while ($sth->fetchrow())
>
> the loop is terminated after processing only 9 (not 5 records.
>
> Why could this be happening? Is there any variable associated with
> Perl DBI which is set to 9 and fetches only 9 rows by default.
> If the number was 8 or 16, that would be less of a surprise.
> But I am unable to make out while the loop exits too early
> and why it exists after fetching 9 records.
>
> Please advise.


First advice: Please read the posting guidelines and post real code -
a minimal example - that shows the problem.

A DBI statement handle has no fetchrow() method! There are a few that
begin with "fetchrow" though.

And there are no restrictions on the number of returned rows from a
select statement.

Second advice: Please read the docs (perldoc DBI).
When fetching a row of data from a statement handle fails, you can use
the $sth->err() method to check the error. Also have a look at the
trace method of the database handle.

And tell us what perl and DBI version you are running.

Thomas

 
Reply With Quote
 
 
 
 
Gregory Toomey
Guest
Posts: n/a
 
      11-12-2003
It was a dark and stormy night, and (E-Mail Removed) managed to scribble:

> I am trying to fetch rows using $sth->fetchrow.
> If I run my sql query from 'sqlplus' prompt, it returns 58 unique
> records. But if I do :
>
> while ($sth->fetchrow())
>
> the loop is terminated after processing only 9 (not 5 records.
>
> Why could this be happening? Is there any variable associated with
> Perl DBI which is set to 9 and fetches only 9 rows by default.
> If the number was 8 or 16, that would be less of a surprise.
> But I am unable to make out while the loop exits too early
> and why it exists after fetching 9 records.
>
> Please advise.


Well, it shouldn't!

I suggest posting the code that causes the problem. Are there any variables used in the SQL statement. Are you SURE the statements are the same. Are you checking DBI return codes?

Note that some databases like Oracle (and possibly mysql with Innodb tables) have "read consistency", allowing two users to see different data. Make sure you are doing commits.

gtoomey
 
Reply With Quote
 
ctcgag@hotmail.com
Guest
Posts: n/a
 
      11-13-2003
(E-Mail Removed) ((E-Mail Removed)) wrote:
> I am trying to fetch rows using $sth->fetchrow.
> If I run my sql query from 'sqlplus' prompt, it returns 58 unique
> records. But if I do :
>
> while ($sth->fetchrow())
>
> the loop is terminated after processing only 9 (not 5 records.
>
> Why could this be happening?


I don't know what fetchrow is. Is it a deprecated synonym for
fetchrow_array?

If so, then as soon as you return a false value (0,empty string,etc.) your
loop will test false and exit.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
softphone with Call proceeding , progress ? mbm VOIP 0 04-02-2008 08:05 AM
How to keep proceeding if one command fails (in Rake)???? Luc Vantroys Ruby 8 08-15-2006 10:09 PM
Rake: How to keep proceeding if one command fails???? Luc Vantroys Ruby 1 08-05-2006 05:49 PM
Need suggestion about proceeding with MCAD B. Karmakar MCAD 2 04-22-2005 09:52 AM
DBI.pm fetchrow() issue superfly2 Perl Misc 3 09-18-2003 02:40 PM



Advertisments