summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2005-10-28 10:58:57 +0200
committerunknown <msvensson@neptunus.(none)>2005-10-28 10:58:57 +0200
commit69d1cce20a90b223e414e60d746f34bd53ba018d (patch)
treefaf4cb17dea791392775949f8203240ef375905d /client
parent14c437a4fc38da5f2a22c88323a7a52361cbde80 (diff)
downloadmariadb-git-69d1cce20a90b223e414e60d746f34bd53ba018d.tar.gz
After reiview fix
- Use msg argument to determine if param is required or not in safe_get_param client/mysqltest.c: Use msg argument as inidicator wheter param is required or not.
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 0d6f5cc3dc5..fa65265ff4e 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -1852,7 +1852,6 @@ struct connection * find_connection_by_name(const char *name)
int select_connection_name(const char *name)
{
- struct connection *con;
DBUG_ENTER("select_connection2");
DBUG_PRINT("enter",("name: '%s'", name));
@@ -1932,14 +1931,25 @@ int close_connection(struct st_query *q)
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
) 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");
if(!*str)
{
- if (required)
+ if (msg)
die(msg);
*arg= str;
DBUG_RETURN(str);
@@ -1949,7 +1959,7 @@ char* safe_get_param(char *str, char** arg, const char *msg, bool required)
*arg= str;
while (*str && *str != ',' && *str != ')')
str++;
- if (required && !*arg)
+ if (msg && !*arg)
die(msg);
*str++= 0;
@@ -2182,15 +2192,15 @@ int do_connect(struct st_query *q)
if (*p != '(')
die("Syntax error in connect - expected '(' found '%c'", *p);
p++;
- p= safe_get_param(p, &con_name, "Missing connection name", 1);
- p= safe_get_param(p, &con_host, "Missing connection host", 1);
- p= safe_get_param(p, &con_user, "Missing connection user", 1);
- p= safe_get_param(p, &con_pass, "Missing connection password", 1);
- p= safe_get_param(p, &con_db, "Missing connection db", 1);
+ p= safe_get_param(p, &con_name, "Missing connection name");
+ p= safe_get_param(p, &con_host, "Missing connection host");
+ p= safe_get_param(p, &con_user, "Missing connection user");
+ p= safe_get_param(p, &con_pass, "Missing connection password");
+ p= safe_get_param(p, &con_db, "Missing connection db");
/* 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 == '$')
@@ -2213,7 +2223,7 @@ int do_connect(struct st_query *q)
/* 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 == '$')
@@ -2233,7 +2243,7 @@ int do_connect(struct st_query *q)
}
/* Options */
- p= safe_get_param(p, &con_options, "Missing options", 0);
+ p= safe_get_param(p, &con_options, 0);
while (*con_options)
{
char* str= con_options;