$db->setValue('name', $cat_name);
     $db->addGlobalUpdateFields();
     if ($db->update()) {
         $info = $I18N->msg('pool_kat_updated', $cat_name);
         rex_deleteCacheMediaCategory($edit_id);
     } else {
         $warning = $db->getError();
     }
 } elseif ($media_method == 'delete_file_cat') {
     $gf = rex_sql::factory();
     $gf->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'file WHERE category_id=' . $edit_id);
     $gd = rex_sql::factory();
     $gd->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'file_category WHERE re_id=' . $edit_id);
     if ($gf->getRows() == 0 && $gd->getRows() == 0) {
         $gf->setQuery('DELETE FROM ' . $REX['TABLE_PREFIX'] . 'file_category WHERE id=' . $edit_id);
         rex_deleteCacheMediaCategory($edit_id);
         rex_deleteCacheMediaLists();
         $info = $I18N->msg('pool_kat_deleted');
     } else {
         $warning = $I18N->msg('pool_kat_not_deleted');
     }
 } elseif ($media_method == 'add_file_cat') {
     $db = rex_sql::factory();
     $db->setTable($REX['TABLE_PREFIX'] . 'file_category');
     $db->setValue('name', rex_request('catname', 'string'));
     $db->setValue('re_id', rex_request('cat_id', 'int'));
     $db->setValue('path', rex_request('catpath', 'string'));
     $db->addGlobalCreateFields();
     $db->addGlobalUpdateFields();
     if ($db->insert()) {
         $info = $I18N->msg('pool_kat_saved', stripslashes(rex_request('catname')));
 /**
  * @access public
  * @return Returns <code>true</code> on success or <code>false</code> on error
  */
 function delete($recurse = false)
 {
     // Rekursiv lˆschen?
     if (!$recurse && $this->hasChildren()) {
         return false;
     }
     if ($recurse) {
         $childs = $this->getChildren();
         foreach ($childs as $child) {
             if (!$child->delete($recurse)) {
                 return false;
             }
         }
     }
     // Alle Dateien lˆschen
     if ($this->hasMedia()) {
         $files = $this->getMedia();
         foreach ($files as $file) {
             if (!$file->delete()) {
                 return false;
             }
         }
     }
     $qry = 'DELETE FROM ' . $this->_getTableName() . ' WHERE id = ' . $this->getId() . ' LIMIT 1';
     $sql = rex_sql::factory();
     // $sql->debugsql = true;
     $sql->setQuery($qry);
     rex_deleteCacheMediaCategory($this->getId());
     rex_deleteCacheMediaList($this->getId());
     return !$sql->hasError() || $sql->getRows() != 1;
 }