public static function save($session_)
 {
     Logger::debug('main', 'Starting Abstract_Session::save for \'' . $session_->id . '\'');
     $SQL = SQL::getInstance();
     $id = $session_->id;
     if (!Abstract_Session::exists($id)) {
         Logger::debug('main', "Abstract_Session::save({$session_}) session does NOT exist, we must create it");
         if (!Abstract_Session::create($session_)) {
             Logger::error('main', "Abstract_Session::save({$session_}) failed to create session");
             return false;
         }
     }
     $SQL->DoQuery('UPDATE @1 SET @2=%3,@4=%5,@6=%7,@8=%9,@10=%11,@12=%13,@14=%15,@16=%17,@18=%19,@20=%21,@22=%23 WHERE @24 = %25 LIMIT 1', $SQL->prefix . 'sessions', 'server', $session_->server, 'mode', $session_->mode, 'type', $session_->type, 'status', $session_->status, 'settings', serialize($session_->settings), 'user_login', $session_->user_login, 'user_displayname', $session_->user_displayname, 'servers', serialize($session_->servers), 'applications', serialize($session_->applications), 'start_time', $session_->start_time, 'timestamp', time(), 'id', $id);
     return true;
 }
 public static function save($session_)
 {
     Logger::debug('main', 'Starting Abstract_Session::save for \'' . $session_->id . '\'');
     $SQL = SQL::getInstance();
     $id = $session_->id;
     if (!Abstract_Session::exists($id)) {
         Logger::debug('main', "Abstract_Session::save({$session_}) session does NOT exist, we must create it");
         if (!Abstract_Session::create($session_)) {
             Logger::error('main', "Abstract_Session::save({$session_}) failed to create session");
             return false;
         }
     }
     $data = array();
     $data['applications'] = array_map("Application::toArray", $session_->getPublishedApplications());
     $data['running_applications'] = array_map("Application::toArray", $session_->getRunningApplications());
     $data['closed_applications'] = array_map("Application::toArray", $session_->getClosedApplications());
     $SQL->DoQuery('UPDATE #1 SET @2=%3,@4=%5,@6=%7,@8=%9,@10=%11,@12=%13,@14=%15,@16=%17,@18=%19,@20=%21,@22=%23,@24=%25,@26=%27 WHERE @28 = %29 LIMIT 1', self::table, 'server', $session_->server, 'client_id', $session_->client_id, 'need_creation', $session_->need_creation, 'mode', $session_->mode, 'type', $session_->type, 'status', $session_->status, 'settings', json_serialize($session_->settings), 'user_login', $session_->user_login, 'user_displayname', $session_->user_displayname, 'servers', json_serialize($session_->servers), 'applications', json_serialize($data), 'start_time', $session_->start_time, 'timestamp', time(), 'id', $id);
     return true;
 }