Re: Method Names (was: Stolen Ideas)

[prev] [thread] [next] [Date index for 2004/08/12]

From: Jay Strauss
Subject: Re: Method Names (was: Stolen Ideas)
Date: 15:04 on 12 Aug 2004
> > Then tackle the whole using database functions like sysdate elegantly in
> > CDBI :)
>
> Syntax, people, give me syntax!

Ok, then how about this:

For using functions upon the left hand side of the "where" clause, for
example
if I want to implement:

select *
  from table
where upper(first_name) = ?;

I do it like:

my $builtin = q[upper(first_name)];
my @rows = $class->search(\$builtin => "BEATLES");

If one of the keys is a reference, pass it to dbi without putting
it in quotes.


For stuff on the right side of the equals sign (for both queries
and updates)

just make the right hand side a reference

i.e.

my $sysdate = q[sysdate];
$row->set(last_modified_date=>\$sysdate);

or for a select or delete

my $str = q[sysdate - 15];
my @rows = $class->search(last_modified_date => \$str);

Otherwise I think you will be faced with doing something like
adding a tag to indicate to CDBI not to mess with the value.  Something
like:

my @rows = $class->search(last_modified_date => q[<PRESERVE>sysdate - 15];

Which I personally think sucks.

Thanks
Jay

(message missing)

Method Names (was: Stolen Ideas)
Jay Strauss 14:20 on 11 Aug 2004

Re: Method Names (was: Stolen Ideas)
Tony Bowden 22:14 on 11 Aug 2004

Re: Method Names (was: Stolen Ideas)
Jay Strauss 15:04 on 12 Aug 2004

Re: Method Names (was: Stolen Ideas)
Tony Bowden 15:54 on 12 Aug 2004

Re: Method Names (was: Stolen Ideas)
Jay Strauss 15:11 on 13 Aug 2004

Re: Method Names (was: Stolen Ideas)
Jay Strauss 16:35 on 14 Aug 2004

Pass a DBI Object?
Brian E. Lozier 18:22 on 14 Aug 2004

Re: Method Names (was: Stolen Ideas)
Tim Bunce 11:54 on 18 Aug 2004

Re: Pass a DBI Object?
Branislav Zahradnik 15:04 on 18 Aug 2004

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