[Qt-interest] How t o use sqlite3_create_collation_v2() API in QTapplication
ashish yadav
ashishyadav78 at gmail.com
Mon Jan 31 06:53:58 CET 2011
Hi Scott,
Please find the out put of gdb :
Starting program: /home/ashish/Desktop/sorting/code/code
warning: Lowest section in /usr/lib/libicudata.so.38 is .hash at 000000d4
[Thread debugging using libthread_db enabled]
[New Thread 0xb57416d0 (LWP 5103)]
[New Thread 0xb56c5b90 (LWP 5106)]
[Thread 0xb56c5b90 (LWP 5106) exited]
Data Base Connected.
Able to get Sqlite3 driver handle.
going for sqlite3_create_collation_v2
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb57416d0 (LWP 5103)]
0x00000000 in ?? ()
(gdb) backtrace
#0 0x00000000 in ?? ()
#1 0xb69bb508 in sqlite3_create_collation_v2 (db=0x8b0f528, zName=0x804e14b
"ENGLISH", enc=4, pCtx=0x8b1da48,
xCompare=0x8049ab0 <Bosch_icuCollationColl(void*, int, void const*, int,
void const*)>,
xDel=0x8049aa0 <Bosch_icuCollationDel(void*)>) at sqlite3.c:90603
#2 0x0804caca in main ()
(gdb)
Thanks & Regards
Ashish
On Sat, Jan 29, 2011 at 10:39 PM, Scott Aron Bloom <
Scott.Bloom at onshorecs.com> wrote:
> When you step in with debugger.. whats the problem?
>
>
>
> *From:* qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com[mailto:
> qt-interest-bounces+scott.bloom <qt-interest-bounces%2Bscott.bloom>=
> onshorecs.com at qt.nokia.com] *On Behalf Of *ashish yadav
> *Sent:* Saturday, January 29, 2011 8:07 AM
> *To:* qt-interest at trolltech.com
> *Subject:* [Qt-interest] How t o use sqlite3_create_collation_v2() API in
> QTapplication
>
>
>
> Hi ,
>
> I am trying to use sqlite3_create_collation_v2() in QT application, but it
> give Segmentation fault when application try to access this function.
>
> The part of code which i use for this :
>
> /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> QSqlDatabase db = QSqlDatabase::addDatabase( "QSQLITE" );
>
> db.setDatabaseName( "./testdatabase.db" );
>
> if( !db.open() )
> {
> qDebug() << db.lastError();
> qFatal( "Failed to connect." );
> exit(1);
> }
>
> qDebug("Data Base Connected.");
>
> QVariant v = db.driver()->handle();
> if (v.isValid() && strcmp(v.typeName(), "sqlite3*") == 0)
> {
> // v.data() returns a pointer to the handle
> sqlite3 *handle = *static_cast<sqlite3 **>(v.data());
> if (handle != 0)
> { // check that it is not NULL
> qDebug() << "Able to get Sqlite3 driver handle.";
>
> int rc ;
>
> UCollator *pUCollator;
> UErrorCode status = U_ZERO_ERROR;
>
> pUCollator = ucol_open("en_EN", &status);
>
> if( U_FAILURE(status) )
> {
> qDebug() << "Error in ucol_open\n";
> return 0;
> }
>
> qDebug() << "going for sqlite3_create_collation_v2\n";
>
> rc = sqlite3_create_collation_v2(handle,"ENGLISH", SQLITE_UTF16,
> (void *)pUCollator,
> icuCollationColl, icuCollationDel );
>
> if( rc!=SQLITE_OK )
> {
> ucol_close(pUCollator);
> qDebug() << "Error registering collation function" ;
> }
>
> }
> else
> {
> qDebug() << "Could not get sqlite Driver handle.";
> db.close();
> exit(1);
> }
>
> }
> else
> {
> qDebug() << "Not vaild handle variant returned." ;
> db.close();
> exit(1);
> }
>
>
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> I also define/declare icuCollationColl & icuCollationDel function ..
> Now when i run this application , its give Segmentation fault :
> ./code
> Data Base Connected.
> Able to get Sqlite3 driver handle.
> going for sqlite3_create_collation_v2
>
> Segmentation fault
>
>
> Can any one please help me to resolve this issue ?
> Please give me your suggestion , it will be help full to resolve this
> issue.
>
> Thanks & Regards
> Ashish
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110131/f9cdc32b/attachment.html
More information about the Qt-interest-old
mailing list