aboutsummaryrefslogtreecommitdiff
path: root/qt
diff options
context:
space:
mode:
Diffstat (limited to 'qt')
-rw-r--r--qt/oracle/basic/driver.cxx13
-rw-r--r--qt/oracle/basic/test.hxx18
2 files changed, 25 insertions, 6 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);
diff --git a/qt/oracle/basic/test.hxx b/qt/oracle/basic/test.hxx
index 25710c0..979e11f 100644
--- a/qt/oracle/basic/test.hxx
+++ b/qt/oracle/basic/test.hxx
@@ -16,14 +16,26 @@ struct object
operator== (const object& x) const
{
return
- str == x.str &&
- blob == x.blob;
+ varchar == x.varchar &&
+ clob == x.clob &&
+ nclob == x.nclob &&
+ blob == x.blob &&
+ raw == x.raw;
}
#pragma db id
- QString str;
+ QString varchar;
+
+ #pragma db type ("CLOB")
+ QString clob;
+
+ #pragma db type ("NCLOB")
+ QString nclob;
QByteArray blob;
+
+ #pragma db type ("RAW(128)")
+ QByteArray raw;
};
#endif // TEST_HXX