RE: [sqlite] Query generation

2006-12-06 Thread Fred Williams
Pusedo code: set s.sql = 'select a from mytable where (b=0)'; if got.more then set s.sql = s.sql + ' and ' + s.userinput; ... set s.sql = s.sql + ';'; > -Original Message- > From: Lloyd [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 07, 2006 2:46 AM > To: sqlite-users@sqlite.org

Re: [sqlite] Query generation

2006-12-06 Thread Darren Duncan
At 2:15 PM +0530 12/7/06, Lloyd wrote: Hi, I am generating queries dynamically from my program based on the input. The primary part of the query is always select a from mytable where (b=0) and based on the user input I add more where clauses to my query like select a from mytable where (b=0) and

Re: [sqlite] Query generation

2006-12-06 Thread Lloyd
Thanks, 0=0 works well enough for me. (This hint is what I wanted) Thanks again, Lloyd On Wed, 2006-12-06 at 10:00 +0100, Mario Frasca wrote: > Lloyd wrote: > > >select a from mytable where (b=0) and > > > >and this is a syntax error. > > > > > you're not saying which language you're using.

Re: [sqlite] Query generation

2006-12-06 Thread Mario Frasca
Lloyd wrote: select a from mytable where (b=0) and and this is a syntax error. you're not saying which language you're using. in Python a common solution looks like this: clauses = [] # add strings to the clauses list, like clauses.append('(b=0)') # join the parts using appropriate glue wh