|
|
Is anyone using QtScript in version Qt version 4.3.1 (as apposed to QSA)
If so what are you using to debug your scripts ?
I know with QSA they provided a seperate debugging utility, but i am unsure
if this would work with QtScript.
If possible i am trying to find a way of stepping through script code
Any help is appreciated ...
Regards,
Ben
-----Original Message-----
From: Bill KING [mailto:bill.king@xxxxxxxxxxxxx]
Sent: Thursday, 6 September 2007 11:23 AM
To: qt-interest@xxxxxxxxxxxxx
Cc: qt-interest@xxxxxxxxxxxxx
Subject: Re: Unicode aware COLLATION in QSQLITE
marco bubke wrote:
> Hi
>
> What is the best way to do Unicode aware COLLATION in sqlite. Is there
> a easy way which is working with qt out of the box(use Qt function for
> comparision)?
>
> Thanks and regards
>
> Marco
We ended up using a custom collation type in qtopia, but found that it
added a significant overhead to our performance. If you can cop that
performance hit, then the below code may help:
Otherwise, we ended up using a custom sorting column, that we repopulate
when we change language. (Note, code is not likely to compile out of the
box for you, but will give you an idea of where to travel).
void QtopiaSqlPrivate::installSorting( QSqlDatabase &db)
{
#if defined(Q_USE_SQLITE) && defined(USE_LOCALE_AWARE)
int sqliteLocaleAwareCompare(void *, int ll, const void *l, int
rl, const void *r);
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
int result = sqlite3_create_collation(
handle,
"localeAwareCompare",
SQLITE_UTF16, // ANY would be nice, but we only
encode in 16 anyway.
0,
sqliteLocaleAwareCompare);
if (result != SQLITE_OK)
qLog(Sql) << "Could not add string collation
function: " << result;
} else {
qLog(Sql) << "Could not get sqlite handle";
}
} else {
qLog(Sql) << "handle variant returned typename " <<
v.typeName();
}
#endif
}
int sqliteLocaleAwareCompare(void *, int ll, const void *l, int rl,
const void *r)
{
QString left = QString::fromUtf16((const ushort *)l, ll/2);
QString right = QString::fromUtf16((const ushort *)r, rl/2);
//qLog(Sql) << "comparing:" << left << "with" << right << "result"
<< QString::localeAwareCompare(left, right);
return QString::localeAwareCompare(left, right);
}
--
Bill King, Software Engineer
Trolltech, Brisbane Technology Park
26 Brandl St, Eight Mile Plains,
QLD, Australia, 4113
Tel + 61 7 3219 9906 (x137)
Fax + 61 7 3219 9938
mobile: 0423 532 733
--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/
--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/
|
|