summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2009-10-23 13:48:03 +1000
committerBill King <bill.king@nokia.com>2009-10-23 13:48:03 +1000
commiteeb116b56f9555458438dfe235b16488db9b1494 (patch)
treeb101f46c0772133c8d1c305cb2c99dd40ab58ff2
parent4d1a9b18b905f21b70608b13f4789dadec6bc181 (diff)
Better sql unicode tests (still not working correctly tho).
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp7
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp13
2 files changed, 9 insertions, 11 deletions
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index ecc0594e34..4b62302472 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -152,10 +152,10 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db )
if ( tst_Databases::isSqlServer( db ) ) {
//workaround for SQL SERVER since he can store unicode only in nvarchar fields
QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode") + " (id int not null, "
- "t_varchar nvarchar(40) not null, t_char nchar(40) )" ));
+ "t_varchar nvarchar(80) not null, t_char nchar(80) )" ));
} else {
QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode") + " (id int not null, "
- "t_varchar varchar(40) not null," "t_char char(40))" ));
+ "t_varchar varchar(100) not null," "t_char char(100))" ));
}
if (tst_Databases::isMSAccess(db)) {
@@ -521,8 +521,7 @@ void tst_Q3SqlCursor::unicode()
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- static const unsigned short utf8arr[] = { 0xd792,0xd79c,0xd792,0xd79c,0xd799,0x20,0xd7a9,0xd799,0x00 };
- static const QString utf8str = QString::fromUcs2( utf8arr );
+ static const QString utf8str = QString::fromUtf8( "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει." );
if ( !db.driver()->hasFeature( QSqlDriver::Unicode ) ) {
QSKIP( "DBMS not Unicode capable", SkipSingle );
}
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 98030d114a..8fe6f2eae9 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -396,7 +396,7 @@ void tst_QSqlQuery::char1SelectUnicode()
QSKIP("Needs someone with more Unicode knowledge than I have to fix", SkipSingle);
if ( db.driver()->hasFeature( QSqlDriver::Unicode ) ) {
- QString uniStr( QChar( 0xfb50 ) );
+ QString uniStr( QChar( 'का' ) );
QSqlQuery q( db );
if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt()<5 )
@@ -1630,8 +1630,7 @@ void tst_QSqlQuery::prepare_bind_exec()
{
// new scope for SQLITE
- static const unsigned short utf8arr[] = { 0xfb50,0xfb60,0xfb70,0xfb80,0xfbe0,0xfbf0,0x00 };
- static const QString utf8str = QString::fromUtf16( utf8arr );
+ static const QString utf8str = QString::fromUtf8( "काचं शक्नोम्यत्तुम् । नोपहिनस्ति माम् ॥" );
static const QString values[6] = { "Harry", "Trond", "Mark", "Ma?rk", "?", ":id" };
@@ -1648,11 +1647,11 @@ void tst_QSqlQuery::prepare_bind_exec()
QVERIFY_SQL( q, exec("set client_min_messages='warning'"));
if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QTDS" ) )
- createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int primary key, name nvarchar(20) null)";
- else if ( db.driverName().startsWith( "QMYSQL" ) && useUnicode )
- createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int not null primary key, name varchar(20) character set utf8)";
+ createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int primary key, name nvarchar(200) null)";
+ else if ( tst_Databases::isMySQL(db) && useUnicode )
+ createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int not null primary key, name varchar(200) character set utf8)";
else
- createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int not null primary key, name varchar(20))";
+ createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int not null primary key, name varchar(200))";
QVERIFY_SQL( q, exec( createQuery ) );