Presentation is loading. Please wait.

Presentation is loading. Please wait.

Implicit Commit 13.3.3. Statements That Cause an Implicit Commit The statements listed in this section (and any synonyms for them) implicitly end any transaction.

Similar presentations


Presentation on theme: "Implicit Commit 13.3.3. Statements That Cause an Implicit Commit The statements listed in this section (and any synonyms for them) implicitly end any transaction."— Presentation transcript:

1 Implicit Commit 13.3.3. Statements That Cause an Implicit Commit The statements listed in this section (and any synonyms for them) implicitly end any transaction active in the current session, as if you had done a COMMIT before executing the statement.COMMIT Data definition language (DDL) statements that define or modify database objects. ALTER TABLE, CREATE INDEX, DROP INDEX, DROP TABLE, RENAME TABLE.ALTER TABLECREATE INDEXDROP INDEXDROP TABLERENAME TABLE ALTER TABLE, CREATE TABLE, and DROP TABLE do not commit a transaction if the TEMPORARY keyword is used. (This does not apply to other operations on temporary tables such as CREATE INDEX, which do cause a commit.) However, although no implicit commit occurs, neither can the statement be rolled back. Therefore, use of such statements will violate transaction atomicity: For example, if you use CREATE TEMPORARY TABLE and then roll back the transaction, the table remains in existence. ALTER TABLECREATE TABLEDROP TABLECREATE INDEXCREATE TEMPORARY TABLE The CREATE TABLE statement in InnoDB is processed as a single transaction. This means that a ROLLBACK from the user does not undo CREATE TABLE statements the user made during that transaction.CREATE TABLEROLLBACKCREATE TABLE Beginning with MySQL 5.0.8, CREATE TABLE, CREATE DATABASE DROP DATABASE, and TRUNCATE TABLE cause an implicit commit.CREATE TABLECREATE DATABASEDROP DATABASETRUNCATE TABLE Beginning with MySQL 5.0.13, ALTER PROCEDURE, CREATE PROCEDURE, and DROP PROCEDURE cause an implicit commit.ALTER PROCEDURECREATE PROCEDUREDROP PROCEDURE Also beginning with MySQL 5.0.13, ALTER FUNCTION, CREATE FUNCTION and DROP FUNCTION cause an implicit commit when used with stored functions, but not with UDFs. (ALTER FUNCTION can only be used with stored functions.)ALTER FUNCTIONCREATE FUNCTIONDROP FUNCTIONALTER FUNCTION Beginning with MySQL 5.0.15, ALTER VIEW, CREATE TRIGGER, CREATE VIEW, DROP TRIGGER, and DROP VIEW cause an implicit commit.ALTER VIEWCREATE TRIGGERCREATE VIEWDROP TRIGGERDROP VIEW Statements that implicitly use or modify tables in the mysql database. Beginning with MySQL 5.0.15, CREATE USER, DROP USER, and RENAME USER cause an implicit commit.CREATE USERDROP USERRENAME USER Transaction-control and locking statements. BEGIN, LOCK TABLES, SET autocommit = 1 (if the value is not already 1), START TRANSACTION, UNLOCK TABLES.BEGINLOCK TABLESSTART TRANSACTIONUNLOCK TABLES UNLOCK TABLES commits a transaction only if any tables currently have been locked with LOCK TABLES. This does not occur for UNLOCK TABLES following FLUSH TABLES WITH READ LOCK because the latter statement does not acquire table-level locks. UNLOCK TABLESLOCK TABLESUNLOCK TABLESFLUSH TABLES WITH READ LOCK Transactions cannot be nested. This is a consequence of the implicit commit performed for any current transaction when you issue a START TRANSACTION statement or one of its synonyms.START TRANSACTION Statements that cause an implicit commit cannot be used in an XA transaction while the transaction is in an ACTIVE state. The BEGIN statement differs from the use of the BEGIN keyword that starts a BEGIN... END compound statement. The latter does not cause an implicit commit. See Section 13.6.1, “BEGIN... END Compound-Statement Syntax”.BEGINBEGIN... ENDSection 13.6.1, “BEGIN... END Compound-Statement Syntax” Data loading statements. LOAD MASTER DATA, LOAD DATA INFILE. Before MySQL 5.0.26, LOAD DATA INFILE caused an implicit commit for all storage engines. As of MySQL 5.0.26, it causes an implicit commit only for tables using the NDB storage engine. For more information, see Bug #11151.LOAD DATA INFILE NDB

2 How to view all the tables in the databse use testdb; show tables; Pls note the colon at the end of the line


Download ppt "Implicit Commit 13.3.3. Statements That Cause an Implicit Commit The statements listed in this section (and any synonyms for them) implicitly end any transaction."

Similar presentations


Ads by Google