public function ifNotExists(string $sql): string
    {
        $sql = $this->c::mbTrim($sql);

        if (!preg_match('/^CREATE\s+TABLE\b/ui', $sql)) {
            return $sql; // Not applicable.
        }
        if (!preg_match('/^CREATE\s+TABLE\s+IF\s+NOT\s+EXISTS\b/ui', $sql)) {
            $sql = preg_replace('/^CREATE\s+TABLE\b/ui', 'CREATE TABLE IF NOT EXISTS', $sql);
        }
        return $sql;
    }
public function ifNotExists(string $sql): string
    {
        $sql = $this->c::mbTrim($sql);

        if (!preg_match('/^CREATE\s+TABLE\b/ui', $sql)) {
            return $sql; // Not applicable.
        }
        if (!preg_match('/^CREATE\s+TABLE\s+IF\s+NOT\s+EXISTS\b/ui', $sql)) {
            $sql = preg_replace('/^CREATE\s+TABLE\b/ui', 'CREATE TABLE IF NOT EXISTS', $sql);
        }
        return $sql;
    }
public function ifNotExists ( string $ sql ) : string { $ sql = $ this -> c :: mbTrim ( $ sql ) ; if ( ! preg_match ( '/^CREATE\s+TABLE\b/ui' , $ sql ) ) { return $ sql ; // Not applicable. } if ( ! preg_match ( '/^CREATE\s+TABLE\s+IF\s+NOT\s+EXISTS\b/ui' , $ sql ) ) { $ sql = preg_replace ( '/^CREATE\s+TABLE\b/ui' , 'CREATE TABLE IF NOT EXISTS' , $ sql ) ; } return $ sql ; }
MySQL `IF NOT EXISTS` check.

@since 160524 First documented version.

@param string $sql SQL to check.

@return string Output `$sql` with `IF NOT EXISTS`.
MySQL IF NOT EXISTS check .