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()
{
unset($this->table);
unset($this->where_array);
unset($this->where_string);
unset($this->select_string);
unset($this->from_string);
unset($this->limit);
unset($this->offset);
// Only unset class variables that
// are not callable. Otherwise, we'll
// delete class methods!
foreach($this as $name => $var)
{
// Skip properties that are needed for every query
$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.