source/Core/Database/Adapter/Doctrine/Database.php
protected function getFirstCommandInStatement($query)
    {
        $sqlComments = '@(([\'"]).*?[^\\\]\2)|((?:\#|--).*?$|/\*(?:[^/*]|/(?!\*)|\*(?!/)|(?R))*\*\/)\s*|(?<=;)\s+@ms';
        $uncommentedQuery = preg_replace($sqlComments, '$1', $query);

        $command = strtoupper(
            trim(
                explode(' ', trim($uncommentedQuery))[0]
            )
        );

        return $command;
    }
protected function getFirstCommandInStatement($query)
    {
        $sqlComments = '@(([\'"]).*?[^\\\]\2)|((?:\#|--).*?$|/\*(?:[^/*]|/(?!\*)|\*(?!/)|(?R))*\*\/)\s*|(?<=;)\s+@ms';
        $uncommentedQuery = preg_replace($sqlComments, '$1', $query);

        $command = strtoupper(
            trim(
                explode(' ', trim($uncommentedQuery))[0]
            )
        );

        return $command;
    }
protected function getFirstCommandInStatement ( $ query ) { $ sqlComments = '@(([\'"]).*?[^\\\]\2)|((?:\#|--).*?$|/\*(?:[^/*]|/(?!\*)|\*(?!/)|(?R))*\*\/)\s*|(?<=;)\s+@ms' ; $ uncommentedQuery = preg_replace ( $ sqlComments , '$1' , $ query ) ; $ command = strtoupper ( trim ( explode ( ' ' , trim ( $ uncommentedQuery ) ) [ 0 ] ) ) ; return $ command ; }
This method strips SQL comments and whitespaces to find the first effective SQL command in a giver statement

@param string $query The query to extract the command from

@return string The first effective SQL command
This method strips SQL comments and whitespaces to find the first effective SQL command in a giver statement