I'm sorry; I made a mistake. More experimenting based on JohnS comments and it seems to be all working fine now - exactly as described but without having to create a dummy column. I'm not sure what my mistake was but it is working now. So no lazy or nonlazy parameters required and this is a good workaround.
I still have one minor problem left though. I would like to generate the onthefly column automatically and so I have added the following lines to the Extra.pm file (which is invoked with $loader->post_init_hook) for this class: #GARD::Book->meta->add_columns( C_sourceyear => { type=> 'varchar', length => 4}); GARD::Book->meta->add_columns( C_sourceyear => { type=> 'sourceyear', length => 4 }); As it stands, it doesn't work. The C_sourceyear file doesn't end up in the class. If I comment out the 2nd line and uncomment out the 1st, this does work. So I guess that post_init_hook doesn't like the type and therefore ignores the column spec. To force it, I added the lines: use Rose::DB::Object::Metadata; Rose::DB::Object::Metadata->column_type_class( sourceyear => 'GARD::DB::Column::SourceYear'); beforehand. This did then create the line but it had converted the type to 'integer', not sourceyear. Presumably because the SourceYear class does use base 'Rose::DB::Object::Metadata::Column::Integer'; This is not a big deal; but just wondering if it's my ignorance as usual or just something to live with. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of John > Siracusa > Sent: 27 June 2007 14:29 > To: Rose::DB::Object list > Subject: Re: [RDBO] on the fly fields > > > On 6/27/07, James Masters <[EMAIL PROTECTED]> wrote: > > Unfortunately, doing this seems to remove the onthefly > column from the > > select spec completely. > > You can pass a nonlazy => 1 param to change that. > > > Also, I had trouble testing this properly but I think that > even if lazy, > > when I do include the onthefly column in the select spec, > it still complains > > that the field doesn't exist. > > I don't see why that should be. Is the SQL generated correct and the > error is on the perl side, or is it the other way around? > > -John > > -------------------------------------------------------------- > ----------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Rose-db-object mailing list > Rose-db-object@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rose-db-object > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object