~drizzle-trunk/drizzle/development

1887.3.2 by Brian Aker
Extended documentation.
1
COMMIT
1994.5.31 by Stewart Smith
just a syntax fix
2
======
1887.3.2 by Brian Aker
Extended documentation.
3
4
COMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]
5
6
Calling COMMIT will cause the current transaction to save itself.
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
7
8
A COMMIT statement ends a transaction within Drizzle and makes all changes visible to other users. The order of events is typically to issue a START TRANSACTION statement, execute one or more SQL statements, and then issue a COMMIT statement. Alternatively, a ROLLBACK statement can be issued, which undoes all the work performed since START TRANSACTION was issued. A COMMIT statement will also release any existing savepoints that may be in use.
9
10
For example, DML statements do not implicitly commit the current transaction. If a user's DML statements have been used to update some data objects, and the updates need to be permanently recorded in the database, you can use the COMMIT command.
11
12
An example: ::
13
14
	START TRANSACTION;
15
16
	INSERT INTO popular_sites (url, id)
1994.4.83 by Marisa Plumb
table update functions edits, starting authentication
17
   		VALUES ('flickr.com', 07);
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
18
19
	INSERT INTO popular_sites (url, id)
1994.4.83 by Marisa Plumb
table update functions edits, starting authentication
20
   		VALUES ('twitter.com', 10);
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
21
22
	SELECT * FROM popular_sites;
23
24
+-----+---------------+-------+---------------------+
25
| id  | url           | notes | accessed            |
26
+=====+===============+=======+=====================+
1994.4.83 by Marisa Plumb
table update functions edits, starting authentication
27
| 07  | flickr.com    | NULL  | 2011-02-03 08:33:31 |
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
28
+-----+---------------+-------+---------------------+
29
| 10  | twitter.com   | NULL  | 2011-02-03 08:39:16 |
30
+-----+---------------+-------+---------------------+
31
32
Then to save the information just inserted, simply issue the COMMIT command: ::
33
34
	COMMIT;