where clause determined at runtime

[prev] [thread] [next] [Date index for 2005/01/26]

From: Warren Pollans
Subject: where clause determined at runtime
Date: 18:56 on 26 Jan 2005
Hello,

I have several queries where the nature of the where clause is not 
known until runtime.  I have separate queries defined for each 
possibility - and select the appropriate one based on conditions at 
runtime - ie, user input.

For example,

__PACKAGE__->set_sql( 'undone_all', <<"");
select _id
from dances left join dancedb
on _id = Dance_id
where Dance_id IS NULL

__PACKAGE__->set_sql( 'undone', <<"");
select _id
from dances left join dancedb
on _id = Dance_id
where Dance_id IS NULL
and _id in (%s)

QUESTION: Is there a "better" way of doing this?  - perhaps by, 
somehow, constructing/modifying the sql at runtime?


Thanks,

Warren

where clause determined at runtime
Warren Pollans 18:56 on 26 Jan 2005

Re: where clause determined at runtime
Perrin Harkins 20:49 on 26 Jan 2005

Re: where clause determined at runtime
William McKee 22:28 on 26 Jan 2005

Generated at 17:42 on 27 Jan 2005 by mariachi v0.52