在DBI-1.634使用手册里有一个selectrow_array函数,该函数具体说明如下:

  This utility method combines "prepare", "execute" and "fetchrow_array" into a single call. If called in a list context, it returns the first row of data from the statement. The $statement parameter can be a previously prepared statement handle, in which case the prepare is skipped.

  手册里说明该函数具备与fetchrow_array类似的功能。在实际使用时,确实有区别的。如下例子:

  

 #!/bin/env perl
 use DBI;

 my $dbh=DBI->connect("dbi:Oracle:gzgldb","nrmdb","nrmoptr123") or die "connect db error!";

 my $sql='select * from router';

 my $sth=$dbh->prepare($sql);

 $sth->execute() or die "execute sql error!";

 my @row1=$sth->fetchrow_array();
 print "@row1 \n";
 @row1=$sth->fetchrow_array();
 print "@row1 num2 \n";

 my @row=$dbh->selectrow_array($sql);
       print "@row\n";

 @row=$dbh->selectrow_array($sql);

       print "@row\n";

 $sth->finish;
 $dbh->disconnect();

以下为输出结果:

由此可以看出fetchrow_array每取一次,行指针会下移一次;而selectrow_array确不会这样做。

DBI-1.634之selectrow_array与fetchrow_array的区别的更多相关文章

  1. perl DBI 学习总结(转载)

    perl DBI 学习总结 源文地址:http://blog.csdn.net/like_zhz/article/details/5441946 DBI和DBD的不同关系模型: ########### ...

  2. Perl数据库DBI接口简介【转载】

    本文转载自:http://blog.csdn.net/like_zhz/article/details/5441946 ######################################## ...

  3. 转 perl DBI 总结

    https://www.cnblogs.com/homezzm/archive/2011/07/22/2113618.html ##查看已经安装的包 #!/usr/bin/perluse strict ...

  4. MongoDB 由于目标计算机积极拒绝,无法连接 2014-07-25T11:00:48.634+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:10061

    转载自:http://www.cnblogs.com/xiaoit/p/3867573.html 1:启动MongoDB 2014-07-25T11:00:48.634+0800 warning: F ...

  5. Linux安装DBI/DBD-ORACLE

    本文只是学习如何配置PERL DBI.PERL DBD时,整理的一个学习实践文档,大部分参考网上资料,详情请见下面参考资料. PERL对数据库的支持广而且全,几乎所有的主流数据库都有与之相应的PERL ...

  6. ruby使用DBI连接MySQL数据库发生异常:in `error': Can't connect to MySQL server on 'localhost' (10061) (DBI::DatabaseError)

    Ruby使用DBI连接MySQL数据库一般为: require "dbi" dbh = DBI.connect("dbi:Mysql:test:localhost&quo ...

  7. 使用DBI(perl)实现文本文件的导入导出mysql

    DBI 是perl脚本连接数据库的一个模块.perl脚本相对shell更灵活,功能更强大,跨平台能力强.相对可执行jar包要简单很多. ​1.下载安装包DBI-1.631.tar.gzperl脚本下载 ...

  8. 【MongoDB】2014-07-25T11:00:48.634+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:10061 由于目标计算机积极拒绝,无法连接。

    1:启动MongoDB 2014-07-25T11:00:48.634+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errn ...

  9. Redhat 安装Oracle DBI和DBD

    Redhat 安装DBI和ORACLE DBD tar -zxvf DBI-1.616.tar.gz cd DBI-1.616 perl Makefile.PL make make install 2 ...

随机推荐

  1. python2.x和python3.x的区别

    一.python2.x和python3.x中raw_input( )和input( )区别 1.在Python2.x中raw_input( )和input( ),两个函数都存在,其中区别为 raw_i ...

  2. SQL2005查询死锁的表和具体的语句

    查是哪个进程死锁了哪些表 select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName fro ...

  3. 如何在模拟器里体验微软HoloLens

    众所周知,微软的HoloLens以及MR设备售价都比较高,这让不少感兴趣的朋友们望而却步,本篇教程将向大家介绍如何在模拟器里体验传说中的HoloLens. 1.需要准备的硬件: 智能手机一台(WP.A ...

  4. (2018干货系列三)最新PHP学习路线整合

    怎么学PHP PHP是一种通用开源脚本语言.语法吸收了C语言.Java和Perl的特点,利于学习,使用广泛,主要适用于Web开发领域. 菜鸟到大神,一步到位,正式开启干货模式: PHP初级开发工程师 ...

  5. WPF文本框只允许输入数字

    XAML代码   < TextBox Height="23" HorizontalAlignment="Left" Margin="100,5, ...

  6. php字符串递增

    当递增变量是字符的时候 $a="a"; $a++; echo $a;//结果是b $a="Z"; $a++; echo $a;// 结果是AA $a=" ...

  7. PHP常见错误

    1.关于单引号和双引号的区别. $sql="insert into tableName values ('".$name."','".$email." ...

  8. freemarker中的split字符串分割

    freemarker中的split字符串分割 1.简易说明 split分割:用来根据另外一个字符串的出现将原字符串分割成字符串序列 2.举例说明 <#--freemarker中的split字符串 ...

  9. C#扩展方法类库StringExtensions

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  10. px单位html5响应式方案

    移动端h5响应式方案最近这几年用得最多的最多的就是rem方案了.这个需要计算根元素的font-size来实现响应式. 但这种方案也有一个缺点,那就是font-size不为整数的时候一些字体使用rem单 ...