summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc1
-rw-r--r--sql/filesort.cc7
-rw-r--r--sql/ha_innodb.cc1
-rw-r--r--sql/item_cmpfunc.cc7
-rw-r--r--sql/item_cmpfunc.h17
-rw-r--r--sql/item_func.cc10
-rw-r--r--sql/item_sum.cc5
-rw-r--r--sql/lex.h2
-rw-r--r--sql/log_event.cc4
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc59
-rw-r--r--sql/opt_range.cc4
-rw-r--r--sql/protocol.cc2
-rw-r--r--sql/records.cc9
-rw-r--r--sql/sql_analyse.h11
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_db.cc12
-rw-r--r--sql/sql_delete.cc10
-rw-r--r--sql/sql_handler.cc9
-rw-r--r--sql/sql_help.cc4
-rw-r--r--sql/sql_lex.cc8
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/sql_show.cc2
-rw-r--r--sql/sql_table.cc28
-rw-r--r--sql/sql_yacc.yy12
-rw-r--r--sql/structs.h2
27 files changed, 122 insertions, 114 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 697de878c03..e6de2dc5224 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4530,7 +4530,6 @@ void Field_geom::get_key_image(char *buff,uint length,CHARSET_INFO *cs,
ulong blob_length=get_length(ptr);
char *blob;
get_ptr(&blob);
- memcpy(buff+2,blob,length);
MBR mbr;
Geometry gobj;
diff --git a/sql/filesort.cc b/sql/filesort.cc
index fcee26278d1..6bc0fc957a9 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -70,7 +70,6 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
int error;
ulong memavl;
uint maxbuffer;
- uint i;
BUFFPEK *buffpek;
ha_rows records;
uchar **sort_keys;
@@ -561,7 +560,8 @@ static void make_sortkey(register SORTPARAM *param,
change_double_for_sort(value,(byte*) to);
break;
}
- case ROW_RESULT:
+ case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
break;
@@ -971,7 +971,8 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
case REAL_RESULT:
sortorder->length=sizeof(double);
break;
- case ROW_RESULT:
+ case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
break;
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index a037c6989aa..86c56a81b4d 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -2293,6 +2293,7 @@ convert_search_mode_to_innobase(
case HA_READ_BEFORE_KEY: return(PAGE_CUR_L);
case HA_READ_PREFIX: return(PAGE_CUR_GE);
case HA_READ_PREFIX_LAST: return(PAGE_CUR_LE);
+ case HA_READ_PREFIX_LAST_OR_PREV:return(PAGE_CUR_LE);
/* In MySQL HA_READ_PREFIX and HA_READ_PREFIX_LAST always
use a complete-field-prefix of a kay value as the search
tuple. I.e., it is not allowed that the last field would
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 8804bb56f6b..0993b8b155a 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -841,6 +841,7 @@ Item *Item_func_case::find_item(String *str)
return args[i+1];
break;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
break;
@@ -1224,6 +1225,9 @@ cmp_item* cmp_item::get_comparator(Item *item)
case ROW_RESULT:
return new cmp_item_row;
break;
+ default:
+ DBUG_ASSERT(0);
+ break;
}
return 0; // to satisfy compiler :)
}
@@ -1366,6 +1370,9 @@ void Item_func_in::fix_length_and_dec()
case ROW_RESULT:
array= new in_row(arg_count, item);
break;
+ default:
+ DBUG_ASSERT(0);
+ return;
}
uint j=0;
for (uint i=0 ; i < arg_count ; i++)
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 8534150acd7..c05d0317341 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -682,17 +682,18 @@ public:
void update_used_tables()
{
if (!args[0]->maybe_null)
- used_tables_cache=0; /* is always false */
- else
{
- args[0]->update_used_tables();
- used_tables_cache=args[0]->used_tables();
+ used_tables_cache= 0; /* is always false */
+ cached_value= (longlong) 0;
}
- if (!used_tables_cache)
+ else
{
- /* Remember if the value is always NULL or never NULL */
- args[0]->val();
- cached_value= args[0]->null_value ? (longlong) 1 : (longlong) 0;
+ args[0]->update_used_tables();
+ if (!(used_tables_cache=args[0]->used_tables()))
+ {
+ /* Remember if the value is always NULL or never NULL */
+ cached_value= (longlong) args[0]->is_null();
+ }
}
}
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 45d666fb47b..3954b53c063 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -252,6 +252,7 @@ Field *Item_func::tmp_table_field(TABLE *t_arg)
res= new Field_string(max_length, maybe_null, name, t_arg, charset());
break;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
break;
@@ -911,6 +912,7 @@ String *Item_func_min_max::val_str(String *str)
return res;
}
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
return 0;
@@ -1467,9 +1469,10 @@ bool udf_handler::get_arguments()
}
break;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
- ;
+ break;
}
}
return 0;
@@ -1927,6 +1930,7 @@ longlong Item_func_benchmark::val_int()
(void) args[0]->val_str(&tmp);
break;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
return 0;
@@ -2063,6 +2067,7 @@ Item_func_set_user_var::update()
break;
}
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
break;
@@ -2144,6 +2149,7 @@ Item_func_get_user_var::val_str(String *str)
}
break;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
break;
@@ -2165,6 +2171,7 @@ double Item_func_get_user_var::val()
case STRING_RESULT:
return atof(entry->value); // This is null terminated
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
return 0;
@@ -2186,6 +2193,7 @@ longlong Item_func_get_user_var::val_int()
case STRING_RESULT:
return strtoull(entry->value,NULL,10); // String is null terminated
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
return 0;
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index c2db50345d1..ae0559e2249 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -388,6 +388,7 @@ double Item_sum_hybrid::val()
case REAL_RESULT:
return sum;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
return 0;
@@ -423,6 +424,7 @@ Item_sum_hybrid::val_str(String *str)
str->set((longlong) sum_int,thd_charset());
break;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
break;
@@ -468,6 +470,7 @@ bool Item_sum_min::add()
}
break;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
break;
@@ -514,10 +517,10 @@ bool Item_sum_max::add()
}
break;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
break;
-
}
return 0;
}
diff --git a/sql/lex.h b/sql/lex.h
index d4ae8c32828..287439a9fe7 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -290,7 +290,7 @@ static SYMBOL symbols[] = {
{ "PACK_KEYS", SYM(PACK_KEYS_SYM),0,0},
{ "PARTIAL", SYM(PARTIAL),0,0},
{ "PASSWORD", SYM(PASSWORD),0,0},
- { "POINT", SYM(POINT),0,0},
+ { "POINT", SYM(POINT_SYM),0,0},
{ "POLYGON", SYM(POLYGON),0,0},
{ "PURGE", SYM(PURGE),0,0},
{ "PRECISION", SYM(PRECISION),0,0},
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 6bd187ab8af..36d4b16225a 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2005,6 +2005,7 @@ void User_var_log_event::pack_info(Protocol* protocol)
buf[val_offset + val_len + 1]= '\'';
break;
case ROW_RESULT:
+ default:
DBUG_ASSERT(1);
return;
}
@@ -2070,6 +2071,7 @@ int User_var_log_event::write_data(IO_CACHE* file)
pos= val;
break;
case ROW_RESULT:
+ default:
DBUG_ASSERT(1);
return 0;
}
@@ -2122,6 +2124,7 @@ void User_var_log_event::print(FILE* file, bool short_form, char* last_db)
fprintf(file, ":='%s';\n", val);
break;
case ROW_RESULT:
+ default:
DBUG_ASSERT(1);
return;
}
@@ -2166,6 +2169,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli)
it= new Item_string(val, val_len, charset);
break;
case ROW_RESULT:
+ default:
DBUG_ASSERT(1);
return 0;
}
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 570bddfe773..5bf7e6e6951 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -554,7 +554,7 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
/* sql_handler.cc */
int mysql_ha_open(THD *thd, TABLE_LIST *tables);
int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok=0);
-int mysql_ha_closeall(THD *thd, TABLE_LIST *tables, bool dont_send_ok=0);
+int mysql_ha_closeall(THD *thd, TABLE_LIST *tables);
int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 147f56b535a..0ed317e7293 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -192,7 +192,6 @@ static char szPipeName [ 257 ];
static SECURITY_ATTRIBUTES saPipeSecurity;
static SECURITY_DESCRIPTOR sdPipeDescriptor;
static HANDLE hPipe = INVALID_HANDLE_VALUE;
-static bool opt_enable_named_pipe = 0;
#endif
#ifdef __WIN__
static pthread_cond_t COND_handler_count;
@@ -502,9 +501,11 @@ static bool read_init_file(char *file_name);
#ifdef __NT__
extern "C" pthread_handler_decl(handle_connections_namedpipes,arg);
#endif
+#if !defined(EMBEDDED_LIBRARY)
#ifdef HAVE_SMEM
static pthread_handler_decl(handle_connections_shared_memory,arg);
#endif
+#endif /* EMBEDDED_LIBRARY */
extern "C" pthread_handler_decl(handle_slave,arg);
#ifdef SET_RLIMIT_NOFILE
static uint set_maximum_open_files(uint max_file_limit);
@@ -782,7 +783,7 @@ void kill_mysql(void)
#if defined(OS2) || defined(__NETWARE__)
extern "C" void kill_server(int sig_ptr)
-#define RETURN_FROM_KILL_SERVER DBUG_RETURN
+#define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
#elif !defined(__WIN__)
static void *kill_server(void *sig_ptr)
#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0)
@@ -799,9 +800,6 @@ static void __cdecl kill_server(int sig_ptr)
RETURN_FROM_KILL_SERVER;
kill_in_progress=TRUE;
abort_loop=1; // This should be set
-#ifdef __NETWARE__
- ActivateScreen(getscreenhandle()); // Show the screen going down
-#endif
signal(sig,SIG_IGN);
if (sig == MYSQL_KILL_SIGNAL || sig == 0)
sql_print_error(ER(ER_NORMAL_SHUTDOWN),my_progname);
@@ -1263,7 +1261,8 @@ void yyerror(const char *s)
{
THD *thd=current_thd;
char *yytext=(char*) thd->lex.tok_start;
- if (!strcmp(s,"parse error"))
+ /* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
+ if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
s=ER(ER_SYNTAX_ERROR);
net_printf(thd,ER_PARSE_ERROR, s, yytext ? (char*) yytext : "",
thd->lex.yylineno);
@@ -1427,7 +1426,6 @@ static void check_data_home(const char *path)
// down server event callback
void mysql_down_server_cb(void *, void *)
{
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT); // auto close the screen
kill_server(0);
}
@@ -1483,26 +1481,6 @@ static void start_signal_handler(void)
static void check_data_home(const char *path)
{
- struct volume_info vol;
- char buff[PATH_MAX], *pos;
-
- bzero((char*) &vol, sizeof(vol)); // clear struct
-
- // find volume name
- if ((pos= strchr(path, ':')))
- {
- uint length= (uint) (pos-path);
- strmake(buff, path, min(length, sizeof(buff)-1));
- }
- else
- strmov(buff, "SYS"); // assume SYS volume
-
- netware_vol_info_from_name(&vol, buff); // retrieve information
- if ((vol.flags & VOL_NSS_PRESENT) == 0)
- {
- sql_print_error("Error: %s is not on an NSS volume!", path);
- unireg_abort(-1);
- }
}
#elif defined(__EMX__)
@@ -2019,11 +1997,6 @@ static int init_common_variables(const char *conf_file_name, int argc,
max_system_variables.pseudo_thread_id= (ulong)~0;
start_time=time((time_t*) 0);
-#ifdef __NETWARE__
- printf("MySQL Server %s, for %s (%s)\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
- fflush(stdout);
-#endif /* __NETWARE__ */
-
#ifdef OS2
{
// fix timezone for daylight saving
@@ -2270,6 +2243,7 @@ static void create_maintenance_thread()
static void create_shutdown_thread()
{
+#if !defined(EMBEDDED_LIBRARY)
#ifdef __WIN__
hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name);
pthread_t hThread;
@@ -2285,6 +2259,7 @@ static void create_shutdown_thread()
if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0))
sql_print_error("Warning: Can't create thread to handle shutdown requests");
#endif
+#endif // EMBEDDED_LIBRARY
}
@@ -2328,6 +2303,7 @@ static void handle_connections_methods()
handler_count--;
}
}
+#if !defined(EMBEDDED_LIBRARY)
#ifdef HAVE_SMEM
if (opt_enable_shared_memory)
{
@@ -2339,7 +2315,8 @@ static void handle_connections_methods()
handler_count--;
}
}
-#endif
+#endif
+#endif // EMBEDDED_LIBRARY
while (handler_count > 0)
pthread_cond_wait(&COND_handler_count,&LOCK_thread_count);
@@ -2704,11 +2681,10 @@ int main(int argc, char **argv)
static int bootstrap(FILE *file)
{
- THD *thd;
int error= 0;
DBUG_ENTER("bootstrap");
#ifndef EMBEDDED_LIBRARY // TODO: Enable this
- thd= new THD;
+ THD *thd= new THD;
thd->bootstrap=1;
thd->client_capabilities=0;
my_net_init(&thd->net,(st_vio*) 0);
@@ -2849,7 +2825,11 @@ inline void kill_broken_server()
(!opt_disable_networking && ip_sock == INVALID_SOCKET))
{
select_thread_in_use = 0;
+#ifdef __NETWARE__
+ kill_server(MYSQL_KILL_SIGNAL); /* never returns */
+#else
kill_server((void*)MYSQL_KILL_SIGNAL); /* never returns */
+#endif /* __NETWARE__ */
}
}
#define MAYBE_BROKEN_SYSCALL kill_broken_server();
@@ -3487,7 +3467,6 @@ enum options
OPT_BDB_LOG_BUFFER_SIZE,
OPT_BDB_MAX_LOCK,
OPT_ERROR_LOG_FILE,
- OPT_AUTOCLOSE,
OPT_ENABLE_SHARED_MEMORY,
OPT_SHARED_MEMORY_BASE_NAME,
OPT_OLD_PASSWORDS
@@ -3500,9 +3479,6 @@ struct my_option my_long_options[] =
{
{"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTOCLOSE, "Auto close screen. (NetWare only)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif /* __NETWARE__ */
{"basedir", 'b',
"Path to installation directory. All paths are usually resolved relative to this.",
(gptr*) &mysql_home_ptr, (gptr*) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
@@ -4890,11 +4866,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (opt_console)
opt_error_log= 0; // Force logs to stdout
break;
-#ifdef __NETWARE__
- case (int) OPT_AUTOCLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case (int) OPT_FLUSH:
#ifdef HAVE_ISAM
nisam_flush=1;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 9c546c99057..c4c5cd28b39 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2153,7 +2153,7 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
if (tmp_min_flag & GEOM_FLAG)
{
tmp= param->table->file->
- records_in_range((int) keynr, (byte*)(param->min_key + 1),
+ records_in_range((int) keynr, (byte*)(param->min_key),
min_key_length,
(ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG),
(byte *)NullS, 0, HA_READ_KEY_EXACT);
@@ -2446,7 +2446,7 @@ int QUICK_SELECT::get_next()
if (range->flag & GEOM_FLAG)
{
if ((result = file->index_read(record,
- (byte*) (range->min_key +1),
+ (byte*) (range->min_key),
range->min_length,
(ha_rkey_function)(range->flag ^
GEOM_FLAG))))
diff --git a/sql/protocol.cc b/sql/protocol.cc
index ebee87806db..9a7a913f874 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -55,8 +55,10 @@ inline bool Protocol::convert_str(const char *from, uint length)
void send_error(THD *thd, uint sql_errno, const char *err)
{
+#ifndef EMBEDDED_LIBRARY
uint length;
char buff[MYSQL_ERRMSG_SIZE+2];
+#endif
NET *net= &thd->net;
DBUG_ENTER("send_error");
DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno,
diff --git a/sql/records.cc b/sql/records.cc
index 7c3bd1110bb..22c4d54550c 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -45,7 +45,8 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
info->ref_length=table->file->ref_length;
info->select=select;
info->print_error=print_error;
- table->status=0; /* And it's allways found */
+ info->ignore_not_found_rows= 0;
+ table->status=0; /* And it's always found */
if (select && my_b_inited(&select->file))
tempfile= &select->file;
@@ -184,7 +185,8 @@ tryNext:
{
if (tmp == HA_ERR_END_OF_FILE)
tmp= -1;
- else if (tmp == HA_ERR_RECORD_DELETED)
+ else if (tmp == HA_ERR_RECORD_DELETED ||
+ (tmp == HA_ERR_KEY_NOT_FOUND && info->ignore_not_found_rows))
goto tryNext;
else
{
@@ -212,7 +214,8 @@ tryNext:
{
if (tmp == HA_ERR_END_OF_FILE)
tmp= -1;
- else if (tmp == HA_ERR_RECORD_DELETED)
+ else if (tmp == HA_ERR_RECORD_DELETED ||
+ (tmp == HA_ERR_KEY_NOT_FOUND && info->ignore_not_found_rows))
goto tryNext;
else
{
diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h
index ada46374a15..5f0058c3ad9 100644
--- a/sql/sql_analyse.h
+++ b/sql/sql_analyse.h
@@ -306,13 +306,14 @@ protected:
public:
uint max_tree_elements, max_treemem;
- analyse(select_result *res) :Procedure(res, PROC_NO_SORT), rows(0),
- output_str_length(0) {}
+ analyse(select_result *res) :Procedure(res, PROC_NO_SORT), f_info(0),
+ rows(0), output_str_length(0) {}
~analyse()
- {
- for (field_info **f=f_info; f != f_end; f++)
- delete (*f);
+ {
+ if (f_info)
+ for (field_info **f=f_info; f != f_end; f++)
+ delete (*f);
}
virtual void add() {}
virtual bool change_columns(List<Item> &fields);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index ccbd7a194f2..41a2b77d50b 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -355,10 +355,6 @@ class select_result;
#define THD_SENTRY_MAGIC 0xfeedd1ff
#define THD_SENTRY_GONE 0xdeadbeef
-#ifdef EMBEDDED_LIBRARY
-typedef struct st_mysql;
-#endif
-
#define THD_CHECK_SENTRY(thd) DBUG_ASSERT(thd->dbug_sentry == THD_SENTRY_MAGIC)
struct system_variables
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index c2efd392495..517438d9203 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -60,9 +60,9 @@ static bool write_db_opt(const char *path, HA_CREATE_INFO *create)
if ((file=my_create(path, CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0)
{
ulong length;
- length= my_sprintf(buf,(buf, "default-character-set=%s\n",
- (create && create->table_charset) ?
- create->table_charset->name : "DEFAULT"));
+ CHARSET_INFO *cs= (create && create->table_charset) ?
+ create->table_charset : default_charset_info;
+ length= my_sprintf(buf,(buf, "default-character-set=%s\n", cs->name));
/* Error is written by my_write */
if (!my_write(file,(byte*) buf, length, MYF(MY_NABP+MY_WME)))
@@ -98,6 +98,7 @@ static bool load_db_opt(const char *path, HA_CREATE_INFO *create)
uint nbytes;
bzero((char*) create,sizeof(*create));
+ create->table_charset= default_charset_info;
if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
{
IO_CACHE cache;
@@ -278,7 +279,8 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
*/
if (thd->db && !strcmp(thd->db,db))
{
- thd->db_charset= create_info ? create_info->table_charset : NULL;
+ thd->db_charset= (create_info && create_info->table_charset) ?
+ create_info->table_charset : default_charset_info;
}
mysql_update_log.write(thd,thd->query, thd->query_length);
@@ -599,7 +601,7 @@ bool mysql_change_db(THD *thd, const char *name)
strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE);
load_db_opt(path, &create);
- thd->db_charset=create.table_charset;
+ thd->db_charset= create.table_charset ? create.table_charset : default_charset_info;
thd->variables.thd_charset=thd->db_charset ? thd->db_charset : default_charset_info;
DBUG_RETURN(0);
}
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 703eafd0af6..05f84616a4c 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -411,6 +411,7 @@ void multi_delete::send_error(uint errcode,const char *err)
int multi_delete::do_deletes(bool from_send_error)
{
int local_error= 0, counter= 0;
+ DBUG_ENTER("do_deletes");
if (from_send_error)
{
@@ -436,7 +437,12 @@ int multi_delete::do_deletes(bool from_send_error)
}
READ_RECORD info;
- init_read_record(&info,thd,table,NULL,0,0);
+ init_read_record(&info,thd,table,NULL,0,1);
+ /*
+ Ignore any rows not found in reference tables as they may already have
+ been deleted by foreign key handling
+ */
+ info.ignore_not_found_rows= 1;
while (!(local_error=info.read_record(&info)) && !thd->killed)
{
if ((local_error=table->file->delete_row(table->record[0])))
@@ -450,7 +456,7 @@ int multi_delete::do_deletes(bool from_send_error)
if (local_error == -1) // End of file
local_error = 0;
}
- return local_error;
+ DBUG_RETURN(local_error);
}
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 954dceff303..0505d2409d4 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -86,18 +86,11 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
return 0;
}
-int mysql_ha_closeall(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
+int mysql_ha_closeall(THD *thd, TABLE_LIST *tables)
{
TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->real_name, 0);
-
- DBUG_ASSERT(dont_send_ok);
if (*ptr)
- {
-// if (!dont_send_ok) VOID(pthread_mutex_lock(&LOCK_open));
close_thread_table(thd, ptr);
-// if (!dont_send_ok) VOID(pthread_mutex_unlock(&LOCK_open));
- }
-// if (!dont_send_ok) send_ok(&thd->net);
return 0;
}
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 24ea2e9734e..def36665fb5 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -254,7 +254,7 @@ int get_all_topics_for_category(THD *thd, TABLE *topics, TABLE *relations,
rcat_id->get_key_image(buff, rcat_id->pack_length(), help_charset,
Field::itRAW);
int key_res= relations->file->index_read(relations->record[0],
- buff, rcat_id->pack_length(),
+ (byte *)buff, rcat_id->pack_length(),
HA_READ_KEY_EXACT);
for ( ; !key_res && cat_id == (int16) rcat_id->val_int() ;
@@ -267,7 +267,7 @@ int get_all_topics_for_category(THD *thd, TABLE *topics, TABLE *relations,
field->get_key_image(topic_id_buff, field->pack_length(), help_charset,
Field::itRAW);
- if (!topics->file->index_read(topics->record[0], topic_id_buff,
+ if (!topics->file->index_read(topics->record[0], (byte *)topic_id_buff,
field->pack_length(),
HA_READ_KEY_EXACT))
res->push_back(get_field(&thd->mem_root,
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 0fe3d11e404..e370ce569b5 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -208,6 +208,7 @@ static int find_keyword(LEX *lex, uint len, bool function)
case INT_RESULT:
return (udf->type == UDFTYPE_FUNCTION) ? UDF_INT_FUNC : UDA_INT_SUM;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
return 0;
@@ -1098,10 +1099,11 @@ void st_select_lex_node::fast_exclude()
{
if ((*link_prev= link_next))
link_next->link_prev= link_prev;
- // Remove slave structure
- for (; slave; slave= slave->next)
- slave->fast_exclude();
}
+ // Remove slave structure
+ for (; slave; slave= slave->next)
+ slave->fast_exclude();
+
}
/*
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index d69f95e7248..ce782b0480c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1059,7 +1059,9 @@ bool do_command(THD *thd)
bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length)
{
+#ifndef EMBEDDED_LIBRARY
int res;
+#endif
NET *net= &thd->net;
bool error= 0;
/*
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 4543c6bc5d0..883693a0406 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4008,6 +4008,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
return new Field_string(item_sum->max_length,maybe_null,
item->name,table,item->charset());
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
return 0;
@@ -4068,6 +4069,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
item->name,table,item->str_value.charset());
break;
case ROW_RESULT:
+ default:
// This case should never be choosen
DBUG_ASSERT(0);
break;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 7cda3d59c59..8607ddadd81 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1664,7 +1664,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
pos= "Unknown";
break;
}
- pos= strend(pos);
+ end= strend(pos);
break;
/* First group - functions relying on SSL */
case SHOW_SSL_GET_VERSION:
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 81adda55deb..80ddad3a4d2 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -191,7 +191,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
for (table=tables ; table ; table=table->next)
{
char *db=table->db ? table->db : thd->db;
- mysql_ha_closeall(thd, table, 1);
+ mysql_ha_closeall(thd, table);
if (!close_temporary_table(thd, db, table->real_name))
{
tmp_table_deleted=1;
@@ -461,9 +461,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
{
if (!sql_field->charset)
sql_field->charset = create_info->table_charset ?
- create_info->table_charset :
- thd->db_charset? thd->db_charset :
- default_charset_info;
+ create_info->table_charset : thd->db_charset;
switch (sql_field->sql_type) {
case FIELD_TYPE_BLOB:
@@ -705,14 +703,6 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
{
if (key->type == Key::FULLTEXT)
column->length=1; /* ft-code ignores it anyway :-) */
- else if (key->type == Key::SPATIAL)
- {
- /*
- BAR: 4 is: (Xmin,Xmax,Ymin,Ymax), this is for 2D case
- Lately we'll extend this code to support more dimensions
- */
- column->length=4*sizeof(double);
- }
else
{
my_printf_error(ER_BLOB_KEY_WITHOUT_LENGTH,
@@ -722,6 +712,17 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
}
}
+ if (key->type == Key::SPATIAL)
+ {
+ if (!column->length )
+ {
+ /*
+ BAR: 4 is: (Xmin,Xmax,Ymin,Ymax), this is for 2D case
+ Lately we'll extend this code to support more dimensions
+ */
+ column->length=4*sizeof(double);
+ }
+ }
if (!(sql_field->flags & NOT_NULL_FLAG))
{
if (key->type == Key::PRIMARY)
@@ -757,6 +758,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
DBUG_RETURN(-1);
}
}
+ else if (f_is_geom(sql_field->pack_flag))
+ {
+ }
else if (column->length > length ||
((f_is_packed(sql_field->pack_flag) ||
((file->table_flags() & HA_NO_PREFIX_CHAR_KEYS) &&
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index a6ee411cb70..b207d429bd2 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -486,7 +486,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token NOW_SYM
%token PASSWORD
%token POINTFROMTEXT
-%token POINT
+%token POINT_SYM
%token POLYFROMTEXT
%token POLYGON
%token POSITION_SYM
@@ -839,7 +839,7 @@ create:
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.options=$2 | $4;
lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type;
- lex->create_info.table_charset=thd->db_charset?thd->db_charset:default_charset_info;
+ lex->create_info.table_charset= thd->db_charset;
lex->name=0;
}
create2
@@ -1146,7 +1146,7 @@ type:
$$=FIELD_TYPE_BLOB; }
| GEOMETRY_SYM { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; }
- | POINT { Lex->charset=&my_charset_bin;
+ | POINT_SYM { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; }
| MULTIPOINT { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; }
@@ -1445,7 +1445,7 @@ alter:
lex->select_lex.db=lex->name=0;
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= DB_TYPE_DEFAULT;
- lex->create_info.table_charset=thd->db_charset?thd->db_charset:default_charset_info;
+ lex->create_info.table_charset= thd->db_charset;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_keys_onoff=LEAVE_AS_IS;
lex->simple_alter=1;
@@ -2314,7 +2314,7 @@ simple_expr:
{ $$= new Item_func_password($3); }
| PASSWORD '(' expr ',' expr ')'
{ $$= new Item_func_password($3,$5); }
- | POINT '(' expr ',' expr ')'
+ | POINT_SYM '(' expr ',' expr ')'
{ $$= new Item_func_point($3,$5); }
| POINTFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3); }
@@ -4039,7 +4039,7 @@ keyword:
| PACK_KEYS_SYM {}
| PARTIAL {}
| PASSWORD {}
- | POINT {}
+ | POINT_SYM {}
| POLYGON {}
| PREV_SYM {}
| PROCESS {}
diff --git a/sql/structs.h b/sql/structs.h
index 59b9335a5c4..77c852673d5 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -106,7 +106,7 @@ typedef struct st_read_record { /* Parameter to read_record */
byte *record;
byte *cache,*cache_pos,*cache_end,*read_positions;
IO_CACHE *io_cache;
- bool print_error;
+ bool print_error, ignore_not_found_rows;
} READ_RECORD;
enum timestamp_type { TIMESTAMP_NONE, TIMESTAMP_DATE, TIMESTAMP_FULL,