Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5eb5fd12
Commit
5eb5fd12
authored
Jan 03, 2005
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for bug #5920 (embedded-server mysql doesn't handle --defaults-file)
parent
e8e6d057
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
17 deletions
+55
-17
client/mysql.cc
client/mysql.cc
+11
-1
include/my_sys.h
include/my_sys.h
+2
-0
libmysqld/libmysqld.c
libmysqld/libmysqld.c
+3
-0
mysys/default.c
mysys/default.c
+39
-16
No files found.
client/mysql.cc
View file @
5eb5fd12
...
@@ -330,6 +330,16 @@ static sig_handler mysql_end(int sig);
...
@@ -330,6 +330,16 @@ static sig_handler mysql_end(int sig);
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
char
buff
[
80
];
char
buff
[
80
];
char
*
defaults
,
*
extra_defaults
;
char
*
emb_argv
[
3
];
int
emb_argc
=
1
;
emb_argv
[
0
]
=
argv
[
0
];
get_defaults_files
(
argc
,
argv
,
&
defaults
,
&
extra_defaults
);
if
(
defaults
)
emb_argv
[
emb_argc
++
]
=
defaults
;
if
(
extra_defaults
)
emb_argv
[
emb_argc
++
]
=
extra_defaults
;
MY_INIT
(
argv
[
0
]);
MY_INIT
(
argv
[
0
]);
DBUG_ENTER
(
"main"
);
DBUG_ENTER
(
"main"
);
...
@@ -375,7 +385,7 @@ int main(int argc,char *argv[])
...
@@ -375,7 +385,7 @@ int main(int argc,char *argv[])
my_end
(
0
);
my_end
(
0
);
exit
(
1
);
exit
(
1
);
}
}
if
(
mysql_server_init
(
0
,
NULL
,
(
char
**
)
server_default_groups
))
if
(
mysql_server_init
(
emb_argc
,
emb_argv
,
(
char
**
)
server_default_groups
))
{
{
free_defaults
(
defaults_argv
);
free_defaults
(
defaults_argv
);
my_end
(
0
);
my_end
(
0
);
...
...
include/my_sys.h
View file @
5eb5fd12
...
@@ -738,6 +738,8 @@ extern void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
...
@@ -738,6 +738,8 @@ extern void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
extern
char
*
strdup_root
(
MEM_ROOT
*
root
,
const
char
*
str
);
extern
char
*
strdup_root
(
MEM_ROOT
*
root
,
const
char
*
str
);
extern
char
*
strmake_root
(
MEM_ROOT
*
root
,
const
char
*
str
,
uint
len
);
extern
char
*
strmake_root
(
MEM_ROOT
*
root
,
const
char
*
str
,
uint
len
);
extern
char
*
memdup_root
(
MEM_ROOT
*
root
,
const
char
*
str
,
uint
len
);
extern
char
*
memdup_root
(
MEM_ROOT
*
root
,
const
char
*
str
,
uint
len
);
extern
void
get_defaults_files
(
int
argc
,
char
**
argv
,
char
**
defaults
,
char
**
extra_defaults
);
extern
int
load_defaults
(
const
char
*
conf_file
,
const
char
**
groups
,
extern
int
load_defaults
(
const
char
*
conf_file
,
const
char
**
groups
,
int
*
argc
,
char
***
argv
);
int
*
argc
,
char
***
argv
);
extern
void
free_defaults
(
char
**
argv
);
extern
void
free_defaults
(
char
**
argv
);
...
...
libmysqld/libmysqld.c
View file @
5eb5fd12
...
@@ -143,6 +143,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
...
@@ -143,6 +143,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
db
?
db
:
"(Null)"
,
db
?
db
:
"(Null)"
,
user
?
user
:
"(Null)"
));
user
?
user
:
"(Null)"
));
if
(
!
host
||
!
host
[
0
])
host
=
mysql
->
options
.
host
;
if
(
mysql
->
options
.
methods_to_use
==
MYSQL_OPT_USE_REMOTE_CONNECTION
||
if
(
mysql
->
options
.
methods_to_use
==
MYSQL_OPT_USE_REMOTE_CONNECTION
||
(
mysql
->
options
.
methods_to_use
==
MYSQL_OPT_GUESS_CONNECTION
&&
(
mysql
->
options
.
methods_to_use
==
MYSQL_OPT_GUESS_CONNECTION
&&
host
&&
*
host
&&
strcmp
(
host
,
LOCAL_HOST
)))
host
&&
*
host
&&
strcmp
(
host
,
LOCAL_HOST
)))
...
...
mysys/default.c
View file @
5eb5fd12
...
@@ -78,6 +78,36 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
...
@@ -78,6 +78,36 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
static
char
*
remove_end_comment
(
char
*
ptr
);
static
char
*
remove_end_comment
(
char
*
ptr
);
/*
Gets --defaults-file and --defaults-extra-file options from command line.
SYNOPSIS
get_defaults_files()
argc Pointer to argc of original program
argv Pointer to argv of original program
defaults --defaults-file option
extra_defaults --defaults-extra-file option
RETURN
defaults and extra_defaults will be set to appropriate items
of argv array, or to NULL if there are no such options
*/
void
get_defaults_files
(
int
argc
,
char
**
argv
,
char
**
defaults
,
char
**
extra_defaults
)
{
*
defaults
=
0
;
*
extra_defaults
=
0
;
if
(
argc
>=
2
)
{
if
(
is_prefix
(
argv
[
1
],
"--defaults-file="
))
*
defaults
=
argv
[
1
];
else
if
(
is_prefix
(
argv
[
1
],
"--defaults-extra-file="
))
*
extra_defaults
=
argv
[
1
];
}
}
/*
/*
Read options from configurations files
Read options from configurations files
...
@@ -111,7 +141,7 @@ static char *remove_end_comment(char *ptr);
...
@@ -111,7 +141,7 @@ static char *remove_end_comment(char *ptr);
int
load_defaults
(
const
char
*
conf_file
,
const
char
**
groups
,
int
load_defaults
(
const
char
*
conf_file
,
const
char
**
groups
,
int
*
argc
,
char
***
argv
)
int
*
argc
,
char
***
argv
)
{
{
DYNAMIC_ARRAY
args
;
DYNAMIC_ARRAY
args
;
const
char
**
dirs
,
*
forced_default_file
;
const
char
**
dirs
,
*
forced_default_file
;
...
@@ -143,21 +173,14 @@ int load_defaults(const char *conf_file, const char **groups,
...
@@ -143,21 +173,14 @@ int load_defaults(const char *conf_file, const char **groups,
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
/* Check if we want to force the use a specific default file */
get_defaults_files
(
*
argc
,
*
argv
,
forced_default_file
=
0
;
(
char
**
)
&
forced_default_file
,
&
defaults_extra_file
);
if
(
*
argc
>=
2
)
if
(
forced_default_file
)
{
forced_default_file
=
strchr
(
forced_default_file
,
'='
)
+
1
;
if
(
is_prefix
(
argv
[
0
][
1
],
"--defaults-file="
))
if
(
defaults_extra_file
)
{
defaults_extra_file
=
strchr
(
defaults_extra_file
,
'='
)
+
1
;
forced_default_file
=
strchr
(
argv
[
0
][
1
],
'='
)
+
1
;
args_used
++
;
args_used
+=
(
forced_default_file
?
1
:
0
)
+
(
defaults_extra_file
?
1
:
0
);
}
else
if
(
is_prefix
(
argv
[
0
][
1
],
"--defaults-extra-file="
))
{
defaults_extra_file
=
strchr
(
argv
[
0
][
1
],
'='
)
+
1
;
args_used
++
;
}
}
group
.
count
=
0
;
group
.
count
=
0
;
group
.
name
=
"defaults"
;
group
.
name
=
"defaults"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment