On Thu, 19 Dec 2002 13:37:28 -0800 (PST) "Roderick A. Anderson" <[EMAIL PROTECTED]> 
wrote:

> Here it is with all the cruft from trying to sort it out.  I haven't
> included the connect stuff or the rest of the script since I know it 
> works.

>     my $sth = $dbh->prepare($domain_qry);
> 
>     $sth->execute($domainname_key);
> 
> #    $sth->bind_col(1, $domainname);
> 
>     $sth->bind_columns(\$domain_tbl_key, \$domainname, \$domainisactive,
>                        \$hosting_co_code, \$username, \$password,
>                        \$frontpageext, \$inrodopi, \$firstname, \$middle,
>                        \$lastname, \$phone, \$registrar, \$regusername,
>                        \$regpassword, \$notes
>                        );

One trick I find useful is to group the \ operation.

   $sth -> bind_columns( \( $v0, $v1, @ar[0,1], @ha{qw(x y)} ) );

Note that bind_columns() does not fetch the rows, it just defines where the
columns will be stored when a row is fetched.

> ### Testing did I get a row back?
> 
>     print p($sth->rows);

$sth->rows() isn't reliable until all rows have been fetched.

> ### When I un-comment this the print works???  But I don't want the
> output
> #    my $dump = $sth->dump_results();

# if you want all rows, process them in a loop
while ( $sth -> fetch ) {
 
>     print p($domain_tbl_key, $domainname, $domainisactive, 
>        $hosting_co_code, $\username, $password, $frontpageext, $inrodopi,
>        $firstname, $middle, $lastname, $phone, $registrar, $regusername,
>        $regpassword, $notes);

}

> ### Should this be above?  Didn't seem to matter earlier.
> 
>     $sth->finish();

$sth->finish() isn't needed if you fetch all rows from a query.

> }

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.




Reply via email to