当前位置:主页 > 技术文档 > Perl 下载

Perl DBI手册 超清版

  • 更新:2020-10-14 10:48:54
  • 大小:798 KB
  • 热度:603
  • 审核:崔念露
  • 类别:技术文章
  • 格式:PDF

  • 资源介绍
  • 相关推荐

可移植的DBI方法:

connect 建立到一个数据库服务器的连接
disconnect 断开数据库服务器的连接
prepare 准备执行一个SQL语句
execute 执行准备好的语句
do 准备并执行一个SQL语句
quote 加引号于要插入的字符串或BLOB值
fetchrow_array 作为一个字段数组取出下一行
fetchrow_arrayref 作为一个字段的引用数组取出下一行
fetchrow_hashref 作为一个哈希表的引用取出下一行
fetchall_arrayref 作为一个字段数组取出所有数据
finish 完成一条语句并且让系统释放资源
rows 返回受影响的行数
data_sources 返回可在localhost上得到的数据库的数组
ChopBlanks 控制fetchrow_*方法是否剥去空格
NUM_OF_PARAMS 在准备的语句中的占位(placeholder-参数)的数目
NULLABLE 其列可以是NULL
trace 执行调试跟踪

资源下载

资源下载地址1:https://pan.baidu.com/s/1jitci_4xWVb8ESoyFDtCgw

网友留言

Perl DBI 示例图
田安琪

Perl DBI 示例图

Perl DBI使用实例
广修贤

#!/usr/bin/perl
 
#set module
use DBI;
 
#scanf the mysqluser
print "请输入mysql帐号:\n";
chomp($mysql_n=<STDIN>);
print "请输入mysql密码:\n";
chomp($mysql_p=<STDIN>);
print "请输入需要连接的数据库:\n";
chomp($mysql_d=<STDIN>);
 
#connect mysql
my $in=DBI->connect("DBI:mysql:database=$mysql_d;host=localhost","$mysql_n","$mysql_p",{'RaiseError'=>1});
#select databases;
my $select=$in->prepare("select * from people");
$select->execute();
 
#print the list
while(my $list=$select->fetchrow_hashref()){
  print "$list->{'username'}\t";
  print "$list->{'password'}\t";
  print "$list->{'number'}\t";
  print "$list->{'year'}\t";
}
print "\n";
#close mysql
$in->disconnect();