hello,

I am facing a very bizarre issue.
I am on mac os x 64 bits.

I needed a uuid() function that generates GUID.
I created then a dll with Qt like:

#include "/usr/local/include/sqlite3ext.h"
SQLITE_EXTENSION_INIT1

#include <QtCore/QUuid>
#include <string.h>

extern "C" void sqlite3_uuid(sqlite3_context *context, int argc,
sqlite3_value **argv){
QUuid uuid = QUuid::createUuid();
QString s = uuid;
s.remove(0,1);
s.remove(s.size()-1,1);
 QByteArray to_utf8 = s.toAscii();
 sqlite3_result_text( context, to_utf8.constData(), -1, SQLITE_TRANSIENT );
}

extern "C" int sqlite3_extension_init(
   sqlite3 *db,
   char **pzErrMsg,
   const sqlite3_api_routines *pApi
){
SQLITE_EXTENSION_INIT2(pApi)
sqlite3_create_function(db, "uuid", 0, SQLITE_UTF8, 0, sqlite3_uuid, 0, 0);
return 0;
}

I compiled Qt with cocoa

then after when I run a script, only in a shell, when I first try to insert
a GUID, it says that the primary key already exists, which is obviously
wrong.
However, this error occurs only in a shell script, not in the command line
(unbelievable!).

I could only fallback to use uuid from boost and it works perfectly.

Is it safe to use Qt to implement a dll for creating user functions?
Do you have any idea on what happens here? (any hints?)

I have no idea how to narrow down the problem,
is someone interested to investigate? if yes I can build a minimal project
(and try to reproduce the same issue)

Any hints are warmly welcome.

Best regards,
Sylvain
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to