{@inheritDoc}
@throws \PDOException
@throws \InvalidArgumentException
964681
public function lastInsertId(string $name = null): string
    {
        $this->connect();

        return $this->pdo->lastInsertId($name);
    }
1295270
public function resolve($key) {
        if (!array_key_exists($key, $this->bindings)) {
            throw new InvalidArgumentException("{$key} is not bound.");
        }

        $binding = $this->bindings[$key];
        $value = $binding['value'];

        // singleton
        if ($value instanceof Closure) {
            return $value($this);
        }

        // anonymous object
        if (is_null($value) && class_exists('\\' . $key)) {
            return $this->make($key);
        }

        // labeled object
        if (is_string($value) && class_exists('\\' . $value)) {
            return $this->make($value);
        }

        return $value;
    }
850588
public function execute(PDO $pdo)
    {
        try {
            $stmt = $pdo->prepare($this->getSql());
            $this->statementExecute($stmt, $this->getWhereData());
            $this->checkAffected($stmt, new NoRecordsAffectedSelectException());
            $data = $this->fetchData(
                $stmt,
                $this->getFetchFlat(),
                $this->getFetchStyle()
            );
            $this->setData($data ?: $this->getDefaultValue());
            return $this->getData();
        } catch (NoRecordsAffectedException $exc) {
            throw $exc;
        } catch (\Exception $exc) {
            throw new ExecutionErrorException($exc->getMessage());
        }
    }
1194352
public function process()
    {
        // Find files
        $files = $this->finder->find();
        if (0 === count($files)) {
            throw new \InvalidArgumentException('No files found for format: *.' . $this->getFormat());
        }

        foreach ($files as $file) {
            $valuesSet = 0;
            $configurations = $this->getConfigurationsFromFile($file);
            foreach ($configurations as $configPath => $configValues) {
                $scopeConfigValues = $this->transformConfigToScopeConfig($configPath, $configValues);
                foreach ($scopeConfigValues as $scopeConfigValue) {
                    $this->configWriter->save(
                        $configPath,
                        $scopeConfigValue['value'],
                        $scopeConfigValue['scope'],
                        $this->scopeConverter->convert($scopeConfigValue['scope_id'], $scopeConfigValue['scope'])
                    );

                    $this->getOutput()->writeln(sprintf('<comment>%s => %s</comment>', $configPath, $scopeConfigValue['value']));
                    $valuesSet++;
                }
            }

            $this->getOutput()->writeln(sprintf('<info>Processed: %s with %s value(s).</info>', $file, $valuesSet));
        }
    }
340195
private function execute()
    {
        $this->Connect();
        try {
            $this->delete->execute($this->places);
            $this->result = true;
        } catch (\PDOException $e) {
            $this->result = null;
            $this->erro = "<b>Erro ao Deletar:</b> {$e->getMessage()}";
        }

        parent::setDefault();
    }
289509
public function execute($input_parameters = null)
    {
        $debug = $this->pdo->getDebugSnapshot();
        $return = parent::execute($input_parameters);

        $sql = $this->getExecutedQueryString($input_parameters?$input_parameters:array());
        $this->pdo->log($sql, null, __METHOD__, $debug);
        $this->pdo->setLastExecutedQuery($sql);
        $this->pdo->incrementQueryCount();

        return $return;
    }
1115720
public function execute()
    {
        $length = mb_strlen($this->getValue());

        if (filter_var($this->numberToTruncate, FILTER_VALIDATE_INT) === false) {
            throw new \InvalidArgumentException("Value to truncate by is not a number");
        } elseif (filter_var($this->numberToTruncate, FILTER_VALIDATE_INT, array(
            "options" => array(
                "min_range" => 0,
                "max_range" => $length
            )
        )) === false) {
            throw new \InvalidArgumentException("Value to truncate by is out of bounds");
        } else {
            return (new SubString($this->getValue(), 0, $length - $this->numberToTruncate))->execute();
        }
    }
1289652
static function PDO(\PDO $pdo):self{
    return new class($host, $port) implements \ArrayAccess{

      function __construct(string $host, int $port){

      }

      function offsetExists($uri){

      }

      function offsetGet($uri):\ArrayAccess{
        return new class($uri) extends \Exception implements \ArrayAccess{#{{{

        };#}}}
      }

      function offsetSet($uri, $value){

      }

      function offsetUnset($uri){

      }

    };
  }
822944
private function tryConnect(): void
    {
        $config = $this->getConfig();

        $pdoConfig = [
          PDO::ATTR_EMULATE_PREPARES => false,
          PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
          PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
        ];

        if (isset($config['adapter_options'])) {
            foreach ($config['adapter_options'] as $key => $value) {
                $pdoConfig[$key] = $value;
            }
        }

        if (isset($config['path'])) {
            $path = $config['path'];
            if (substr($path, 0, 8) == 'storage:') {
                $path = Application::getStoragePath(substr($path, 8));
            }
        } else {
            $path = Application::getStoragePath('data/database.sqlite');
        }

        $directory = dirname($path);
        if (!is_dir($directory)) {
            Directory::mkdir($directory, 0755);
        }

        $this->pdo = new PDO('sqlite:' . $path);
        foreach ($pdoConfig as $key => $value) {
            $this->pdo->setAttribute($key, $value);
        }

        // create needed function(s)
        $this->pdo->sqliteCreateFunction('ILIKE', function ($mask, $value) {
            $mask = str_replace(['%', '_'], ['.*?', '.'], preg_quote($mask, '/'));
            $mask = "/^$mask$/ui";
            return preg_match($mask, $value);
        }, 2);
    }
1077581
public function connect()
    {
        if (!$this->isConnected()) {
            $this->pdo = $this->createPDO();
            $this->pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [Statement::class]);
        }
    }
297
public function init()
    {
        $host =getenv('PDO_HOST');
        if($host) {
            $this->setHost(trim($host));
        }

        $database = getenv('PDO_DATABASE');
        if($database) {
            $this->setDatabase(trim($database));
        }
        $user = getenv('PDO_USER');
        if($user) {
            $this->setUser($user);
        }

        $password = getenv('PDO_PASSWORD');
        if($password) {
            $this->setPassword($password);
        }
    }
1313558
private function initialize()
    {
        $this->pdo->exec(
            'CREATE TABLE IF NOT EXISTS `'.$this->table.'` '
            .'(id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, channel VARCHAR(255), level INTEGER, message LONGTEXT, time INTEGER UNSIGNED, INDEX(channel) USING HASH, INDEX(level) USING HASH, INDEX(time) USING BTREE)'
        );

        //Read out actual columns
        $actualFields = array();
        $rs = $this->pdo->query('SELECT * FROM `'.$this->table.'` LIMIT 0');
        for ($i = 0; $i < $rs->columnCount(); $i++) {
            $col = $rs->getColumnMeta($i);
            $actualFields[] = $col['name'];
        }

        //Calculate changed entries
        $removedColumns = array_diff(
            $actualFields,
            $this->additionalFields,
            $this->defaultfields
        );
        $addedColumns = array_diff($this->additionalFields, $actualFields);

        //Remove columns
        if (!empty($removedColumns)) {
            foreach ($removedColumns as $c) {
                $this->pdo->exec('ALTER TABLE `'.$this->table.'` DROP `'.$c.'`;');
            }
        }

        //Add columns
        if (!empty($addedColumns)) {
            foreach ($addedColumns as $c) {
                $this->pdo->exec('ALTER TABLE `'.$this->table.'` add `'.$c.'` TEXT NULL DEFAULT NULL;');
            }
        }

        // merge default and additional field to one array
        $this->defaultfields = array_merge($this->defaultfields, $this->additionalFields);

        $this->initialized = true;
    }
749006
public function set($key, $values, $replace = true)
    {
        if(!is_string($key) && !is_int($key)){
            throw new \InvalidArgumentException('$key expected to be string, got:'.gettype($key));
        }

        if( !is_string($values) && !is_array($values) ){
            throw new \InvalidArgumentException('$key expected to be string or array, got: '.gettype($key));
        }

        $values = array_values((array)$values);

        if (true === $replace || !isset($this->container[$key])) {
            $this->container[$key] = $values;
        } else {
            $this->container[$key] = array_merge($this->container[$key], $values);
        }
    }
433423
public function bind(array $param) {
		foreach ($param as $key => $value) {
			if (is_null($value)) {
				$type = \PDO::PARAM_NULL;
			} else if (is_bool($value)) {
				$type = \PDO::PARAM_BOOL;
			} else if (is_int($value)) {
				$type = \PDO::PARAM_INT;
			} else {
				$type = \PDO::PARAM_STR;
			}
			$this->result->bindValue(is_int($key) ? ++$key : $key, $value, $type);
		}
	}
800989
public function invalidate()
    {
        $query = $this->pdo->prepare(<<<SQL
DELETE FROM robotstxt__cache1
WHERE base = :base;
SQL
        );
        $query->bindValue('base', $this->base, \PDO::PARAM_STR);
        return $query->execute();
    }
365236
public function bindValues($query) {
        if (!empty($this->bind_values) && !empty($this->bind_keys)) {
            if (!$query instanceof \PDOStatement) {
                $this->setError('q', 'No valid PDO Statement provided');
            }

            for ($ii = 0; $ii < count($this->bind_values); $ii++) {
                $param = $this->get_PDO_param($this->bind_values[$ii]);
                $value = $this->bind_values[$ii];
                $key = $this->bind_keys[$ii];

                $query->bindValue($key, $value, $param);
            }
        }
    }
1311388
private static function checkAutocommit(\PDO $pdo): void
    {
        $vendor = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
        
        // MySQL turns autocommit off during a transaction.
        if ($vendor == "mysql") {
            return;
        }

        try {
            if ($pdo->getAttribute(\PDO::ATTR_AUTOCOMMIT)) {
                throw new \InvalidArgumentException("PDO::ATTR_AUTOCOMMIT should be disabled.");
            }
        } catch (\PDOException $e) {
            /*
             * Ignore this, as some drivers would throw an exception for an
             * unsupported attribute (e.g. Postgres).
             */
        }
    }