Important: Please read the Qt Code of Conduct -

How to build single sql query for QSQLite for full text search on table

  • im using QSQLite in Qt 4.8 and trying to do Full Text Search
    im trying to find away to build query that preform text search using LIKE and %str%
    or maybe other query.
    i have table with N columns and i like to build query so if i search "foo"
    it will give me as results all the rows that part or all of the strings in one of the row columns contains "foo". what is the best way to do it in SQLite? does SQLite FTS3 and FTS4 Extensions supported ?

  • SQLite has FTS3 from version 3.5.0 and FTS4 from 3.7.4 (you could read it "here": ). And Qt 4.8 QSQLITE driver is built with SQLite version (you could read it in the Qt's sources).

  • i compiled the driver with the full text support , its the only way from what i was reading

  • i have new problem , after its working and gives me good results , in the presentation layer im using
    its Tableview and QSqlQueryModel.
    when i get the results , it is adding me more blank headers into the exciting table result.
    this is how the sql query looks like this , inside the QSqlQueryModel subclass :
    @void ListSqlModel::setFullTextSearchListQuery(const QString &query)
    QString tbl = LIST_TBL;
    QString queryFullTextSearch = "SELECT * FROM "+tbl +" WHERE "+tbl+" MATCH '"+query+"'";
    QSqlQueryModel::setQuery(queryFullTextSearch, queryDB); // queryDB is QSqlDatabase im using


  • Could you wrap your code in @-signs?

Log in to reply