@param string $statement
@param int    $mode
@param mixed  $arg3
@param array  $ctorargs

@return array|bool|false|\PDOStatement
979720
public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = [])
    {
        $result = $this->client->query($statement, self::$options['timeout']);

        if ($result === false) {
            throw new PDOException($this->client->error, $this->client->errno);
        }

        return $result;
    }
356071
function prepare($statement = null, array $placeholders = null) {
		$this->dbh !== null or $this->setup();

		if ($placeholders !== null) {
			$consts = [];
			foreach ($placeholders as $key => $val) {
				$consts["[$key]"] = $val;
			}

			return \fenrir\MysqlStatement::instance($this->dbh, strtr($statement, $consts));
		}
		else { // placeholders === null
			return \fenrir\MysqlStatement::instance($this->dbh, $statement);
		}
	}
702735
public function prepare($statement, $options = [])
    {
        // numbering placeholder to named placeholder.
        $statement = preg_replace_callback('/(^|\s|,)?\?(,|\s|$)?/', array($this, 'replaceNumberedHolder'), $statement);

        $sth = parent::prepare($statement, $options);
        $sth->setConnection($this);
        $this->count_numbered = 0;

        return $sth;
    }
1121894
public function execute($statement, array $bind = [])
    {
        $stmt = $this->query($statement, $bind);
        return $stmt->rowCount();
    }
300634
public function prepare($statement, $driverOpts = null) {
		if ($driverOpts === null) {
			$driverOpts = [];
		}

		try {
			$stmt = $this->pdo->prepare($statement, $driverOpts);
			return new PreparedStatement($stmt, $this->pdo, $this->exceptionAdapter);
		} catch (PDOException $e) {
			throw $this->exceptionAdapter->adapt($e, $statement);
		}
	}
1260219
public static function Fetch($statement, $parameters=array(), $fetchMode=PDO::FETCH_BOTH)
	{
		$db = self::connect($fetchMode);
		
		try
		{
			$query = $db->prepare($statement);
			
			if($query)
			{
				foreach($parameters as $key => $parameter)
				{
					if(!isset($parameter["type"]))
						$parameter["type"] = PDO::PARAM_STR;
	
					$query->bindParam($key,$parameter["value"],$parameter["type"]);
				}
				
				$query->execute();
			}
			else
			{
				throw new \Exception("Sorry, there was a problem with the query statement.");
			}
		}
		catch (PDOException $e)
		{
			$exception = "Sorry, there was a problem with the query. ({$e->getMessage()})";
		}

		if($exception) throw new \Exception($exception);
		
		return $query->fetch($fetchMode);
	}
1281619
public function bindParameters(PDOStatement $statement, $parameters)
    {
        // Bind all parameters
        $parameterCount = count($parameters);
        for ($index = 0; $index < $parameterCount; $index++) {
            $value = $parameters[$index];
            $phpType = gettype($value);

            // Allow overriding of parameter type using an associative array
            if ($phpType === 'array') {
                $phpType = $value['type'];
                $value = $value['value'];
            }

            // Check type of parameter
            $type = $this->getPDOParamType($phpType);
            if ($type === PDO::PARAM_STR) {
                $value = (string) $value;
            }

            // Bind this value
            $statement->bindValue($index+1, $value, $type);
        }
    }
933807
public function query($statement, $param1 = null, $param2 = null, $param3 = null)
    {
        if ($param3 !== null) {
            return $this->pdo->query($statement, $param1, $param2, $param3);
        }

        if ($param2 !== null) {
            return $this->pdo->query($statement, $param1, $param2);
        }

        if ($param1 !== null) {
            return $this->pdo->query($statement, $param1);
        }

        return $this->pdo->query($statement);
    }
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);
        }
    }
866045
public function executeStatement($statement, array $options = [])
    {
        if (!empty($options)) {
            return $this->session->execute($statement, $options);
        } else {
            return $this->session->execute($statement);
        }
    }
1031090
public function execute_statement( Statement $statement, array $data, $options = 0 ) {

		$this->query_statement( $statement, $data, $options );

		return $this->last_affected_rows();
	}
1141599
public function fetchGroups(string $statement, array $bindings = [], $style = PDO::FETCH_COLUMN): array
    {
        $sth = $this->execute($statement, $bindings);
        $group = $sth->fetchAll(PDO::FETCH_GROUP | $style);

        $this->freeResource($sth);

        return $group;
    }
715666
private static function getPositionalPlaceholderPositions(string $statement) : array
    {
        return self::collectPlaceholders(
            $statement,
            '?',
            self::POSITIONAL_TOKEN,
            static function (string $_, int $placeholderPosition, int $fragmentPosition, array &$carry) : void {
                $carry[] = $placeholderPosition + $fragmentPosition;
            }
        );
    }
1041831
private function getPdoStatement($statement)
    {
        try {
            if (false === $sth = $this->pdo->prepare($statement)) {
                throw new \Exception(sprintf('Can not prepare this pdo statement: "%s"', $statement));
            }
        } catch (\Exception $e) {
            throw $e;
        }

        return $sth;
    }
184426
public function exists(string $statement, ...$params): bool
    {
        /**
         * @var string|int|float|bool|null $result
         */
        $result = $this->single($statement, $params);
        return !empty($result);
    }
857232
public function parse_query(string $statement): ?array
  {
    if ( $this->parser === null ){
      $this->parser = new \PHPSQLParser\PHPSQLParser();
    }
    try {
      $r = $this->parser->parse($statement);
      if ( !count($r) ){
        return null;
      }
      if ( isset($r['BRACKET']) && (\count($r) === 1) ){
        return null;
      }
      return $r;
    }
    catch ( \Exception $e ){
      $this->log('Impossible to parse the query '.$statement);
    }
    return null;
  }
522821
private static function handleArraySplice(
        StatementsAnalyzer $statements_analyzer,
        array $args,
        Context $context
    ) {
        $array_arg = $args[0]->value;

        if (ExpressionAnalyzer::analyze(
            $statements_analyzer,
            $array_arg,
            $context
        ) === false) {
            return false;
        }

        $offset_arg = $args[1]->value;

        if (ExpressionAnalyzer::analyze(
            $statements_analyzer,
            $offset_arg,
            $context
        ) === false) {
            return false;
        }

        if (!isset($args[2])) {
            return;
        }

        $length_arg = $args[2]->value;

        if (ExpressionAnalyzer::analyze(
            $statements_analyzer,
            $length_arg,
            $context
        ) === false) {
            return false;
        }

        if (!isset($args[3])) {
            return;
        }

        $replacement_arg = $args[3]->value;

        if (ExpressionAnalyzer::analyze(
            $statements_analyzer,
            $replacement_arg,
            $context
        ) === false) {
            return false;
        }

        if (isset($replacement_arg->inferredType)
            && !$replacement_arg->inferredType->hasArray()
            && $replacement_arg->inferredType->hasString()
            && $replacement_arg->inferredType->isSingle()
        ) {
            $replacement_arg->inferredType = new Type\Union([
                new Type\Atomic\TArray([Type::getInt(), $replacement_arg->inferredType])
            ]);
        }

        if (isset($array_arg->inferredType)
            && $array_arg->inferredType->hasArray()
            && isset($replacement_arg->inferredType)
            && $replacement_arg->inferredType->hasArray()
        ) {
            /** @var TArray|ObjectLike */
            $array_type = $array_arg->inferredType->getTypes()['array'];

            if ($array_type instanceof ObjectLike) {
                $array_type = $array_type->getGenericArrayType();
            }

            /** @var TArray|ObjectLike */
            $replacement_array_type = $replacement_arg->inferredType->getTypes()['array'];

            if ($replacement_array_type instanceof ObjectLike) {
                $replacement_array_type = $replacement_array_type->getGenericArrayType();
            }

            $by_ref_type = TypeCombination::combineTypes([$array_type, $replacement_array_type]);

            ExpressionAnalyzer::assignByRefParam(
                $statements_analyzer,
                $array_arg,
                $by_ref_type,
                $by_ref_type,
                $context,
                false
            );

            return;
        }

        $array_type = Type::getArray();

        ExpressionAnalyzer::assignByRefParam(
            $statements_analyzer,
            $array_arg,
            $array_type,
            $array_type,
            $context,
            false
        );
    }