Commit 9ee2a297 authored by monty@donna.mysql.fi's avatar monty@donna.mysql.fi
Browse files

Fixes for embedded MySQL

Some limit optimization
parent 93de1122
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -315,3 +315,4 @@ libmysqld/time.cc
libmysqld/unireg.cc
linked_libmysqld_sources
sql-bench/bench-count-distinct
libmysqld/sql_handler.cc
+11 −5
Original line number Diff line number Diff line
@@ -36,14 +36,17 @@ const char *client_errors[]=
  "MySQL client got out of memory",
  "Wrong host info",
  "Localhost via UNIX socket",
  "%s via TCP/IP",
  "%-.64s via TCP/IP",
  "Error in server handshake",
  "Lost connection to MySQL server during query",
  "Commands out of sync; You can't run this command now",
  "Verbindung ueber Named Pipe; Host: %-.64s",
  "Kann nicht auf Named Pipe warten. Host: %-.64s  pipe: %-.32s (%lu)",
  "Kann Named Pipe nicht oeffnen. Host: %-.64s  pipe: %-.32s (%lu)",
  "Kann den Status der Named Pipe nicht setzen.  Host: %-.64s  pipe: %-.32s (%lu)"
  "Kann den Status der Named Pipe nicht setzen.  Host: %-.64s  pipe: %-.32s (%lu)",
  "Can't initialize character set %-.64s (path: %-.64s)",
  "Got packet bigger than 'max_allowed_packet'",
  "Embedded server",
};

#else /* ENGLISH */
@@ -60,19 +63,22 @@ const char *client_errors[]=
  "MySQL client run out of memory",
  "Wrong host info",
  "Localhost via UNIX socket",
  "%s via TCP/IP",
  "%-.64s via TCP/IP",
  "Error in server handshake",
  "Lost connection to MySQL server during query",
  "Commands out of sync;  You can't run this command now",
  "%s via named pipe",
  "%-.64s via named pipe",
  "Can't wait for named pipe to host: %-.64s  pipe: %-.32s (%lu)",
  "Can't open named pipe to host: %-.64s  pipe: %-.32s (%lu)",
  "Can't set state of named pipe to host: %-.64s  pipe: %-.32s (%lu)",
  "Can't initialize character set %-.64s (path: %-.64s)",
  "Got packet bigger than 'max_allowed_packet'",
  "Embedded server",
};
#endif


void init_client_errs(void)
{
  errmsg[CLIENT_ERRMAP] = &client_errors[0];
  my_errmsg[CLIENT_ERRMAP] = &client_errors[0];
}
+14 −12
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ static String glob_buffer,old_buffer;
static int wait_time = 5;
static STATUS status;
static ulong select_limit,max_join_size,opt_connect_timeout=0;
static char *xmlmeta[] = {
static const char *xmlmeta[] = {
  "&", "&",
  "<", "&lt;",
  0, 0
@@ -173,8 +173,8 @@ static int sql_connect(char *host,char *database,char *user,char *password,
		       uint silent);
static int put_info(const char *str,INFO_TYPE info,uint error=0);
static void safe_put_field(const char *pos,ulong length);
static char *array_value(char **array, char *key);
static char *xmlencode(char *dest, char *src);
static const char *array_value(const char **array, char *key);
static void xmlencode(char *dest, char *src);
static void my_chomp(char *end);
static void init_pager();
static void end_pager();
@@ -1739,8 +1739,8 @@ print_table_data_vertically(MYSQL_RES *result)
  }
}

static char
*array_value(char **array, char *key) {
static const char
*array_value(const char **array, char *key) {
  int x;
  for(x=0; array[x]; x+=2)
    if(!strcmp(array[x], key))
@@ -1748,19 +1748,21 @@ static char
  return 0;
}

static char
*xmlencode(char *dest, char *src) {
static void
xmlencode(char *dest, char *src)
{
  char *p = src;
  char *t;
  const char *t;
  char s[2] = { 0, 0 };
  *dest = 0;
  
  do {
  do
  {
    s[0] = *p;
    if(!(t=array_value(xmlmeta, s))) t = s;
    strcat(dest, t);
    if (!(t=array_value(xmlmeta, s)))
      t = s;
    dest=strmov(dest, t);
  } while(*p++);
  return dest;
}

static void
+1 −0
Original line number Diff line number Diff line
@@ -53,3 +53,4 @@ extern const char *client_errors[]; /* Error messages */
#define CR_NAMEDPIPESETSTATE_ERROR 2018
#define CR_CANT_READ_CHARSET	2019
#define CR_NET_PACKET_TOO_LARGE 2020
#define CR_EMBEDDED_CONNECTION	2021
+8 −0
Original line number Diff line number Diff line
@@ -157,6 +157,10 @@ extern unsigned long net_buffer_length;

#define net_new_transaction(net) ((net)->pkt_nr=0)

#ifdef __cplusplus
extern "C" {
#endif

int	my_net_init(NET *net, Vio* vio);
void	net_end(NET *net);
void	net_clear(NET *net);
@@ -172,6 +176,10 @@ struct rand_struct {
  double max_value_dbl;
};

#ifdef __cplusplus
}
#endif

  /* The following is for user defined functions */

enum Item_result {STRING_RESULT,REAL_RESULT,INT_RESULT};
Loading