Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Programming Sections 14– database transactions and controlling User Access.

Similar presentations


Presentation on theme: "Database Programming Sections 14– database transactions and controlling User Access."— Presentation transcript:

1 Database Programming Sections 14– database transactions and controlling User Access

2 Marge Hohly2 Review  DDL - defines a table and changes to the table  DML - manipulates the data in a table  DCL - controls who can use the table

3 Marge Hohly3 Transactions  Allow users to make changes to data then decide whether to save or not the work.  Database transactions bundle multiple steps into a logical unit.  Transactions consist of one of the following: DML statements which constitute one consistent change to the data. The DML processes include INSERT, UPDATE, DELETE and MERGE one DDL statement such as CREATE, ALTER, DROP, RENAME or TRUNCATE one DCL statement such as GRANT or REVOKE

4 Marge Hohly4 Transactions  COMMIT When user wants to save group of changes and make pending changes permanent  ROLLBACK Discards changes made to database, all pending changes are discarded.  SAVEPOINT Creates a marker in a transaction, which divides the transaction into smaller pieces.  ROLLBACK TO SAVEPOINT Allows user to roll back the current transaction to a specified savepoint. Discards only changes after the SAVEPOINT

5 Marge Hohly5

6 6 Example UPDATE d_cds SET cd_number = 96 WHERE title = 'Graduation Songbook'; SAVEPOINT one INSERT INTO d_cds(cd_number, title, producer, year) VALUES(100, 'Go For It', 'The Music Man', 2004) ); UPDATE d_cds SET cd_number = 101 ROLLBACK TO SAVEPOINT one COMMIT;

7 Marge Hohly7

8 8

9 9

10 10

11 Marge Hohly11

12 Marge Hohly12

13 Marge Hohly13

14 Marge Hohly14

15 Marge Hohly15

16 Marge Hohly16

17 Marge Hohly17

18 Marge Hohly18

19 Terminology  Transaction  Commit  Savepoint  Rollback  Read consistency  Locks Marge Hohly19


Download ppt "Database Programming Sections 14– database transactions and controlling User Access."

Similar presentations


Ads by Google