Loading BitKeeper/etc/collapsed +5 −0 Original line number Diff line number Diff line Loading @@ -5,8 +5,13 @@ 45001f7c3b2hhCXDKfUvzkX9TNe6VA 45002051rHJfMEXAIMiAZV0clxvKSA 4513d8e4Af4dQWuk13sArwofRgFDQw 45143312u0Tz4r0wPXCbUKwdHa2jWA 45143b90ewOQuTW8-jrB3ZSAQvMRJw 45184588w9U72A6KX1hUFeAC4shSHA 45185df8mZbxfp85FbA0VxUXkmDewA 4519a6c5BVUxEHTf5iJnjZkixMBs8g 451ab499rgdjXyOnUDqHu-wBDoS-OQ 451b110a3ZV6MITl93ehXk2wxrbW7g 45214442pBGT9KuZEGixBH71jTzbOA 45214a07hVsIGwvwa-WrO-jpeaSwVw 452a92d0-31-8wSzSfZi165fcGcXPA sql/sp.cc +23 −0 Original line number Diff line number Diff line Loading @@ -653,6 +653,17 @@ db_drop_routine(THD *thd, int type, sp_name *name) if (table->file->ha_delete_row(table->record[0])) ret= SP_DELETE_ROW_FAILED; } if (ret == SP_OK) { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } close_thread_tables(thd); DBUG_RETURN(ret); } Loading Loading @@ -687,6 +698,17 @@ db_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) if ((table->file->ha_update_row(table->record[1],table->record[0]))) ret= SP_WRITE_ROW_FAILED; } if (ret == SP_OK) { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } close_thread_tables(thd); DBUG_RETURN(ret); } Loading Loading @@ -765,6 +787,7 @@ print_field_values(THD *thd, TABLE *table, return SP_INTERNAL_ERROR; } } return SP_OK; } Loading sql/sql_acl.cc +66 −1 Original line number Diff line number Diff line Loading @@ -3140,9 +3140,22 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, grant_option=TRUE; thd->mem_root= old_root; pthread_mutex_unlock(&acl_cache->lock); if (!result) /* success */ { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } rw_unlock(&LOCK_grant); if (!result) if (!result) /* success */ send_ok(thd); /* Tables are automatically closed */ DBUG_RETURN(result); } Loading Loading @@ -3294,9 +3307,21 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, grant_option=TRUE; thd->mem_root= old_root; pthread_mutex_unlock(&acl_cache->lock); if (!result && !no_error) { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } rw_unlock(&LOCK_grant); if (!result && !no_error) send_ok(thd); /* Tables are automatically closed */ DBUG_RETURN(result); } Loading Loading @@ -3394,11 +3419,23 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, } } VOID(pthread_mutex_unlock(&acl_cache->lock)); if (!result) { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } rw_unlock(&LOCK_grant); close_thread_tables(thd); if (!result) send_ok(thd); DBUG_RETURN(result); } Loading Loading @@ -5398,6 +5435,13 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list) } VOID(pthread_mutex_unlock(&acl_cache->lock)); if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } rw_unlock(&LOCK_grant); close_thread_tables(thd); if (result) Loading Loading @@ -5454,6 +5498,13 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list) rebuild_check_host(); VOID(pthread_mutex_unlock(&acl_cache->lock)); if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } rw_unlock(&LOCK_grant); close_thread_tables(thd); if (result) Loading Loading @@ -5523,6 +5574,13 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list) rebuild_check_host(); VOID(pthread_mutex_unlock(&acl_cache->lock)); if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } rw_unlock(&LOCK_grant); close_thread_tables(thd); if (result) Loading Loading @@ -5697,6 +5755,13 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list) } VOID(pthread_mutex_unlock(&acl_cache->lock)); if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } rw_unlock(&LOCK_grant); close_thread_tables(thd); Loading sql/sql_db.cc +5 −0 Original line number Diff line number Diff line Loading @@ -705,6 +705,7 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, qinfo.db = db; qinfo.db_len = strlen(db); /* These DDL methods and logging protected with LOCK_mysql_create_db */ mysql_bin_log.write(&qinfo); } send_ok(thd, result); Loading Loading @@ -783,6 +784,7 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) qinfo.db_len = strlen(db); thd->clear_error(); /* These DDL methods and logging protected with LOCK_mysql_create_db */ mysql_bin_log.write(&qinfo); } send_ok(thd, result); Loading Loading @@ -905,6 +907,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) qinfo.db_len = strlen(db); thd->clear_error(); /* These DDL methods and logging protected with LOCK_mysql_create_db */ mysql_bin_log.write(&qinfo); } thd->server_status|= SERVER_STATUS_DB_DROPPED; Loading @@ -931,6 +934,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) tbl_name_len= strlen(tbl->table_name) + 3; if (query_pos + tbl_name_len + 1 >= query_end) { /* These DDL methods and logging protected with LOCK_mysql_create_db */ write_to_binlog(thd, query, query_pos -1 - query, db, db_len); query_pos= query_data_start; } Loading @@ -943,6 +947,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) if (query_pos != query_data_start) { /* These DDL methods and logging protected with LOCK_mysql_create_db */ write_to_binlog(thd, query, query_pos -1 - query, db, db_len); } } Loading sql/sql_parse.cc +26 −103 Original line number Diff line number Diff line Loading @@ -3237,6 +3237,7 @@ mysql_execute_command(THD *thd) /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) { /* Presumably, REPAIR and binlog writing doesn't require synchronization */ if (mysql_bin_log.is_open()) { thd->clear_error(); // No binlog error generated Loading Loading @@ -3269,6 +3270,7 @@ mysql_execute_command(THD *thd) /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) { /* Presumably, ANALYZE and binlog writing doesn't require synchronization */ if (mysql_bin_log.is_open()) { thd->clear_error(); // No binlog error generated Loading @@ -3293,6 +3295,7 @@ mysql_execute_command(THD *thd) /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) { /* Presumably, OPTIMIZE and binlog writing doesn't require synchronization */ if (mysql_bin_log.is_open()) { thd->clear_error(); // No binlog error generated Loading Loading @@ -3580,6 +3583,7 @@ mysql_execute_command(THD *thd) /* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */ thd->options|= OPTION_KEEP_LOG; } /* DDL and binlog write order protected by LOCK_open */ res= mysql_rm_table(thd, first_table, lex->drop_if_exists, lex->drop_temporary); } Loading Loading @@ -3979,13 +3983,9 @@ mysql_execute_command(THD *thd) break; if (end_active_trans(thd)) goto error; /* Conditionally writes to binlog */ if (!(res= mysql_create_user(thd, lex->users_list))) { if (mysql_bin_log.is_open()) thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); send_ok(thd); } break; } case SQLCOM_DROP_USER: Loading @@ -3995,15 +3995,9 @@ mysql_execute_command(THD *thd) break; if (end_active_trans(thd)) goto error; /* Conditionally writes to binlog */ if (!(res= mysql_drop_user(thd, lex->users_list))) { if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } send_ok(thd); } break; } case SQLCOM_RENAME_USER: Loading @@ -4013,15 +4007,9 @@ mysql_execute_command(THD *thd) break; if (end_active_trans(thd)) goto error; /* Conditionally writes to binlog */ if (!(res= mysql_rename_user(thd, lex->users_list))) { if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } send_ok(thd); } break; } case SQLCOM_REVOKE_ALL: Loading @@ -4029,15 +4017,9 @@ mysql_execute_command(THD *thd) if (check_access(thd, UPDATE_ACL, "mysql", 0, 1, 1, 0) && check_global_access(thd,CREATE_USER_ACL)) break; /* Conditionally writes to binlog */ if (!(res = mysql_revoke_all(thd, lex->users_list))) { if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } send_ok(thd); } break; } case SQLCOM_REVOKE: Loading Loading @@ -4096,6 +4078,7 @@ mysql_execute_command(THD *thd) check_grant_routine(thd, grants | GRANT_ACL, all_tables, lex->type == TYPE_ENUM_PROCEDURE, 0)) goto error; /* Conditionally writes to binlog */ res= mysql_routine_grant(thd, all_tables, lex->type == TYPE_ENUM_PROCEDURE, lex->users_list, grants, Loading @@ -4108,16 +4091,11 @@ mysql_execute_command(THD *thd) GRANT_ACL), all_tables, 0, UINT_MAX, 0)) goto error; /* Conditionally writes to binlog */ res= mysql_table_grant(thd, all_tables, lex->users_list, lex->columns, lex->grant, lex->sql_command == SQLCOM_REVOKE); } if (!res && mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } else { Loading @@ -4128,16 +4106,11 @@ mysql_execute_command(THD *thd) goto error; } else /* Conditionally writes to binlog */ res = mysql_grant(thd, select_lex->db, lex->users_list, lex->grant, lex->sql_command == SQLCOM_REVOKE); if (!res) { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } if (lex->sql_command == SQLCOM_GRANT) { List_iterator <LEX_USER> str_list(lex->users_list); Loading Loading @@ -4175,6 +4148,7 @@ mysql_execute_command(THD *thd) We WANT to write and we CAN write. ! we write after unlocking the table. */ /* Presumably, RESET and binlog writing doesn't require synchronization */ if (!lex->no_write_to_binlog && write_to_binlog) { if (mysql_bin_log.is_open()) Loading Loading @@ -4691,20 +4665,16 @@ mysql_execute_command(THD *thd) already puts on CREATE FUNCTION. */ if (lex->sql_command == SQLCOM_ALTER_PROCEDURE) /* Conditionally writes to binlog */ result= sp_update_procedure(thd, lex->spname, &lex->sp_chistics); else /* Conditionally writes to binlog */ result= sp_update_function(thd, lex->spname, &lex->sp_chistics); } } switch (result) { case SP_OK: if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } send_ok(thd); break; case SP_KEY_NOT_FOUND: Loading Loading @@ -4749,9 +4719,11 @@ mysql_execute_command(THD *thd) } #endif if (lex->sql_command == SQLCOM_DROP_PROCEDURE) result= sp_drop_procedure(thd, lex->spname); /* Conditionally writes to binlog */ result= sp_drop_procedure(thd, lex->spname); /* Conditionally writes to binlog */ else result= sp_drop_function(thd, lex->spname); /* Conditionally writes to binlog */ result= sp_drop_function(thd, lex->spname); /* Conditionally writes to binlog */ } else { Loading @@ -4764,6 +4736,8 @@ mysql_execute_command(THD *thd) { if (check_access(thd, DELETE_ACL, "mysql", 0, 1, 0, 0)) goto error; /* Does NOT write to binlog */ if (!(res = mysql_drop_function(thd, &lex->spname->m_name))) { send_ok(thd); Loading @@ -4784,12 +4758,6 @@ mysql_execute_command(THD *thd) switch (result) { case SP_OK: if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } send_ok(thd); break; case SP_KEY_NOT_FOUND: Loading Loading @@ -4887,50 +4855,8 @@ mysql_execute_command(THD *thd) { if (end_active_trans(thd)) goto error; if (!(res= mysql_create_view(thd, thd->lex->create_view_mode)) && mysql_bin_log.is_open()) { String buff; const LEX_STRING command[3]= {{ C_STRING_WITH_LEN("CREATE ") }, { C_STRING_WITH_LEN("ALTER ") }, { C_STRING_WITH_LEN("CREATE OR REPLACE ") }}; thd->clear_error(); buff.append(command[thd->lex->create_view_mode].str, command[thd->lex->create_view_mode].length); view_store_options(thd, first_table, &buff); buff.append(STRING_WITH_LEN("VIEW ")); /* Test if user supplied a db (ie: we did not use thd->db) */ if (first_table->db && first_table->db[0] && (thd->db == NULL || strcmp(first_table->db, thd->db))) { append_identifier(thd, &buff, first_table->db, first_table->db_length); buff.append('.'); } append_identifier(thd, &buff, first_table->table_name, first_table->table_name_length); if (lex->view_list.elements) { List_iterator_fast<LEX_STRING> names(lex->view_list); LEX_STRING *name; int i; for (i= 0; name= names++; i++) { buff.append(i ? ", " : "("); append_identifier(thd, &buff, name->str, name->length); } buff.append(')'); } buff.append(STRING_WITH_LEN(" AS ")); buff.append(first_table->source.str, first_table->source.length); thd->binlog_query(THD::STMT_QUERY_TYPE, buff.ptr(), buff.length(), FALSE, FALSE); } /* Conditionally writes to binlog. */ res= mysql_create_view(thd, first_table, thd->lex->create_view_mode); break; } case SQLCOM_DROP_VIEW: Loading @@ -4938,13 +4864,8 @@ mysql_execute_command(THD *thd) if (check_table_access(thd, DROP_ACL, all_tables, 0) || end_active_trans(thd)) goto error; if (!(res= mysql_drop_view(thd, first_table, thd->lex->drop_mode)) && mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::STMT_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } /* Conditionally writes to binlog. */ res= mysql_drop_view(thd, first_table, thd->lex->drop_mode); break; } case SQLCOM_CREATE_TRIGGER: Loading @@ -4952,6 +4873,7 @@ mysql_execute_command(THD *thd) if (end_active_trans(thd)) goto error; /* Conditionally writes to binlog. */ res= mysql_create_or_drop_trigger(thd, all_tables, 1); /* We don't care about trigger body after this point */ Loading @@ -4964,6 +4886,7 @@ mysql_execute_command(THD *thd) if (end_active_trans(thd)) goto error; /* Conditionally writes to binlog. */ res= mysql_create_or_drop_trigger(thd, all_tables, 0); break; } Loading Loading
BitKeeper/etc/collapsed +5 −0 Original line number Diff line number Diff line Loading @@ -5,8 +5,13 @@ 45001f7c3b2hhCXDKfUvzkX9TNe6VA 45002051rHJfMEXAIMiAZV0clxvKSA 4513d8e4Af4dQWuk13sArwofRgFDQw 45143312u0Tz4r0wPXCbUKwdHa2jWA 45143b90ewOQuTW8-jrB3ZSAQvMRJw 45184588w9U72A6KX1hUFeAC4shSHA 45185df8mZbxfp85FbA0VxUXkmDewA 4519a6c5BVUxEHTf5iJnjZkixMBs8g 451ab499rgdjXyOnUDqHu-wBDoS-OQ 451b110a3ZV6MITl93ehXk2wxrbW7g 45214442pBGT9KuZEGixBH71jTzbOA 45214a07hVsIGwvwa-WrO-jpeaSwVw 452a92d0-31-8wSzSfZi165fcGcXPA
sql/sp.cc +23 −0 Original line number Diff line number Diff line Loading @@ -653,6 +653,17 @@ db_drop_routine(THD *thd, int type, sp_name *name) if (table->file->ha_delete_row(table->record[0])) ret= SP_DELETE_ROW_FAILED; } if (ret == SP_OK) { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } close_thread_tables(thd); DBUG_RETURN(ret); } Loading Loading @@ -687,6 +698,17 @@ db_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) if ((table->file->ha_update_row(table->record[1],table->record[0]))) ret= SP_WRITE_ROW_FAILED; } if (ret == SP_OK) { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } close_thread_tables(thd); DBUG_RETURN(ret); } Loading Loading @@ -765,6 +787,7 @@ print_field_values(THD *thd, TABLE *table, return SP_INTERNAL_ERROR; } } return SP_OK; } Loading
sql/sql_acl.cc +66 −1 Original line number Diff line number Diff line Loading @@ -3140,9 +3140,22 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, grant_option=TRUE; thd->mem_root= old_root; pthread_mutex_unlock(&acl_cache->lock); if (!result) /* success */ { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } rw_unlock(&LOCK_grant); if (!result) if (!result) /* success */ send_ok(thd); /* Tables are automatically closed */ DBUG_RETURN(result); } Loading Loading @@ -3294,9 +3307,21 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, grant_option=TRUE; thd->mem_root= old_root; pthread_mutex_unlock(&acl_cache->lock); if (!result && !no_error) { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } rw_unlock(&LOCK_grant); if (!result && !no_error) send_ok(thd); /* Tables are automatically closed */ DBUG_RETURN(result); } Loading Loading @@ -3394,11 +3419,23 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, } } VOID(pthread_mutex_unlock(&acl_cache->lock)); if (!result) { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } rw_unlock(&LOCK_grant); close_thread_tables(thd); if (!result) send_ok(thd); DBUG_RETURN(result); } Loading Loading @@ -5398,6 +5435,13 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list) } VOID(pthread_mutex_unlock(&acl_cache->lock)); if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } rw_unlock(&LOCK_grant); close_thread_tables(thd); if (result) Loading Loading @@ -5454,6 +5498,13 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list) rebuild_check_host(); VOID(pthread_mutex_unlock(&acl_cache->lock)); if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } rw_unlock(&LOCK_grant); close_thread_tables(thd); if (result) Loading Loading @@ -5523,6 +5574,13 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list) rebuild_check_host(); VOID(pthread_mutex_unlock(&acl_cache->lock)); if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } rw_unlock(&LOCK_grant); close_thread_tables(thd); if (result) Loading Loading @@ -5697,6 +5755,13 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list) } VOID(pthread_mutex_unlock(&acl_cache->lock)); if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } rw_unlock(&LOCK_grant); close_thread_tables(thd); Loading
sql/sql_db.cc +5 −0 Original line number Diff line number Diff line Loading @@ -705,6 +705,7 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, qinfo.db = db; qinfo.db_len = strlen(db); /* These DDL methods and logging protected with LOCK_mysql_create_db */ mysql_bin_log.write(&qinfo); } send_ok(thd, result); Loading Loading @@ -783,6 +784,7 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) qinfo.db_len = strlen(db); thd->clear_error(); /* These DDL methods and logging protected with LOCK_mysql_create_db */ mysql_bin_log.write(&qinfo); } send_ok(thd, result); Loading Loading @@ -905,6 +907,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) qinfo.db_len = strlen(db); thd->clear_error(); /* These DDL methods and logging protected with LOCK_mysql_create_db */ mysql_bin_log.write(&qinfo); } thd->server_status|= SERVER_STATUS_DB_DROPPED; Loading @@ -931,6 +934,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) tbl_name_len= strlen(tbl->table_name) + 3; if (query_pos + tbl_name_len + 1 >= query_end) { /* These DDL methods and logging protected with LOCK_mysql_create_db */ write_to_binlog(thd, query, query_pos -1 - query, db, db_len); query_pos= query_data_start; } Loading @@ -943,6 +947,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) if (query_pos != query_data_start) { /* These DDL methods and logging protected with LOCK_mysql_create_db */ write_to_binlog(thd, query, query_pos -1 - query, db, db_len); } } Loading
sql/sql_parse.cc +26 −103 Original line number Diff line number Diff line Loading @@ -3237,6 +3237,7 @@ mysql_execute_command(THD *thd) /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) { /* Presumably, REPAIR and binlog writing doesn't require synchronization */ if (mysql_bin_log.is_open()) { thd->clear_error(); // No binlog error generated Loading Loading @@ -3269,6 +3270,7 @@ mysql_execute_command(THD *thd) /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) { /* Presumably, ANALYZE and binlog writing doesn't require synchronization */ if (mysql_bin_log.is_open()) { thd->clear_error(); // No binlog error generated Loading @@ -3293,6 +3295,7 @@ mysql_execute_command(THD *thd) /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) { /* Presumably, OPTIMIZE and binlog writing doesn't require synchronization */ if (mysql_bin_log.is_open()) { thd->clear_error(); // No binlog error generated Loading Loading @@ -3580,6 +3583,7 @@ mysql_execute_command(THD *thd) /* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */ thd->options|= OPTION_KEEP_LOG; } /* DDL and binlog write order protected by LOCK_open */ res= mysql_rm_table(thd, first_table, lex->drop_if_exists, lex->drop_temporary); } Loading Loading @@ -3979,13 +3983,9 @@ mysql_execute_command(THD *thd) break; if (end_active_trans(thd)) goto error; /* Conditionally writes to binlog */ if (!(res= mysql_create_user(thd, lex->users_list))) { if (mysql_bin_log.is_open()) thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); send_ok(thd); } break; } case SQLCOM_DROP_USER: Loading @@ -3995,15 +3995,9 @@ mysql_execute_command(THD *thd) break; if (end_active_trans(thd)) goto error; /* Conditionally writes to binlog */ if (!(res= mysql_drop_user(thd, lex->users_list))) { if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } send_ok(thd); } break; } case SQLCOM_RENAME_USER: Loading @@ -4013,15 +4007,9 @@ mysql_execute_command(THD *thd) break; if (end_active_trans(thd)) goto error; /* Conditionally writes to binlog */ if (!(res= mysql_rename_user(thd, lex->users_list))) { if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } send_ok(thd); } break; } case SQLCOM_REVOKE_ALL: Loading @@ -4029,15 +4017,9 @@ mysql_execute_command(THD *thd) if (check_access(thd, UPDATE_ACL, "mysql", 0, 1, 1, 0) && check_global_access(thd,CREATE_USER_ACL)) break; /* Conditionally writes to binlog */ if (!(res = mysql_revoke_all(thd, lex->users_list))) { if (mysql_bin_log.is_open()) { thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } send_ok(thd); } break; } case SQLCOM_REVOKE: Loading Loading @@ -4096,6 +4078,7 @@ mysql_execute_command(THD *thd) check_grant_routine(thd, grants | GRANT_ACL, all_tables, lex->type == TYPE_ENUM_PROCEDURE, 0)) goto error; /* Conditionally writes to binlog */ res= mysql_routine_grant(thd, all_tables, lex->type == TYPE_ENUM_PROCEDURE, lex->users_list, grants, Loading @@ -4108,16 +4091,11 @@ mysql_execute_command(THD *thd) GRANT_ACL), all_tables, 0, UINT_MAX, 0)) goto error; /* Conditionally writes to binlog */ res= mysql_table_grant(thd, all_tables, lex->users_list, lex->columns, lex->grant, lex->sql_command == SQLCOM_REVOKE); } if (!res && mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } } else { Loading @@ -4128,16 +4106,11 @@ mysql_execute_command(THD *thd) goto error; } else /* Conditionally writes to binlog */ res = mysql_grant(thd, select_lex->db, lex->users_list, lex->grant, lex->sql_command == SQLCOM_REVOKE); if (!res) { if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } if (lex->sql_command == SQLCOM_GRANT) { List_iterator <LEX_USER> str_list(lex->users_list); Loading Loading @@ -4175,6 +4148,7 @@ mysql_execute_command(THD *thd) We WANT to write and we CAN write. ! we write after unlocking the table. */ /* Presumably, RESET and binlog writing doesn't require synchronization */ if (!lex->no_write_to_binlog && write_to_binlog) { if (mysql_bin_log.is_open()) Loading Loading @@ -4691,20 +4665,16 @@ mysql_execute_command(THD *thd) already puts on CREATE FUNCTION. */ if (lex->sql_command == SQLCOM_ALTER_PROCEDURE) /* Conditionally writes to binlog */ result= sp_update_procedure(thd, lex->spname, &lex->sp_chistics); else /* Conditionally writes to binlog */ result= sp_update_function(thd, lex->spname, &lex->sp_chistics); } } switch (result) { case SP_OK: if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } send_ok(thd); break; case SP_KEY_NOT_FOUND: Loading Loading @@ -4749,9 +4719,11 @@ mysql_execute_command(THD *thd) } #endif if (lex->sql_command == SQLCOM_DROP_PROCEDURE) result= sp_drop_procedure(thd, lex->spname); /* Conditionally writes to binlog */ result= sp_drop_procedure(thd, lex->spname); /* Conditionally writes to binlog */ else result= sp_drop_function(thd, lex->spname); /* Conditionally writes to binlog */ result= sp_drop_function(thd, lex->spname); /* Conditionally writes to binlog */ } else { Loading @@ -4764,6 +4736,8 @@ mysql_execute_command(THD *thd) { if (check_access(thd, DELETE_ACL, "mysql", 0, 1, 0, 0)) goto error; /* Does NOT write to binlog */ if (!(res = mysql_drop_function(thd, &lex->spname->m_name))) { send_ok(thd); Loading @@ -4784,12 +4758,6 @@ mysql_execute_command(THD *thd) switch (result) { case SP_OK: if (mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } send_ok(thd); break; case SP_KEY_NOT_FOUND: Loading Loading @@ -4887,50 +4855,8 @@ mysql_execute_command(THD *thd) { if (end_active_trans(thd)) goto error; if (!(res= mysql_create_view(thd, thd->lex->create_view_mode)) && mysql_bin_log.is_open()) { String buff; const LEX_STRING command[3]= {{ C_STRING_WITH_LEN("CREATE ") }, { C_STRING_WITH_LEN("ALTER ") }, { C_STRING_WITH_LEN("CREATE OR REPLACE ") }}; thd->clear_error(); buff.append(command[thd->lex->create_view_mode].str, command[thd->lex->create_view_mode].length); view_store_options(thd, first_table, &buff); buff.append(STRING_WITH_LEN("VIEW ")); /* Test if user supplied a db (ie: we did not use thd->db) */ if (first_table->db && first_table->db[0] && (thd->db == NULL || strcmp(first_table->db, thd->db))) { append_identifier(thd, &buff, first_table->db, first_table->db_length); buff.append('.'); } append_identifier(thd, &buff, first_table->table_name, first_table->table_name_length); if (lex->view_list.elements) { List_iterator_fast<LEX_STRING> names(lex->view_list); LEX_STRING *name; int i; for (i= 0; name= names++; i++) { buff.append(i ? ", " : "("); append_identifier(thd, &buff, name->str, name->length); } buff.append(')'); } buff.append(STRING_WITH_LEN(" AS ")); buff.append(first_table->source.str, first_table->source.length); thd->binlog_query(THD::STMT_QUERY_TYPE, buff.ptr(), buff.length(), FALSE, FALSE); } /* Conditionally writes to binlog. */ res= mysql_create_view(thd, first_table, thd->lex->create_view_mode); break; } case SQLCOM_DROP_VIEW: Loading @@ -4938,13 +4864,8 @@ mysql_execute_command(THD *thd) if (check_table_access(thd, DROP_ACL, all_tables, 0) || end_active_trans(thd)) goto error; if (!(res= mysql_drop_view(thd, first_table, thd->lex->drop_mode)) && mysql_bin_log.is_open()) { thd->clear_error(); thd->binlog_query(THD::STMT_QUERY_TYPE, thd->query, thd->query_length, FALSE, FALSE); } /* Conditionally writes to binlog. */ res= mysql_drop_view(thd, first_table, thd->lex->drop_mode); break; } case SQLCOM_CREATE_TRIGGER: Loading @@ -4952,6 +4873,7 @@ mysql_execute_command(THD *thd) if (end_active_trans(thd)) goto error; /* Conditionally writes to binlog. */ res= mysql_create_or_drop_trigger(thd, all_tables, 1); /* We don't care about trigger body after this point */ Loading @@ -4964,6 +4886,7 @@ mysql_execute_command(THD *thd) if (end_active_trans(thd)) goto error; /* Conditionally writes to binlog. */ res= mysql_create_or_drop_trigger(thd, all_tables, 0); break; } Loading