Please note: this project is inactive since early 2006

 
4.5.3 Pattern matching

Suppose you want to get all the writers whose names begins with 'Hu', you'll write:

    objects=ec.fetch('Writer', qualifier='lastName like "Hu*"')

Available wildcards are '*' and '?'. The former matches any number of characters (including 0 -zero- character), the latter exactly one occurrence of a character.

You can also use the operator 'caseInsensitiveLike':

    objects=ec.fetch('Writer', qualifier='lastName caseInsensitiveLike "hu?o"')
will match: 'Hugo', 'Hulo', 'HUGO', 'hUXO', ...

Alternatively, you'd probably prefer to use a shorted alias for caseInsensitiveLike: ilike

    objects=ec.fetch('Writer', qualifier='lastName ilike "hu?o"')

Last, if you want to add raw '*' and '?' characters in a like pattern, escape them. For example, this fetchs all books whose title ends with 'here?':

    objects=ec.fetch('Book', qualifier='title like "*here\?"')

Comments are welcome: Sebastien Bigaret / Modeling Home Page
Hosted by:SourceForge.net Logo