diff options
author | kostja@bodhi.(none) <> | 2007-07-02 02:01:05 +0400 |
---|---|---|
committer | kostja@bodhi.(none) <> | 2007-07-02 02:01:05 +0400 |
commit | 674d10270c92c15cb204ec5cc87f2f5d06195184 (patch) | |
tree | a05ad91c128639f5f062a7f8bb257c5c5943d5d6 /sql | |
parent | 38deea24964e1acf0920f8dee1a4442531d3ed80 (diff) | |
parent | 2d8decabd42558776d9079aa36d48dcebee9ade3 (diff) | |
download | mariadb-git-674d10270c92c15cb204ec5cc87f2f5d06195184.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into bodhi.(none):/opt/local/work/mysql-5.0-runtime
Diffstat (limited to 'sql')
-rw-r--r-- | sql/handler.cc | 2 | ||||
-rw-r--r-- | sql/item.h | 8 | ||||
-rw-r--r-- | sql/sp.cc | 2 | ||||
-rw-r--r-- | sql/sp_head.cc | 4 | ||||
-rw-r--r-- | sql/sql_class.h | 7 | ||||
-rw-r--r-- | sql/sql_error.cc | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 8 | ||||
-rw-r--r-- | sql/sql_trigger.cc | 2 | ||||
-rw-r--r-- | sql/sql_view.cc | 19 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 5 |
11 files changed, 45 insertions, 18 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 37b81b58cfe..f8aec72ec90 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1343,7 +1343,7 @@ int ha_delete_table(THD *thd, enum db_type table_type, const char *path, strmake(buff, thd->net.last_error, sizeof(buff)-1); thd->query_error= 0; - thd->spcont= 0; + thd->spcont= NULL; thd->lex->current_select= 0; thd->net.last_error[0]= 0; diff --git a/sql/item.h b/sql/item.h index 3478095351a..fdb85b131c1 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1764,11 +1764,17 @@ public: enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } }; +/** + Item_empty_string -- is a utility class to put an item into List<Item> + which is then used in protocol.send_fields() when sending SHOW output to + the client. +*/ + class Item_empty_string :public Item_string { public: Item_empty_string(const char *header,uint length, CHARSET_INFO *cs= NULL) : - Item_string("",0, cs ? cs : &my_charset_bin) + Item_string("",0, cs ? cs : &my_charset_utf8_general_ci) { name=(char*) header; max_length= cs ? length * cs->mbmaxlen : length; } void make_field(Send_field *field); }; diff --git a/sql/sp.cc b/sql/sp.cc index de786a77275..d28e9138fa8 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -438,10 +438,10 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, Lex_input_stream lip(thd, defstr.c_ptr(), defstr.length()); thd->m_lip= &lip; lex_start(thd); + thd->spcont= NULL; ret= MYSQLparse(thd); } - thd->spcont= 0; if (ret || thd->is_fatal_error || newlex.sphead == NULL) { sp_head *sp= newlex.sphead; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index a98fe5027c9..d939fd20b9b 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -2581,7 +2581,7 @@ sp_instr_set::exec_core(THD *thd, uint *nextp) sp_rcontext *spcont= thd->spcont; - thd->spcont= 0; /* Avoid handlers */ + thd->spcont= NULL; /* Avoid handlers */ my_error(ER_OUT_OF_RESOURCES, MYF(0)); spcont->clear_handler(); thd->spcont= spcont; @@ -3316,7 +3316,7 @@ sp_instr_set_case_expr::exec_core(THD *thd, uint *nextp) sp_rcontext *spcont= thd->spcont; - thd->spcont= 0; /* Avoid handlers */ + thd->spcont= NULL; /* Avoid handlers */ my_error(ER_OUT_OF_RESOURCES, MYF(0)); spcont->clear_handler(); thd->spcont= spcont; diff --git a/sql/sql_class.h b/sql/sql_class.h index b005f956c28..d86f097ebe8 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -697,6 +697,13 @@ public: #ifndef DBUG_OFF bool is_backup_arena; /* True if this arena is used for backup. */ #endif + /* + The states relfects three diffrent life cycles for three + different types of statements: + Prepared statement: INITIALIZED -> PREPARED -> EXECUTED. + Stored procedure: INITIALIZED_FOR_SP -> EXECUTED. + Other statements: CONVENTIONAL_EXECUTION never changes. + */ enum enum_state { INITIALIZED= 0, INITIALIZED_FOR_SP= 1, PREPARED= 2, diff --git a/sql/sql_error.cc b/sql/sql_error.cc index a25c82c7721..344a0c00db8 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -126,7 +126,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, sp_rcontext *spcont= thd->spcont; thd->no_warnings_for_error= 1; - thd->spcont= 0; + thd->spcont= NULL; thd->killed= THD::KILL_BAD_DATA; my_message(code, msg, MYF(0)); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 488f05ab41f..b65ad705a36 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4893,6 +4893,10 @@ create_sp_error: #endif // ifndef DBUG_OFF case SQLCOM_CREATE_VIEW: { + /* + Note: SQLCOM_CREATE_VIEW also handles 'ALTER VIEW' commands + as specified through the thd->lex->create_view_mode flag. + */ if (end_active_trans(thd)) goto error; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index f781d1372ad..567f92b55ba 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1724,6 +1724,13 @@ static bool check_prepared_statement(Prepared_statement *stmt, res= mysql_test_create_table(stmt); break; + case SQLCOM_CREATE_VIEW: + if (lex->create_view_mode == VIEW_ALTER) + { + my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0)); + goto error; + } + break; case SQLCOM_DO: res= mysql_test_do_fields(stmt, tables, lex->insert_list); break; @@ -1766,7 +1773,6 @@ static bool check_prepared_statement(Prepared_statement *stmt, case SQLCOM_ROLLBACK: case SQLCOM_TRUNCATE: case SQLCOM_CALL: - case SQLCOM_CREATE_VIEW: case SQLCOM_DROP_VIEW: case SQLCOM_REPAIR: case SQLCOM_ANALYZE: diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index cf6db22fbcb..5762614e47f 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -982,7 +982,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, Lex_input_stream lip(thd, trg_create_str->str, trg_create_str->length); thd->m_lip= &lip; lex_start(thd); - thd->spcont= 0; + thd->spcont= NULL; int err= MYSQLparse((void *)thd); if (err || thd->is_fatal_error) diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 40f54799295..6c94d388d0e 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -205,18 +205,17 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view) } -/* - Creating/altering VIEW procedure +/** + @brief Creating/altering VIEW procedure - SYNOPSIS - mysql_create_view() - thd - thread handler - views - views to create - mode - VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE + @param thd thread handler + @param views views to create + @param mode VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE - RETURN VALUE - FALSE OK - TRUE Error + @note This function handles both create and alter view commands. + + @retval FALSE Operation was a success. + @retval TRUE An error occured. */ bool mysql_create_view(THD *thd, TABLE_LIST *views, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f09ba5b8b3a..6c146f77ed6 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3671,6 +3671,11 @@ alter: { THD *thd= YYTHD; LEX *lex= thd->lex; + if (lex->sphead) + { + my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW"); + MYSQL_YYABORT; + } lex->sql_command= SQLCOM_CREATE_VIEW; lex->create_view_mode= VIEW_ALTER; /* first table in list is target VIEW name */ |