Feature #21025 » exec_SELECTgetSingleRow.diff
t3lib/class.t3lib_db.php (working copy) | ||
---|---|---|
}
|
||
return $output;
|
||
}
|
||
|
||
/**
|
||
* Creates and executes a SELECT SQL-statement AND gets a result set and returns an array with a single record in.
|
||
* LIMIT is automatically set to 1 and can not be overridden
|
||
*
|
||
* @param string See exec_SELECTquery()
|
||
* @param string See exec_SELECTquery()
|
||
* @param string See exec_SELECTquery()
|
||
* @param string See exec_SELECTquery()
|
||
* @param string See exec_SELECTquery()
|
||
* @param boolean If set, the result will be fetched with sql_fetch_assoc, else sql_fetch_row will be used.
|
||
*/
|
||
function exec_SELECTgetSingleRow($select_fields,$from_table,$where_clause,$groupBy='',$orderBy='',$numIndex=FALSE) {
|
||
$res = $this->exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,'1');
|
||
if ($this->debugOutput) $this->debug('exec_SELECTquery');
|
||
|
||
if (!$this->sql_error()) {
|
||
$output = array();
|
||
|
||
if ($numIndex===TRUE) {
|
||
$output = $this->sql_fetch_row($res);
|
||
} else {
|
||
$output = $this->sql_fetch_assoc($res);
|
||
}
|
||
$this->sql_free_result($res);
|
||
}
|
||
return $output;
|
||
}
|
||
|
||
/**
|
||
* Counts the number of rows in a table.
|
t3lib/class.t3lib_refindex.php (working copy) | ||
---|---|---|
|
||
if (isset($TCA[$table])) {
|
||
// Get raw record from DB:
|
||
list($record) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*',$table,'uid='.intval($uid));
|
||
$record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*',$table,'uid='.intval($uid));
|
||
|
||
if (is_array($record)) {
|
||
|
||
... | ... | |
if (($GLOBALS['BE_USER']->workspace===0 && $GLOBALS['BE_USER']->isAdmin()) || $bypassWorkspaceAdminCheck) {
|
||
|
||
// Get current index from Database:
|
||
list($refRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$refRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'*',
|
||
'sys_refindex',
|
||
'hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash,'sys_refindex')
|
||
... | ... | |
if ($GLOBALS['TCA'][$refRec['tablename']]) {
|
||
|
||
// Get that record from database:
|
||
list($record) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*',$refRec['tablename'],'uid='.intval($refRec['recuid']));
|
||
$record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*',$refRec['tablename'],'uid='.intval($refRec['recuid']));
|
||
|
||
if (is_array($record)) {
|
||
|
t3lib/class.t3lib_page.php (working copy) | ||
---|---|---|
if (($table=='pages' || (int)$TCA[$table]['ctrl']['versioningWS']>=2) && $workspace!==0) {
|
||
|
||
// Select workspace version of record:
|
||
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
$fields,
|
||
$table,
|
||
'pid!=-1 AND
|
||
... | ... | |
$this->deleteClause($table)
|
||
);
|
||
|
||
if (is_array($rows[0])) {
|
||
return $rows[0];
|
||
if (is_array($row)) {
|
||
return $row;
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
}
|
||
|
||
// Select workspace version of record, only testing for deleted.
|
||
list($newrow) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$newrow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
$fields,
|
||
$table,
|
||
'pid=-1 AND
|
||
... | ... | |
|
||
// If version found, check if it could have been selected with enableFields on as well:
|
||
if (is_array($newrow)) {
|
||
if ($bypassEnableFieldsCheck || $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
if ($bypassEnableFieldsCheck || $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'uid',
|
||
$table,
|
||
'pid=-1 AND
|
||
... | ... | |
}
|
||
} else {
|
||
// OK, so no workspace version was found. Then check if online version can be selected with full enable fields and if so, return 1:
|
||
if ($bypassEnableFieldsCheck || $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
if ($bypassEnableFieldsCheck || $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'uid',
|
||
$table,
|
||
'uid='.intval($uid).$enFields
|
||
... | ... | |
}
|
||
else {
|
||
if ($wsid > 0) {
|
||
$ws = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_workspace', 'uid='.intval($wsid).' AND deleted=0'); // No $TCA yet!
|
||
if (count($ws)) {
|
||
$ws = $ws[0];
|
||
}
|
||
else {
|
||
return false;
|
||
}
|
||
$ws = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_workspace', 'uid='.intval($wsid).' AND deleted=0'); // No $TCA yet!
|
||
if (!is_array($ws)) return false;
|
||
}
|
||
else {
|
||
$ws = $wsid;
|
t3lib/class.t3lib_befunc.php (working copy) | ||
---|---|---|
if ($workspace !== 0 && $TCA[$table] && $TCA[$table]['ctrl']['versioningWS']) {
|
||
|
||
// Select workspace version of record:
|
||
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
$fields,
|
||
$table,
|
||
'pid=-1 AND
|
||
... | ... | |
t3lib_BEfunc::deleteClause($table)
|
||
);
|
||
|
||
if (is_array($rows[0])) return $rows[0];
|
||
if (is_array($row)) return $row;
|
||
}
|
||
}
|
||
return FALSE;
|
||
... | ... | |
if ($workspace!==0 && $TCA[$table] && (int)$TCA[$table]['ctrl']['versioningWS']>=2) {
|
||
|
||
// Select workspace version of record:
|
||
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
$fields,
|
||
$table,
|
||
'pid!=-1 AND
|
||
... | ... | |
t3lib_BEfunc::deleteClause($table)
|
||
);
|
||
|
||
if (is_array($rows[0])) return $rows[0];
|
||
if (is_array($row)) return $row;
|
||
}
|
||
|
||
return FALSE;
|
t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php (working copy) | ||
---|---|---|
public function get($entryIdentifier) {
|
||
$cacheEntry = false;
|
||
|
||
$cacheEntries = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$cacheEntry = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'content',
|
||
$this->cacheTable,
|
||
'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable) . ' '
|
||
. 'AND (crdate + lifetime >= ' . $GLOBALS['EXEC_TIME'] . ' OR lifetime = 0)'
|
||
);
|
||
|
||
if (count($cacheEntries) == 1) {
|
||
$cacheEntry = $cacheEntries[0]['content'];
|
||
}
|
||
|
||
return $cacheEntry;
|
||
return $cacheEntry['content'];
|
||
}
|
||
|
||
/**
|
||
... | ... | |
public function has($entryIdentifier) {
|
||
$hasEntry = false;
|
||
|
||
$cacheEntries = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$cacheEntry = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
|
||
'content',
|
||
$this->cacheTable,
|
||
'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable) . ' '
|
||
. 'AND crdate + lifetime >= ' . $GLOBALS['EXEC_TIME']
|
||
);
|
||
|
||
if (count($cacheEntries) == 1) {
|
||
$hasEntry = true;
|
||
}
|
||
|
||
return $hasEntry;
|
||
return $cacheEntry > 0 ? TRUE : FALSE;
|
||
}
|
||
|
||
/**
|
t3lib/class.t3lib_userauthgroup.php (working copy) | ||
---|---|---|
$wsRec = array('uid' => $wsRec);
|
||
break;
|
||
default:
|
||
list($wsRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$wsRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
$fields,
|
||
'sys_workspace',
|
||
'pid=0 AND uid='.intval($wsRec).
|
typo3/alt_doc.php (working copy) | ||
---|---|---|
list($table,$orig_uid,$language) = explode(':',$justLocalized);
|
||
|
||
if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
|
||
list($localizedRecord) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$localizedRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'uid',
|
||
$table,
|
||
$TCA[$table]['ctrl']['languageField'].'='.intval($language).' AND '.
|
typo3/class.db_list.inc (working copy) | ||
---|---|---|
list($table,$orig_uid,$language) = explode(':',$justLocalized);
|
||
|
||
if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
|
||
list($localizedRecord) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$localizedRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'uid',
|
||
$table,
|
||
$TCA[$table]['ctrl']['languageField'].'='.intval($language).' AND '.
|
typo3/mod/user/ws/class.wslib_gui.php (working copy) | ||
---|---|---|
$this->formatWorkspace_cache[$wsid] = ''; // Does not output anything for ONLINE because it might confuse people to think that the elemnet IS online which is not the case - only that it exists as an offline version in the online workspace...
|
||
break;
|
||
default:
|
||
list($titleRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('title','sys_workspace','uid='.intval($wsid).t3lib_BEfunc::deleteClause('sys_workspace'));
|
||
$titleRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('title','sys_workspace','uid='.intval($wsid).t3lib_BEfunc::deleteClause('sys_workspace'));
|
||
$this->formatWorkspace_cache[$wsid] = '['.$wsid.'] '.$titleRec['title'];
|
||
break;
|
||
}
|
typo3/sysext/cms/tslib/class.tslib_content.php (working copy) | ||
---|---|---|
);
|
||
$requestHash = md5(serialize($parameters));
|
||
|
||
$cacheEntry = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$cacheEntry = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'treelist',
|
||
'cache_treelist',
|
||
'md5hash = \'' . $requestHash . '\' AND ( expires > ' . $GLOBALS['EXEC_TIME'] . ' OR expires = 0 )'
|
||
... | ... | |
'md5hash = \'' . $requestHash . '\' AND ( expires > ' . $GLOBALS['EXEC_TIME'] . ' OR expires = 0 )'
|
||
);
|
||
|
||
if (!empty($cacheEntry[0]['treelist'])) {
|
||
if (!empty($cacheEntry['treelist'])) {
|
||
// cache hit
|
||
t3lib_div::devLog('Cache Treelist: HIT', 'tslib_cObj');
|
||
return $cacheEntry[0]['treelist'];
|
||
return $cacheEntry['treelist'];
|
||
} else {
|
||
// cache miss
|
||
t3lib_div::devLog('Cache Treelist: MISS', 'tslib_cObj');
|
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy) | ||
---|---|---|
}
|
||
|
||
// Look for keyword configuration record:
|
||
list($previewData) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$previewData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'*',
|
||
'sys_preview',
|
||
'keyword='.$GLOBALS['TYPO3_DB']->fullQuoteStr($inputCode, 'sys_preview').
|
typo3/sysext/rsaauth/sv1/storage/class.tx_rsaauth_split_storage.php (working copy) | ||
---|---|---|
'crdate<' . ($GLOBALS['EXEC_TIME'] - 30 * 60));
|
||
|
||
// Get our value
|
||
list($row) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('key_value',
|
||
$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('key_value',
|
||
'tx_rsaauth_keys', 'uid=' . $keyId);
|
||
if (is_array($row)) {
|
||
$result = $keyPart1 . $row['key_value'];
|
typo3/sysext/impexp/app/index.php (working copy) | ||
---|---|---|
* @return array Preset record, if any (otherwise false)
|
||
*/
|
||
function getPreset($uid) {
|
||
list($preset) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_impexp_presets','uid='.intval($uid));
|
||
$preset = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*','tx_impexp_presets','uid='.intval($uid));
|
||
return $preset;
|
||
}
|
||
|
typo3/sysext/version/cm1/index.php (working copy) | ||
---|---|---|
$this->formatWorkspace_cache[$wsid] = ''; // Does not output anything for ONLINE because it might confuse people to think that the elemnet IS online which is not the case - only that it exists as an offline version in the online workspace...
|
||
break;
|
||
default:
|
||
list($titleRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('title','sys_workspace','uid='.intval($wsid).t3lib_BEfunc::deleteClause('sys_workspace'));
|
||
$titleRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('title','sys_workspace','uid='.intval($wsid).t3lib_BEfunc::deleteClause('sys_workspace'));
|
||
$this->formatWorkspace_cache[$wsid] = '['.$wsid.'] '.$titleRec['title'];
|
||
break;
|
||
}
|
typo3/sysext/indexed_search/pi/class.tx_indexedsearch.php (working copy) | ||
---|---|---|
// Create header if we are searching more than one indexing configuration:
|
||
if (count($indexCfgs)>1) {
|
||
if ($freeIndexUid>0) {
|
||
list($indexCfgRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('title','index_config','uid='.intval($freeIndexUid).$this->cObj->enableFields('index_config'));
|
||
$indexCfgRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('title','index_config','uid='.intval($freeIndexUid).$this->cObj->enableFields('index_config'));
|
||
$titleString = $indexCfgRec['title'];
|
||
} else {
|
||
$titleString = $this->pi_getLL('opt_freeIndexUid_header_'.$freeIndexUid);
|
||
... | ... | |
if ($freeIndexUid>=0) {
|
||
|
||
// First, look if the freeIndexUid is a meta configuration:
|
||
list($indexCfgRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('indexcfgs','index_config','type=5 AND uid='.intval($freeIndexUid).$this->cObj->enableFields('index_config'));
|
||
$indexCfgRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('indexcfgs','index_config','type=5 AND uid='.intval($freeIndexUid).$this->cObj->enableFields('index_config'));
|
||
if (is_array($indexCfgRec)) {
|
||
$refs = t3lib_div::trimExplode(',',$indexCfgRec['indexcfgs']);
|
||
$list = array(-99); // Default value to protect against empty array.
|
||
... | ... | |
list($table,$uid) = t3lib_div::revExplode('_',$ref,2);
|
||
switch ($table) {
|
||
case 'index_config':
|
||
list($idxRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid','index_config','uid='.intval($uid).$this->cObj->enableFields('index_config'));
|
||
$idxRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid','index_config','uid='.intval($uid).$this->cObj->enableFields('index_config'));
|
||
if ($idxRec) $list[] = $uid;
|
||
break;
|
||
case 'pages':
|
||
... | ... | |
} else { // ... otherwise, get flag from sys_language record:
|
||
|
||
// Get sys_language record
|
||
$rowDat = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_language', 'uid='.intval($row['sys_language_uid']).' '.$this->cObj->enableFields('sys_language'));
|
||
$rowDat = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_language', 'uid='.intval($row['sys_language_uid']).' '.$this->cObj->enableFields('sys_language'));
|
||
|
||
// Flag code:
|
||
$flag = $rowDat[0]['flag'];
|
||
$flag = $rowDat['flag'];
|
||
if ($flag) {
|
||
|
||
// FIXME not all flags from typo3/gfx/flags are available in media/flags/
|
typo3/sysext/indexed_search/class.crawler.php (working copy) | ||
---|---|---|
if ($params['indexConfigUid']) {
|
||
|
||
// Load the indexing configuration record:
|
||
list($cfgRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$cfgRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'*',
|
||
'index_config',
|
||
'uid='.intval($params['indexConfigUid'])
|
typo3/sysext/indexed_search/modfunc1/class.tx_indexedsearch_modfunc1.php (working copy) | ||
---|---|---|
$lines[] = '<td>'.$cmdLinks.'</td>';
|
||
|
||
// Query:
|
||
$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'*',
|
||
'index_fulltext',
|
||
'phash = '.intval($row['phash'])
|
||
... | ... | |
'phash = '.intval($row['phash'])
|
||
);
|
||
$lines[] = '<td style="white-space: normal;">'.
|
||
htmlspecialchars(t3lib_div::fixed_lgd_cs($this->utf8_to_currentCharset($ftrows[0]['fulltextdata']),3000)).
|
||
'<hr/><em>Size: '.strlen($ftrows[0]['fulltextdata']).'</em>'.
|
||
htmlspecialchars(t3lib_div::fixed_lgd_cs($this->utf8_to_currentCharset($ftrows['fulltextdata']),3000)).
|
||
'<hr/><em>Size: '.strlen($ftrows['fulltextdata']).'</em>'.
|
||
'</td>';
|
||
|
||
// Query:
|
||
... | ... | |
$content = '';
|
||
|
||
// Selects the result row:
|
||
$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$phashRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'*',
|
||
'index_phash',
|
||
'phash = '.intval($phash)
|
||
... | ... | |
'index_phash',
|
||
'phash = '.intval($phash)
|
||
);
|
||
$phashRecord = $ftrows[0];
|
||
|
||
// If found, display:
|
||
if (is_array($phashRecord)) {
|
||
... | ... | |
$this->utf8_to_currentCharset(t3lib_div::view_array($phashRecord));
|
||
|
||
// Getting debug information if any:
|
||
$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'*',
|
||
'index_debug',
|
||
'phash = '.intval($phash)
|
||
... | ... | |
'phash = '.intval($phash)
|
||
);
|
||
if (is_array($ftrows)) {
|
||
$debugInfo = unserialize($ftrows[0]['debuginfo']);
|
||
$debugInfo = unserialize($ftrows['debuginfo']);
|
||
$lexer = $debugInfo['lexer'];
|
||
unset($debugInfo['lexer']);
|
||
|
||
... | ... | |
function reindexPhash($phash, $pageId) {
|
||
|
||
// Query:
|
||
list($resultRow) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$resultRow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||
'ISEC.*, IP.*',
|
||
'index_phash IP, index_section ISEC',
|
||
'IP.phash = ISEC.phash
|
typo3/sysext/openid/sv1/class.tx_openid_sv1.php (working copy) | ||
---|---|---|
protected function getUserRecord($openIDIdentifier) {
|
||
$record = null;
|
||
if ($openIDIdentifier) {
|
||
list($record) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*',
|
||
$record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*',
|
||
$this->authenticationInformation['db_user']['table'],
|
||
'tx_openid_openid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($openIDIdentifier, $this->authenticationInformation['db_user']['table']) .
|
||
$this->authenticationInformation['db_user']['check_pid_clause'] .
|