bind_columns ??
am 01.04.2005 06:25:42 von Michael GaleHello,
I was going over some tutorials online and am lost when the tutorial
starts the bind_column selection.
The part that I do not understand is:
my( $id, $name, $title, $phone );
$sth->bind_columns( undef, \$id, \$name, \$title, \$phone );
If I am not mistaken, the first statment creates the following
variables: $id, $name, $title, $phone.
The second statement then is what I do not get, why is the "undef" there
? and what does \$varname actually ?
I included the full example from the tutorial below.
Thanks.
--snip--
use strict;
use DBI;
my $dbh = DBI->connect( 'dbi:Oracle:orcl',
'jeffrey',
'jeffspassword',
{
RaiseError => 1,
AutoCommit => 0
}
) || die "Database connection not made:
$DBI::errstr";
my $sql = qq{ SELECT id, name, title, phone FROM employees };
my $sth = $dbh->prepare( $sql );
$sth->execute();
my( $id, $name, $title, $phone );
$sth->bind_columns( undef, \$id, \$name, \$title, \$phone );
while( $sth->fetch() ) {
print "$name, $title, $phone\n";
}
$sth->finish();
$dbh->disconnect();
--snip--
Michael
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org