faker.c
/* This skips comment blocks and gets to the first character in SQL query */
This skips comment blocks and gets to the first character in SQL query
This skips comment blocks and gets to the first character in SQL query
const char *skip_initial_comments(const char *query)
{
    char in_comment = 0, slash_before = 0, star_before = 0;
    const char *p;
    for (p = query; *p; p++) {
        if (isspace(*p))
            continue;
        if (!in_comment) {
            if (isalpha(*p))
                return p;
            if (slash_before && *p == '*') {
                in_comment = 1;
            }
            slash_before = (*p == '/');
        } else {
            if (star_before && *p == '/') {
                in_comment = 0;
            }
            star_before = (*p == '*');
        }
    }
    return *p ? p : NULL;
}
const char * skip_initial_comments ( const char * query ) { char in_comment = 0 , slash_before = 0 , star_before = 0 ; const char * p ; for ( p = query ; * p ; p ++ ) { if ( isspace ( * p ) ) continue ; if ( ! in_comment ) { if ( isalpha ( * p ) ) return p ; if ( slash_before && * p == ' ' ) { in_comment = 1 ; } slash_before = ( * p == ' ' ) ; } else { if ( star_before && * p == ' ' ) { in_comment = 0 ; } star_before = ( * p == ' ' ) ; } } return * p ? p : NULL ; }
This skips comment blocks and gets to the first character in SQL query
This skips comment blocks and gets to the first character in SQL query