2009年8月21日星期五

[PerlChina] Re: 求助,这段看不明白~

周延 wrote:
> 刚接触这个,老师直接让改程序,语法粗看了下,下面这段还不懂但是时间又很紧,不能慢慢研究了,麻烦前辈们帮忙解答下,感激不尽^_^
>
> sub extract_person_list_from_database()
> {
> my ($option, $total, $cid, $port) = @_;
> my $sql_fetch_person = qq {select id, name from contact_info where
> issearch = 0 and id % ? = ? limit 20 };


> my $stat = $thedbh->prepare($sql_fetch_person);


> my ($id, $name); #这几行都是声明吗? ($id, $name); 为什么加括号
> while ( $flag == 1 )
> {
> $rv = $stat->execute($total, $cid);
> @current_array = ();
> if( $rv > 0 )
> {
> $stat->bind_columns(\$id, \$name); #这里也不知道?

这里是把 sql_fetch_person 里抓到的 id 和 name 值付给 $id 和 $name, 下面
每次执行 $stat->fetch 用的。 有时间的话看看 DBI 的文档
http://search.cpan.org/perldoc?DBI

> while ( $stat->fetch())
> {

Qiang

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

没有评论: