summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_db.cc8
-rw-r--r--sql/sql_union.cc17
2 files changed, 17 insertions, 8 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 39c8c00898d..48c355b6cd9 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -18,6 +18,7 @@
/* create and drop of databases */
#include "mysql_priv.h"
+#include <mysys_err.h>
#include "sql_acl.h"
#include <my_dir.h>
#include <m_ctype.h>
@@ -185,7 +186,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
strxmov(path, mysql_data_home, "/", db, NullS);
unpack_dirname(path,path); // Convert if not unix
- if (my_stat(path,&stat_info,MYF(MY_WME)))
+ if (my_stat(path,&stat_info,MYF(0)))
{
if (!(create_options & HA_LEX_CREATE_IF_NOT_EXISTS))
{
@@ -197,6 +198,11 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
}
else
{
+ if (my_errno != ENOENT)
+ {
+ my_error(EE_STAT, MYF(0),path,my_errno);
+ goto exit;
+ }
strend(path)[-1]=0; // Remove last '/' from path
if (my_mkdir(path,0777,MYF(0)) < 0)
{
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index e56dd4b476e..70c05489f82 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -355,15 +355,18 @@ int st_select_lex_unit::exec()
if (uncacheable || !item || !item->assigned() || describe)
{
- if (optimized && item && item->assigned())
+ if (optimized && item)
{
- item->assigned(0); // We will reinit & rexecute unit
- item->reset();
- table->file->delete_all_rows();
+ if (item->assigned())
+ {
+ item->assigned(0); // We will reinit & rexecute unit
+ item->reset();
+ table->file->delete_all_rows();
+ }
+ /* re-enabling indexes for next subselect iteration */
+ if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL))
+ DBUG_ASSERT(1);
}
- if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL) &&
- !describe)
- DBUG_RETURN(1); // For sub-selects
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
{
ha_rows records_at_start= 0;