AAAAhome/academiac/www/libraries/joomla/database/table/asset.php000064400000005610151372717420020142 0ustar00_db->getQuery(true); // Get the asset id for the asset. $query->select($this->_db->quoteName('id')); $query->from($this->_db->quoteName('#__assets')); $query->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote($name)); $this->_db->setQuery($query); $assetId = (int) $this->_db->loadResult(); if (empty($assetId)) { return false; } // Check for a database error. if ($error = $this->_db->getErrorMsg()) { $this->setError($error); return false; } return $this->load($assetId); } /** * Asset that the nested set data is valid. * * @return boolean True if the instance is sane and able to be stored in the database. * * @link http://docs.joomla.org/JTable/check * @since 11.1 */ public function check() { $this->parent_id = (int) $this->parent_id; // JTableNested does not allow parent_id = 0, override this. if ($this->parent_id > 0) { // Get the JDatabaseQuery object $query = $this->_db->getQuery(true); $query->select('COUNT(id)'); $query->from($this->_db->quoteName($this->_tbl)); $query->where($this->_db->quoteName('id') . ' = ' . $this->parent_id); $this->_db->setQuery($query); if ($this->_db->loadResult()) { return true; } else { if ($error = $this->_db->getErrorMsg()) { $this->setError($error); } else { $this->setError(JText::_('JLIB_DATABASE_ERROR_INVALID_PARENT_ID')); } return false; } } return true; } }