Attempting to implement a "MATCH ALL VALUES" expression at the application level.

From: Mike Kienenberger (mkienen..mail.com)
Date: Mon Apr 17 2006 - 17:53:51 EDT

  • Next message: Mike Kienenberger: "Re: Attempting to implement a "MATCH ALL VALUES" expression at the application level."

    I'm trying to implement a "Match all values" expression behavior (like
    previously discussed as hasAllOfExp or MatchAllValuesExpression on the
    mailing list in the past). I'm guessing no one ever implemented a
    MatchAllValuesExpression.

    However, I'm finding myself inadequate for the task.

    For example,

    letters
    a
    b
    c

    digits
    1
    2
    3

    letters__digits
    a-1
    a-2
    a-3
    b-2
    c-3
    c-2

    find all 1s: a
    find all 2s: a, b, c
    find all 3s: a, c

    "Match all values" on (1, 2) would generate sql like the following and
    return "a"

    select l1.* from letters l1, letters_digits ld1, digits d1, letters
    l2, letters_digits ld1, digits d2 where

    d1.value = '1' and ld1.digit_id = d1.digit_id and ld1.letter_id = l1.letter_id
    and
    d2.value = '2' and ld2.digit_id = d2.digit_id and ld2.letter_id = l2.letter_id

    At least, that's my understanding of what would need to be done based
    on previous postings.

    My actual use case is something along the lines of "any number of
    names" + "any number of phones" + "any number of emails" on a contact
    record that has a many-to-many relationship with names and with phones
    and with emails.

    Anyone have any suggestions?

    I'm about to give up and do it in-memory by searching for a single
    name, and then doing an in-memory removal (from the list) of each
    non-matching contact for each remaining name, phone, and email....



    This archive was generated by hypermail 2.0.0 : Mon Apr 17 2006 - 17:54:15 EDT