Changeset 34129

Show
Ignore:
Timestamp:
06/24/09 21:44:54 (4 years ago)
Author:
fujiwara
Message:

key_start_with 引数追加

Location:
lang/perl/DBIx-CouchLike/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/DBIx-CouchLike/trunk/lib/DBIx/CouchLike.pm

    r34128 r34129  
    99use DBIx::CouchLike::Iterator; 
    1010 
    11 our $VERSION = '0.07'; 
     11our $VERSION = '0.08'; 
    1212our $RD; 
    1313__PACKAGE__->mk_accessors(qw/ dbh table utf8 _json /); 
     
    208208        $sql .= q{ AND m.key LIKE ? }; 
    209209        push @param, $query->{key_like}; 
     210    } 
     211    elsif ( exists $query->{key_start_with} ) { 
     212        my ($part, @value) 
     213            = $self->_start_with("m.key" => $query->{key_start_with}); 
     214        $sql .= q{ AND } . $part; 
     215        push @param, @value; 
    210216    } 
    211217 
  • lang/perl/DBIx-CouchLike/trunk/t/02_view.t

    r34128 r34129  
    8686]; 
    8787 
     88 
     89@res = $couch->view("tags/name", { key_start_with => "c" }); 
     90is_deeply \@res => [ 
     91    { key => "cat",  value => "animal",       id => $a_id }, 
     92    { key => "cat",  value => "unix command", id => $u_id }, 
     93]; 
     94 
     95@res = $couch->view("tags/name", { key_start_with => "d" }); 
     96is_deeply \@res => [ 
     97    { key => "dog",  value => "animal",       id => $a_id }, 
     98]; 
     99 
    88100@res = $couch->view("tags/name", { key => {"<>" => "dog"} }); 
    89101is_deeply \@res => [ 
  • lang/perl/DBIx-CouchLike/trunk/xt/04_benchmark.t

    r33620 r34129  
    7171        my $r = $couch->view('count/by_tail_of_id', { key_like => "12%" }); 
    7272    }, 
     73    map_key_sw => sub { 
     74        my $r = $couch->view('count/by_tail_of_id', { key_start_with => "12" }); 
     75    }, 
    7376    map_key_docs => sub { 
    7477        my $r = $couch->view('count/by_tail_of_id', { key => "12", include_docs => 1, });