From 3cc019d0df41400f9cf921040adab0ae198b570a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 12 Jan 2012 09:06:13 +0200 Subject: Implement callback data re-basing support for LOB result streaming This is used by the query machinery when a copy of the image has to be made. In this case stream_result() needs to use data from the copy of the image, and not from the image that was bound to the bind array. --- oracle/types/driver.cxx | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/oracle/types/driver.cxx b/oracle/types/driver.cxx index b23a757..684a46e 100644 --- a/oracle/types/driver.cxx +++ b/oracle/types/driver.cxx @@ -178,13 +178,15 @@ main (int argc, char* argv[]) // Test large BLOBs. // - blob b (1, 50000); + blob b1 (1, 50000); + blob b2 (2, 500000); // Persist. // { transaction t (db->begin ()); - db->persist (b); + db->persist (b1); + db->persist (b2); t.commit (); } @@ -192,10 +194,41 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr bl (db->load (1)); + auto_ptr p1 (db->load (1)); + auto_ptr p2 (db->load (2)); t.commit (); - assert (b == *bl); + assert (b1 == *p1); + assert (b2 == *p2); + } + + // Test image copying with LOB data. + // + { + typedef odb::query query; + typedef odb::result result; + + transaction t (db->begin ()); + + result r (db->query (query::id < 3)); + result::iterator i (r.begin ()); + + assert (i != r.end ()); + ++i; + assert (i != r.end ()); + + { + result r (db->query (query::id < 2)); + result::iterator i (r.begin ()); + assert (i != r.end ()); + assert (i->value_.size () == 50000); + assert (++i == r.end ()); + } + + assert (i->value_.size () == 500000); // Load from copy. + assert (++i == r.end ()); + + t.commit (); } // Test descriptor management in TIMESTAMP and INTERVAL images. -- cgit v1.1