Executes the statement and returns the first column of the first row.

@param $statement
@param array $namedParameters
@param null $connection
@return string
509301
public static function returnSingleValue($statement, $namedParameters = [], $connection = null)
    {
        $statement = self::executeStatement(
            $statement,
            $namedParameters,
            $connection !== null ? $connection : static::getReadOnlyConnection()
        );

        return $statement->fetchColumn(0);
    }
247037
private function executeWrite($statement, array $parameters)
    {
        if ($this->transactionCount == 0) {
            $connection = $this->pool->selectWriteConnection();
        } else {
            $connection = $this->transactionConnection;
        }

        try {
            return $connection->execute(
                $this->expandPlaceholders($statement, $parameters),
                $parameters
            );
        } catch (ConnectionException $e) {
            $this->pool->disableWriteConnection($connection);
            if ($this->pool->getWriteConnectionCount() == 0) {
                throw $e;
            }

            return $this->executeWrite($statement, $parameters);
        }
    }
199546
public function applyExprFromString($qb, $alias, $field, $exprValue, $namedParameter = null)
	{
		if (!$qb instanceof QueryBuilder && !$qb instanceof Builder) {
			throw new \InvalidArgumentException(sprintf('Argument 1 passed to "%s" must be an instance of "%s" or "%s", "%s" given.', __METHOD__, '\Doctrine\ORM\QueryBuilder', '\Doctrine\ODM\MongoDB\Query\Builder', gettype($qb)));
		}
		
		$value = $exprValue;
		$namedParameter = $namedParameter ?: ':'.$field;
		$dbDriver = $qb instanceof QueryBuilder ? 'orm' : 'mongodb';
		
		foreach ($this->mapConverters as $mapConverter) {
	        if (true === $this->supports($mapConverter, $dbDriver, $exprValue)) {
	            $converter = new $mapConverter['class']();
	            
	            if (!$converter instanceof QueryExprConverterInterface) {
	                throw new \RuntimeException(sprintf('Class "%s" must implemented interface "%s" for be used like query expression value converter.', $mapConverter['class'], '\Oka\PaginationBundle\Converter\QueryExprConverterInterface'));
	            }
	            
	            $expr = $converter->apply($dbDriver, $alias, $field, $exprValue, $namedParameter, $value);
	            break;
	        }
		}
		
		if ($qb instanceof QueryBuilder) {
			if (false === isset($expr)) {
				$expr = (new \Doctrine\ORM\Query\Expr())->eq($alias.'.'.$field, $namedParameter);
				$qb->setParameter($namedParameter, $exprValue);
			} else {
			    switch (true) {
			        case is_array($value):
			            foreach ($value as $key => $val) {
			                $qb->setParameter($key, $val);
			            }
			            break;
			        case null !== $value:
			            $qb->setParameter($namedParameter, $value);
			            break;
			    }
			}
			
			$qb->andWhere($expr);
		} else {
			$qb->addAnd(isset($expr) ? $expr : (new \Doctrine\MongoDB\Query\Expr())->field($field)->equals($value));
		}
	}
849256
public function exec($statement, $params) 
    {
        $this->count++;
        try {
            return $this->persistence->exec($statement, $params);
        } catch (\PDOException $e) {
            \common_Logger::w('Failed: '.$statement);
            throw $e;
        }
    }
997424
public function getSingleResult($statement, $params = array())
    {
        $result = $this->getResults($statement, $params);

        if (!sizeof($result)) {
            return null;
        }

        return $result[0];
    }
1047025
protected function getSQLResultFromConnection($connection, $sql, array $params = array())
    {
        $result = $connection->fetchAll($sql, $params);
        return $result;
    }
102098
public function prepare(string $statement) : PreparedStatementInterface
    {
        $preparedStatement = @$this->getConnection()->prepare($statement);

        if ($preparedStatement === false) {
            throw new ParserRuntimeException('Statement could not be prepared.', 0);
        }

        return new Sqlite3PreparedStatement($preparedStatement);
    }
83601
def namedb_query_execute( cur, query, values, abort=True):
    
    return db_query_execute(cur, query, values, abort=abort)
1319550
public function exec($statement)
    {
        $connection = $this->getWrappedConnection();

        $logger = $this->_config->getSQLLogger();
        if ($logger) {
            $logger->startQuery($statement);
        }

        try {
            $result = $connection->exec($statement);
        } catch (Throwable $ex) {
            throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, $statement);
        }

        if ($logger) {
            $logger->stopQuery();
        }

        return $result;
    }
171671
public function prepare($statement, $options = null)
    {
        $options = is_null($options) ? [] : $options;
        if (strpos($statement, ':') !== false) {
            $i = 0;
            $bindKeyMap = [];
            $statement = preg_replace_callback('/:([a-zA-Z_]\w*?)\b/', function ($matches) use (&$i, &$bindKeyMap) {
                $bindKeyMap[$matches[1]] = $i++;

                return '?';
            }, $statement);
        }

        $stmtObj = $this->client->prepare($statement);

        if ($stmtObj) {
            $stmtObj->bindKeyMap = $bindKeyMap ?? [];

            return new PDOStatement($this, $stmtObj, $options);
        } else {
            $statementException = new StatementException($this->client->error, $this->client->errno);
            throw new QueryException($statement, [], $statementException);
        }
    }
1254347
public function queryAssoc($statement, $params = array()) {
        $start = microtime(true);
        $query = $this->prepare($statement);
        try {
            $query->execute($params);
        } catch (\PDOException $e){
            $this->error($e->getMessage(), array(
                'File' => __FILE__,
                'Line' => __LINE__ - 4,
                'Query' => $statement .'',
                'Params' => $params,
                'Trace' => $e->getTraceAsString()
            ));
            return null;
        }
        $r = $query->fetchAll(\PDO::FETCH_ASSOC);
        $this->debug($statement . '', array(
            'params' => $params,
            'intoArray' => 'assoc',
            'rows' => count($r),
            'time' => microtime(true) - $start,
            'dns' => $this->dns
        ));
        return $r;
    }
382773
public static @NotNull SqlQuery namedQuery(@NotNull @SQL String sql, @NotNull Map<String, ?> valueMap) {
        return namedQuery(sql, VariableResolver.forMap(valueMap));
    }
758537
public function prepare($statement) {
        $this->connect();

        $this->statement = new Statement($statement, $this->getParams(), $this->routings);
        $this->statement->setFetchMode($this->defaultFetchMode);

        return $this->statement;
    }
680306
public function initConnection(Connection $connection)
    {
        /** @var $pdo PDO */
        $pdo = $connection->getWrappedConnection();
        $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
        $params = $connection->getParams();
        if (!isset($params['charset'])) {
            throw new RuntimeException("No connection charset specified");
        }
        $pdo->exec('SET NAMES ' . $pdo->quote($params['charset']));
    }
655811
protected function run(string $statement, array $parameters = []): int
    {
        try {
            return $this->driver->execute($statement, $parameters);
        } catch (StatementException $e) {
            throw new HandlerException($e);
        }
    }
1330186
private function invokeBefore(array $namedParams, array $classParams)
    {
        $invoker = new Invoker();
        foreach ($this->before as $function) {
            $response = $invoker->invoke($function, $namedParams, $classParams);
            if ($response !== null) {
                return $response;
            }
        }
    }
116175
public function prepare($statement)
    {
	
        $returnValue = null;
        $this->preparedExec = false;
        $returnValue = $this->getStatement($statement);

		
        return $returnValue;
    }