diff options
-rw-r--r-- | oracle/types/driver.cxx | 22 | ||||
-rw-r--r-- | oracle/types/test.hxx | 23 |
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 |