Show
Ignore:
Timestamp:
11/15/08 10:59:41 (5 years ago)
Author:
yappo
Message:

index を使った delete が出来るようになった

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Data-Model/trunk/lib/Data/Model/Driver/DBI.pm

    r23563 r23747  
    8989    unshift @{ $columns->{from} }, $schema->{model}; 
    9090 
     91    my $index_query = delete $columns->{index}; 
    9192    my $stmt = Data::Model::SQL->new(%{ $columns }); 
    9293    $self->add_key_to_where($stmt, $schema->{key}, $key) if $key; 
    93     $self->add_index_to_where($schema, $stmt, $columns->{index}) if exists $columns->{index}; 
     94    $self->add_index_to_where($schema, $stmt, $index_query) if $index_query; 
    9495    my $sql = $stmt->as_sql; 
    9596 
     
    222223 
    223224    $columns->{from} = [ $schema->{model} ]; 
     225    my $index_query = delete $columns->{index}; 
    224226    my $stmt = Data::Model::SQL->new(%{ $columns }); 
    225227    $self->add_key_to_where($stmt, $schema->{key}, $key) if $key; 
     228    $self->add_index_to_where($schema, $stmt, $index_query) if $index_query; 
    226229 
    227230    my $sql = "DELETE " . $stmt->as_sql;