DBI, connect(), prepare(), execute(), fetchrow_array()

来源:互联网 发布:网络开设赌场被判案例 编辑:程序博客网 时间:2024/05/22 07:51


#!/usr/bin/perl use strict; use DBI; my $dbh = DBI->connect("dbi:mysql:dbname", 'user','passwd', '') or die "can't connect!\n"; my $sql = qq/show variables/; my $sth = $dbh->prepare($sql); $sth->execute(); while(my @array=$sth->fetchrow_array()) {    printf("%-35s", $_) foreach(@array);    print "\n"; } $dbh -> disconnect(); exit 0;


0 0
原创粉丝点击