MINOR Database quoting in TreeDropdownField (fixes #5484)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@103515 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-26 22:58:57 +00:00 committed by Sam Minnee
parent ad6f1adcd8
commit 7ae748a40f

View File

@ -243,7 +243,7 @@ class TreeDropdownField extends FormField {
if ( $this->searchCallback ) if ( $this->searchCallback )
$res = call_user_func($this->searchCallback, $this->sourceObject, $this->labelField, $this->search); $res = call_user_func($this->searchCallback, $this->sourceObject, $this->labelField, $this->search);
else else
$res = DataObject::get($this->sourceObject, "$this->labelField LIKE '%$this->search%'"); $res = DataObject::get($this->sourceObject, "\"$this->labelField\" LIKE '%$this->search%'");
if( $res ) { if( $res ) {
// iteratively fetch the parents in bulk, until all the leaves can be accessed using the tree control // iteratively fetch the parents in bulk, until all the leaves can be accessed using the tree control
@ -252,7 +252,7 @@ class TreeDropdownField extends FormField {
$this->searchIds[$row->ID] = true; $this->searchIds[$row->ID] = true;
} }
while (!empty($parents)) { while (!empty($parents)) {
$res = DB::query('SELECT "ParentID", "ID" FROM '.$this->sourceObject.' WHERE "ID" in ('.implode(',',array_keys($parents)).')'); $res = DB::query('SELECT "ParentID", "ID" FROM \"' . $this->sourceObject . '\" WHERE "ID" in ('.implode(',',array_keys($parents)).')');
$parents = array(); $parents = array();
foreach($res as $row) { foreach($res as $row) {