int ParseForArgs(const char* sqlcmd) { int numargs = 0; const char* ptr = sqlcmd; while (*ptr) if(*ptr == '\'') while(*++ptr && (*ptr != '\'' || *++ptr && *ptr == '\'')) ; else if(*ptr == '-' && *(ptr+1) == '-') while(*++ptr && *ptr != '\n' && *ptr != '\r') ; else if(*ptr == '/' && *(ptr+1) == '*') { ptr++; while(*++ptr && (*ptr != '*' || (*(ptr+1) && *(ptr+1) != '/'))) ; } else if(*ptr++ == '?') ++numargs; return numargs; }
Report message to a moderator