function Schema::skipComment
Returns the offset past an SQL comment.
Parameters
string $sql: The SQL to scan.
int $offset: Offset to scan from.
Return value
int|null Offset of the first character after the comment, or NULL if $offset does not open a comment or the comment is unterminated.
File
-
core/
modules/ sqlite/ src/ Driver/ Database/ sqlite/ Schema.php, line 788
Class
- Schema
- SQLite implementation of \Drupal\Core\Database\Schema.
Namespace
Drupal\sqlite\Driver\Database\sqliteCode
protected function skipComment(string $sql, int $offset) : ?int {
$opening = substr($sql, $offset, 2);
if ($opening === '--') {
$line_length = strcspn($sql, "\r\n", $offset + 2);
$line_end = $offset + 2 + $line_length;
return $line_end === strlen($sql) ? $line_end : $line_end + 1;
}
if ($opening === '/*') {
$close = strpos($sql, '*/', $offset + 2);
return $close === FALSE ? NULL : $close + 2;
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.