aboutsummaryrefslogtreecommitdiff
path: root/oracle
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-11-10 13:07:20 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-11-10 16:39:13 +0200
commite00bc68eb5eb8070c8799275f73345a27f7abc60 (patch)
tree74d3abb9620edff3a6ab289a3570b590a420cf7d /oracle
parent8c4f0afcc7f2db3c0696aa1edac1270c4bffbec7 (diff)
Test large Oracle LOBs
Diffstat (limited to 'oracle')
-rw-r--r--oracle/types/driver.cxx22
-rw-r--r--oracle/types/test.hxx23
2 files changed, 45 insertions, 0 deletions
diff --git a/oracle/types/driver.cxx b/oracle/types/driver.cxx
index b786cec..aac636a 100644
--- a/oracle/types/driver.cxx
+++ b/oracle/types/driver.cxx
@@ -169,6 +169,28 @@ main (int argc, char* argv[])
assert (bui3 == *buil3);
}
+ // Test large BLOBs.
+ //
+ blob b (1, 50000);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<blob> bl (db->load<blob> (1));
+ t.commit ();
+
+ assert (b == *bl);
+ }
+
// Test descriptor management in TIMESTAMP and INTERVAL images.
//
{
diff --git a/oracle/types/test.hxx b/oracle/types/test.hxx
index 907d310..be49b82 100644
--- a/oracle/types/test.hxx
+++ b/oracle/types/test.hxx
@@ -252,4 +252,27 @@ struct big_int
}
};
+#pragma db object
+struct blob
+{
+ blob (): id_ (0) {}
+
+ blob (unsigned int id, std::size_t n)
+ : id_ (id), value_ ('b', n)
+ {
+ }
+
+ #pragma db id
+ unsigned int id_;
+
+ #pragma db type ("BLOB")
+ std::vector<char> value_;
+
+ bool
+ operator== (const blob& y) const
+ {
+ return id_ == y.id_ && value_ == y.value_;
+ }
+};
+
#endif // TEST_HXX