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. The empty string default looks to me like the result of an auto-generated module running against MySQL, which looooves to make unrequested empty string defaults. You might want to "fix up" the auto-generated column metadata before spitting out the module code, wiping any unrequested empty string defaults (i.e., set the default to undef instead) This declaration looks fine, BTW: > unique_keys => [ > [ 'email' ], > [ 'username' ], > ], It translates to: ...->meta->unique_keys([ 'email' ], [ 'username' ]); which makes two unique keys, each with one column. -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