public function delete($id)
 {
     $tag = "EntityDAO: delete()";
     Log::notice("{$tag}");
     $blueprint = $this->blueprint;
     $query = "DELETE FROM " . $this->tableName() . " WHERE id=" . $id;
     $sql = new DatabaseUpdate($query, "delete");
     try {
         $sql->doUpdate();
         $id = 0;
         return $id;
     } catch (Exception $e) {
         Log::error("{$tag}: [" . $sql->err_code . "] " . $sql->err_message);
         throw $e;
     }
 }
Пример #2
0
 public static function session_handler_update_session_id($session_id_old, $session_id_new)
 {
     $tag = "Session::session_handler_update_session_id()";
     Log::debug($tag);
     // For maximum performace, query the database directly (do not use EntityDAO)
     $session_table_name = substr(BPConfig::$session_blueprint, 0, strpos(BPConfig::$session_blueprint, "."));
     $session_field_id = BPConfig::$session_field_id;
     $query = "UPDATE {$session_table_name} SET {$session_field_id}='{$session_id_new}' WHERE {$session_field_id}='{$session_id_old}'";
     $sql = new DatabaseUpdate($query, "update");
     try {
         $sql->doUpdate();
         return true;
     } catch (Exception $e) {
         Log::error("{$tag}: Caught: " . $e->getMessage());
         return false;
     }
 }