On 6/27/06, John Siracusa <[EMAIL PROTECTED]> wrote: > The update() method has a changes_only parameter that instructs it to only > update the columns whose values have been modified. I suppose I should add > the same option to the insert() method (thus making it also valid on all > calls to the save() method). I'll add it to my list...
I'm doing this now, but I've got a question. If a column has a default value specified in the RDBO metadata, should it be explicitly set when inserting with "changes only"? Consider: CREATE TABLE mytable ( id SERIAL PRIMARY KEY, num INT DEFAULT 123, name VARCHAR(255), flag INT DEFAULT 123 ); package MyObject; ... __PACKAGE__->meta->setup ( table => 'mytable', columns => [ id => { type => 'serial', primary_key => 1 }, num => { type => 'int' }, name => { type => 'varchar', length => 255 }, flag => { type => 'int', default => 123 }, ], ... ); What SQL should be run by this operation? $o = MyObject->new(name => 'foo')->save(changes_only => 1); Should it be this? INSERT INTO mytable (name) VALUES ('foo'); Or should it be this? INSERT INTO mytable (name, flag) VALUES ('foo', 1); They may seem identical, but now imagine if the default value in the "flag" column metadata was something other than 123. Anyone have any opinions about how this should be handled? -John Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object