diff options
author | unknown <malff/marcsql@weblab.(none)> | 2007-08-30 13:23:59 -0600 |
---|---|---|
committer | unknown <malff/marcsql@weblab.(none)> | 2007-08-30 13:23:59 -0600 |
commit | 89d3d585112fd71d62bcac511dab6530b6df793e (patch) | |
tree | 8a9eb637bc86a49e83f7ac315d1483f381fea0a2 /client | |
parent | 674f49f8f415c35b37660d85234e268bd3bd03ef (diff) | |
parent | 88cf551a16af65e6b5e1396a31447e9b38cd5519 (diff) | |
download | mariadb-git-89d3d585112fd71d62bcac511dab6530b6df793e.tar.gz |
Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into weblab.(none):/home/marcsql/TREE/mysql-5.1-rt50-merge
client/mysql.cc:
Auto merged
mysql-test/r/query_cache.result:
Auto merged
mysql-test/t/query_cache.test:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_handler.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 8e6a4dd99ae..794f252853a 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1263,6 +1263,7 @@ static bool add_line(String &buffer,char *line,char *in_string, char buff[80], *pos, *out; COMMANDS *com; bool need_space= 0; + bool ss_comment= 0; DBUG_ENTER("add_line"); if (!line[0] && buffer.is_empty()) @@ -1311,22 +1312,36 @@ static bool add_line(String &buffer,char *line,char *in_string, } if ((com=find_command(NullS,(char) inchar))) { - const String tmp(line,(uint) (out-line), charset_info); - buffer.append(tmp); - if ((*com->func)(&buffer,pos-1) > 0) - DBUG_RETURN(1); // Quit - if (com->takes_params) - { - for (pos++ ; - *pos && (*pos != *delimiter || - !is_prefix(pos + 1, delimiter + 1)) ; pos++) - ; // Remove parameters - if (!*pos) - pos--; - else - pos+= delimiter_length - 1; // Point at last delim char - } - out=line; + const String tmp(line,(uint) (out-line), charset_info); + buffer.append(tmp); + if ((*com->func)(&buffer,pos-1) > 0) + DBUG_RETURN(1); // Quit + if (com->takes_params) + { + if (ss_comment) + { + /* + If a client-side macro appears inside a server-side comment, + discard all characters in the comment after the macro (that is, + until the end of the comment rather than the next delimiter) + */ + for (pos++; *pos && (*pos != '*' || *(pos + 1) != '/'); pos++) + ; + pos--; + } + else + { + for (pos++ ; + *pos && (*pos != *delimiter || + !is_prefix(pos + 1, delimiter + 1)) ; pos++) + ; // Remove parameters + if (!*pos) + pos--; + else + pos+= delimiter_length - 1; // Point at last delim char + } + } + out=line; } else { @@ -1386,7 +1401,7 @@ static bool add_line(String &buffer,char *line,char *in_string, out=line; } } - else if (*ml_comment && inchar == '*' && *(pos + 1) == '/') + else if (*ml_comment && !ss_comment && inchar == '*' && *(pos + 1) == '/') { pos++; *ml_comment= 0; @@ -1394,6 +1409,11 @@ static bool add_line(String &buffer,char *line,char *in_string, } else { // Add found char to buffer + if (!*in_string && inchar == '/' && *(pos + 1) == '*' && + *(pos + 2) == '!') + ss_comment= 1; + else if (!*in_string && ss_comment && inchar == '*' && *(pos + 1) == '/') + ss_comment= 0; if (inchar == *in_string) *in_string= 0; else if (!*ml_comment && !*in_string && |