Trigger select does not trigger on TEMP fields

[prev] [thread] [next] [Date index for 2004/06/25]

From: William McKee
Subject: Trigger select does not trigger on TEMP fields
Date: 20:30 on 25 Jun 2004
Hi List,

Here's my latest gotcha with CDBI. I'm using a trigger__select to
populate some temporary fields for one of my tables. If this table is
referenced by another table, unless I ask for an existing column in the
table (that is not the PK), the trigger select will not get fired. Is
that by design? My expectations were that requesting the TEMP field
would cause CDBI to call the trigger select and load the values for that
field. Instead it returns an empty string :(.

Let me try restating this problem using class definitions since that
often helps to demonstrate what I'm doing:

  package QT::Orders;
  use base qw(QT::DBI);
  __PACKAGE__->table('orders');
  __PACKAGE__->columns(All => qw/id user_id order_date cc_type cc_number cc_exp cc_cvv2 cc_confirm approval approval_by/);
  __PACKAGE__->has_a(user_id => 'QT::DBI::Users');

  package QT::DBI::Users;
  use base qw(QT::DBI);
  use Data::Dumper;
  __PACKAGE__->table('users');
  __PACKAGE__->columns(Primary => qw/user_id/);
  __PACKAGE__->columns(Essential => qw/type_id reseller_id/);
  __PACKAGE__->columns(All => qw/password credit_score ctime/);
  __PACKAGE__->columns(TEMP => qw/full_email/);
  __PACKAGE__->has_many(orders => 'QT::DBI::Orders', 'user_id');


Using the above, I search orders via the following code:

  my $order = QT::Orders->search(id => 1)->first;


If I call $order->user_id->full_email, I get an empty string. However,
if I first call $order->user_id->type_id (or any other *real* field)
then call $order->user_id->full_email, I get the expected value.


Thanks for your input,
William

        -- 
        Knowmad Services Inc.
http://www.knowmad.com

Trigger select does not trigger on TEMP fields
William McKee 20:30 on 25 Jun 2004

Re: Trigger select does not trigger on TEMP fields
Charles Bailey 22:31 on 25 Jun 2004

Re: Trigger select does not trigger on TEMP fields
William McKee 14:35 on 17 Sep 2004

Re: Trigger select does not trigger on TEMP fields
Charles Bailey 20:29 on 17 Sep 2004

Re: Trigger select does not trigger on TEMP fields
William McKee 14:29 on 20 Sep 2004

Re: Trigger select does not trigger on TEMP fields
William McKee 11:43 on 26 Jun 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52