芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/giga.mgaplay.com.br/vendor/mongodb/mongodb/src/Operation/DropCollection.php
isDefault()) { unset($options['writeConcern']); } $this->databaseName = (string) $databaseName; $this->collectionName = (string) $collectionName; $this->options = $options; } /** * Execute the operation. * * @see Executable::execute() * @param Server $server * @return array|object Command result document * @throws UnsupportedException if writeConcern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ public function execute(Server $server) { if (isset($this->options['writeConcern']) && ! server_supports_feature($server, self::$wireVersionForWriteConcern)) { throw UnsupportedException::writeConcernNotSupported(); } $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['writeConcern'])) { throw UnsupportedException::writeConcernNotSupportedInTransaction(); } $command = new Command(['drop' => $this->collectionName]); try { $cursor = $server->executeWriteCommand($this->databaseName, $command, $this->createOptions()); } catch (CommandException $e) { /* The server may return an error if the collection does not exist. * Check for an error code (or message for pre-3.2 servers) and * return the command reply instead of throwing. */ if ( $e->getCode() === self::$errorCodeNamespaceNotFound || $e->getMessage() === self::$errorMessageNamespaceNotFound ) { return $e->getResultDocument(); } throw $e; } if (isset($this->options['typeMap'])) { $cursor->setTypeMap($this->options['typeMap']); } return current($cursor->toArray()); } /** * Create options for executing the command. * * @see http://php.net/manual/en/mongodb-driver-server.executewritecommand.php * @return array */ private function createOptions() { $options = []; if (isset($this->options['session'])) { $options['session'] = $this->options['session']; } if (isset($this->options['writeConcern'])) { $options['writeConcern'] = $this->options['writeConcern']; } return $options; } }