diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-11-15 12:04:57 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-11-16 11:25:05 +0200 |
commit | 7b6ace8f265e12704cc1d7e0c6f26dfe51ea2809 (patch) | |
tree | 9a225b06e2938f487fb9ec90ca4dcd40698260ab /qt/oracle/basic/driver.cxx | |
parent | 1792e4f1aba7a60ae4ae6a227982da5459d34cfc (diff) |
Add tests for Oracle LOB support of QByteArray and QString
Diffstat (limited to 'qt/oracle/basic/driver.cxx')
-rw-r--r-- | qt/oracle/basic/driver.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/qt/oracle/basic/driver.cxx b/qt/oracle/basic/driver.cxx index 926ea8f..39f6b41 100644 --- a/qt/oracle/basic/driver.cxx +++ b/qt/oracle/basic/driver.cxx @@ -9,6 +9,7 @@ #include <memory> // std::auto_ptr #include <cassert> #include <iostream> +#include <string> #include <odb/oracle/database.hxx> #include <odb/oracle/transaction.hxx> @@ -28,9 +29,15 @@ main (int argc, char* argv[]) { auto_ptr<database> db (create_database (argc, argv)); + string long_str (20000, 'l'); + object o; - o.str = "John Doe"; - o.blob = QByteArray ("\0x13\0xDE\0x00\0x00\0x00\0x54\0xF2\0x6A", 8); + o.varchar = "John Doe"; + o.clob = QString::fromStdString (string (150, 'c')); + 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 ())); // Persist. // @@ -44,7 +51,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - object* ol = db->load<object> (o.str); + object* ol = db->load<object> (o.varchar); t.commit (); assert (*ol == o); |