当前位置: 首页>>代码示例>>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;未经允许,请勿转载。