On Mon, February 12, 2007 9:48 am, John Siracusa wrote: > On 2/11/07, Ask Bjørn Hansen <[EMAIL PROTECTED]> wrote: >> When I run Foo::Model::User::Manager->new(username => 'ask')->load >> (speculative => 1) >> >> the generated SQL is >> >> SELECT bitcard_id, email, id, name, nomail, pass, public_profile, >> username FROM users WHERE email = ? - bind params: >> >> (notice how it's using the wrong query and that the parameter isn't >> used). > > The problem is here: > >> email => { type => 'varchar', default => '', length => 255, not_null => >> 1 }, > > RDBO uses the first unique key what has a defined value (evaluated in > the order they were added to the metadata, IIRC). Since the default > value for the email column is indeed defined (''), it is used. The > bind params debug line actually is printing the value it's binding: an > empty string.
Hm, so ->new is populating unspecified columns with default values and then load is using those. Could the population of unspecified columns be delayed, or make it possible for ->load to determine that a column was not specified but has been given the default value. Graham. ------------------------------------------------------------------------- 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