Avoid double looping in autorecord find_all

Bug #640803 reported by wouter bolsterlee
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Anewt
Fix Released
Wishlist
wouter bolsterlee

Bug Description

Deep inside AnewtAutorecord::_db_find_sql is this snippet of code:

  $rows = $connection->prepare_execute_fetch_all('?raw?', $sql_full);
  return AnewtAutoRecord::_db_objects_from_arrays($class, $rows);

Both lines of code cause a full looping through the result rows, while object creation could also be done in one pass (i.e. pipelining) by not using the _fetch_all() convenience API from AnewtDatabaseConnection, and avoiding _db_objects_from_arrays() (plural) in favor of _db_object_from_array() (singular)

Tags: autorecord
Revision history for this message
wouter bolsterlee (wbolster) wrote :

 1788 Wouter Bolsterlee 2010-10-02
      [autorecord] Avoid double loops when instantiating objects

      Don't use AnewtDatabaseConnection convenience API, but build
      AutoRecord instances while looping through the result set.

      Fixes lp:640803.

Changed in anewt:
status: New → In Progress
assignee: nobody → Wouter Bolsterlee (uws) (uws)
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.