Package Gnumed :: Package pycommon :: Module gmMatchProvider :: Class cMatchProvider_SQL2 |
[frames] | no frames]

# Class cMatchProvider_SQL2

source code

        object --+
                 |
    cMatchProvider --+
                     |
                    cMatchProvider_SQL2

Known Subclasses:
  - wxpython.gmAddressWidgets.cAddressMatchProvider

    Match provider which searches matches
       in possibly several database tables.

    queries:
            - a list of unicode strings
            - each string is a query
            - each string must contain: "... where <column> %(fragment_condition)s ..."
            - each string can contain in the where clause: "... %(<context_key>)s ..."
            - each query must return (data, label)

    context definitions to be used in the queries
    example: {'ctxt_country': {'where_part': 'and country = %(country)s', 'placeholder': 'country'}}

    _SQL_data2match:
            SQL to retrieve a match by, say, primary key
            wherein the only argument is 'pk'

Instance Methods
__init__(self, queries=None, context=None) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
getAllMatches(self) Return all items. | source code
getMatchesByPhrase(self, aFragment) Return matches for aFragment at start of phrases. | source code
getMatchesBySubstr(self, aFragment) Return matches for aFragment as a true substring. | source code
getMatchesByWord(self, aFragment) Return matches for aFragment at start of words inside phrases. | source code
get_match_by_data(self, data=None) | source code
Inherited from `cMatchProvider`: `getMatches`, `setThresholds`, `set_context`, `unset_context` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables
Inherited from `cMatchProvider`: `print_queries`

Properties
Inherited from `cMatchProvider`: `ignored_chars`, `word_separators` Inherited from `object`: `__class__`

Method Details

### __init__(self, queries=None, context=None) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__ (inherited documentation)

### getAllMatches(self) | source code
Return all items. Overrides: cMatchProvider.getAllMatches

### getMatchesByPhrase(self, aFragment) | source code
Return matches for aFragment at start of phrases. Overrides: cMatchProvider.getMatchesByPhrase

### getMatchesBySubstr(self, aFragment) | source code
Return matches for aFragment as a true substring. Overrides: cMatchProvider.getMatchesBySubstr

### getMatchesByWord(self, aFragment) | source code
Return matches for aFragment at start of words inside phrases. Overrides: cMatchProvider.getMatchesByWord

### get_match_by_data(self, data=None) | source code
Overrides: cMatchProvider.get_match_by_data