BUGFIX Reverted text replacement performance improvement in SQLQuery - it was replacing more ocurrences via str_replace() than the previous implementation based on arrays, which broke queries augmented by Translatable (originally committed in r60468 and r54044)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65291 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-11-05 14:23:17 +00:00
parent 486ae69f09
commit ccd149f689

View File

@ -65,8 +65,6 @@ class SQLQuery extends Object {
*/
public $delete = false;
private $replacements = array();
/**
* The logical connective used to join WHERE clauses. Defaults to AND.
* @var string
@ -354,8 +352,6 @@ class SQLQuery extends Object {
* @param string $new The new text.
*/
function replaceText($old, $new) {
$this->replacements[] = array($old, $new);
/*
if($this->select) foreach($this->select as $i => $item)
$this->select[$i] = str_replace($old, $new, $item);
@ -378,7 +374,6 @@ class SQLQuery extends Object {
foreach($this->having as $i => $item)
$this->having[$i] = str_replace($old, $new, $item);
}
*/
}
/**
@ -411,10 +406,6 @@ class SQLQuery extends Object {
if($this->orderby) $text .= " ORDER BY " . $this->orderby;
if($this->limit) $text .= " LIMIT " . $this->limit;
foreach($this->replacements as $replacement) {
$text = str_replace($replacement[0], $replacement[1], $text);
}
return $text;
}