Generalized query_builder '_reset' method

This commit is contained in:
Timothy Warren 2012-03-12 15:46:55 -04:00
parent 4701cbfe65
commit 9d33c5e8f0
2 changed files with 22 additions and 7 deletions

View File

@ -464,13 +464,28 @@ class Query_Builder {
*/ */
private function _reset() private function _reset()
{ {
unset($this->table); // Only unset class variables that
unset($this->where_array); // are not callable. Otherwise, we'll
unset($this->where_string); // delete class methods!
unset($this->select_string); foreach($this as $name => $var)
unset($this->from_string); {
unset($this->limit); // Skip properties that are needed for every query
unset($this->offset); $save_properties = array(
'db',
'sql'
);
if (in_array($name, $save_properties))
{
continue;
}
// Nothing query-generation related is safe!
if ( ! is_callable($this->$name))
{
unset($this->$name);
}
}
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

Binary file not shown.