本文整理匯總了PHP中TYPO3\CMS\Core\Database\DatabaseConnection::fullQuoteStr方法的典型用法代碼示例。如果您正苦於以下問題:PHP DatabaseConnection::fullQuoteStr方法的具體用法?PHP DatabaseConnection::fullQuoteStr怎麽用?PHP DatabaseConnection::fullQuoteStr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Core\Database\DatabaseConnection
的用法示例。
在下文中一共展示了DatabaseConnection::fullQuoteStr方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: storeKeywordsToDatabase
/**
* Stores the keywords from the current query to the database.
*
* @param string $keywords The current query's keywords
* @return void
*/
protected function storeKeywordsToDatabase($keywords)
{
$nextSequenceId = $this->getNextSequenceId();
$this->database->sql_query('INSERT INTO tx_solr_last_searches (sequence_id, tstamp, keywords)
VALUES (' . $nextSequenceId . ', ' . time() . ', ' . $this->database->fullQuoteStr($keywords, 'tx_solr_last_searches') . ')
ON DUPLICATE KEY UPDATE tstamp = ' . time() . ', keywords = ' . $this->database->fullQuoteStr($keywords, 'tx_solr_last_searches'));
}
示例2: getDuplicateRowsIfExist
/**
* This method determines duplicates for a queue entry with the same parameters and this timestamp.
* If the timestamp is in the past, it will check if there is any unprocessed queue entry in the past.
* If the timestamp is in the future it will check, if the queued entry has exactly the same timestamp
*
* @param int $tstamp
* @param string $parameters
* @author Fabrizio Branca
* @author Timo Schmidt
* @return array;
*/
protected function getDuplicateRowsIfExist($tstamp, $fieldArray)
{
$rows = array();
$currentTime = $this->getCurrentTime();
//if this entry is scheduled with "now"
if ($tstamp <= $currentTime) {
if ($this->extensionSettings['enableTimeslot']) {
$timeBegin = $currentTime - 100;
$timeEnd = $currentTime + 100;
$where = ' ((scheduled BETWEEN ' . $timeBegin . ' AND ' . $timeEnd . ' ) OR scheduled <= ' . $currentTime . ') ';
} else {
$where = 'scheduled <= ' . $currentTime;
}
} elseif ($tstamp > $currentTime) {
//entry with a timestamp in the future need to have the same schedule time
$where = 'scheduled = ' . $tstamp;
}
if (!empty($where)) {
$result = $this->db->exec_SELECTgetRows('qid', 'tx_crawler_queue', $where . ' AND NOT exec_time' . ' AND NOT process_id ' . ' AND page_id=' . intval($fieldArray['page_id']) . ' AND parameters_hash = ' . $this->db->fullQuoteStr($fieldArray['parameters_hash'], 'tx_crawler_queue'));
if (is_array($result)) {
foreach ($result as $value) {
$rows[] = $value['qid'];
}
}
}
return $rows;
}
示例3: fetchUserRecordByIdentifier
/**
* Get a user from DB by social identifier
*
* @param string $identifier social identifier
* @param string $extraWhere Additional WHERE clause: " AND ...
* @param array $dbUserSetup User db table definition: $this->db_user
* @return mixed User array or FALSE
*/
public function fetchUserRecordByIdentifier($identifier, $extraWhere = '', $dbUserSetup = '')
{
$result = FALSE;
$identityClassName = 'Portrino\\PxHybridAuth\\Domain\\Model\\Identity\\' . ucfirst($this->getServiceProvider()) . 'Identity';
if (class_exists($identityClassName) && defined($identityClassName . '::EXTBASE_TYPE')) {
$extbaseType = constant($identityClassName . '::EXTBASE_TYPE');
$identityClause = 'deleted=0 AND hidden=0 AND identifier=' . $this->db->fullQuoteStr($identifier, 'tx_pxhybridauth_domain_model_identity') . ' AND ' . 'tx_extbase_type=' . $this->db->fullQuoteStr($extbaseType, 'tx_pxhybridauth_domain_model_identity');
$socialIdentities = $this->db->exec_SELECTgetRows('*', 'tx_pxhybridauth_domain_model_identity', $identityClause);
foreach ($socialIdentities as $socialIdentity) {
if (isset($socialIdentity['fe_user'])) {
$dbUser = is_array($dbUserSetup) ? $dbUserSetup : $this->db_user;
// Look up the user by the username and/or extraWhere:
$dbres = $this->db->exec_SELECTquery('*', $dbUser['table'], 'uid' . '=' . $this->db->fullQuoteStr($socialIdentity['fe_user'], $dbUser['table']) . $this->db->fullQuoteStr($dbUser['check_pid_clause'], $dbUser['table']) . $dbUser['enable_clause'] . $extraWhere);
if ($dbres) {
$result = $this->db->sql_fetch_assoc($dbres);
$this->db->sql_free_result($dbres);
if ($result) {
break;
}
}
}
}
}
return $result;
}
示例4: updateIdentifierHashesForStorage
/**
* Creates file identifier hashes for a single storage.
*
* @param ResourceStorage $storage The storage to update
* @return array The executed database queries
*/
protected function updateIdentifierHashesForStorage(ResourceStorage $storage)
{
$queries = array();
if (!ExtensionManagementUtility::isLoaded('dbal')) {
// if DBAL is not loaded, we're using MySQL and can thus use their
// SHA1() function
if ($storage->usesCaseSensitiveIdentifiers()) {
$updateCall = 'SHA1(identifier)';
} else {
$updateCall = 'SHA1(LOWER(identifier))';
}
$queries[] = $query = sprintf('UPDATE sys_file SET identifier_hash = %s WHERE storage=%d', $updateCall, $storage->getUid());
$this->db->sql_query($query);
// folder hashes cannot be done with one call: so do it manually
$files = $this->db->exec_SELECTgetRows('uid, storage, identifier', 'sys_file', sprintf('storage=%d AND folder_hash=%s', $storage->getUid(), $this->db->fullQuoteStr('', 'sys_file')));
foreach ($files as $file) {
$folderHash = $storage->hashFileIdentifier($storage->getFolderIdentifierFromFileIdentifier($file['identifier']));
$queries[] = $query = $this->db->UPDATEquery('sys_file', 'uid=' . $file['uid'], array('folder_hash' => $folderHash));
$this->db->sql_query($query);
}
} else {
// manually hash the identifiers when using DBAL
$files = $this->db->exec_SELECTgetRows('uid, storage, identifier', 'sys_file', sprintf('storage=%d AND identifier_hash=""', $storage->getUid()));
foreach ($files as $file) {
$hash = $storage->hashFileIdentifier($file['identifier']);
$folderHash = $storage->hashFileIdentifier($storage->getFolderIdentifierFromFileIdentifier($file['identifier']));
$queries[] = $query = $this->db->UPDATEquery('sys_file', 'uid=' . $file['uid'], array('identifier_hash' => $hash, 'folder_hash' => $folderHash));
$this->db->sql_query($query);
}
}
return $queries;
}
示例5: getUserRecord
/**
* Gets user record for the user with the OpenID provided by the user
*
* @param string $openIDIdentifier OpenID identifier to search for
* @return array Database fields from the table that corresponds to the current login mode (FE/BE)
*/
protected function getUserRecord($openIDIdentifier)
{
$record = null;
try {
$openIDIdentifier = $this->normalizeOpenID($openIDIdentifier);
// $openIDIdentifier always has a trailing slash
// but tx_openid_openid field possibly not so check for both alternatives in database
$record = $this->databaseConnection->exec_SELECTgetSingleRow('*', $this->authenticationInformation['db_user']['table'], 'tx_openid_openid IN (' . $this->databaseConnection->fullQuoteStr($openIDIdentifier, $this->authenticationInformation['db_user']['table']) . ',' . $this->databaseConnection->fullQuoteStr(rtrim($openIDIdentifier, '/'), $this->authenticationInformation['db_user']['table']) . ')' . $this->authenticationInformation['db_user']['check_pid_clause'] . $this->authenticationInformation['db_user']['enable_clause']);
if ($record) {
// Make sure to work only with normalized OpenID during the whole process
$record['tx_openid_openid'] = $this->normalizeOpenID($record['tx_openid_openid']);
}
} catch (Exception $e) {
// This should never happen and generally means hack attempt.
// We just log it and do not return any records.
$this->writeLog($e->getMessage());
}
// Hook to modify the user record, e.g. to register a new user
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['openid']['getUserRecord']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['openid']['getUserRecord'])) {
$_params = array('record' => &$record, 'response' => $this->openIDResponse, 'authInfo' => $this->authenticationInformation);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['openid']['getUserRecord'] as $funcName) {
GeneralUtility::callUserFunction($funcName, $_params, $this);
}
}
return $record;
}
示例6: addRecordTypeConstraint
/**
* Add a constraint to ensure that the record type of the returned tuples is matching the data type of the repository.
*
* @param string $className The class name
* @param array &$sql The query parts
* @return void
*/
protected function addRecordTypeConstraint($className, &$sql)
{
if ($className !== NULL) {
$dataMap = $this->dataMapper->getDataMap($className);
if ($dataMap->getRecordTypeColumnName() !== NULL) {
$recordTypes = array();
if ($dataMap->getRecordType() !== NULL) {
$recordTypes[] = $dataMap->getRecordType();
}
foreach ($dataMap->getSubclasses() as $subclassName) {
$subclassDataMap = $this->dataMapper->getDataMap($subclassName);
if ($subclassDataMap->getRecordType() !== NULL) {
$recordTypes[] = $subclassDataMap->getRecordType();
}
}
if (!empty($recordTypes)) {
$recordTypeStatements = array();
foreach ($recordTypes as $recordType) {
$tableName = $dataMap->getTableName();
$recordTypeStatements[] = $tableName . '.' . $dataMap->getRecordTypeColumnName() . '=' . $this->databaseHandle->fullQuoteStr($recordType, $tableName);
}
$sql['additionalWhereClause'][] = '(' . implode(' OR ', $recordTypeStatements) . ')';
}
}
}
}
示例7: updateExistingAssociation
/**
* Updates existing association.
*
* @param string $serverUrl Server URL
* @param \Auth_OpenID_Association $association OpenID association
* @return void
*/
protected function updateExistingAssociation($serverUrl, \Auth_OpenID_Association $association)
{
$where = sprintf('server_url=%s AND assoc_handle=%s AND expires>%d', $this->databaseConnection->fullQuoteStr($serverUrl, self::ASSOCIATION_TABLE_NAME), $this->databaseConnection->fullQuoteStr($association->handle, self::ASSOCIATION_TABLE_NAME), time());
$serializedAssociation = serialize($association);
$values = array('content' => base64_encode($serializedAssociation), 'tstamp' => time());
$this->databaseConnection->exec_UPDATEquery(self::ASSOCIATION_TABLE_NAME, $where, $values);
}
示例8: replacePlaceholders
/**
* Replace query placeholders in a query part by the given
* parameters.
*
* @param string &$sqlString The query part with placeholders
* @param array $parameters The parameters
* @param string $tableName
*
* @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception
* @deprecated since 6.2, will be removed two versions later
* @todo add deprecation notice after getUidOfAlreadyPersistedValueObject is adjusted
*/
protected function replacePlaceholders(&$sqlString, array $parameters, $tableName = 'foo')
{
// @todo profile this method again
if (substr_count($sqlString, '?') !== count($parameters)) {
throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception('The number of question marks to replace must be equal to the number of parameters.', 1242816074);
}
$offset = 0;
foreach ($parameters as $parameter) {
$markPosition = strpos($sqlString, '?', $offset);
if ($markPosition !== FALSE) {
if ($parameter === NULL) {
$parameter = 'NULL';
} elseif (is_array($parameter) || $parameter instanceof \ArrayAccess || $parameter instanceof \Traversable) {
$items = array();
foreach ($parameter as $item) {
$items[] = $this->databaseHandle->fullQuoteStr($item, $tableName);
}
$parameter = '(' . implode(',', $items) . ')';
} else {
$parameter = $this->databaseHandle->fullQuoteStr($parameter, $tableName);
}
$sqlString = substr($sqlString, 0, $markPosition) . $parameter . substr($sqlString, $markPosition + 1);
}
$offset = $markPosition + strlen($parameter);
}
}
示例9: findOneByOriginalFileAndTaskTypeAndConfiguration
/**
* @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\FileInterface $file
* @param string $taskType The task that should be executed on the file
* @param array $configuration
*
* @return ProcessedFile
*/
public function findOneByOriginalFileAndTaskTypeAndConfiguration(FileInterface $file, $taskType, array $configuration)
{
$databaseRow = $this->databaseConnection->exec_SELECTgetSingleRow('*', $this->table, 'original=' . (int) $file->getUid() . ' AND task_type=' . $this->databaseConnection->fullQuoteStr($taskType, $this->table) . ' AND configurationsha1=' . $this->databaseConnection->fullQuoteStr(sha1(serialize($configuration)), $this->table));
if (is_array($databaseRow)) {
$processedFile = $this->createDomainObject($databaseRow);
} else {
$processedFile = $this->createNewProcessedFileObject($file, $taskType, $configuration);
}
return $processedFile;
}
示例10: putUrlToCache
/**
* Sets the entry to cache.
*
* @param UrlCacheEntry $cacheEntry
* @return void
*/
public function putUrlToCache(UrlCacheEntry $cacheEntry)
{
$data = array('original_url' => $cacheEntry->getOriginalUrl(), 'page_id' => $cacheEntry->getPageId(), 'request_variables' => json_encode($cacheEntry->getRequestVariables()), 'rootpage_id' => $cacheEntry->getRootPageId(), 'speaking_url' => $cacheEntry->getSpeakingUrl());
if ($cacheEntry->getCacheId()) {
$this->databaseConnection->exec_UPDATEquery('tx_realurl_urlcache', 'uid=' . $this->databaseConnection->fullQuoteStr($cacheEntry->getCacheId(), 'tx_realurl_urlcache'), $data);
} else {
$this->databaseConnection->exec_INSERTquery('tx_realurl_urlcache', $data);
$cacheEntry->setCacheId($this->databaseConnection->sql_insert_id());
}
}
示例11: insertLastVersion
/**
* Update the current_version field after update
* For performance reason "native" TYPO3_DB is
* used here directly.
*
* @param integer $repositoryUid
* @return integer
*/
public function insertLastVersion($repositoryUid = 1)
{
$groupedRows = $this->databaseConnection->exec_SELECTgetRows('extension_key, max(integer_version) as maxintversion', 'tx_extensionmanager_domain_model_extension', 'repository=' . intval($repositoryUid), 'extension_key');
$extensions = count($groupedRows);
if ($extensions > 0) {
// set all to 0
$this->databaseConnection->exec_UPDATEquery('tx_extensionmanager_domain_model_extension', 'current_version=1 AND repository=' . intval($repositoryUid), array('current_version' => 0));
// Find latest version of extensions and set current_version to 1 for these
foreach ($groupedRows as $row) {
$this->databaseConnection->exec_UPDATEquery('tx_extensionmanager_domain_model_extension', 'extension_key=' . $this->databaseConnection->fullQuoteStr($row['extension_key'], 'tx_extensionmanager_domain_model_extension') . ' AND integer_version=' . intval($row['maxintversion']) . ' AND repository=' . intval($repositoryUid), array('current_version' => 1));
}
}
return $extensions;
}
示例12: performUpdate
/**
* Perform update
*
* @param array &$dbQueries Queries done in this update
* @param mixed &$customMessages Custom messages
* @return boolean Whether the updated was made or not
*/
public function performUpdate(array &$dbQueries, &$customMessages)
{
$rows = $this->db->exec_SELECTgetRows('uid,pi_flexform', $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'], 'CType = ' . $this->db->fullQuoteStr('media', $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']) . ' AND pi_flexform LIKE ' . $this->db->fullQuoteStr('%<sheet index="sDEF">%', $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']));
/** @var $flexformTools \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools */
$flexformTools = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools');
foreach ($rows as $row) {
$flexFormXML = $row['pi_flexform'];
$data = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($flexFormXML);
$sDEF = $data['data']['sDEF']['lDEF'];
unset($data['data']['sDEF']);
$type = $sDEF['mmType']['vDEF'];
$data['data']['sGeneral'] = array('lDEF' => array('mmType' => array('vDEF' => $type)));
$width = $sDEF['mmWidth']['vDEF'];
if ($width) {
$data['data']['sGeneral']['lDEF']['mmWidth'] = array('vDEF' => (int) $width);
}
$height = $sDEF['mmHeight']['vDEF'];
if ($height) {
$data['data']['sGeneral']['lDEF']['mmHeight'] = array('vDEF' => (int) $height);
}
switch ($type) {
case 'video':
$data['data']['sVideo'] = array('lDEF' => array('mmFile' => array('vDEF' => $sDEF['mmFile']['vDEF'])));
break;
case 'audio':
$data['data']['sAudio'] = array('lDEF' => array('mmAudioFallback' => array('vDEF' => $sDEF['mmFile']['vDEF'])));
break;
default:
continue;
}
$newXML = $flexformTools->flexArray2Xml($data, TRUE);
$newXML = str_replace('encoding=""', 'encoding="utf-8"', $newXML);
$this->db->exec_UPDATEquery($GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'], 'uid = ' . $row['uid'], array('pi_flexform' => $newXML));
}
return TRUE;
}
示例13: putUrlToCache
/**
* Sets the entry to cache.
*
* @param UrlCacheEntry $cacheEntry
* @return void
*/
public function putUrlToCache(UrlCacheEntry $cacheEntry)
{
$data = array('expire' => $cacheEntry->getExpiration(), 'original_url' => $cacheEntry->getOriginalUrl(), 'page_id' => $cacheEntry->getPageId(), 'request_variables' => json_encode($cacheEntry->getRequestVariables()), 'rootpage_id' => $cacheEntry->getRootPageId(), 'speaking_url' => $cacheEntry->getSpeakingUrl());
if ($cacheEntry->getCacheId()) {
$this->databaseConnection->exec_UPDATEquery('tx_realurl_urldata', 'uid=' . $this->databaseConnection->fullQuoteStr($cacheEntry->getCacheId(), 'tx_realurl_urldata'), $data);
} else {
$this->databaseConnection->sql_query('START TRANSACTION');
if ($this->limitTableRecords('tx_realurl_urldata')) {
$this->databaseConnection->sql_query('DELETE FROM tx_realurl_uniqalias_cache_map WHERE url_cache_id NOT IN (SELECT uid FROM tx_realurl_urldata)');
}
$this->databaseConnection->exec_INSERTquery('tx_realurl_urldata', $data);
$cacheEntry->setCacheId($this->databaseConnection->sql_insert_id());
$this->databaseConnection->sql_query('COMMIT');
}
}
示例14: enrichWithRelationFields
/**
* Resolve relations as defined in TCA and add them to the provided $pageRecord array.
*
* @param int $uid Page id
* @param array $pageRecord Array with page data to add relation data to.
* @throws \RuntimeException
* @return array $pageRecord with additional relations
*/
protected function enrichWithRelationFields($uid, array $pageRecord)
{
$pageOverlayFields = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields']);
foreach ($GLOBALS['TCA']['pages']['columns'] as $column => $configuration) {
if ($this->columnHasRelationToResolve($configuration)) {
$configuration = $configuration['config'];
if ($configuration['MM']) {
/** @var $loadDBGroup \TYPO3\CMS\Core\Database\RelationHandler */
$loadDBGroup = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\RelationHandler::class);
$loadDBGroup->start($pageRecord[$column], isset($configuration['allowed']) ? $configuration['allowed'] : $configuration['foreign_table'], $configuration['MM'], $uid, 'pages', $configuration);
$relatedUids = isset($loadDBGroup->tableArray[$configuration['foreign_table']]) ? $loadDBGroup->tableArray[$configuration['foreign_table']] : array();
} else {
$columnIsOverlaid = in_array($column, $pageOverlayFields, true);
$table = $configuration['foreign_table'];
$field = $configuration['foreign_field'];
$whereClauseParts = array($field . ' = ' . (int) ($columnIsOverlaid ? $uid : $pageRecord['uid']));
if (isset($configuration['foreign_match_fields']) && is_array($configuration['foreign_match_fields'])) {
foreach ($configuration['foreign_match_fields'] as $field => $value) {
$whereClauseParts[] = $field . ' = ' . $this->databaseConnection->fullQuoteStr($value, $table);
}
}
if (isset($configuration['foreign_table_field'])) {
if ((int) $this->languageUid > 0 && $columnIsOverlaid) {
$whereClauseParts[] = trim($configuration['foreign_table_field']) . ' = \'pages_language_overlay\'';
} else {
$whereClauseParts[] = trim($configuration['foreign_table_field']) . ' = \'pages\'';
}
}
if (isset($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'])) {
$whereClauseParts[] = $table . '.' . $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'] . ' = 0';
}
$whereClause = implode(' AND ', $whereClauseParts);
$whereClause .= $this->pageContext->deleteClause($table);
$orderBy = isset($configuration['foreign_sortby']) ? $configuration['foreign_sortby'] : '';
$rows = $this->databaseConnection->exec_SELECTgetRows('uid', $table, $whereClause, '', $orderBy);
if (!is_array($rows)) {
throw new \RuntimeException('Could to resolve related records for page ' . $uid . ' and foreign_table ' . htmlspecialchars($configuration['foreign_table']), 1343589452);
}
$relatedUids = array();
foreach ($rows as $row) {
$relatedUids[] = $row['uid'];
}
}
$pageRecord[$column] = implode(',', $relatedUids);
}
}
return $pageRecord;
}
示例15: upgradeV2xToV30
/**
* Upgrades configuration from v2.x to v3.0.
*
* @return string
*/
protected function upgradeV2xToV30()
{
$table = 'tx_scheduler_task';
$oldClassName = 'Tx_IgLdapSsoAuth_Task_ImportUsers';
$newClassName = 'Causal\\IgLdapSsoAuth\\Task\\ImportUsers';
$oldPattern = 'O:' . strlen($oldClassName) . ':"' . $oldClassName . '":';
$newPattern = 'O:' . strlen($newClassName) . ':"' . $newClassName . '":';
$oldTaskRecords = $this->databaseConnection->exec_SELECTgetRows('uid, serialized_task_object', $table, 'serialized_task_object LIKE ' . $this->databaseConnection->fullQuoteStr($oldPattern . '%', $table));
$i = 0;
foreach ($oldTaskRecords as $oldTaskRecord) {
$data = array('serialized_task_object' => preg_replace('/^' . $oldPattern . '/', $newPattern, $oldTaskRecord['serialized_task_object']));
$this->databaseConnection->exec_UPDATEquery($table, 'uid=' . (int) $oldTaskRecord['uid'], $data);
$i++;
}
return $this->formatOk('Successfully updated ' . $i . ' user import scheduler task' . ($i > 1 ? 's' : ''));
}