Commit 3b1649b4 authored by unknown's avatar unknown
Browse files

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

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.0-push

parents 2b483eb6 d8fa9819
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -22,8 +22,10 @@ else
  yassl_dummy_link_fix=
endif
#AUTOMAKE_OPTIONS =              nostdinc
INCLUDES =			-I$(top_builddir)/include -I$(top_srcdir)/include \
				-I$(top_srcdir)/regex $(openssl_includes)
INCLUDES =			-I$(top_builddir)/include \
				-I$(top_srcdir)/include \
				-I$(top_srcdir)/regex \
                                $(openssl_includes) $(yassl_includes) 
LIBS =				@CLIENT_LIBS@
LDADD=				@CLIENT_EXTRA_LDFLAGS@ \
                                $(top_builddir)/libmysql/libmysqlclient.la
+1 −1
Original line number Diff line number Diff line
@@ -342,7 +342,7 @@ static struct my_option my_long_options[] =
  {"result-file", 'r',
   "Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  {"routines", 'R', "Dump routines FUNCTIONS and PROCEDURES.",
  {"routines", 'R', "Dump stored routines (functions and procedures).",
     (gptr*) &opt_routines, (gptr*) &opt_routines, 0, GET_BOOL,
     NO_ARG, 0, 0, 0, 0, 0, 0},
  {"set-charset", OPT_SET_CHARSET,
+132 −38
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@
#define PAD_SIZE	128
#define MAX_CONS	128
#define MAX_INCLUDE_DEPTH 16
#define LAZY_GUESS_BUF_SIZE 8192
#define INIT_Q_LINES	  1024
#define MIN_VAR_ALLOC	  32
#define BLOCK_STACK_DEPTH  32
@@ -1837,23 +1836,28 @@ void free_replace()
  DBUG_VOID_RETURN;
}


int select_connection_name(const char *name)
struct connection * find_connection_by_name(const char *name)
{
  struct connection *con;
  DBUG_ENTER("select_connection2");
  DBUG_PRINT("enter",("name: '%s'", name));

  for (con= cons; con < next_con; con++)
  {
    if (!strcmp(con->name, name))
    {
      cur_con= con;
      DBUG_RETURN(0);
      return con;
    }
  }
  return 0; /* Connection not found */
}


int select_connection_name(const char *name)
{
  DBUG_ENTER("select_connection2");
  DBUG_PRINT("enter",("name: '%s'", name));

  if (!(cur_con= find_connection_by_name(name)))
    die("connection '%s' not found in connection pool", name);
  DBUG_RETURN(1);				/* Never reached */
  DBUG_RETURN(0);
}


@@ -1883,7 +1887,7 @@ int close_connection(struct st_query *q)
  DBUG_PRINT("enter",("name: '%s'",p));

  if (!*p)
    die("Missing connection name in connect");
    die("Missing connection name in disconnect");
  name= p;
  while (*p && !my_isspace(charset_info,*p))
    p++;
@@ -1906,6 +1910,14 @@ int close_connection(struct st_query *q)
      }
#endif
      mysql_close(&con->mysql);
      my_free(con->name, MYF(0));
      /*
         When the connection is closed set name to "closed_connection"
         to make it possible to reuse the connection name.
         The connection slot will not be reused
       */
      if (!(con->name = my_strdup("closed_connection", MYF(MY_WME))))
        die("Out of memory");
      DBUG_RETURN(0);
    }
  }
@@ -1919,20 +1931,35 @@ 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)
{
  DBUG_ENTER("safe_get_param");
  if(!*str)
  {
    if (msg) 
      die(msg);
    *arg= str;
    DBUG_RETURN(str);
  }
  while (*str && my_isspace(charset_info,*str))
    str++;
  *arg= str;
  for (; *str && *str != ',' && *str != ')' ; str++)
  {
    if (my_isspace(charset_info,*str))
      *str= 0;
  }
  if (!*str)
  while (*str && *str != ',' && *str != ')')
    str++;
  if (msg && !*arg)
    die(msg);

  *str++= 0;
@@ -2117,13 +2144,39 @@ int connect_n_handle_errors(struct st_query *q, MYSQL* con, const char* host,
}


/*
  Open a new connection to MySQL Server with the parameters
  specified

  SYNOPSIS
   do_connect()
    q	       called command

  DESCRIPTION
    connect(<name>,<host>,<user>,<pass>,<db>,[<port>,<sock>[<opts>]]);

      <name> - name of the new connection
      <host> - hostname of server
      <user> - user to connect as
      <pass> - password used when connecting
      <db>   - initial db when connected
      <port> - server port
      <sock> - server socket
      <opts> - options to use for the connection
               SSL - use SSL if available
               COMPRESS - use compression if available

 */

int do_connect(struct st_query *q)
{
  char *con_name, *con_user,*con_pass, *con_host, *con_port_str,
    *con_db, *con_sock;
  char *p= q->first_argument;
    *con_db, *con_sock, *con_options;
  char *con_buf, *p;
  char buff[FN_REFLEN];
  int con_port;
  bool con_ssl= 0;
  bool con_compress= 0;
  int free_con_sock= 0;
  int error= 0;
  int create_conn= 1;
@@ -2131,23 +2184,25 @@ int do_connect(struct st_query *q)
  DBUG_ENTER("do_connect");
  DBUG_PRINT("enter",("connect: %s",p));

  /* Make a copy of query before parsing, safe_get_param will modify */
  if (!(con_buf= my_strdup(q->first_argument, MYF(MY_WME))))
    die("Could not allocate con_buf");
  p= con_buf;

  if (*p != '(')
    die("Syntax error in connect - expected '(' found '%c'", *p);
  p++;
  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");
  if (!*p || *p == ';')				/* Default port and sock */
  {
    con_port= port;
    con_sock= (char*) unix_sock;
  }
  else
  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, 0);
  if (*con_port_str)
  {
    VAR* var_port, *var_sock;
    p= safe_get_param(p, &con_port_str, "missing connection port");
    if (*con_port_str == '$')
    {
      if (!(var_port= var_get(con_port_str, 0, 0, 0)))
@@ -2155,8 +2210,22 @@ int do_connect(struct st_query *q)
      con_port= var_port->int_val;
    }
    else
    {
      con_port= atoi(con_port_str);
    p= safe_get_param(p, &con_sock, "missing connection socket");
      if (con_port == 0)
        die("Illegal argument for port: '%s'", con_port_str);
    }
  }
  else
  {
    con_port= port;
  }

  /* Sock */
  VAR *var_sock;
  p= safe_get_param(p, &con_sock, 0);
  if (*con_sock)
  {
    if (*con_sock == '$')
    {
      if (!(var_sock= var_get(con_sock, 0, 0, 0)))
@@ -2168,20 +2237,44 @@ int do_connect(struct st_query *q)
      con_sock[var_sock->str_val_len]= 0;
    }
  }
  else
  {
    con_sock= (char*) unix_sock;
  }

  /* Options */
  p= safe_get_param(p, &con_options, 0);
  while (*con_options)
  {
    char* str= con_options;
    while (*str && !my_isspace(charset_info, *str))
      str++;
    *str++= 0;
    if (!strcmp(con_options, "SSL"))
      con_ssl= 1;
    else if (!strcmp(con_options, "COMPRESS"))
      con_compress= 1;
    else
      die("Illegal option to connect: %s", con_options);
    con_options= str;
  }
  q->last_argument= p;

  if (next_con == cons_end)
    die("Connection limit exhausted - increase MAX_CONS in mysqltest.c");

  if (find_connection_by_name(con_name))
    die("Connection %s already exists", con_name);

  if (!mysql_init(&next_con->mysql))
    die("Failed on mysql_init()");
  if (opt_compress)
  if (opt_compress || con_compress)
    mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
  mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
  mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME, charset_name);

#ifdef HAVE_OPENSSL
  if (opt_use_ssl)
  if (opt_use_ssl || con_ssl)
    mysql_ssl_set(&next_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
		  opt_ssl_capath, opt_ssl_cipher);
#endif
@@ -2212,6 +2305,7 @@ int do_connect(struct st_query *q)
  }
  if (free_con_sock)
    my_free(con_sock, MYF(MY_WME));
  my_free(con_buf, MYF(MY_WME));
  DBUG_RETURN(error);
}

+6 −6
Original line number Diff line number Diff line
@@ -15,10 +15,9 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
    fi
    AC_MSG_RESULT([using bundled yaSSL])
    yassl_dir="extra/yassl"
    openssl_libs="\
    -L\$(top_builddir)/extra/yassl/src -lyassl\
    -L\$(top_builddir)/extra/yassl/taocrypt/src -ltaocrypt"
    openssl_includes="-I\$(top_srcdir)/extra/yassl/include"
    yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt"
    yassl_libs_with_path="\$(top_srcdir)/extra/yassl/src/libyassl.a \$(top_srcdir)/extra/yassl/taocrypt/src/libtaocrypt.a"
    yassl_includes="-I\$(top_srcdir)/extra/yassl/include"
    AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
    AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
    # System specific checks
@@ -36,8 +35,9 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
    yassl_dir=""
    AC_MSG_RESULT(no)
  fi
  AC_SUBST(openssl_libs)
  AC_SUBST(openssl_includes)
  AC_SUBST(yassl_libs)
  AC_SUBST(yassl_includes)
  AC_SUBST(yassl_dir)
  AC_SUBST(yassl_libs_with_path)
  AM_CONDITIONAL([HAVE_YASSL], [ test "with_yassl" = "yes" ])
])
+1 −1
Original line number Diff line number Diff line
@@ -1129,7 +1129,7 @@ dnl Is this the right match for DEC OSF on alpha?
        sql/Makefile.in)
          # Use gen_lex_hash.linux instead of gen_lex_hash
          # Add library dependencies to mysqld_DEPENDENCIES
          lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(ndbcluster_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs)"
          lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(ndbcluster_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs) \$(yassl_libs)"
          cat > $filesed << EOF
s,\(^.*\$(MAKE) gen_lex_hash\)\$(EXEEXT),#\1,
s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux,
Loading