Improving debugging support in 'read_line' function

parent a9bd2830
...@@ -3346,7 +3346,7 @@ int read_line(char *buf, int size) ...@@ -3346,7 +3346,7 @@ int read_line(char *buf, int size)
LINT_INIT(last_quote); LINT_INIT(last_quote);
start_lineno= cur_file->lineno; start_lineno= cur_file->lineno;
DBUG_PRINT("info", ("start_lineno: %d", start_lineno)); DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno));
for (; p < buf_end ;) for (; p < buf_end ;)
{ {
skip_char= 0; skip_char= 0;
...@@ -3370,7 +3370,7 @@ int read_line(char *buf, int size) ...@@ -3370,7 +3370,7 @@ int read_line(char *buf, int size)
die("Missing end of block"); die("Missing end of block");
*p= 0; *p= 0;
DBUG_PRINT("info", ("end of file")); DBUG_PRINT("info", ("end of file at line %d", cur_file->lineno));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
cur_file--; cur_file--;
...@@ -3393,7 +3393,8 @@ int read_line(char *buf, int size) ...@@ -3393,7 +3393,8 @@ int read_line(char *buf, int size)
if (end_of_query(c)) if (end_of_query(c))
{ {
*p= 0; *p= 0;
DBUG_PRINT("exit", ("Found delimiter '%s'", delimiter)); DBUG_PRINT("exit", ("Found delimiter '%s' at line %d",
delimiter, cur_file->lineno));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else if ((c == '{' && else if ((c == '{' &&
...@@ -3405,7 +3406,8 @@ int read_line(char *buf, int size) ...@@ -3405,7 +3406,8 @@ int read_line(char *buf, int size)
/* Only if and while commands can be terminated by { */ /* Only if and while commands can be terminated by { */
*p++= c; *p++= c;
*p= 0; *p= 0;
DBUG_PRINT("exit", ("Found '{' indicating begining of block")); DBUG_PRINT("exit", ("Found '{' indicating start of block at line %d",
cur_file->lineno));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else if (c == '\'' || c == '"' || c == '`') else if (c == '\'' || c == '"' || c == '`')
...@@ -3420,7 +3422,8 @@ int read_line(char *buf, int size) ...@@ -3420,7 +3422,8 @@ int read_line(char *buf, int size)
{ {
/* Comments are terminated by newline */ /* Comments are terminated by newline */
*p= 0; *p= 0;
DBUG_PRINT("exit", ("Found newline in comment")); DBUG_PRINT("exit", ("Found newline in comment at line: %d",
cur_file->lineno));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
break; break;
...@@ -3435,13 +3438,19 @@ int read_line(char *buf, int size) ...@@ -3435,13 +3438,19 @@ int read_line(char *buf, int size)
{ {
/* Skip all space at begining of line */ /* Skip all space at begining of line */
if (c == '\n') if (c == '\n')
start_lineno= cur_file->lineno; /* Query hasn't started yet */ {
/* Query hasn't started yet */
start_lineno= cur_file->lineno;
DBUG_PRINT("info", ("Query hasn't started yet, start_lineno: %d",
start_lineno));
}
skip_char= 1; skip_char= 1;
} }
else if (end_of_query(c)) else if (end_of_query(c))
{ {
*p= 0; *p= 0;
DBUG_PRINT("exit", ("Found delimiter '%s'", delimiter)); DBUG_PRINT("exit", ("Found delimiter '%s' at line: %d",
delimiter, cur_file->lineno));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else if (c == '}') else if (c == '}')
...@@ -3449,7 +3458,8 @@ int read_line(char *buf, int size) ...@@ -3449,7 +3458,8 @@ int read_line(char *buf, int size)
/* A "}" need to be by itself in the begining of a line to terminate */ /* A "}" need to be by itself in the begining of a line to terminate */
*p++= c; *p++= c;
*p= 0; *p= 0;
DBUG_PRINT("exit", ("Found '}' in begining of a line")); DBUG_PRINT("exit", ("Found '}' in begining of a line at line: %d",
cur_file->lineno));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else if (c == '\'' || c == '"' || c == '`') else if (c == '\'' || c == '"' || c == '`')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment