'Because the database dates have time in them, we can\'t use direct
comparisons even when field_count == 3. The query has time = 0, but
the database object has time == something. As such, a complete compare
will almost never be correct.'

def build_date_relop_dict(self):

    def relop_eq(db, query, field_count):
        if (db.year == query.year):
            if (field_count == 1):
                return True
            if (db.month == query.month):
                if (field_count == 2):
                    return True
                return (db.day == query.day)
        return False
    def relop_gt(db, query, field_count):
        if (db.year > query.year):
            return True
        if ((field_count > 1) and (db.year == query.year)):
            if (db.month > query.month):
                return True
            return ((field_count == 3) and (db.month == query.month) and (db.day > query.day))
        return False
    def relop_lt(db, query, field_count):
        if (db.year < query.year):
            return True
        if ((field_count > 1) and (db.year == query.year)):
            if (db.month < query.month):
                return True
            return ((field_count == 3) and (db.month == query.month) and (db.day < query.day))
        return False
    def relop_ne(db, query, field_count):
        return (not relop_eq(db, query, field_count))
    def relop_ge(db, query, field_count):
        return (not relop_lt(db, query, field_count))
    def relop_le(db, query, field_count):
        return (not relop_gt(db, query, field_count))
    self.date_search_relops = {'=': [1, relop_eq], '>': [1, relop_gt], '<': [1, relop_lt], '!=': [2, relop_ne], '>=': [2, relop_ge], '<=': [2, relop_le]}
