~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/dynamic.rst

modified transaction docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
Dynamic SQL allows you to execute DDL statements (and other SQL statements) that are not supported in purely static SQL programs.
7
7
 
8
8
In Drizzle you can use the EXECUTE command along with :doc:'user defined variables <variables>'
9
 
to create SQL in a dynamic manner on the server. An exmaple of this is:
10
 
 
11
 
.. code-block:: mysql
 
9
to create SQL in a dynamic manner on the server. An exmaple of this is: ::
12
10
 
13
11
        SET @var= "SELECT 1";
14
12
        EXECUTE @var;
15
13
 
16
 
You can also omit the variable and just insert the SQL directly:
17
 
 
18
 
.. code-block:: mysql
 
14
You can also omit the variable and just insert the SQL directly: ::
19
15
 
20
16
        EXECUTE "SELECT 1";
21
17
 
23
19
generated and no data will be returned by the execution of the statement.
24
20
 
25
21
If you want to launch the query in a separate session, you can do that with
26
 
the following:
27
 
 
28
 
.. code-block:: mysql
 
22
the following: ::
29
23
 
30
24
        EXECUTE "SELECT 1" CONCURRENT;
31
25
 
32
26
The query will run in a new session and will execute as the user that
33
27
launched it. It can be killed via KILL and the system limit on total number
34
28
of sessions will be enforced.
35
 
 
36
 
.. todo::
37
 
 
38
 
   EXECUTE executes the statements inside an explicit transaction.