Friday, August 25, 2006

search->first, find, and single

DBIx::Class 简单地读取一条数据的时候有三种方法。

一是用 ->search( { author_id => 1 } )->first;
二是用 ->find( { author_id => 1 } );
三是用 ->single( { author_id => 1 } );

我用 Data::Compare 比较过。三者的数据是一样的。
但是原理上来说,最下面的是最快的。因为没有创建一个 Cursor.

http://search.cpan.org/~jrobinson/DBIx-Class-0.07001/lib/DBIx/Class/ResultSet.pm#single

Labels:

2 Comments:

Anonymous Anonymous said...

I found a list of free PERL books available online for download which might be useful for the readers.
Top 4 Perl Books for free download.

8/30/2006 3:52 PM  
Blogger Fayland said...

mm, these books are somehow outdated.
I will recommend the newest Perl Best Pratices and Perl Cookbook 4.
:)

8/30/2006 4:53 PM  

Post a Comment

Links to this post:

Create a Link

<< Home