Commit a2a1e972 authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Portability fixes

parent 17d8cc22
...@@ -491,15 +491,6 @@ void init_parser() ...@@ -491,15 +491,6 @@ void init_parser()
memset(&var_reg,0, sizeof(var_reg)); memset(&var_reg,0, sizeof(var_reg));
} }
int hex_val(int c)
{
if (isdigit(c))
return c - '0';
else if ((c = tolower(c)) >= 'a' && c <= 'f')
return c - 'a' + 10;
else
return -1;
}
int dyn_string_cmp(DYNAMIC_STRING* ds, const char* fname) int dyn_string_cmp(DYNAMIC_STRING* ds, const char* fname)
{ {
...@@ -1550,56 +1541,6 @@ int do_while(struct st_query* q) ...@@ -1550,56 +1541,6 @@ int do_while(struct st_query* q)
} }
int safe_copy_unescape(char* dest, char* src, int size)
{
register char* p_dest = dest, *p_src = src;
register int c, val;
enum { ST_NORMAL, ST_ESCAPED, ST_HEX2} state = ST_NORMAL ;
size--; /* just to make life easier */
for (; p_dest - size < dest && p_src - size < src &&
(c = *p_src) != '\n' && c; ++p_src)
{
switch(state) {
case ST_NORMAL:
if (c == '\\')
state = ST_ESCAPED;
else
*p_dest++ = c;
break;
case ST_ESCAPED:
if ((val = hex_val(c)) > 0)
{
*p_dest = val;
state = ST_HEX2;
}
else
{
state = ST_NORMAL;
*p_dest++ = c;
}
break;
case ST_HEX2:
if ((val = hex_val(c)) > 0)
{
*p_dest = (*p_dest << 4) + val;
p_dest++;
}
else
*p_dest++ = c;
state = ST_NORMAL;
break;
}
}
*p_dest = 0;
return (p_dest - dest);
}
int read_line(char* buf, int size) int read_line(char* buf, int size)
{ {
int c; int c;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
/* Functions to handle space-packed-records and blobs */ /* Functions to handle space-packed-records and blobs */
#include "myisamdef.h" #include "myisamdef.h"
#include <assert.h>
/* Enough for comparing if number is zero */ /* Enough for comparing if number is zero */
static char zero_string[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static char zero_string[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
......
This diff is collapsed.
...@@ -2092,11 +2092,12 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli) ...@@ -2092,11 +2092,12 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
*/ */
break; break;
case BINLOG_FORMAT_323_GEQ_57 : case BINLOG_FORMAT_323_GEQ_57 :
/* Can distinguish, based on the value of 'created' */ /*
if (!created) Can distinguish, based on the value of 'created',
break; which was generated at master startup.
/* otherwise this was generated at master startup*/ */
close_temporary_tables(thd); if (created)
close_temporary_tables(thd);
break; break;
default : default :
/* this case is impossible */ /* this case is impossible */
......
...@@ -846,18 +846,22 @@ inline bool add_item_to_list(Item *item) ...@@ -846,18 +846,22 @@ inline bool add_item_to_list(Item *item)
{ {
return current_lex->select->item_list.push_back(item); return current_lex->select->item_list.push_back(item);
} }
inline bool add_value_to_list(Item *value) inline bool add_value_to_list(Item *value)
{ {
return current_lex->value_list.push_back(value); return current_lex->value_list.push_back(value);
} }
inline bool add_order_to_list(Item *item,bool asc) inline bool add_order_to_list(Item *item,bool asc)
{ {
return add_to_list(current_lex->select->order_list,item,asc); return add_to_list(current_lex->select->order_list,item,asc);
} }
inline bool add_group_to_list(Item *item,bool asc) inline bool add_group_to_list(Item *item,bool asc)
{ {
return add_to_list(current_lex->select->group_list,item,asc); return add_to_list(current_lex->select->group_list,item,asc);
} }
inline void mark_as_null_row(TABLE *table) inline void mark_as_null_row(TABLE *table)
{ {
table->null_row=1; table->null_row=1;
......
...@@ -430,6 +430,29 @@ void THD::close_active_vio() ...@@ -430,6 +430,29 @@ void THD::close_active_vio()
} }
#endif #endif
/*****************************************************************************
Table Ident
****************************************************************************/
Table_ident::Table_ident(LEX_STRING db_arg,LEX_STRING table_arg,bool force)
:table(table_arg)
{
if (!force && (current_thd->client_capabilities & CLIENT_NO_SCHEMA))
db.str=0;
else
db= db_arg;
if (db.str)
table_case_convert(db.str,db.length);
table_case_convert(table.str,table.length);
}
Table_ident::Table_ident(LEX_STRING table_arg) :table(table_arg)
{
db.str=0;
table_case_convert(table.str,table.length);
}
/***************************************************************************** /*****************************************************************************
** Functions to provide a interface to select results ** Functions to provide a interface to select results
*****************************************************************************/ *****************************************************************************/
......
...@@ -33,7 +33,7 @@ enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_IGNORE }; ...@@ -33,7 +33,7 @@ enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_IGNORE };
enum enum_log_type { LOG_CLOSED, LOG_TO_BE_OPENED, LOG_NORMAL, LOG_NEW, LOG_BIN}; enum enum_log_type { LOG_CLOSED, LOG_TO_BE_OPENED, LOG_NORMAL, LOG_NEW, LOG_BIN};
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON, enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
DELAY_KEY_WRITE_ALL }; DELAY_KEY_WRITE_ALL };
extern inline void table_case_convert(char * name, uint length);
/* log info errors */ /* log info errors */
#define LOG_INFO_EOF -1 #define LOG_INFO_EOF -1
#define LOG_INFO_IO -2 #define LOG_INFO_IO -2
...@@ -762,22 +762,8 @@ class Table_ident :public Sql_alloc { ...@@ -762,22 +762,8 @@ class Table_ident :public Sql_alloc {
public: public:
LEX_STRING db; LEX_STRING db;
LEX_STRING table; LEX_STRING table;
inline Table_ident(LEX_STRING db_arg,LEX_STRING table_arg,bool force) Table_ident(LEX_STRING db_arg,LEX_STRING table_arg,bool force);
:table(table_arg) Table_ident(LEX_STRING table_arg);
{
if (!force && (current_thd->client_capabilities & CLIENT_NO_SCHEMA))
db.str=0;
else
db= db_arg;
if (db.str)
table_case_convert(db.str,db.length);
table_case_convert(table.str,table.length);
}
inline Table_ident(LEX_STRING table_arg) :table(table_arg)
{
db.str=0;
table_case_convert(table.str,table.length);
}
inline void change_db(char *db_name) inline void change_db(char *db_name)
{ db.str= db_name; db.length=(uint) strlen(db_name); } { db.str= db_name; db.length=(uint) strlen(db_name); }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment