From 4cca29a2d9085a495a198b252a4c0d18b3ff9c76 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 2 Nov 2011 09:35:02 +0200 Subject: Optimize load_id(), load() sequence for SQLite and PostgreSQL In these databases both of these functions load the data into the object image. If there is no chance of image overwrite between these calls, then we don't need to load the image the second time. --- odb/pgsql/object-result.hxx | 2 +- odb/pgsql/object-result.txx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'odb') diff --git a/odb/pgsql/object-result.hxx b/odb/pgsql/object-result.hxx index 0fb68c1..53a4dbe 100644 --- a/odb/pgsql/object-result.hxx +++ b/odb/pgsql/object-result.hxx @@ -42,7 +42,7 @@ namespace odb object_statements&); virtual void - load (object_type&); + load (object_type&, bool fetch); virtual id_type load_id (); diff --git a/odb/pgsql/object-result.txx b/odb/pgsql/object-result.txx index 57a70d7..6459906 100644 --- a/odb/pgsql/object-result.txx +++ b/odb/pgsql/object-result.txx @@ -34,9 +34,10 @@ namespace odb template void object_result_impl:: - load (object_type& obj) + load (object_type& obj, bool fetch) { - load_image (); + if (fetch) + load_image (); // This is a top-level call so the statements cannot be locked. // -- cgit v1.1