芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/store.kwesioben.com/vendor/doctrine/dbal/src/Driver/IBMDB2/Statement.php
*/ private array $lobs = []; /** * @internal The statement can be only instantiated by its driver connection. * * @param resource $stmt */ public function __construct($stmt) { $this->stmt = $stmt; } /** * {@inheritDoc} */ public function bindValue($param, $value, $type = ParameterType::STRING): bool { assert(is_int($param)); if (func_num_args() < 3) { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindValue() is deprecated.' . ' Pass the type corresponding to the parameter being bound.', ); } return $this->bindParam($param, $value, $type); } /** * {@inheritDoc} * * @deprecated Use {@see bindValue()} instead. */ public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', __METHOD__, ); assert(is_int($param)); if (func_num_args() < 3) { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindParam() is deprecated.' . ' Pass the type corresponding to the parameter being bound.', ); } switch ($type) { case ParameterType::INTEGER: $this->bind($param, $variable, DB2_PARAM_IN, DB2_LONG); break; case ParameterType::LARGE_OBJECT: $this->lobs[$param] = &$variable; break; default: $this->bind($param, $variable, DB2_PARAM_IN, DB2_CHAR); break; } return true; } /** * @param int $position Parameter position * @param mixed $variable * * @throws Exception */ private function bind($position, &$variable, int $parameterType, int $dataType): void { $this->parameters[$position] =& $variable; if (! db2_bind_param($this->stmt, $position, '', $parameterType, $dataType)) { throw StatementError::new($this->stmt); } } /** * {@inheritDoc} */ public function execute($params = null): ResultInterface { if ($params !== null) { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5556', 'Passing $params to Statement::execute() is deprecated. Bind parameters using' . ' Statement::bindParam() or Statement::bindValue() instead.', ); } $handles = $this->bindLobs(); $result = @db2_execute($this->stmt, $params ?? $this->parameters); foreach ($handles as $handle) { fclose($handle); } $this->lobs = []; if ($result === false) { throw StatementError::new($this->stmt); } return new Result($this->stmt); } /** * @return list
* * @throws Exception */ private function bindLobs(): array { $handles = []; foreach ($this->lobs as $param => $value) { if (is_resource($value)) { $handle = $handles[] = $this->createTemporaryFile(); $path = stream_get_meta_data($handle)['uri']; $this->copyStreamToStream($value, $handle); $this->bind($param, $path, DB2_PARAM_FILE, DB2_BINARY); } else { $this->bind($param, $value, DB2_PARAM_IN, DB2_CHAR); } unset($value); } return $handles; } /** * @return resource * * @throws Exception */ private function createTemporaryFile() { $handle = @tmpfile(); if ($handle === false) { throw CannotCreateTemporaryFile::new(error_get_last()); } return $handle; } /** * @param resource $source * @param resource $target * * @throws Exception */ private function copyStreamToStream($source, $target): void { if (@stream_copy_to_stream($source, $target) === false) { throw CannotCopyStreamToStream::new(error_get_last()); } } }