bind_columns ??

Michael Gale <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
Hello,

	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/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.