diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-02-27 21:07:18 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-02-27 21:07:18 +0000 |
commit | bd15853708ae73ee69220738a061e10d015d7fb9 (patch) | |
tree | facfbd5b08e3cbb8e7fa2b4adf433b54d4c0c5bc /core/libraries | |
parent | 0b9fe18a6bf4036a05db7f9479d7b55d3fe5c782 (diff) |
This implements table prefix for all the queries in core, user, exif,
tag, search, comment and notification modules (Ticket #68)
Diffstat (limited to 'core/libraries')
-rw-r--r-- | core/libraries/ORM_MPTT.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/libraries/ORM_MPTT.php b/core/libraries/ORM_MPTT.php index bcbdde4e..c1adb920 100644 --- a/core/libraries/ORM_MPTT.php +++ b/core/libraries/ORM_MPTT.php @@ -52,9 +52,9 @@ class ORM_MPTT_Core extends ORM { try { // Make a hole in the parent for this new item $this->db->query( - "UPDATE `{$this->table_name}` SET `left` = `left` + 2 WHERE `left` >= {$parent->right}"); + "UPDATE `[{$this->table_name}]` SET `left` = `left` + 2 WHERE `left` >= {$parent->right}"); $this->db->query( - "UPDATE `{$this->table_name}` SET `right` = `right` + 2 WHERE `right` >= {$parent->right}"); + "UPDATE `[{$this->table_name}]` SET `right` = `right` + 2 WHERE `right` >= {$parent->right}"); $parent->right += 2; // Insert this item into the hole @@ -90,9 +90,9 @@ class ORM_MPTT_Core extends ORM { $this->lock(); try { $this->db->query( - "UPDATE `{$this->table_name}` SET `left` = `left` - 2 WHERE `left` > {$this->right}"); + "UPDATE `[{$this->table_name}]` SET `left` = `left` - 2 WHERE `left` > {$this->right}"); $this->db->query( - "UPDATE `{$this->table_name}` SET `right` = `right` - 2 WHERE `right` > {$this->right}"); + "UPDATE `[{$this->table_name}]` SET `right` = `right` - 2 WHERE `right` > {$this->right}"); } catch (Exception $e) { $this->unlock(); throw $e; @@ -229,21 +229,21 @@ class ORM_MPTT_Core extends ORM { if ($level_delta) { // Update the levels for the to-be-moved items $this->db->query( - "UPDATE `{$this->table_name}` SET `level` = `level` + $level_delta" . + "UPDATE `[{$this->table_name}]` SET `level` = `level` + $level_delta" . " WHERE `left` >= $original_left AND `right` <= $original_right"); } // Make a hole in the target for the move $target->db->query( - "UPDATE `{$this->table_name}` SET `left` = `left` + $size_of_hole" . + "UPDATE `[{$this->table_name}]` SET `left` = `left` + $size_of_hole" . " WHERE `left` >= $target_right"); $target->db->query( - "UPDATE `{$this->table_name}` SET `right` = `right` + $size_of_hole" . + "UPDATE `[{$this->table_name}]` SET `right` = `right` + $size_of_hole" . " WHERE `right` >= $target_right"); // Change the parent. $this->db->query( - "UPDATE `{$this->table_name}` SET `parent_id` = {$target->id}" . + "UPDATE `[{$this->table_name}]` SET `parent_id` = {$target->id}" . " WHERE `id` = {$this->id}"); // If the source is to the right of the target then we just adjusted its left and right above. @@ -256,7 +256,7 @@ class ORM_MPTT_Core extends ORM { $new_offset = $target->right - $left; $this->db->query( - "UPDATE `{$this->table_name}`" . + "UPDATE `[{$this->table_name}]`" . " SET `left` = `left` + $new_offset," . " `right` = `right` + $new_offset" . " WHERE `left` >= $left" . @@ -264,10 +264,10 @@ class ORM_MPTT_Core extends ORM { // Close the hole in the source's parent after the move $this->db->query( - "UPDATE `{$this->table_name}` SET `left` = `left` - $size_of_hole" . + "UPDATE `[{$this->table_name}]` SET `left` = `left` - $size_of_hole" . " WHERE `left` > $right"); $this->db->query( - "UPDATE `{$this->table_name}` SET `right` = `right` - $size_of_hole" . + "UPDATE `[{$this->table_name}]` SET `right` = `right` - $size_of_hole" . " WHERE `right` > $right"); } catch (Exception $e) { $this->unlock(); |