BUGFIX: Escape table name in versioned to allow creation of page type classes with the same names as SQL reserved words

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@68170 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-12-10 08:38:19 +00:00
parent 6f30d987f3
commit b26bd547ba

View File

@ -265,7 +265,7 @@ class Versioned extends DataObjectDecorator {
if(!isset($manipulation[$table]['fields']['Version'])) {
// Add any extra, unchanged fields to the version record.
$data = DB::query("SELECT * FROM $table WHERE ID = $id")->record();
$data = DB::query("SELECT * FROM `$table` WHERE ID = $id")->record();
if($data) foreach($data as $k => $v) {
if (!isset($newManipulation['fields'][$k])) $newManipulation['fields'][$k] = "'" . addslashes($v) . "'";
}