Changeset 10

Show
Ignore:
Timestamp:
05/03/06 23:59:38 (4 years ago)
Author:
sky
Message:

r13@crucially-3 (orig r930): btrott | 2005-06-23 19:05:09 -0700
Fixed broken update method, and added a test for it

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/Data/ObjectDriver/Driver/DBI.pm

    r9 r10  
    302302    my $sql = "UPDATE $tbl SET\n"; 
    303303    $sql .= join(', ', map $driver->db_column_name($tbl, $_) . " = ?", @$cols) . "\n"; 
    304     my $stmt = $driver->prepare_statement(ref($obj), $obj->primary_key); 
     304    my $stmt = $driver->prepare_statement(ref($obj), 
     305        $driver->primary_key_to_terms(ref($obj), $obj->primary_key)); 
    305306    $sql .= $stmt->as_sql_where; 
    306307     
  • trunk/t/32-partitioned.t

    r4 r10  
    77use Recipe; 
    88use Ingredient; 
    9 use Test::More tests => 46; 
     9use Test::More tests => 48; 
    1010 
    1111my($tmp, $iter); 
     
    1818is($recipe->title, 'Banana Milkshake', 'Title is Banana Milkshake'); 
    1919 
     20$recipe->title('My Banana Milkshake'); 
     21ok($recipe->save, 'Object updated successfully'); 
     22is($recipe->title, 'My Banana Milkshake', 'Title is My Banana Milkshake'); 
     23 
    2024$tmp = Recipe->lookup($recipe->id); 
    2125is(ref $tmp, 'Recipe', 'lookup gave us a recipe'); 
    22 is($tmp->title, 'Banana Milkshake', 'Title is Banana Milkshake'); 
     26is($tmp->title, 'My Banana Milkshake', 'Title is My Banana Milkshake'); 
    2327 
    2428my @recipes = Recipe->search; 
    2529is(scalar @recipes, 1, 'Got one recipe back from search'); 
    26 is($recipes[0]->title, 'Banana Milkshake', 'Title is Banana Milkshake'); 
     30is($recipes[0]->title, 'My Banana Milkshake', 'Title is My Banana Milkshake'); 
    2731 
    2832$iter = Recipe->search; 
     
    3135ok(!$iter->(), 'Iterator gave us only one recipe'); 
    3236is(ref $tmp, 'Recipe', 'Iterator gave us a recipe'); 
    33 is($tmp->title, 'Banana Milkshake', 'Title is Banana Milkshake'); 
     37is($tmp->title, 'My Banana Milkshake', 'Title is My Banana Milkshake'); 
    3438 
    3539my $ingredient = Ingredient->new;