|
|
|
|
@ -162,6 +162,11 @@ static char is_digit_string(char *f, char *t)
|
|
|
|
|
char *mysql_query_digest_and_first_comment(char *s, int _len, char *first_comment){
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
char cur_comment[FIRST_COMMENT_MAX_LENGTH];
|
|
|
|
|
cur_comment[0]=0;
|
|
|
|
|
int ccl=0;
|
|
|
|
|
int cmd=0;
|
|
|
|
|
|
|
|
|
|
int len = _len;
|
|
|
|
|
if (_len > QUERY_DIGEST_MAX_LENGTH) {
|
|
|
|
|
len = QUERY_DIGEST_MAX_LENGTH;
|
|
|
|
|
@ -193,7 +198,10 @@ char *mysql_query_digest_and_first_comment(char *s, int _len, char *first_commen
|
|
|
|
|
// comment type 1 - start with '/*'
|
|
|
|
|
if(prev_char == '/' && *s == '*')
|
|
|
|
|
{
|
|
|
|
|
ccl=0;
|
|
|
|
|
flag = 1;
|
|
|
|
|
if (*(s+1)=='!')
|
|
|
|
|
cmd=1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// comment type 2 - start with '#'
|
|
|
|
|
@ -246,6 +254,12 @@ char *mysql_query_digest_and_first_comment(char *s, int _len, char *first_commen
|
|
|
|
|
// comment
|
|
|
|
|
// --------
|
|
|
|
|
if (flag == 1) {
|
|
|
|
|
if (cmd) {
|
|
|
|
|
if (ccl<FIRST_COMMENT_MAX_LENGTH-1) {
|
|
|
|
|
cur_comment[ccl]=*s;
|
|
|
|
|
ccl++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (fc==0) {
|
|
|
|
|
fc=1;
|
|
|
|
|
}
|
|
|
|
|
@ -270,6 +284,44 @@ char *mysql_query_digest_and_first_comment(char *s, int _len, char *first_commen
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
p_r = flag == 1 ? p_r_t - SIZECHAR : p_r_t;
|
|
|
|
|
if (cmd) {
|
|
|
|
|
cur_comment[ccl]=0;
|
|
|
|
|
if (ccl>=2) {
|
|
|
|
|
ccl-=2;
|
|
|
|
|
cur_comment[ccl]=0;
|
|
|
|
|
char el=0;
|
|
|
|
|
int fcc=0;
|
|
|
|
|
while (el==0 && fcc<ccl ) {
|
|
|
|
|
switch (cur_comment[fcc]) {
|
|
|
|
|
case '/':
|
|
|
|
|
case '*':
|
|
|
|
|
case '!':
|
|
|
|
|
case '0':
|
|
|
|
|
case '1':
|
|
|
|
|
case '2':
|
|
|
|
|
case '3':
|
|
|
|
|
case '4':
|
|
|
|
|
case '5':
|
|
|
|
|
case '6':
|
|
|
|
|
case '7':
|
|
|
|
|
case '8':
|
|
|
|
|
case '9':
|
|
|
|
|
case ' ':
|
|
|
|
|
fcc++;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
el=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (el) {
|
|
|
|
|
memcpy(p_r,cur_comment+fcc,ccl-fcc);
|
|
|
|
|
p_r+=(ccl-fcc);
|
|
|
|
|
*p_r++=' ';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cmd=0;
|
|
|
|
|
}
|
|
|
|
|
prev_char = ' ';
|
|
|
|
|
flag = 0;
|
|
|
|
|
s++;
|
|
|
|
|
|