summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2005-12-24 20:13:51 +0300
committerunknown <dlenev@mysql.com>2005-12-24 20:13:51 +0300
commiteff9369d10cf1bbb5fc2dcbe46aef3e3cc88797a (patch)
tree98fa99bfff1491e01070d24e8d05941d68a44ee3 /sql
parent81ca15813bfc482ac98614de41a867e47dde07d3 (diff)
parent9ae226fe41576390b48141205619223eb4cdde4b (diff)
downloadmariadb-git-eff9369d10cf1bbb5fc2dcbe46aef3e3cc88797a.tar.gz
Merge mysql.com:/home/dlenev/src/mysql-5.0-bg14836
into mysql.com:/home/dlenev/src/mysql-5.1-merges mysql-test/r/view.result: Auto merged mysql-test/t/view.test: Auto merged sql/sql_select.cc: Auto merged sql/share/errmsg.txt: Auto merged sql/sql_show.cc: Auto merged storage/ndb/src/kernel/blocks/backup/Backup.cpp: Auto merged storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: Auto merged storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Auto merged storage/ndb/tools/ndb_size.pl: Auto merged mysql-test/r/information_schema.result: Manual merge. mysql-test/t/information_schema.test: Manual merge. sql/sql_trigger.cc: Manual merge.
Diffstat (limited to 'sql')
-rw-r--r--sql/share/errmsg.txt2
-rw-r--r--sql/sql_select.cc12
-rw-r--r--sql/sql_show.cc12
-rw-r--r--sql/sql_trigger.cc26
4 files changed, 36 insertions, 16 deletions
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index ab9663db475..12123001463 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -5372,7 +5372,7 @@ ER_WSAS_FAILED
eng "WSAStartup Failed"
ger "WSAStartup fehlgeschlagen"
ER_DIFF_GROUPS_PROC
- eng "Can't handle procedures with differents groups yet"
+ eng "Can't handle procedures with different groups yet"
ger "Kann Prozeduren mit unterschiedlichen Gruppen noch nicht verarbeiten"
ER_NO_GROUP_FOR_PROC
eng "Select must have a group with this procedure"
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index f2833f94400..ed54aba91d3 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8218,7 +8218,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
uint convert_blob_length)
{
Item::Type orig_type= type;
- Item *orig_item;
+ Item *orig_item= 0;
if (type != Item::FIELD_ITEM &&
item->real_item()->type() == Item::FIELD_ITEM &&
@@ -8271,10 +8271,12 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
}
else
result= create_tmp_field_from_field(thd, (*from_field= field->field),
- item->name, table,
- modify_item ? field :
- NULL,
- convert_blob_length);
+ orig_item ? orig_item->name :
+ item->name,
+ table,
+ modify_item ? field :
+ NULL,
+ convert_blob_length);
if (orig_type == Item::REF_ITEM && orig_modify)
((Item_ref*)orig_item)->set_result_field(result);
return result;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 7abd625c2a9..ad99191fcb1 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2260,6 +2260,13 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
bool res;
lex->all_selects_list= lsel;
+ /*
+ Restore thd->temporary_tables to be able to process
+ temporary tables(only for 'show index' & 'show columns').
+ This should be changed when processing of temporary tables for
+ I_S tables will be done.
+ */
+ thd->temporary_tables= open_tables_state_backup.temporary_tables;
res= open_normal_and_derived_tables(thd, show_table_list,
MYSQL_LOCK_IGNORE_FLUSH);
/*
@@ -2279,6 +2286,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
show_table_list->view_db.str :
show_table_list->db),
show_table_list->alias));
+ thd->temporary_tables= 0;
close_thread_tables(thd);
show_table_list->table= 0;
goto err;
@@ -2799,7 +2807,9 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
table->field[6]->store((const char*) pos,
strlen((const char*) pos), cs);
is_blob= (field->type() == FIELD_TYPE_BLOB);
- if (field->has_charset() || is_blob)
+ if (field->has_charset() || is_blob ||
+ field->real_type() == MYSQL_TYPE_VARCHAR || // For varbinary type
+ field->real_type() == MYSQL_TYPE_STRING) // For binary type
{
longlong char_max_len= is_blob ?
(longlong) field->max_length() / field->charset()->mbminlen :
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index e91736fd48b..7b501364701 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -78,10 +78,6 @@ const char * const trigname_file_ext= ".TRN";
static File_option trigname_file_parameters[]=
{
{
- /*
- FIXME: Length specified for "trigger_table" key is erroneous, problem
- caused by this are reported as BUG#14090 and should be fixed ASAP.
- */
{(char *) STRING_WITH_LEN("trigger_table")},
offsetof(struct st_trigname, trigger_table),
FILE_OPTIONS_ESTRING
@@ -155,6 +151,17 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
But do we want this ?
*/
+ /*
+ Note that once we will have check for TRIGGER privilege in place we won't
+ need second part of condition below, since check_access() function also
+ checks that db is specified.
+ */
+ if (!thd->lex->spname->m_db.length || create && !tables->db_length)
+ {
+ my_error(ER_NO_DB_ERROR, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+
if (!create &&
!(tables= add_table_for_trigger(thd, thd->lex->spname)))
DBUG_RETURN(TRUE);
@@ -285,6 +292,9 @@ end:
definer. The caller is responsible to provide memory for
storing LEX_STRING object.
+ NOTE
+ Assumes that trigger name is fully qualified.
+
RETURN VALUE
False - success
True - error
@@ -308,8 +318,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
/* Trigger must be in the same schema as target table. */
if (my_strcasecmp(table_alias_charset, table->s->db.str,
- lex->spname->m_db.str ? lex->spname->m_db.str :
- thd->db))
+ lex->spname->m_db.str))
{
my_error(ER_TRG_IN_WRONG_SCHEMA, MYF(0));
return 1;
@@ -1010,7 +1019,6 @@ bool Table_triggers_list::get_trigger_info(THD *thd, trg_event_type event,
static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig)
{
- const char *db= !trig->m_db.str ? thd->db : trig->m_db.str;
LEX *lex= thd->lex;
char path_buff[FN_REFLEN];
LEX_STRING path;
@@ -1018,7 +1026,7 @@ static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig)
struct st_trigname trigname;
DBUG_ENTER("add_table_for_trigger");
- strxnmov(path_buff, FN_REFLEN-1, mysql_data_home, "/", db, "/",
+ strxnmov(path_buff, FN_REFLEN-1, mysql_data_home, "/", trig->m_db.str, "/",
trig->m_name.str, trigname_file_ext, NullS);
path.length= unpack_filename(path_buff, path_buff);
path.str= path_buff;
@@ -1047,7 +1055,7 @@ static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig)
/* We need to reset statement table list to be PS/SP friendly. */
lex->query_tables= 0;
lex->query_tables_last= &lex->query_tables;
- DBUG_RETURN(sp_add_to_query_tables(thd, lex, db,
+ DBUG_RETURN(sp_add_to_query_tables(thd, lex, trig->m_db.str,
trigname.trigger_table.str, TL_WRITE));
}