Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Creating a custom sqlite3 function in a Qt program

Creating a custom sqlite3 function in a Qt program

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    silviubogan
    wrote on 2 Feb 2014, 16:57 last edited by
    #1

    Hello,

    In a Qt 5.2 program I open an SQLite database and I can use it well. Then I take the files in Qt source code (Src/qtbase/src/3rdparty/sqlite), I include sqlite3.h and add sqlite3.h and sqlite3.c in my .pro file. I get the handle to its driver, it is valid. Then I try to create a custom sqlite3 function. The sqlite3_create_function function gives segmentation fault. It is called like this:

    @sqlite3_create_function(handler, "funcname", 2,
    SQLITE_ANY, 0, &func, NULL, NULL);@

    The segmentation fault is given from function sqlite3_mutex_enter (line 17821 in sqlite3.c) called from sqlite3_create_function_v2 (line 116246) which is called from sqlite3_create_function (line 116229).

    @** Obtain the mutex p. If some other thread already has the mutex, block
    ** until it can be obtained.
    */
    SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex *p){
    if( p ){
    sqlite3GlobalConfig.mutex.xMutexEnter(p); // segfault here
    }
    }@

    What can I do to be able to define a custom function for my SQL?

    Thanks.

    1 Reply Last reply
    0

    1/1

    2 Feb 2014, 16:57

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved