[wp-trac] [WordPress Trac] #12257: wpdb Scales Badly Due to Unnecessary Copies of All Query Results
WordPress Trac
wp-trac at lists.automattic.com
Tue Oct 26 22:39:13 UTC 2010
#12257: wpdb Scales Badly Due to Unnecessary Copies of All Query Results
--------------------------+-------------------------------------------------
Reporter: miqrogroove | Owner: ryan
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.1
Component: Database | Version:
Severity: critical | Keywords: has-patch commit
--------------------------+-------------------------------------------------
Comment(by joelhardi):
> Can we still create the last_result property for php4 and used the magic
!__get() method to replace it for php5, allowing it to throw a deprecated
warning? It isn't the most elegant solution, but it should work.
Or, would be easy to just have the magic !__get() method return the same
thing as before (result set as an array of objects aka `get_results()`)
... so, it would be fully backward compatible for PHP5. i.e. this would do
it:
{{{
function __get( $name ) {
if ( $name == 'last_result' && !is_null( $this->mysql_last_result
) )
return $this->get_results();
return NULL; // or could raise error if $name is invalid
}
}}}
Personally, I would vote for just removing it, since it's supposed to be
private. People who were using it incorrectly just need to make an easy
fix to their code by substituting the `get_results()` call that they
should have been using in the first place. I suppose someone could argue
that if they're subclassing wpdb and accessing `last_result` like a
protected property then what they're doing isn't totally wrong.
No way I can think of to make it backward compatible for PHP4 without
defeating purpose of the patch.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12257#comment:19>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list