I found a bug a couple weeks back where I had a DB structure that had  
this odd table hanging around where the only field was the primary  
key, which was also a foreign key. I found at the time that you could  
create a new() on that object, which would save() fine. But if you  
ever wanted to call save() a second time, it would fail because the  
SQL generated is something like:

UPDATE foo SET  WHERE id = ?;

This obviously fails.

I passed it off as nothing, cos really why would you have a table  
with one field. So I screwed with my schema and managed to squeeze  
the table away.

Anyway, I'm now seeing the same problem again when you use save 
(changes_only => 1), but there were no changes. It generates the same  
SQL as above because it always seems to think the primary key is a  
modified field.

my $foo = My::Foo->new(id => 1);
$foo->load;
$foo->save(changes_only => 1);

Because we created foo by setting id to 1, it thinks "id" is a  
modified field.

regards,
Danial

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to