diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-11-30 16:05:52 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-11-30 16:16:43 +0200 |
commit | 72ad2f40da8268326bcbf4fc0d230860a8b05581 (patch) | |
tree | 8f7f4fd10b3658dbeeb4dbc84c9abfbfaa4da257 /qt | |
parent | 44cb5422ce125f356b9f6c87f4ef372d9d693fb1 (diff) |
Add tests for QString NCHAR and NVARCHAR2 mapping
Diffstat (limited to 'qt')
-rw-r--r-- | qt/oracle/basic/driver.cxx | 16 | ||||
-rw-r--r-- | qt/oracle/basic/test.hxx | 16 |
2 files changed, 26 insertions, 6 deletions
diff --git a/qt/oracle/basic/driver.cxx b/qt/oracle/basic/driver.cxx index 1afb966..908f2b4 100644 --- a/qt/oracle/basic/driver.cxx +++ b/qt/oracle/basic/driver.cxx @@ -29,13 +29,21 @@ main (int argc, char* argv[]) { auto_ptr<database> db (create_database (argc, argv)); - string long_str (20000, 'l'); + string short_str (13, 's'); + string medium_str (150, 'm'); + string long_str (20000, 'v'); + string unicode_str ("a \xD5\x95 \xEA\xAA\xAA \xF2\xAA\xAA\xAA"); object o; - o.varchar = "John Doe"; - o.clob = QString::fromStdString (string (150, 'c')); + o.char_= QString::fromStdString (short_str); + o.varchar2 = QString::fromStdString (medium_str); + o.clob = QString::fromStdString (long_str); + + o.nchar= QString::fromStdString (unicode_str); + o.nvarchar2 = QString::fromStdString (unicode_str); o.nclob = QString::fromStdString (long_str); + o.raw = QByteArray ("\0x13\0xDE\0x00\0x00\0x00\0x54\0xF2\0x6A", 8); o.blob = QByteArray (long_str.c_str (), static_cast<int> (long_str.size ())); @@ -52,7 +60,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - object* ol = db->load<object> (o.varchar); + object* ol = db->load<object> (o.varchar2); t.commit (); assert (*ol == o); diff --git a/qt/oracle/basic/test.hxx b/qt/oracle/basic/test.hxx index 979e11f..6a3e788 100644 --- a/qt/oracle/basic/test.hxx +++ b/qt/oracle/basic/test.hxx @@ -16,7 +16,10 @@ struct object operator== (const object& x) const { return - varchar == x.varchar && + varchar2 == x.varchar2 && + char_ == x.char_ && + nchar == x.nchar && + nvarchar2 == x.nvarchar2 && clob == x.clob && nclob == x.nclob && blob == x.blob && @@ -24,7 +27,16 @@ struct object } #pragma db id - QString varchar; + QString varchar2; + + #pragma db type ("CHAR(13)") + QString char_; + + #pragma db type ("NCHAR(13)") + QString nchar; + + #pragma db type ("NVARCHAR2(512)") + QString nvarchar2; #pragma db type ("CLOB") QString clob; |