當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IDBConnection::setValues方法代碼示例

本文整理匯總了PHP中OCP\IDBConnection::setValues方法的典型用法代碼示例。如果您正苦於以下問題:PHP IDBConnection::setValues方法的具體用法?PHP IDBConnection::setValues怎麽用?PHP IDBConnection::setValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OCP\IDBConnection的用法示例。


在下文中一共展示了IDBConnection::setValues方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testSetValuesSameNoError

 public function testSetValuesSameNoError()
 {
     $this->makeTestTable();
     $this->connection->setValues('table', ['integerfield' => 1], ['textfield' => 'foo', 'clobfield' => 'not_null']);
     // this will result in 'no affected rows' on certain optimizing DBs
     // ensure the PreConditionNotMetException isn't thrown
     $this->connection->setValues('table', ['integerfield' => 1], ['textfield' => 'foo']);
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:8,代碼來源:ConnectionTest.php

示例2: setUserValue

 /**
  * Set a user defined value
  *
  * @param string $userId the userId of the user that we want to store the value under
  * @param string $appName the appName that we want to store the value under
  * @param string $key the key under which the value is being stored
  * @param string $value the value that you want to store
  * @param string $preCondition only update if the config value was previously the value passed as $preCondition
  * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met
  */
 public function setUserValue($userId, $appName, $key, $value, $preCondition = null)
 {
     // TODO - FIXME
     $this->fixDIInit();
     $preconditionArray = [];
     if (isset($preCondition)) {
         $preconditionArray = ['configvalue' => $preCondition];
     }
     $this->connection->setValues('preferences', ['userid' => $userId, 'appid' => $appName, 'configkey' => $key], ['configvalue' => $value], $preconditionArray);
     // only add to the cache if we already loaded data for the user
     if (isset($this->userCache[$userId])) {
         if (!isset($this->userCache[$userId][$appName])) {
             $this->userCache[$userId][$appName] = array();
         }
         $this->userCache[$userId][$appName][$key] = $value;
     }
 }
開發者ID:farukuzun,項目名稱:core-1,代碼行數:27,代碼來源:allconfig.php

示例3: setUserValue

 /**
  * Set a user defined value
  *
  * @param string $userId the userId of the user that we want to store the value under
  * @param string $appName the appName that we want to store the value under
  * @param string $key the key under which the value is being stored
  * @param string|float|int $value the value that you want to store
  * @param string $preCondition only update if the config value was previously the value passed as $preCondition
  * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met
  * @throws \UnexpectedValueException when trying to store an unexpected value
  */
 public function setUserValue($userId, $appName, $key, $value, $preCondition = null)
 {
     if (!is_int($value) && !is_float($value) && !is_string($value)) {
         throw new \UnexpectedValueException('Only integers, floats and strings are allowed as value');
     }
     // TODO - FIXME
     $this->fixDIInit();
     $preconditionArray = [];
     if (isset($preCondition)) {
         $preconditionArray = ['configvalue' => $preCondition];
     }
     $this->connection->setValues('preferences', ['userid' => $userId, 'appid' => $appName, 'configkey' => $key], ['configvalue' => $value], $preconditionArray);
     // only add to the cache if we already loaded data for the user
     if (isset($this->userCache[$userId])) {
         if (!isset($this->userCache[$userId][$appName])) {
             $this->userCache[$userId][$appName] = array();
         }
         $this->userCache[$userId][$appName][$key] = $value;
     }
 }
開發者ID:drognisep,項目名稱:Portfolio-Site,代碼行數:31,代碼來源:AllConfig.php

示例4: setValues

 /**
  * Insert or update a row value
  *
  * @param string $table
  * @param array $keys (column name => value)
  * @param array $values (column name => value)
  * @param array $updatePreconditionValues ensure values match preconditions (column name => value)
  * @return int number of new rows
  * @throws \Doctrine\DBAL\DBALException
  * @throws PreconditionNotMetException
  */
 public function setValues($table, array $keys, array $values, array $updatePreconditionValues = [])
 {
     return $this->connection->setValues($table, $keys, $values, $updatePreconditionValues);
 }
開發者ID:farukuzun,項目名稱:core-1,代碼行數:15,代碼來源:db.php

示例5: store

 /**
  * Store a set of credentials
  *
  * @param string|null $userId Null for system-wide credentials
  * @param string $identifier
  * @param mixed $credentials
  */
 public function store($userId, $identifier, $credentials)
 {
     $value = $this->crypto->encrypt(json_encode($credentials));
     $this->dbConnection->setValues(self::DB_TABLE, ['user' => $userId, 'identifier' => $identifier], ['credentials' => $value]);
 }
開發者ID:GitHubUser4234,項目名稱:core,代碼行數:12,代碼來源:CredentialsManager.php

示例6: testSetValuesOverWritePreconditionFailed

 /**
  * @expectedException \OCP\PreConditionNotMetException
  */
 public function testSetValuesOverWritePreconditionFailed()
 {
     $this->makeTestTable();
     $this->connection->setValues('table', ['integerfield' => 1], ['textfield' => 'foo', 'booleanfield' => true, 'clobfield' => 'not_null']);
     $this->connection->setValues('table', ['integerfield' => 1], ['textfield' => 'bar'], ['booleanfield' => false]);
 }
開發者ID:gvde,項目名稱:core,代碼行數:9,代碼來源:connection.php


注:本文中的OCP\IDBConnection::setValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。