本文整理汇总了PHP中Zend\Db\Adapter\ParameterContainer::count方法的典型用法代码示例。如果您正苦于以下问题:PHP ParameterContainer::count方法的具体用法?PHP ParameterContainer::count怎么用?PHP ParameterContainer::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\Adapter\ParameterContainer
的用法示例。
在下文中一共展示了ParameterContainer::count方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute
*
* @param ParameterContainer|null $parameters
* @throws Exception\InvalidQueryException
* @return Result
*/
public function execute($parameters = null)
{
if (!$this->isPrepared()) {
$this->prepare();
}
/** START Standard ParameterContainer Merging Block */
if (!$this->parameterContainer instanceof ParameterContainer) {
if ($parameters instanceof ParameterContainer) {
$this->parameterContainer = $parameters;
$parameters = null;
} else {
$this->parameterContainer = new ParameterContainer();
}
}
if (is_array($parameters)) {
$this->parameterContainer->setFromArray($parameters);
}
if ($this->parameterContainer->count() > 0) {
$parameters = $this->parameterContainer->getPositionalArray();
}
/** END Standard ParameterContainer Merging Block */
if ($this->profiler) {
$this->profiler->profilerStart($this);
}
$resultResource = pg_execute($this->pgsql, $this->statementName, (array) $parameters);
if ($this->profiler) {
$this->profiler->profilerFinish();
}
if ($resultResource === false) {
throw new Exception\InvalidQueryException(pg_last_error());
}
$result = $this->driver->createResult($resultResource);
return $result;
}
示例2: execute
/**
* @param mixed $parameters
* @throws Exception\InvalidQueryException
* @return Result
*/
public function execute($parameters = null)
{
if (!$this->isPrepared) {
$this->prepare();
}
/** START Standard ParameterContainer Merging Block */
if (!$this->parameterContainer instanceof ParameterContainer) {
if ($parameters instanceof ParameterContainer) {
$this->parameterContainer = $parameters;
$parameters = null;
} else {
$this->parameterContainer = new ParameterContainer();
}
}
if (is_array($parameters)) {
$this->parameterContainer->setFromArray($parameters);
}
if ($this->parameterContainer->count() > 0) {
$this->bindParametersFromContainer();
}
/** END Standard ParameterContainer Merging Block */
try {
$this->resource->execute();
} catch (\PDOException $e) {
throw new Exception\InvalidQueryException('Statement could not be executed', null, $e);
}
$result = $this->driver->createResult($this->resource, $this);
return $result;
}
示例3: execute
/**
* Execute
*
* @param ParameterContainer $parameters
* @return mixed
*/
public function execute($parameters = null)
{
if (!$this->isPrepared) {
$this->prepare();
}
/** START Standard ParameterContainer Merging Block */
if (!$this->parameterContainer instanceof ParameterContainer) {
if ($parameters instanceof ParameterContainer) {
$this->parameterContainer = $parameters;
$parameters = null;
} else {
$this->parameterContainer = new ParameterContainer();
}
}
if (is_array($parameters)) {
$this->parameterContainer->setFromArray($parameters);
}
if ($this->parameterContainer->count() > 0) {
$this->bindParametersFromContainer();
}
/** END Standard ParameterContainer Merging Block */
if ($this->resource->execute() === false) {
throw new Exception\RuntimeException($this->resource->error);
}
if ($this->bufferResults === true) {
$this->resource->store_result();
$this->isPrepared = false;
$buffered = true;
} else {
$buffered = false;
}
$result = $this->driver->createResult($this->resource, $buffered);
return $result;
}
示例4: execute
/**
* Execute
*
* @param ParameterContainer $parameters
* @return mixed
*/
public function execute($parameters = null)
{
if (!$this->isPrepared) {
$this->prepare();
}
/** START Standard ParameterContainer Merging Block */
if (!$this->parameterContainer instanceof ParameterContainer) {
if ($parameters instanceof ParameterContainer) {
$this->parameterContainer = $parameters;
$parameters = null;
} else {
$this->parameterContainer = new ParameterContainer();
}
}
if (is_array($parameters)) {
$this->parameterContainer->setFromArray($parameters);
}
if ($this->parameterContainer->count() > 0) {
$this->bindParametersFromContainer();
}
/** END Standard ParameterContainer Merging Block */
if ($this->profiler) {
$this->profiler->profilerStart($this);
}
if ($this->driver->getConnection()->inTransaction()) {
$ret = @oci_execute($this->resource, OCI_NO_AUTO_COMMIT);
} else {
$ret = @oci_execute($this->resource, OCI_COMMIT_ON_SUCCESS);
}
if ($this->profiler) {
$this->profiler->profilerFinish();
}
if ($ret === false) {
$e = oci_error($this->resource);
throw new Exception\RuntimeException($e['message'], $e['code']);
}
$result = $this->driver->createResult($this->resource);
return $result;
}
示例5: testCount
/**
* @testdox unit test: Test count() returns the proper count
* @covers Zend\Db\Adapter\ParameterContainer::count
*/
public function testCount()
{
$this->assertEquals(1, $this->parameterContainer->count());
}
示例6: execute
/**
* Execute
*
* @param ParameterContainer|array $parameters
* @throws Exception\RuntimeException
* @return mixed
*/
public function execute($parameters = null)
{
if (!$this->isPrepared) {
$this->prepare();
}
/** START Standard ParameterContainer Merging Block */
if (!$this->parameterContainer instanceof ParameterContainer) {
if ($parameters instanceof ParameterContainer) {
$this->parameterContainer = $parameters;
$parameters = null;
} else {
$this->parameterContainer = new ParameterContainer();
}
}
if (is_array($parameters)) {
$this->parameterContainer->setFromArray($parameters);
}
if ($this->parameterContainer->count() > 0) {
$this->bindParametersFromContainer();
}
/** END Standard ParameterContainer Merging Block */
if ($this->profiler) {
$this->profiler->profilerStart($this);
}
if ($this->bufferResults === true) {
// $this -> resource -> store_result();
// $this -> isPrepared = false;
$buffered = true;
} else {
$buffered = false;
}
if ($this->sql instanceof \MongoZend\Db\NoSql\Select) {
$_order = $this->sql->getOrder();
// , $this -> sql->getColumns()
$return = $this->resource->find($this->sql->getWhere());
if (!empty($_order)) {
foreach ($_order as $_k => $_v) {
if (strtolower($_v) == 'desc' || $_v < 0) {
$_order[$_k] = -1;
} else {
$_order[$_k] = 1;
}
}
$return = $return->sort($_order);
}
if ($this->sql->getLimit() !== null) {
$return = $return->limit($this->sql->getLimit());
}
if ($this->sql->getOffset() !== null) {
$return = $return->skip($this->sql->getOffset());
}
} elseif ($this->sql instanceof \MongoZend\Db\NoSql\Insert) {
$_data = $this->sql->getValues();
$return = $this->resource->insert($_data);
$buffered = $this->sql->getRawState()['table'];
$this->driver->getConnection()->storeLastGeneratedValue($buffered, $_data['_id']);
// $return = $this -> resource -> update( [ '_id' => $_data[ '_id' ] ], [ '$set' => array( "id" => (string) $_data[ '_id' ] ) ] );
} elseif ($this->sql instanceof \MongoZend\Db\NoSql\Update) {
$_data = $this->sql->getSet();
$_where = $this->sql->getWhere();
$return = $this->resource->update($_where, $_data);
$buffered = $this->sql->getRawState()['table'];
$this->driver->getConnection()->storeLastGeneratedValue($buffered, $_data['_id']);
} elseif ($this->sql instanceof \MongoZend\Db\NoSql\Delete) {
$_where = $this->sql->getWhere();
$return = $this->resource->remove($_where);
$buffered = $this->sql->getRawState()['table'];
$this->driver->getConnection()->storeLastGeneratedValue($buffered, null);
} else {
$return = $this->resource->execute();
}
if ($this->profiler) {
$this->profiler->profilerFinish();
}
if ($return === false) {
throw new Exception\RuntimeException($this->getDriver()->getConnection()->getDB()->lastError());
}
$result = $this->driver->createResult($return, $buffered);
return $result;
}