s='select p.id,partno,description, c.name || l.name as location_descriptor from parts as p inner join locations as l on p.location_id = l.id inner join containers as c on l.container_id = c.id where '
s='select p.id,partno,description, c.name || l.name as location_descriptor from parts as p inner join locations as l on p.location_id = l.id inner join containers as c on l.container_id = c.id where '
iffilter['l']:
iffilter['l']=='true':
s+='('
s+='('
foriinrange(len(keywords)):
foriinrange(len(keywords)):
s+='LOWER(l.name) like LOWER(:kw'+str(i)+') AND '
s+='LOWER(l.name) like LOWER(:kw'+str(i)+') AND '
s=s[:-5]
s=s[:-5]
s+=') OR '
s+=') OR '
iffilter['p']:
iffilter['p']=='true':
s+='('
s+='('
foriinrange(len(keywords)):
foriinrange(len(keywords)):
s+='LOWER(partno) like LOWER(:kw'+str(i)+') AND '
s+='LOWER(partno) like LOWER(:kw'+str(i)+') AND '
s=s[:-5]
s=s[:-5]
s+=') OR '
s+=') OR '
iffilter['d']:
iffilter['d']=='true':
s+='('
s+='('
foriinrange(len(keywords)):
foriinrange(len(keywords)):
s+='LOWER(description) like LOWER(:kw'+str(i)+') AND '
s+='LOWER(description) like LOWER(:kw'+str(i)+') AND '