当前位置: 首页>>代码示例>>PHP>>正文


PHP DatabaseConnection::sql_insert_id方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Database\DatabaseConnection::sql_insert_id方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::sql_insert_id方法的具体用法?PHP DatabaseConnection::sql_insert_id怎么用?PHP DatabaseConnection::sql_insert_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Database\DatabaseConnection的用法示例。


在下文中一共展示了DatabaseConnection::sql_insert_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createRecords

 /**
  * creates an image record for each image which was selected in the select-box
  */
 private function createRecords()
 {
     $url = $this->feedImport['feed_url'];
     // TODO: import image from media feed
     //$fileNames = explode(',', );
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     $data = curl_exec($ch);
     curl_close($ch);
     $xml = new SimpleXMLElement($data, LIBXML_NOCDATA);
     $maxImages = 5;
     foreach ($xml->channel[0]->item as $item) {
         $mediaProperties = $item->children('http://search.yahoo.com/mrss/');
         $mediaContent = $mediaProperties->content[0];
         $imageUrl = $mediaContent->attributes()->url;
         $fileName = $this->getFilenameFromUrl($imageUrl);
         if (trim($fileName) && !isset($this->images[$fileName])) {
             $filepath = PATH_site . 'uploads/tx_gorillary/' . $fileName;
             $this->downloadFile($imageUrl, $filepath);
             $newRecord = array('pid' => $this->feedImport['pid'], 'feedimport' => $this->feedImport['uid'], 'crdate' => time(), 'cruser_id' => $this->feedImport['cruser_id'], 'image' => $fileName, 'title' => trim($item->title), 'description' => trim($item->description), 'link' => $item->link);
             $this->db->exec_INSERTquery('tx_gorillary_images', $newRecord);
             $newRecord['uid'] = $this->db->sql_insert_id();
             $this->images[$fileName] = $newRecord;
         }
         $maxImages--;
         if ($maxImages == 0) {
             break;
         }
     }
 }
开发者ID:visol,项目名称:ext-gorillary,代码行数:34,代码来源:class.tx_gorillary_feedimport_save_hook.php

示例2: storedGzipCompressedDataReturnsSameData

 /**
  * @test
  */
 public function storedGzipCompressedDataReturnsSameData()
 {
     $testStringWithBinary = @gzcompress('sdfkljer4587');
     $this->fixture->exec_INSERTquery($this->testTable, array('fieldblob' => $testStringWithBinary));
     $id = $this->fixture->sql_insert_id();
     $entry = $this->fixture->exec_SELECTgetRows('fieldblob', $this->testTable, 'id = ' . $id);
     $this->assertEquals($testStringWithBinary, $entry[0]['fieldblob']);
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:11,代码来源:DatabaseConnectionTest.php

示例3: createRecords

 /**
  * creates an image record for each image which was selected in the select-box
  */
 private function createRecords()
 {
     $fileNames = explode(',', $this->collection['images']);
     foreach ($fileNames as $fileName) {
         if (trim($fileName) && !isset($this->images[$fileName])) {
             $newRecord = array('pid' => $this->collection['pid'], 'collection' => $this->collection['uid'], 'crdate' => time(), 'cruser_id' => $this->collection['cruser_id'], 'image' => $fileName, 'title' => $this->getTitleFromName($fileName));
             $this->db->exec_INSERTquery('tx_gorillary_images', $newRecord);
             $newRecord['uid'] = $this->db->sql_insert_id();
             $this->images[$fileName] = $newRecord;
         }
     }
 }
开发者ID:visol,项目名称:ext-gorillary,代码行数:15,代码来源:class.tx_gorillary_collection_save_hook.php

示例4: migrateNewsCategoryRecords

 /**
  * Process not yet migrated tx_news category records to sys_category records
  */
 protected function migrateNewsCategoryRecords()
 {
     $rows = $this->databaseConnection->exec_SELECTgetRows('uid, pid, tstamp, crdate, cruser_id, starttime, endtime, sorting, ' . 'sys_language_uid, l10n_parent, l10n_diffsource, ' . 'title, description, ' . 'fe_group, single_pid, shortcut, import_id, import_source', 'tx_news_domain_model_category', 'migrate_sys_category_uid = 0 AND deleted = 0');
     if ($this->databaseConnection->sql_error()) {
         $message = ' SQL ERROR: ' . $this->databaseConnection->sql_error();
         $status = FlashMessage::ERROR;
         $title = 'Failed selecting old category records';
         $this->messageArray[] = array($status, $title, $message);
     }
     // Create a new sys_category record for each found record
     $newCategoryRecords = 0;
     foreach ($rows as $row) {
         $oldUid = $row['uid'];
         unset($row['uid']);
         if (is_null($row['l10n_diffsource'])) {
             $row['l10n_diffsource'] = '';
         }
         if ($this->databaseConnection->exec_INSERTquery('sys_category', $row) !== FALSE) {
             $newUid = $this->databaseConnection->sql_insert_id();
             $this->databaseConnection->exec_UPDATEquery('tx_news_domain_model_category', 'uid=' . $oldUid, array('migrate_sys_category_uid' => $newUid));
             $newCategoryRecords++;
         } else {
             $message = ' SQL ERROR: ' . $this->databaseConnection->sql_error();
             $status = FlashMessage::ERROR;
             $title = 'Failed copying [' . $oldUid . '] ' . htmlspecialchars($row['title']) . ' to sys_category';
             $this->messageArray[] = array($status, $title, $message);
         }
     }
     $message = 'Created ' . $newCategoryRecords . ' sys_category records';
     $status = FlashMessage::INFO;
     $title = '';
     $this->messageArray[] = array($status, $title, $message);
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:36,代码来源:class.ext_update.php

示例5: 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());
     }
 }
开发者ID:rvock,项目名称:typo3-realurl,代码行数:16,代码来源:DatabaseCache.php

示例6: prepareTables

 /**
  * Add is_dummy_record record and create dummy record
  *
  * @return void
  */
 private function prepareTables()
 {
     $sql = 'ALTER TABLE %s ADD is_dummy_record tinyint(1) unsigned DEFAULT \'0\' NOT NULL';
     foreach ($this->tables as $table) {
         $_sql = sprintf($sql, $table);
         $this->database->sql_query($_sql);
     }
     $values = array('title' => $this->getUniqueId('title'), 'l10n_diffsource' => '', 'description' => '', 'is_dummy_record' => 1);
     $this->database->exec_INSERTquery('sys_category', $values);
     $this->categoryUid = $this->database->sql_insert_id();
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:16,代码来源:CategoryCollectionTest.php

示例7: readUrlFromArray

 /**
  * Read URL for not-yet-inserted log-entry
  *
  * @param	integer		Queue field array,
  * @return	string
  */
 function readUrlFromArray($field_array)
 {
     // Set exec_time to lock record:
     $field_array['exec_time'] = $this->getCurrentTime();
     $this->db->exec_INSERTquery('tx_crawler_queue', $field_array);
     $queueId = $field_array['qid'] = $this->db->sql_insert_id();
     $result = $this->readUrl_exec($field_array);
     // Set result in log which also denotes the end of the processing of this entry.
     $field_array = array('result_data' => serialize($result));
     $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid=' . intval($queueId), $field_array);
     return $result;
 }
开发者ID:nawork,项目名称:crawler,代码行数:18,代码来源:class.tx_crawler_lib.php

示例8: createLocalStorage

 /**
  * Create the initial local storage base e.g. for the fileadmin/ directory.
  *
  * @param string $name
  * @param string $basePath
  * @param string $pathType
  * @param string $description
  * @param bool $default set to default storage
  * @return int uid of the inserted record
  */
 public function createLocalStorage($name, $basePath, $pathType, $description = '', $default = false)
 {
     $caseSensitive = $this->testCaseSensitivity($pathType === 'relative' ? PATH_site . $basePath : $basePath);
     // create the FlexForm for the driver configuration
     $flexFormData = array('data' => array('sDEF' => array('lDEF' => array('basePath' => array('vDEF' => rtrim($basePath, '/') . '/'), 'pathType' => array('vDEF' => $pathType), 'caseSensitive' => array('vDEF' => $caseSensitive)))));
     /** @var $flexObj FlexFormTools */
     $flexObj = GeneralUtility::makeInstance(FlexFormTools::class);
     $flexFormXml = $flexObj->flexArray2Xml($flexFormData, true);
     // create the record
     $field_values = array('pid' => 0, 'tstamp' => $GLOBALS['EXEC_TIME'], 'crdate' => $GLOBALS['EXEC_TIME'], 'name' => $name, 'description' => $description, 'driver' => 'Local', 'configuration' => $flexFormXml, 'is_online' => 1, 'is_browsable' => 1, 'is_public' => 1, 'is_writable' => 1, 'is_default' => $default ? 1 : 0);
     $this->db->exec_INSERTquery('sys_file_storage', $field_values);
     return (int) $this->db->sql_insert_id();
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:23,代码来源:StorageRepository.php

示例9: addRow

 /**
  * Adds a row to the storage
  *
  * @param string $tableName The database table name
  * @param array $fieldValues The row to be inserted
  * @param bool $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
  * @return int The uid of the inserted row
  */
 public function addRow($tableName, array $fieldValues, $isRelation = FALSE)
 {
     if (isset($fieldValues['uid'])) {
         unset($fieldValues['uid']);
     }
     $this->databaseHandle->exec_INSERTquery($tableName, $fieldValues);
     $this->checkSqlErrors();
     $uid = $this->databaseHandle->sql_insert_id();
     if (!$isRelation) {
         $this->clearPageCache($tableName, $uid);
     }
     return (int) $uid;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:21,代码来源:Typo3DbBackend.php

示例10: add

 /**
  * Adds a processedfile object in the database
  *
  * @param ProcessedFile $processedFile
  * @return void
  */
 public function add($processedFile)
 {
     if ($processedFile->isPersisted()) {
         $this->update($processedFile);
     } else {
         $insertFields = $processedFile->toArray();
         $insertFields['crdate'] = $insertFields['tstamp'] = time();
         $insertFields = $this->cleanUnavailableColumns($insertFields);
         $this->databaseConnection->exec_INSERTquery($this->table, $insertFields);
         $uid = $this->databaseConnection->sql_insert_id();
         $processedFile->updateProperties(array('uid' => $uid));
     }
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:19,代码来源:ProcessedFileRepository.php

示例11: migrateLocations

    /**
     * Migrate locations with relations
     *
     * @return void
     */
    protected function migrateLocations()
    {
        $locations = $this->fetchLocations();
        while ($row = $this->database->sql_fetch_assoc($locations)) {
            $location = $this->mapFieldsPreImport($row, 'locations');
            $table = 'tx_storefinder_domain_model_location';
            if ($record = $this->isAlreadyImported($location, $table)) {
                unset($location['import_id']);
                $this->database->exec_UPDATEquery($table, 'uid = ' . $record['uid'], $location);
                $this->records['locations'][$row['uid']] = $location['uid'] = $record['uid'];
            } else {
                $this->database->exec_INSERTquery($table, $location);
                $this->records['locations'][$row['uid']] = $location['uid'] = $this->database->sql_insert_id();
            }
            $this->mapFieldsPostImport($row, $location, 'locations');
            $this->migrateFilesToFal($row, $location, $this->fileMapping['locations']['media']);
            $this->migrateFilesToFal($row, $location, $this->fileMapping['locations']['imageurl']);
            $this->migrateFilesToFal($row, $location, $this->fileMapping['locations']['icon']);
        }
        $this->database->sql_query('
			update tx_storefinder_domain_model_location AS l
				LEFT JOIN (
					SELECT uid_foreign, COUNT(*) AS count
					FROM sys_category_record_mm
					WHERE tablenames = \'tx_storefinder_domain_model_location\' AND fieldname = \'categories\'
					GROUP BY uid_foreign
				) AS c ON l.uid = c.uid_foreign
			set l.categories = COALESCE(c.count, 0);
		');
        $this->database->sql_query('
			update tx_storefinder_domain_model_location AS l
				LEFT JOIN (
					SELECT uid_local, COUNT(*) AS count
					FROM tx_storefinder_location_attribute_mm
					GROUP BY uid_local
				) AS a ON l.uid = a.uid_local
			set l.attributes = COALESCE(a.count, 0);
		');
        $this->database->sql_query('
			update tx_storefinder_domain_model_location AS l
				LEFT JOIN (
					SELECT uid_local, COUNT(*) AS count
					FROM tx_storefinder_location_location_mm
					GROUP BY uid_local
				) AS a ON l.uid = a.uid_local
			set l.related = COALESCE(a.count, 0);
		');
        $this->messageArray[] = array('message' => count($this->records['locations']) . ' locations migrated');
    }
开发者ID:evoWeb,项目名称:store_finder,代码行数:54,代码来源:UpdateUtility.php

示例12: logDownload

 /**
  * Log the access of the file
  *
  * @param integer|null $intFileSize
  */
 protected function logDownload($intFileSize = null)
 {
     if ($this->isLoggingEnabled()) {
         if (is_null($intFileSize)) {
             $intFileSize = $this->fileSize;
         }
         $data_array = array('tstamp' => time(), 'file_name' => $this->file, 'file_size' => $intFileSize, 'user_id' => intval($this->feUserObj->user['uid']));
         if (is_null($this->logRowUid)) {
             $this->databaseConnection->exec_INSERTquery('tx_nawsecuredl_counter', $data_array);
             $this->logRowUid = $this->databaseConnection->sql_insert_id();
         } else {
             $this->databaseConnection->exec_UPDATEquery('tx_nawsecuredl_counter', '`uid`=' . (int) $this->logRowUid, $data_array);
         }
     }
 }
开发者ID:nawork,项目名称:naw_securedl,代码行数:20,代码来源:FileDelivery.php

示例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');
     }
 }
开发者ID:olek07,项目名称:GiGaBonus,代码行数:21,代码来源:DatabaseCache.php

示例14: updateDatabase

 /**
  * Writes changes into database
  *
  * @return void
  */
 public function updateDatabase()
 {
     if (!is_array($this->data)) {
         return;
     }
     $diff = array_diff_assoc($this->data, $this->origData);
     foreach ($diff as $key => $value) {
         if (!isset($this->data[$key])) {
             unset($diff[$key]);
         }
     }
     if (!empty($diff)) {
         $this->data['tstamp'] = $diff['tstamp'] = $GLOBALS['EXEC_TIME'];
         if (intVal($this->data['uid']) > 0) {
             $this->databaseHandle->exec_UPDATEquery($this->getTableName(), 'uid=' . $this->getUid(), $diff);
         } else {
             $this->data['crdate'] = $diff['crdate'] = $GLOBALS['EXEC_TIME'];
             $this->databaseHandle->exec_INSERTquery($this->getTableName(), $diff);
             $this->setUid($this->databaseHandle->sql_insert_id());
             $this->data['uid'] = $this->getUid();
         }
         $this->origData = $this->data;
     }
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:29,代码来源:class.tx_mmforum_data.php

示例15: addIdentityToFrontendUser

 /**
  * Creates a frontend user based on the data of the social user
  *
  * @param array $user
  * @param string $provider
  * @param string $identifier
  *
  * @return array|FALSE the created identity record or false if it is not possible
  */
 protected function addIdentityToFrontendUser($user, $provider, $identifier)
 {
     $result = false;
     $identityClassName = 'Portrino\\PxHybridAuth\\Domain\\Model\\Identity\\' . $provider . 'Identity';
     if (class_exists($identityClassName) && defined($identityClassName . '::EXTBASE_TYPE')) {
         $extbaseType = constant($identityClassName . '::EXTBASE_TYPE');
         $this->database->exec_INSERTquery('tx_pxhybridauth_domain_model_identity', ['pid' => $user['pid'], 'tx_extbase_type' => $extbaseType, 'identifier' => $identifier, 'fe_user' => $user['uid'], 'hidden' => 0, 'deleted' => 0, 'tstamp' => time(), 'crdate' => time()]);
         $id = $this->database->sql_insert_id();
         $where = 'uid=' . intval($id);
         $result = $this->database->exec_SELECTgetSingleRow('*', 'tx_pxhybridauth_domain_model_identity', $where);
         if ($result) {
             $this->database->exec_UPDATEquery('fe_users', 'uid=' . intval($user['uid']), ['tx_pxhybridauth_identities' => 1]);
         }
     }
     return $result;
 }
开发者ID:portrino,项目名称:px_hybrid_auth,代码行数:25,代码来源:SocialLoginAuthenticationServiceSlot.php


注:本文中的TYPO3\CMS\Core\Database\DatabaseConnection::sql_insert_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。