How to add a user defined function in QDB Library?

349 views Asked by At

QDB is a database provided by QNX Neutrino package. I went through the QDB documentation to add a user defined SQL function: http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.qdb_en_dev_guide/writing_functions.html?cp=2_0_8

I created a source file which had my user define SQL function written in C and qdb_function structure definition. I built it with a make file to create libudf.so. As suggested by QDB I added Function = [email protected] in the qdb.cfg. But while running the qdb in the shell prompt, it is giving the error (in bold):

qdb -I basic -V -R set -v -c /etc/sql/qdb.cfg -s de_DE@cldr -o tempstore=/fs/tmpfs

QDB: No script registered for handling corrupt database.

qdb: processing [TempMainAddressBook]Function - Can't access shared library

and qdb is getting exited immediately.

I have tried following things:

  1. made sure sqlite3 library is added in the make file

  2. source code is in strictly in C by using directive : extern "C" to avoid name mangling as the file extension is .cpp. I also tried with .c extension.

  3. given the absolute path of the libudf.so in qdb.cfg as : Function = udftag@/usr/lib/libudf.so

  4. qdb_funcion struct is properly defined in library's source code only.

  5. tried without using the static declaration of function(mentioned in the qdb docs)

After trying all hits and trials also, I am getting the same error every time which is Can't access shared library

If any one has any idea to resolve this error please share.

1

There are 1 answers

0
maverick On

Suggestion 1: run qdb by setting LD_DEBUG=1, like in:

LD_DEBUG=1 qdb command line options 

This will output a lot of debug information from the dynamic loader as it attempts to locate and then load the .so files. Check what is the path that it output before the "Can't access" message is displayed.

Suggestion 2: obvious but make sure that the permissions are OK for the .so file. Do you have the execution permission set?

Suggestion 3: check if the error message is identical if you completely remove the .so file from the system

Suggestion 4: increase the number of lower-case 'v'-s. QDB likely supports more, with progressively more verbose information provided as you increase the numbers (6 should be enough for full verbosity)