Changeset 2881


Ignore:
Timestamp:
12/17/13 16:58:32 (10 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-5858

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Bug fix on handling existing TaQL query string.
If original query is related to FIELDNAME or SRCNAME,
it is overwritten. Otherwise, the new query is appended
to the original one.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/selector.py

    r2876 r2881  
    224224        query_list = list(self.generate_query(selection_list))
    225225        if len(query_list) > 0:
    226             query = 'SELECT FROM $1 WHERE ' + ' || '.join(query_list)
     226            original_query = self.get_query()
     227            if len(original_query) == 0 or re.match('.*(SRC|FIELD)NAME.*',original_query):
     228                query = 'SELECT FROM $1 WHERE ' + ' || '.join(query_list)
     229            else:
     230                query = 'SELECT FROM $1 WHERE (' + original_query + ') && (' + ' || '.join(query_list) + ')'
    227231            self._settaql(query)
    228232
     
    338342                s = map(string.strip, pattern.split('~'))
    339343                if len(s) == 2 and s[0].isdigit() and s[1].isdigit():
    340                     self.id = [int(s[0])-1,int(s[1])]
     344                    id0 = int(s[0])
     345                    id1 = int(s[1])
     346                    if id0 == 0:
     347                        self.id = id1
     348                        self.template = string.Template('FIELDNAME == regex(\'.+__${reg}$\')')
     349                    else:
     350                        self.id = [id0-1,id1]
     351                        self.template = string.Template('FIELDNAME == regex(\'.+__${reg}$\') && FIELDNAME != regex(\'.+__${optreg}$\')')
    341352                else:
    342353                    raise RuntimeError('Invalid syntax: %s'%(pattern))
    343                 self.template = string.Template('FIELDNAME == regex(\'.+__${reg}$\') && FIELDNAME != regex(\'.+__${optreg}$\')')
    344354            else:
    345355                raise RuntimeError('Invalid syntax: %s'%(pattern))
Note: See TracChangeset for help on using the changeset viewer.