Sign in Join
FPDoc Onlineexperiment

SkipComments function

In unit DB

Skip SQL comments.

Declaration

pascal
function SkipComments(var p: PChar; EscapeSlash: Boolean; 
 EscapeRepeat: Boolean): Boolean

Arguments

p

Pointer to null-terminated string containing a SQL statement.

EscapeSlash

Is a backslash an escape character.

EscapeRepeat

Are repeated quotes considered a single character.

Function result

True if a comment was skipped.

Description

SkipComments examines the null-terminated string in P and skips any SQL comment or string literal found at the start. It returns P the first non-comment or non-string literal position. The EscapeSlash parameter determines whether the backslash character (\) functions as an escape character (i.e. the following character is not considered a delimiter). EscapeRepeat must be set to True if the quote character is repeated to indicate itself.

The function returns True if a comment was found and skipped, False otherwise.

Errors

No checks are done on the validity of P.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.