first of all,u can download DBD/DBI modules such as DBI-perl-bin-1.06.tar.gz and msql-mysql-moduels-XXX.tar.gz.
then compile it.
you can test the perl script below to test.
#!/usr/bin/perl
use DBI;
$database="test";
$data_s="DBI:mysql:$database";
$username="root";
$passwd=" ";
$dbh = DBI->connect($data_s,$username,$passwd) or die "shit,can't connect:$dbh->errstr\n";
print "Creating table jiangzk\n";
($dbh->do("\
CREATE TABLE jiangzk(
id int(2) primary key,
name char(10),
hobby char(10))")) or die $DBI::errstr;
print "Insert records\n";
$dbh->do("insert into jiangzk values(1,'jzk','football')") or die $DBI::errstr;
$dbh->do("insert into jiangzk values(2,'gaoyin','love')") or die $DBI::errstr;
print "Testing records\n";
$sth=$dbh->prepare("select * from jiangzk") or die die $dbh->errstr;
$sth->execute() or die $sth->errstr;
while (($row = $sth->fetchrow_arrayref))
{
print $row->[0]," ",length($row->[1]),"\n";
die "Record had wrong data";
}
$dbh->do("drop table $table") or die $DBI::errstr;
print "Test ok\n";
exit 0;
----- Original Message -----
From: Larry Mak <MakAtak@stripped>
To: <mysql@lists.mysql.com>
Sent: Thursday, May 27, 1999 11:34 AM
Subject: PERL
Can someone tell me how PERL interacts with SQL? Is it nearly the same as PHP?[I need PERL for file stuff]
Sorry, new on the list if this question was already answered.
Thanks in advance
=============================================
Just because two people argue, it doesn't mean they don't
love each other, and just because they don't argue doesn't
mean they do.
- Larry Mak
http://www.asan.com/users/MakAtak
http://www.stuy.edu/clubs/keyclub
=============================================
| Thread |
|---|
| • PERL | Larry Mak | 27 May |
| • Re: PERL | Sasha Pachev | 27 May |
| • Re: PERL | jiangzk | 27 May |