Curt Russell Crandall writes:
 > I'm rewriting a piece of C code that uses the OpenClient libraries to set
 > a row in a process table under certain circumstances.  The chunk of Perl
 > code that handles this is:
 > 
 > package init_process;
 > 
 > ...
 > 
 > my $cmd = "exec sales2..sa_initprocess ", $dbh->quote($item_src) . ",
 > " . $proc_id;
 > my $sth = $dbh->prepare("$cmd") or warn(...);
 > 
 > $sth->execute() or warn(...);
 > 
 > my $numrows = 0;
 > do
 >  {
 >      while (my @row = $sth->fetchrow_array())
 >       {
 >           print join("::", @row), "\n";  ### line 45
 >           ($a, $b, $c, $d, $e, $f, $g, $h, $i) = @row;
 >       }
 >  } while ($sth->{syb_more_results});
 > $sth->finish();
 > 
 > print "numrows: $numrows\n";
 > 
 > The output of this is:
 > Use of uninitialized value at init_process.pm line 45
 > Use of uninitialized value at init_process.pm line 45

You have two entries in @row that are undef (i.e. - they are NULL in
the result set).

 > /tmp/xxx.tmp::EXTtranldr::Apr 25 2001 12:26PM::::1::1::Apr 25 2001
 > 12:00AM::0::0::0::0::0::0::0::8
 > 0
 > numrows: 2

The second row (actually the second result set) is the "status" result
from the stored proc.

If you are not interested in this value you can set
$dbh->{syb_do_proc_status} = 1, which should cause $sth->execute() to
fetch this result value for you and return a failure if it is not 0.

Michael
-- 
Michael Peppler - Data Migrations Inc. - [EMAIL PROTECTED]
http://www.mbay.net/~mpeppler - [EMAIL PROTECTED]
International Sybase User Group - http://www.isug.com
Sybase on Linux mailing list: [EMAIL PROTECTED]

Reply via email to