/** * @deprecated 2.0 always use ids only for storage * * @param string $groupName * @return null|string */ public function get_group_id($groupName) { $query = 'SELECT ' . $this->_db->NameQuote('id') . "\n FROM " . $this->_db->NameQuote('#__usergroups') . "\n WHERE " . $this->_db->NameQuote('title') . " = " . $this->_db->Quote($groupName); $this->_db->setQuery($query); $return = $this->_db->loadResult(); return $return; }
/** * Returns the JSON-encoded string for the CB Configuration * * @param DatabaseDriverInterface $db Database Driver * @return null|string JSON-encoded string (or NULL if failed) */ public static function getConfig(DatabaseDriverInterface $db) { $db->setQuery("SELECT " . $db->NameQuote('params') . "\n FROM " . $db->NameQuote('#__comprofiler_plugin') . "\n WHERE " . $db->NameQuote('id') . " = 1"); $json = $db->loadResult(); if ($json) { return (array) json_decode($json); } return array(); }
/** * This method loads the first field of the first row returned by the query. * * @return string|null The value returned in the query or null if the query failed. */ public function &queryloadResult() { $sql = $this->_buildSQLquery(); $this->_db->setQuery($sql); $result = $this->_db->loadResult(); if ($result === null && $this->_db->getErrorNum()) { trigger_error('SQLXML::queryloadResult: error returned: ' . $this->_db->getErrorMsg(), E_USER_NOTICE); } return $result; }
/** * Counts rows from table $tableName matching $selection * * @param string $tableName * @param array $selection array( 'columnName' => array( 'columnValue' => 'columnValueType' ) ) * @param boolean $positiveSelect TRUE: select corresponding to selection, FALSE: Select NOT the selection * @return boolean TRUE: no error, FALSE: error (logged) */ protected function countRows($tableName, $selection, $positiveSelect) { $where = $this->sqlBuildSelectionWhere($selection, $positiveSelect); $sql = 'SELECT COUNT(*) FROM ' . $this->_db->NameQuote($tableName) . "\n WHERE " . $where; $this->_db->setQuery($sql); $result = $this->_db->loadResult(); if ($result === null) { $this->setError(sprintf('%s::countRows of Table %s Row(s) %s failed with SQL error: %s', get_class($this), $tableName, $where, $this->_db->getErrorMsg()), $sql); } return $result; }