~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
2222.2.1 by Mark Atwood
documentation work
8
A COMMIT statement ends a transaction within Drizzle and makes all
9
changes visible to other users. The order of events is typically to
10
issue a START TRANSACTION statement, execute one or more SQL
11
statements, and then issue a COMMIT statement. Alternatively, a
12
ROLLBACK statement can be issued, which undoes all the work performed
13
since START TRANSACTION was issued. A COMMIT statement will also
14
release any existing savepoints that may be in use.
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
15
2222.2.1 by Mark Atwood
documentation work
16
For example, DML statements do not implicitly commit the current
17
transaction. If a user's DML statements have been used to update some
18
data objects, and the updates need to be permanently recorded in the
19
database, you can use the COMMIT command.
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
20
2194.5.2 by Andrew Hutchings
Fix SQL markup
21
An example:
22
23
.. code-block:: mysql
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
24
25
	START TRANSACTION;
26
27
	INSERT INTO popular_sites (url, id)
1994.4.83 by Marisa Plumb
table update functions edits, starting authentication
28
   		VALUES ('flickr.com', 07);
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
29
30
	INSERT INTO popular_sites (url, id)
1994.4.83 by Marisa Plumb
table update functions edits, starting authentication
31
   		VALUES ('twitter.com', 10);
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
32
33
	SELECT * FROM popular_sites;
34
35
+-----+---------------+-------+---------------------+
36
| id  | url           | notes | accessed            |
37
+=====+===============+=======+=====================+
1994.4.83 by Marisa Plumb
table update functions edits, starting authentication
38
| 07  | flickr.com    | NULL  | 2011-02-03 08:33:31 |
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
39
+-----+---------------+-------+---------------------+
40
| 10  | twitter.com   | NULL  | 2011-02-03 08:39:16 |
41
+-----+---------------+-------+---------------------+
42
2194.5.2 by Andrew Hutchings
Fix SQL markup
43
Then to save the information just inserted, simply issue the COMMIT command:
44
45
.. code-block:: mysql
1994.4.82 by Marisa Plumb
additions and updates to transaction docs
46
47
	COMMIT;