content_image/727100.jpg content_image/727099.jpg
is the database that is checked. If the statement has been logged using the statement format, the default database (specified with a USE  statement) is the database that is checked. 

<img src='content_image/727100.jpg'>

For replication, the steps involved are listed here: 

1. Which logging format is used? 

• STATEMENT.  Test the default database. 

• ROW.  Test the database affected by the changes. 

2. Are there any --replicate-do-db  options? 

• Yes.  Does the database match any of them? 

• Yes.  Continue to Step 4. 

• No.  Ignore the update and exit. 

• No.  Continue to step 3. 

3. Are there any --replicate-ignore-db  options? 

• Yes.  Does the database match any of them? 

• Yes.  Ignore the update and exit. 

• No.  Continue to step 4. 

• No.  Continue to step 4. 

## Note 

Only DML statements can be logged using the row format. DDL statements are always logged as statements, even when binlog_format=ROW . All DDL statements are therefore always filtered according to the rules for statement-based replication. This means that you must select the default database explicitly with a USE  statement in order for a DDL statement to be applied. 

4. Proceed to checking the table-level replication options, if there are any. For a description of how these options are checked, see Section 17.2.5.2, “Evaluation of Table-Level Replication Options” . 

<img src='content_image/727099.jpg'>

For binary logging, the steps involved are listed here: 

1. Are there any --binlog-do-db  or --binlog-ignore-db  options? 

• Yes.  Continue to step 2. 

• No.  Log the statement and exit. 

2. Is there a default database (has any database been selected by USE )? 

• Yes.  Continue to step 3. 

## Important 

A statement that is still permitted at this stage is not yet actually executed. The statement is not executed until all table-level options (if any) have also been checked, and the outcome of that process permits execution of the statement. 

