rose-db-object

Can I create a table (if not exists) from Rose::DB::Object metadata?

I'm having trouble finding it in the CPAN documentation -- is there a way to create a table (IF NOT EXISTS) from manually-entered Rose::DB::Object metadata? I'm using SQLite as an engine, if it happens to matter. Thanks! ...

Why isn't Rose::DB::Object sort_by RAND() doing what I expect?

I can't get it to work. I'm using this query: my $user_questions = RoseDB::UserSecurityQuestion::Manager->get_user_security_questions( query => [ 'user.username' => $username, ], with_objects => ['User','SecurityQuestion'], sort_by => 'RAND()', ...

How can I force list context in Template Toolkit with RDBO?

I have a TT plugin that does the trivial unique ids: sub get_unique_uid_tt { my ( $classname, $o ) = @_; my %h; foreach my $item ( @{$o} ) { unless ( exists $h{ $item->id } ) { $h{ $item->id } = 1; } } return keys %h; } where the template call is simply: [% Namespace.get_unique_uid_tt( data.users ) %] and...

Setting NULL datetime with Rose::DB::Object and MySQL

I could be wrong here, but it looks like there's conflicting standards here. MySQL treats a stored datetime of "0000-00-00 00:00:00" as being equivalent to NULL. (update - only, it seems, if the datetime is defined as NOT NULL) But Rose::DB::Object uses DateTime for MySQL DATETIME fields, and trying to set a null DATETIME from "0000-00...

Are Rose::DB::Object::Cached memory cached through different processes?

Are RDBOC objects cached through different processes? I'm thining of running it in mod-perl, and it would factor into things, even though it would mostly be used on things that don't change (much). Also, do relationships referencing RDBOCs use the cache when it should intuitively? ...

Using Rose::DB::Object, how can I auto create an object in a relationship if not found?

I have 2 tables that are 1-to-[0/1]. Is there a way to auto create the relationship object/row using Rose::DB::Object: For example: # detailed_summary is the 1-to-1 relationship # if detailed_summary exist, get it # if not, create a new one with links? $obj->detailed_summary Maybe a trigger? ...