Commit 8947628c authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/my/mysql-5.0

parents a332242e 2eeaddeb
...@@ -386,4 +386,18 @@ p mask example ...@@ -386,4 +386,18 @@ p mask example
20 \\\\% \\\\% 20 \\\\% \\\\%
20 \\\\% \\\\_ 20 \\\\% \\\\_
DROP TABLE t1; DROP TABLE t1;
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
a\\b a\\\"b a'\\b a'\\\"b
a\\b a\\\"b a'\\b a'\\\"b
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
a\\b a\\\'b a"\\b a"\\\'b
a\\b a\\\'b a"\\b a"\\\'b
SET @@SQL_MODE='';
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
a\b a\"b a'\b a'\"b
a\b a\"b a'\b a'\"b
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
a\b a\'b a"\b a"\'b
a\b a\'b a"\b a"\'b
SET @@SQL_MODE=@OLD_SQL_MODE; SET @@SQL_MODE=@OLD_SQL_MODE;
...@@ -174,4 +174,14 @@ order by masks.p, example; ...@@ -174,4 +174,14 @@ order by masks.p, example;
DROP TABLE t1; DROP TABLE t1;
# Bug #6368: Make sure backslashes mixed with doubled quotes are handled
# correctly in NO_BACKSLASH_ESCAPES mode
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
SET @@SQL_MODE='';
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
SET @@SQL_MODE=@OLD_SQL_MODE; SET @@SQL_MODE=@OLD_SQL_MODE;
...@@ -23,6 +23,29 @@ case "$1" in ...@@ -23,6 +23,29 @@ case "$1" in
;; ;;
esac esac
usage () {
cat <<EOF
Usage: $0 [OPTIONS]
--no-defaults Don't read the system defaults file
--defaults-file=FILE Use the specified defaults file
--defaults-extra-file=FILE Also use defaults from the specified file
--ledir=DIRECTORY Look for mysqld in the specified directory
--log-error=FILE Log errors to the specified log file
--open-files-limit=LIMIT Limit the number of open files
--core-file-size=LIMIT Limit core files to the specified size
--timezone=TZ Set the system timezone
--mysqld=FILE Use the specified file as mysqld
--mysqld-version=VERSION Use "mysqld-VERSION" as mysqld
--nice=NICE Set the scheduling priority of mysqld
--skip-kill-mysqld Don't try to kill stray mysqld processes
All other options are passed to the mysqld program.
EOF
exit 1
}
parse_arguments() { parse_arguments() {
# We only need to pass arguments through to the server if we don't # We only need to pass arguments through to the server if we don't
# handle them here. So, we collect unrecognized options (passed on # handle them here. So, we collect unrecognized options (passed on
...@@ -67,6 +90,9 @@ parse_arguments() { ...@@ -67,6 +90,9 @@ parse_arguments() {
fi fi
;; ;;
--nice=*) niceness=`echo "$arg" | sed -e "s;--nice=;;"` ;; --nice=*) niceness=`echo "$arg" | sed -e "s;--nice=;;"` ;;
--help)
usage
;;
*) *)
if test -n "$pick_args" if test -n "$pick_args"
then then
......
...@@ -3376,39 +3376,34 @@ int main(int argc, char **argv) ...@@ -3376,39 +3376,34 @@ int main(int argc, char **argv)
return 0; return 0;
} }
} }
else if (argc >= 4) else if (argc == 4 || argc == 5)
{ {
const char *defaults_file = "--defaults-file"; /*
const char *service = "--local-service"; This may seem strange, because we handle --local-service while
char extra_opt[FN_REFLEN] = ""; preserving 4.1's behavior of allowing any one other argument that is
passed to the service on startup. (The assumption is that this is
--defaults-file=file, but that was not enforced in 4.1, so we don't
enforce it here.)
*/
char *extra_opt= NULL;
char *account_name = NULL; char *account_name = NULL;
char *option;
int index; int index;
for (index = 3; index < argc; index++) for (index = 3; index < argc; index++)
{ {
option= argv[index]; if (strncmp(argv[index], "--local-service", 15) == 0)
/*
Install an optional service with optional config file
mysqld --install-manual mysqldopt --defaults-file=c:\miguel\my.ini
*/
if (strncmp(option, defaults_file, strlen(defaults_file)) == 0)
{ {
strmov(extra_opt, option); account_name=(char*)malloc(27);
strmov(account_name, "NT AUTHORITY\\LocalService\0");
} }
else else
/*
Install an optional service as local service
mysqld --install-manual mysqldopt --local-service
*/
if (strncmp(option, service, strlen(service)) == 0)
{ {
account_name=(char*)malloc(27); extra_opt= argv[index];
strmov(account_name, "NT AUTHORITY\\LocalService\0");
} }
} }
if (!default_service_handling(argv, argv[2], argv[2], file_path, extra_opt, account_name)) if (argc != 5 || account_name)
return 0; if (!default_service_handling(argv, argv[2], argv[2], file_path, extra_opt, account_name))
return 0;
} }
else if (argc == 1 && Service.IsService(MYSQL_SERVICENAME)) else if (argc == 1 && Service.IsService(MYSQL_SERVICENAME))
{ {
......
...@@ -337,7 +337,8 @@ static char *get_text(LEX *lex) ...@@ -337,7 +337,8 @@ static char *get_text(LEX *lex)
continue; continue;
} }
#endif #endif
if (*str == '\\' && str+1 != end) if (!(lex->thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) &&
*str == '\\' && str+1 != end)
{ {
switch(*++str) { switch(*++str) {
case 'n': case 'n':
......
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