~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/dynamic.rst

  • Committer: Lee Bieber
  • Date: 2011-02-16 14:48:10 UTC
  • mfrom: (2172.1.5 build)
  • Revision ID: kalebral@gmail.com-20110216144810-u3w6f3a5s6qwisrz
Merge Stewart - remove unused macros
Merge Olaf - remove old style casts
Merge Stewart remove  unused macros in drizzledump
Merge Andrew - 718657: Several errors in Date/Time docs
Merge Olaf - Move strfunc functions into TYPELIB class

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: ::
 
9
to create SQL in a dynamic manner on the server. An exmaple of this is:
 
10
 
 
11
.. code-block:: mysql
10
12
 
11
13
        SET @var= "SELECT 1";
12
14
        EXECUTE @var;
13
15
 
14
 
You can also omit the variable and just insert the SQL directly: ::
 
16
You can also omit the variable and just insert the SQL directly:
 
17
 
 
18
.. code-block:: mysql
15
19
 
16
20
        EXECUTE "SELECT 1";
17
21
 
19
23
generated and no data will be returned by the execution of the statement.
20
24
 
21
25
If you want to launch the query in a separate session, you can do that with
22
 
the following: ::
 
26
the following:
 
27
 
 
28
.. code-block:: mysql
23
29
 
24
30
        EXECUTE "SELECT 1" CONCURRENT;
25
31