Results 1 to 4 of 4

Thread: SQLITE and REGEXP

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Posts
    70
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default SQLITE and REGEXP

    Hi,

    In my project, I am using a qslite database opened with QSqlDatabase with "QSQLITE" driver.

    I would like to be able to execute a SELECT statement with a REGEXP like:
    SELECT * FROM mytable WHERE myattribute REGEXP 'A[0-9]*';
    But, as written in sqlite documentation, the REGEXP function is not implemented by default:
    No regexp() user function is defined by default and so use of the REGEXP operator will normally result in an error message
    I know we can implement this function by using sqlite3_create_function but I don't know how to do and if it's the better solution and I would like to avoid prerequisites on sqlite library.

    My questions:
    Q1-How to add REGEXP implementation on SQLITE driver ?
    Q2-Do you know if QT plan to deliver a default implementation of sqlite REGEXP function based on QRegExp ?

    Thank you in advance for your help.

  2. #2
    Join Date
    Aug 2008
    Posts
    70
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: SQLITE and REGEXP

    No answer ?

    Please help !

  3. #3
    Join Date
    Oct 2010
    Location
    Belarus
    Posts
    71
    Thanks
    1
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Windows Maemo/MeeGo

    Default Re: SQLITE and REGEXP

    rewrite sqlite plugin. or use sqllite in direct way
    Try read Qt documentation before ask stupid question.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: SQLITE and REGEXP

    Top Google hit for "qt sqlite regexp" is http://lists.trolltech.com/qt-intere...ad00466-0.html which explains a little about how to get the necessary Sqlite handle so that you can graft a regexp() impl. into the driver using Sqlite API calls.

    I haven't tried this myself yet. I notice there is a Qt bug report requesting this, so I may not have to
    http://bugreports.qt.nokia.com/browse/QTBUG-18084

Similar Threads

  1. RegExp Question
    By slava in forum Qt Programming
    Replies: 3
    Last Post: 12th July 2010, 19:33
  2. RegExp
    By pucara_faa in forum Qt Programming
    Replies: 2
    Last Post: 15th November 2009, 13:41
  3. QDirModel with QSortFilterProxyModel and regexp
    By mchrk in forum Qt Programming
    Replies: 6
    Last Post: 15th January 2009, 11:13
  4. Simple RegExp Question...
    By jared.carlson23 in forum Newbie
    Replies: 1
    Last Post: 4th July 2008, 14:10
  5. RegExp question
    By high_flyer in forum General Programming
    Replies: 1
    Last Post: 26th August 2007, 18:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.