BUGFIX Fixed SQL that contained backticks to work on databases with ANSI SQL enabled

This commit is contained in:
Sean Harvey 2009-09-29 23:04:52 +00:00
parent 16307e5562
commit 4cdeb3d20f
2 changed files with 10 additions and 2 deletions

View File

@ -110,7 +110,11 @@ class UserDefinedForm extends Page {
*/ */
public function doPublish() { public function doPublish() {
// remove fields on the live table which could have been orphaned. // remove fields on the live table which could have been orphaned.
$live = Versioned::get_by_stage("EditableFormField", "Live", "`EditableFormField`.ParentID = $this->ID"); if(defined('Database::USE_ANSI_SQL')) {
$live = Versioned::get_by_stage("EditableFormField", "Live", "\"EditableFormField\".\"ParentID\" = $this->ID");
} else {
$live = Versioned::get_by_stage("EditableFormField", "Live", "`EditableFormField`.ParentID = $this->ID");
}
if($live) { if($live) {
foreach($live as $field) { foreach($live as $field) {
$field->deleteFromStage('Live'); $field->deleteFromStage('Live');

View File

@ -31,7 +31,11 @@ class EditableMultipleOptionField extends EditableFormField {
* @return void * @return void
*/ */
public function publish($fromStage, $toStage, $createNewVersion = false) { public function publish($fromStage, $toStage, $createNewVersion = false) {
$live = Versioned::get_by_stage("EditableOption", "Live", "`EditableOption`.ParentID = $this->ID"); if(defined('Database::USE_ANSI_SQL')) {
$live = Versioned::get_by_stage("EditableOption", "Live", "\"EditableOption\".\"ParentID\" = $this->ID");
} else {
$live = Versioned::get_by_stage("EditableOption", "Live", "`EditableOption`.ParentID = $this->ID");
}
if($live) { if($live) {
foreach($live as $option) { foreach($live as $option) {
$option->delete(); $option->delete();