[mythtv-users] Problem in finder with quotation marks

Anduin Withers awithers at anduin.com
Sun Oct 5 12:47:04 EDT 2003


> Qt is 3.2.1 here, so this isn't the solution.

It doesn't matter which version you are running, what matters is which
version the code was written for. In Qt 3.1 the code could be written like
this (caution what follows may look like real code, it is probably not):

    QSqlQuery query("SELECT subtitle,starttime,channel.channum,"
            "channel.callsign,description,endtime,channel.chanid "
            "FROM program,channel "
            "WHERE program.title = :TITLE AND "
            "program.chanid = channel.chanid "
            "AND program.starttime > :STARTTIME "
            "ORDER BY program.starttime;",
            m_db);
    query.bindValue(":TITLE", progTitle.utf8());
    query.bindValue(":STARTTIME", progStart.toString("yyyyMMddhhmm50"));
    query.exec();

AFAIK the only solution in Qt 3.0 is to manually escape any character that
needs it. The problem with manually escaping characters is that it is error
prone. Take for example my broad "any character that needs it" description
rather than simply listing the handful of characters that really need it
(note the use of another generalization: handful). Code gets written this
way as well (meaning "not right the first time" and usually "not exactly
right the second or subsequent times").

--
Anduin Withers




More information about the mythtv-users mailing list