'Returns the values of the attributes that match \'prefix\'.
Args:
subject: The subject.
prefix: The attribute prefix.
start: The start timestamp.
end: The end timestamp.
limit: The maximum number of values to return.
Returns:
A list of the form (attribute, value, timestamp).'

@utils.Synchronized
def GetValuesFromPrefix(self, subject, prefix, start, end, limit=None):

    pattern = (prefix + '%')
    subject = utils.SmartStr(subject)
    query = 'SELECT    predicate,    value,    timestamp    FROM    tbl\n                                                            WHERE    subject    =    ?    AND    predicate    LIKE    ?\n                                                                                    AND    timestamp    >=    ?    AND    timestamp    <=    ?\n                                                                                    ORDER    BY    timestamp    DESC'
    if limit:
        query += '    LIMIT    ?'
        args = (subject, pattern, start, end, limit)
    else:
        args = (subject, pattern, start, end)
    data = self.Execute(query, args).fetchall()
    return data
