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
22c0d648
Commit
22c0d648
authored
Oct 28, 2005
by
msvensson@neptunus.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
After reiview fix
- Use msg argument to determine if param is required or not in safe_get_param
parent
05e63b96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
12 deletions
+22
-12
client/mysqltest.c
client/mysqltest.c
+22
-12
No files found.
client/mysqltest.c
View file @
22c0d648
...
@@ -1852,7 +1852,6 @@ struct connection * find_connection_by_name(const char *name)
...
@@ -1852,7 +1852,6 @@ struct connection * find_connection_by_name(const char *name)
int
select_connection_name
(
const
char
*
name
)
int
select_connection_name
(
const
char
*
name
)
{
{
struct
connection
*
con
;
DBUG_ENTER
(
"select_connection2"
);
DBUG_ENTER
(
"select_connection2"
);
DBUG_PRINT
(
"enter"
,(
"name: '%s'"
,
name
));
DBUG_PRINT
(
"enter"
,(
"name: '%s'"
,
name
));
...
@@ -1932,14 +1931,25 @@ int close_connection(struct st_query *q)
...
@@ -1932,14 +1931,25 @@ int close_connection(struct st_query *q)
future to handle quotes. For now we assume that anything that is not
future to handle quotes. For now we assume that anything that is not
a comma, a space or ) belongs to the argument. space is a chopper, comma or
a comma, a space or ) belongs to the argument. space is a chopper, comma or
) are delimiters/terminators
) are delimiters/terminators
SYNOPSIS
safe_get_param
str - string to get param from
arg - pointer to string where result will be stored
msg - Message to display if param is not found
if msg is 0 this param is not required and param may be empty
RETURNS
pointer to str after param
*/
*/
char
*
safe_get_param
(
char
*
str
,
char
**
arg
,
const
char
*
msg
,
bool
required
)
char
*
safe_get_param
(
char
*
str
,
char
**
arg
,
const
char
*
msg
)
{
{
DBUG_ENTER
(
"safe_get_param"
);
DBUG_ENTER
(
"safe_get_param"
);
if
(
!*
str
)
if
(
!*
str
)
{
{
if
(
required
)
if
(
msg
)
die
(
msg
);
die
(
msg
);
*
arg
=
str
;
*
arg
=
str
;
DBUG_RETURN
(
str
);
DBUG_RETURN
(
str
);
...
@@ -1949,7 +1959,7 @@ char* safe_get_param(char *str, char** arg, const char *msg, bool required)
...
@@ -1949,7 +1959,7 @@ char* safe_get_param(char *str, char** arg, const char *msg, bool required)
*
arg
=
str
;
*
arg
=
str
;
while
(
*
str
&&
*
str
!=
','
&&
*
str
!=
')'
)
while
(
*
str
&&
*
str
!=
','
&&
*
str
!=
')'
)
str
++
;
str
++
;
if
(
required
&&
!*
arg
)
if
(
msg
&&
!*
arg
)
die
(
msg
);
die
(
msg
);
*
str
++=
0
;
*
str
++=
0
;
...
@@ -2182,15 +2192,15 @@ int do_connect(struct st_query *q)
...
@@ -2182,15 +2192,15 @@ int do_connect(struct st_query *q)
if
(
*
p
!=
'('
)
if
(
*
p
!=
'('
)
die
(
"Syntax error in connect - expected '(' found '%c'"
,
*
p
);
die
(
"Syntax error in connect - expected '(' found '%c'"
,
*
p
);
p
++
;
p
++
;
p
=
safe_get_param
(
p
,
&
con_name
,
"Missing connection name"
,
1
);
p
=
safe_get_param
(
p
,
&
con_name
,
"Missing connection name"
);
p
=
safe_get_param
(
p
,
&
con_host
,
"Missing connection host"
,
1
);
p
=
safe_get_param
(
p
,
&
con_host
,
"Missing connection host"
);
p
=
safe_get_param
(
p
,
&
con_user
,
"Missing connection user"
,
1
);
p
=
safe_get_param
(
p
,
&
con_user
,
"Missing connection user"
);
p
=
safe_get_param
(
p
,
&
con_pass
,
"Missing connection password"
,
1
);
p
=
safe_get_param
(
p
,
&
con_pass
,
"Missing connection password"
);
p
=
safe_get_param
(
p
,
&
con_db
,
"Missing connection db"
,
1
);
p
=
safe_get_param
(
p
,
&
con_db
,
"Missing connection db"
);
/* Port */
/* Port */
VAR
*
var_port
;
VAR
*
var_port
;
p
=
safe_get_param
(
p
,
&
con_port_str
,
"Missing connection port"
,
0
);
p
=
safe_get_param
(
p
,
&
con_port_str
,
0
);
if
(
*
con_port_str
)
if
(
*
con_port_str
)
{
{
if
(
*
con_port_str
==
'$'
)
if
(
*
con_port_str
==
'$'
)
...
@@ -2213,7 +2223,7 @@ int do_connect(struct st_query *q)
...
@@ -2213,7 +2223,7 @@ int do_connect(struct st_query *q)
/* Sock */
/* Sock */
VAR
*
var_sock
;
VAR
*
var_sock
;
p
=
safe_get_param
(
p
,
&
con_sock
,
"Missing connection socket"
,
0
);
p
=
safe_get_param
(
p
,
&
con_sock
,
0
);
if
(
*
con_sock
)
if
(
*
con_sock
)
{
{
if
(
*
con_sock
==
'$'
)
if
(
*
con_sock
==
'$'
)
...
@@ -2233,7 +2243,7 @@ int do_connect(struct st_query *q)
...
@@ -2233,7 +2243,7 @@ int do_connect(struct st_query *q)
}
}
/* Options */
/* Options */
p
=
safe_get_param
(
p
,
&
con_options
,
"Missing options"
,
0
);
p
=
safe_get_param
(
p
,
&
con_options
,
0
);
while
(
*
con_options
)
while
(
*
con_options
)
{
{
char
*
str
=
con_options
;
char
*
str
=
con_options
;
...
...
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