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
> Subject: [sqlite] Query generation
> 
> 
> 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 (x=10)
> 
> but in one case there in no where clause to add, so my final query
> become
> 
> select a from mytable where (b=0) and
> 
> and this is a syntax error.
> 
> Is there any option to add a null clause after the 'and' ?
> 
> Thanks,
>   Lloyd
> 
> 
> ______________________________________
> Scanned and protected by Email scanner
> 
> --------------------------------------------------------------
> ---------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> --------------------------------------------------------------
> ---------------
> 

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to