diff options
author | unknown <bell@sanja.is.com.ua> | 2005-01-05 16:48:23 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2005-01-05 16:48:23 +0200 |
commit | 47dc78e6a3bb6554504da0869705c2155d7b772d (patch) | |
tree | 2d4c17ce2b2688d209f1864bea4459a6021d896a /sql/sql_base.cc | |
parent | 4fd1524c0a0e3fed746a8f2af743cafbb12abfd4 (diff) | |
download | mariadb-git-47dc78e6a3bb6554504da0869705c2155d7b772d.tar.gz |
fixed views with PS protocol
mysql-test/r/view.result:
query cache part moved to separate test
mysql-test/t/view.test:
query cache part moved to separate test
sql/item_func.cc:
fixed for safety
sql/sql_base.cc:
do not use real table call with view
fixed wrapping * substitured items
fixed fix_fields call parameter (refference)
sql/sql_yacc.yy:
added initialisation of SELECT in commands which can use subqueries
sql/table.cc:
fised fix_fields call parameter
sql/table.h:
new view specific method
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index a620ce2f10f..bbe2f44f46b 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2262,7 +2262,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, field makes some prepared query ambiguous and so erroneous, but we accept this trade off. */ - if (item->cached_table->table) + if (item->cached_table->table && !item->cached_table->view) { found= find_field_in_real_table(thd, item->cached_table->table, name, length, @@ -3047,15 +3047,19 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name, ¬_used_field_index, TRUE)) { Item *item= iterator->item(thd); + if (view && !thd->lex->current_select->no_wrap_view_item) + { + /* + as far as we have view, then item point to view_iter, so we + can use it directly for this view specific operation + */ + item= new Item_ref(view_iter.item_ptr(), tables->view_name.str, + field_name); + } if (!found++) (void) it->replace(item); // Replace '*' else it->after(item); - if (view && !thd->lex->current_select->no_wrap_view_item) - { - item= new Item_ref(it->ref(), tables->view_name.str, - field_name); - } #ifndef NO_EMBEDDED_ACCESS_CHECKS if (any_privileges) { @@ -3328,7 +3332,8 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, COND **conds) thd->restore_backup_item_arena(arena, &backup); if (embedded->on_expr && !embedded->on_expr->fixed) { - if (embedded->on_expr->fix_fields(thd, tables, &table->on_expr)) + if (embedded->on_expr->fix_fields(thd, tables, + &embedded->on_expr)) goto err_no_arena; } } |