~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/commit.rst

Does not work (compile issue in plugin).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
COMMIT
2
 
======
3
 
 
4
 
COMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]
5
 
 
6
 
Calling COMMIT will cause the current transaction to save itself.
7
 
 
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.
15
 
 
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.
20
 
 
21
 
An example:
22
 
 
23
 
.. code-block:: mysql
24
 
 
25
 
        START TRANSACTION;
26
 
 
27
 
        INSERT INTO popular_sites (url, id)
28
 
                VALUES ('flickr.com', 07);
29
 
 
30
 
        INSERT INTO popular_sites (url, id)
31
 
                VALUES ('twitter.com', 10);
32
 
 
33
 
        SELECT * FROM popular_sites;
34
 
 
35
 
+-----+---------------+-------+---------------------+
36
 
| id  | url           | notes | accessed            |
37
 
+=====+===============+=======+=====================+
38
 
| 07  | flickr.com    | NULL  | 2011-02-03 08:33:31 |
39
 
+-----+---------------+-------+---------------------+
40
 
| 10  | twitter.com   | NULL  | 2011-02-03 08:39:16 |
41
 
+-----+---------------+-------+---------------------+
42
 
 
43
 
Then to save the information just inserted, simply issue the COMMIT command:
44
 
 
45
 
.. code-block:: mysql
46
 
 
47
 
        COMMIT;