diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-11-20 11:49:14 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-11-20 11:49:14 +0000 |
commit | 4157e3ccf1a5b6cffc3d58cbf661cd528340b5fa (patch) | |
tree | ca20cd3b7ca390ea76d470fbb31bb10d558c151a | |
parent | d56293a189105352a5e392c1318c323518c64796 (diff) | |
download | elgg-4157e3ccf1a5b6cffc3d58cbf661cd528340b5fa.tar.gz elgg-4157e3ccf1a5b6cffc3d58cbf661cd528340b5fa.tar.bz2 |
Refs #569, #570, #571: Corrected and optimised insert query
git-svn-id: https://code.elgg.org/elgg/trunk@2473 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/entities.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index b1613c1d1..3604574e3 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -2165,7 +2165,7 @@ global $CONFIG;
$entity_guid = (int) $entity_guid;
$name = mysql_real_escape_string($name);
- if ($setting = get_data_row("select value from {$CONFIG->dbprefix}private_settings where name = '{$name}' and entity_guid = {$entity_guid}")) {
+ if ($setting = get_data_row("SELECT value from {$CONFIG->dbprefix}private_settings where name = '{$name}' and entity_guid = {$entity_guid}")) {
return $setting->value;
}
return false;
@@ -2182,7 +2182,7 @@ $entity_guid = (int) $entity_guid; - $result = get_data("select * from {$CONFIG->dbprefix}private_settings where entity_guid = {$entity_guid}"); + $result = get_data("SELECT * from {$CONFIG->dbprefix}private_settings where entity_guid = {$entity_guid}"); if ($result) { $return = array(); @@ -2206,11 +2206,11 @@ function set_private_setting($entity_guid, $name, $value) {
global $CONFIG;
- remove_private_setting($entity_guid, $name);
$entity_guid = (int) $entity_guid;
$name = mysql_real_escape_string($name);
- $value = mysql_real_escape_string($value);
- return insert_data("insert into {$CONFIG->dbprefix}private_settings set name = '{$name}', value = '{$value}' where entity_guid = {$entity_guid}");
+ $value = mysql_real_escape_string($value); +
+ return insert_data("INSERT into {$CONFIG->dbprefix}private_settings (entity_guid, name, value) VALUES ($entity_guid, '{$name}', '{$value}') ON DUPLICATE KEY UPDATE value='$value'");
}
@@ -2227,7 +2227,7 @@ global $CONFIG;
$entity_guid = (int) $entity_guid;
$name = mysql_real_escape_string($name);
- return delete_data("delete from {$CONFIG->dbprefix}private_settings where name = '{$name}' and entity_guid = {$entity_guid}");
+ return delete_data("DELETE from {$CONFIG->dbprefix}private_settings where name = '{$name}' and entity_guid = {$entity_guid}");
} @@ -2242,7 +2242,7 @@ global $CONFIG; $entity_guid = (int) $entity_guid; - return delete_data("delete from {$CONFIG->dbprefix}private_settings where entity_guid = {$entity_guid}"); + return delete_data("DELETE from {$CONFIG->dbprefix}private_settings where entity_guid = {$entity_guid}"); } /** |