Merge lp:~sharan-monikantan/drizzle/drizzletest_docs into lp:drizzle

Proposed by Sharan Kumar
Status: Merged
Merged at revision: 2571
Proposed branch: lp:~sharan-monikantan/drizzle/drizzletest_docs
Merge into: lp:drizzle
Diff against target: 1688 lines (+1673/-0)
2 files modified
docs/index.rst (+1/-0)
docs/testing/drizzletest_commands.rst (+1672/-0)
To merge this branch: bzr merge lp:~sharan-monikantan/drizzle/drizzletest_docs
Reviewer Review Type Date Requested Status
Patrick Crews Needs Fixing
Henrik Ingo Pending
Review via email: mp+112656@code.launchpad.net

Description of the change

Compiled the documentation for drizzletest.

To post a comment you must log in.
Revision history for this message
Patrick Crews (patrick-crews) wrote :

Need to remove the bulk of the text as it is too close to the original docs.
The API calls can remain, but any detail text should be worked on as 'clean room' design - borrow nothing from the MySQL docs...explore and document on your own.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/index.rst'
2--- docs/index.rst 2012-03-16 23:58:53 +0000
3+++ docs/index.rst 2012-06-28 21:24:22 +0000
4@@ -157,6 +157,7 @@
5 testing/sysbench.rst
6 testing/writing_tests.rst
7 testing/dbqp.rst
8+ testing/drizzletest_commands.rst
9
10 Indices and tables
11 ==================
12
13=== added file 'docs/testing/drizzletest_commands.rst'
14--- docs/testing/drizzletest_commands.rst 1970-01-01 00:00:00 +0000
15+++ docs/testing/drizzletest_commands.rst 2012-06-28 21:24:22 +0000
16@@ -0,0 +1,1672 @@
17+Drizzletest Commands
18+====================
19+
20+The commands that are endorsed in Drizzletest are delineated in the following documentation. Examples are given for the commands. Browse **tests/t** for more examples.
21+
22+.. note:: The commands are not case sensitive
23+
24+List of commands
25+----------------
26+
27+* :ref:`append_file`
28+* :ref:`cat_file`
29+* :ref:`change_user`
30+* :ref:`character_set`
31+* :ref:`chmod`
32+* :ref:`connect`
33+* :ref:`connection`
34+* :ref:`copy_file`
35+* :ref:`dec`
36+* :ref:`delimiter`
37+* :ref:`die`
38+* :ref:`diff_files`
39+* :ref:`dirty_close`
40+* :ref:`disable/enable_abort_on_error`
41+* :ref:`disable/enable_connect_log`
42+* :ref:`disable/enable_info`
43+* :ref:`disable/enable_metadata`
44+* :ref:`disable/enable_parsing`
45+* :ref:`disable/enable_ps_protocol`
46+* :ref:`disable/enable_query_log`
47+* :ref:`disable/enable_reconnect`
48+* :ref:`disable/enable_result_log`
49+* :ref:`disable/enable_rpl_parse`
50+* :ref:`disable/enable_warnings`
51+* :ref:`disconnect`
52+* :ref:`echo`
53+* :ref:`end`
54+* :ref:`end_timer`
55+* :ref:`error`
56+* :ref:`eval`
57+* :ref:`exec`
58+* :ref:`exit`
59+* :ref:`file_exists`
60+* :ref:`horizontal_results`
61+* :ref:`if`
62+* :ref:`inc`
63+* :ref:`let`
64+* :ref:`mkdir`
65+* :ref:`list_files`
66+* :ref:`list_files_append_file`
67+* :ref:`list_files_write_file`
68+* :ref:`lowercase_result`
69+* :ref:`move_file`
70+* :ref:`perl`
71+* :ref:`ping`
72+* :ref:`query`
73+* :ref:`query_get_value`
74+* :ref:`query_horizontal`
75+* :ref:`query_vertical`
76+* :ref:`real_sleep`
77+* :ref:`reap`
78+* :ref:`remove_file`
79+* :ref:`remove_files_wildcard`
80+* :ref:`replace_column`
81+* :ref:`replace_regex`
82+* :ref:`replace_result`
83+* :ref:`require`
84+* :ref:`result`
85+* :ref:`rmdir`
86+* :ref:`save_master_pos`
87+* :ref:`send`
88+* :ref:`send_eval`
89+* :ref:`send_quit`
90+* :ref:`shutdown_server`
91+* :ref:`skip`
92+* :ref:`sleep`
93+* :ref:`sorted_result`
94+* :ref:`source`
95+* :ref:`start_timer`
96+* :ref:`sync_slave_with_master`
97+* :ref:`sync_with_master`
98+* :ref:`system`
99+* :ref:`vertical_results`
100+* :ref:`wait_for_slave_to_stop`
101+* :ref:`while`
102+* :ref:`write_file`
103+
104+.. _append_file:
105+
106+append_file
107+-----------
108+:Syntax:
109+
110+:program:`append_file file_name [terminator]`
111+
112+`append_file` is similar to
113+:ref:`write_file`
114+except for the text untill the ``[terminator]`` are appended to the end of the existing file. If the file ``file_name`` does not exist, a new file with the name ``file_name`` is created first. The file name can be substituted with variables.
115+
116+:Example:
117+
118+.. code-block:: python
119+
120+ write_file $TMP_DIR/file1;
121+ writing line one
122+ writing line two
123+ EOF
124+ append_file $TMP_DIR/file1;
125+ appending line three
126+ EOF
127+
128+ write_file $TMP_DIR/file2 END_OF_FILE;
129+ writing line one
130+ writing line two
131+ END_OF_FILE
132+ append_file $TMP_DIR/file2 END_OF_FILE;
133+ appending line three
134+ END_OF_FILE
135+
136+.. _cat_file:
137+
138+cat_file
139+--------
140+
141+:Syntax:
142+
143+:program:`cat_file file_name`
144+
145+`cat_file` is used to display the contents of the file ``file_name`` on to the console output.
146+
147+:Example:
148+
149+.. code-block:: python
150+
151+ cat_file $TMP_DIR/file1;
152+ displaying line one
153+ displaying line two
154+ .
155+ .
156+ displaying line n
157+ EOF
158+
159+.. _change_user:
160+
161+change_user
162+-----------
163+
164+:Syntax:
165+
166+:program:`change_user [user_name], [password], [db_name]`
167+
168+`change_user` changes the current user to the one specified by ``user_name``, sets ``password`` as the password and makes the database specified by ``db_name`` as the default database for the current connection
169+
170+:Example:
171+
172+.. code-block:: python
173+
174+ change_user root;
175+ (changes the current user to root)
176+ change_user root,passwd;
177+ (changes the current user to root and makes passwd as the password
178+ change_user root,passwd,drizzle
179+ (changes the current user to root, makes passwd as the password and drizzle as the default database)
180+
181+.. _character_set:
182+
183+character_set
184+-------------
185+
186+:Syntax:
187+
188+:program:`character_set charset_name`
189+
190+`character_set` sets the default character set to the one specified by ``charset_name``. By default the character set is ``latin1``
191+
192+:Example:
193+
194+.. code-block:: python
195+
196+ character_set utf8;
197+ --character_set sjis
198+
199+.. _chmod:
200+
201+chmod
202+-----
203+
204+:Syntax:
205+
206+:program:`chmod octal_mode file_name`
207+
208+`chmod` changes the access priviledges of the file ``file_name``. The file mode is given by a 4 digit octal number ``octal_mode``. Variables can be used to specify the file.
209+
210+:Example:
211+
212+.. code-block:: python
213+
214+ chmod 0777 $TMP_DIR/file1;
215+ The above command makes the file *file1* as readable, writable and executable by all users.
216+
217+
218+.. _connect:
219+
220+connect
221+-------
222+
223+:Syntax:
224+
225+:program:`connect (name, host_name, user_name, password, db_name [,port_num [,socket [,options [,default_auth]]]])`
226+
227+`connect` opens a connection specified by the arguments and makes it the current connection. The various arguments are
228+
229+``name`` is the name given to the connection. This name can be used with command like ``connection``, ``disconnect`` and ``dirty_close``. The ``name`` must not be currently in use by another open connection
230+
231+``host_name`` refers to the host on which the server is running
232+
233+``user_name`` and ``password`` are the username and the corresponding password for Drizzle account to use.
234+
235+``db_name`` is the name of the default database to be used. :program:`*NO-ONE*` indicates that, no default database should be selected. This argument can also be left blank to select no database.
236+
237+``port_num`` is the TCP/IP port number to use for the connection. The argument is optional. It can also be specified by a variable.
238+
239+``socket`` is the socket file to use for connections to localhost. This argument is optional. The value can also be given by a variable.
240+
241+``options`` can be one or more of the words SSL and COMPRESS, separated by white spaces. They specify the use of SSL and the compressed clien/server protocol, respectively
242+
243+``default_auth`` refers to the authentication plugin name. It is passed to mysql_options() C API function using MYSQL_DEFAULT_AUTH option. The option --plugin-dir can be used to specify in which directory, the plugin resides.
244+
245+.. note:: In order to omit an argument, leave it as blank(white spaces). An empty string replaces its position. If a port number / socket options is omitted, the default port / socket is chosen.
246+
247+.. code-block:: python
248+
249+ connect(conn1,localhost,root,,);
250+ connect(conn2,localhost,root,mypass,test);
251+ connect(conn3,127.0.0.1,root,,test,$MASTER_MYPORT);
252+
253+.. note:: If a connection fails initially, and if the abort-on-error flag is set, then five retries are done to establish the connection.
254+
255+.. _connection:
256+
257+connection
258+----------
259+
260+:Syntax:
261+
262+:program:`connection connection_name`
263+
264+``connection`` creates ``connection_name`` as the current connection. The connection_name can be specified by variables. Specifying the connection_name as ``default`` creates the connections that drizzletest opens when it starts.
265+
266+:Example:
267+
268+.. code-block:: python
269+
270+ connection default;
271+ connection conn;
272+ connection root;
273+
274+.. _copy_file:
275+
276+copy_file
277+---------
278+
279+:Syntax:
280+
281+:program:`copy_file from_file to_file`
282+
283+`copy_file` copies the contents of `from_file` into `to_file`. If the file `to_file` exists, then the command fails to execute. The names of the files can be provided through variables.
284+
285+:Example:
286+
287+.. code-block:: python
288+
289+ copy_file source_file1.txt dest_file.txt;
290+ copy_file source_file2.txt dest_file.txt; (this command will not execute since dest_file.txt already exists)
291+
292+.. _dec:
293+
294+dec
295+---
296+
297+:Syntax:
298+
299+:program:`dec $variable_name`
300+
301+``dec`` command is used to decrement the numeric value of a variable. If the variable does not have a numeric value associated with it, the result is undefined.
302+
303+:Example:
304+
305+.. code-block:: python
306+
307+ dec $100;
308+ dec $count_value;
309+
310+.. _delimiter:
311+
312+delimiter
313+---------
314+
315+:Syntax:
316+
317+:program:`delimiter string`
318+
319+``delimiter`` makes the ``string`` specified, as the default delimiter for the commands. The string can consist of 1 to 15 characters. The default delimiter for commands is semicolon(;)
320+
321+:Example:
322+
323+.. code-block:: python
324+
325+ delimiter /;
326+ delimeter stop;
327+
328+.. note:: Changing the delimiter becomes handy when we need to use a long SQL statement like the ``CREATE PROCEDURE`` which includes a semicolon delimited statement, but to be considered as a single statement.
329+
330+To reset the previous default delimiter, we can use ``delimiter ;|``
331+
332+.. _die:
333+
334+die
335+---
336+
337+:Syntax:
338+
339+:program:`die [message]`
340+
341+``die`` command kills the test with appropriate error code. It also prints the message given as argument, as the reason for killing the test.
342+
343+:Example:
344+
345+.. code-block:: python
346+
347+ die cannot continue;
348+ drizzletest: At line 1: cannot continue
349+ not ok
350+
351+When this command is executed, the test is killed and the message for killing the test is also displayed.
352+
353+.. _diff_files:
354+
355+diff_files
356+----------
357+
358+:Syntax:
359+
360+:program:`diff_files file_name1 file_name2`
361+
362+``diff_files`` compares the two files given as arguments. That is ``file_name1`` and ``file_name2``. The command succeeds only if the two files are same. Else if the files are different or if either file does not exist, the command fails. The file names can be specified with variables.
363+
364+:Example:
365+
366+.. code-block:: python
367+
368+ diff_files file_data1 file_data2;
369+
370+.. _dirty_close:
371+
372+dirty_close
373+-----------
374+
375+:Syntax:
376+
377+:program:`dirty_close connection_name`
378+
379+``dirty_close`` closes the connection specified by ``connection_name``. This command is similar to ``disconnect``. However, this command calls ``vio_delete()`` prior to closing the connection. The connection_name can be specified via a variable.
380+
381+.. note:: If the ``connection_name`` refers to a current connection, then ``connection`` command must be used to swithch to a different(new) connection before executing any further SQL statements.
382+
383+.. _disable/enable_abort_on_error:
384+
385+disable/enable_abort_on_error
386+-----------------------------
387+
388+:Syntax:
389+
390+:program:`disable_abort_on_error,enable_abort_on_error`
391+
392+This command is used to enable / disable the ``abort-on-error`` behavior. When this setting is enabled, drizzletest aborts the test, when an unexpected error is produced by a statement. In this case, the ``.reject`` file is not generated.
393+
394+.. note:: The setting is enabled by default.
395+
396+:Example:
397+
398+.. code-block:: python
399+
400+ --disable_abort_on_error
401+ --enable_abort_on_error
402+
403+.. _disable/enable_connect_log:
404+
405+disable/enable_connect_log
406+--------------------------
407+
408+:Syntax:
409+
410+:program:`disable_connect_log, enable_connect_log`
411+
412+This command is used to enable / disable logging of connection details such as, when the connection was created, switch of connections etc. When this setting is enabled, drizzletest enters the details about the connection in the test results.
413+
414+.. note:: The setting is disabled by default.
415+
416+.. note:: If the query logging is disabled using ``disable_query_log``, connection logging is also automatically turned off, untill query logging is enabled.
417+
418+:Example:
419+
420+.. code-block:: python
421+
422+ --disable_connect_log
423+ --enable_connect_log
424+
425+.. _disable/enable_info:
426+
427+disable/enable_info
428+-------------------
429+
430+:Syntax:
431+
432+:program:`disable_info, enable_info`
433+
434+This command enables / disables the displaying of additional information about the SQL statement results. When this setting is enabled, drizzletest displays the affected rows count. The ``affected-rows`` value is the number of rows selected from statements such as ``SELECT``.
435+
436+.. note:: The setting is disabled by default.
437+
438+:Example:
439+
440+.. code-block:: python
441+
442+ --disable_info
443+ --enable_info
444+
445+.. _disable/enable_metadata:
446+
447+disable/enable_metadata
448+-----------------------
449+
450+:Syntax:
451+
452+:program:`disable_metadata, enable_metadata`
453+
454+This command disables / enables the ``query metadata`` display. When this setting is enabled, drizzletest adds the query metadata to the result. The metadata consists of values corresponding to MYSQL_FIELD C API data structure.
455+
456+.. note:: The setting is disabled by default
457+
458+:Example:
459+
460+.. code-block:: python
461+
462+ --disable_metadata
463+ --enable_metadata
464+
465+.. _disable/enable_parsing:
466+
467+disable/enable_parsing
468+----------------------
469+
470+:Syntax:
471+
472+:program:`disable_parsing, enable_parsing`
473+
474+This command enables / disables ``query parsing``. These commands are useful when we want to ``comment out`` (deactivate) a piece of code from the test case, without performing the hectic task of adding comment marker to each line.
475+
476+.. note:: The setting is enabled by default
477+
478+:Example:
479+
480+.. code-block:: python
481+
482+ --disable_parsing
483+ --enable_parsing
484+
485+.. _disable/enable_ps_protocol:
486+
487+disable/enable_ps_protocol
488+--------------------------
489+
490+:Syntax:
491+
492+:program:`disable_ps_protocol, enable_ps_protocol`
493+
494+This command enables / disables ``prepared-statement protocol``.
495+
496+.. note:: The setting is disabled by default
497+
498+:Example:
499+
500+.. code-block:: python
501+
502+ --disable_ps_protocol
503+ --enable_ps_protocol
504+
505+.. _disable/enable_query_log:
506+
507+disable/enable_query_log
508+------------------------
509+
510+:Syntax:
511+
512+:program:`disable_query_log, enable_query_log`
513+
514+This command enables / disables ``query logging``. When this setting is enabled, drizzletest displays the SQL statements, given as input, in the test results. Disabling this option will reduce the size of the test result produced. This in turn, reduces the complexity of comparing the actual test results with the expected ones.
515+
516+.. note:: The setting is enabled by default.
517+
518+:Example:
519+
520+.. code-block:: python
521+
522+ --disable_query_log
523+ --enable_query_log
524+
525+.. _disable/enable_reconnect:
526+
527+disable/enable_reconnect
528+------------------------
529+
530+:Syntax:
531+
532+:program:`disable_reconnect, enable_reconnect`
533+
534+This command is used to enable / disable the ``automatic reconnection`` to a connection which has failed to connect. The automatic reconnection applies only to the ``current connection``.
535+
536+.. note:: The default setting depends on client library version
537+
538+:Example:
539+
540+.. code-block:: python
541+
542+ --disable_reconnect
543+ --enable_reconnect
544+
545+.. _disable/enable_result_log:
546+
547+disable/enable_result_log
548+-------------------------
549+
550+:Syntax:
551+
552+:program:`disable_result_log, enable_result_log`
553+
554+This command enables / disables the ``logging of results``. Enabling this setting will allow drizzletest to display the query results. It also displays the results from command like ``echo`` and ``exec``
555+
556+.. note:: The setting is enabled by default
557+
558+:Example:
559+
560+.. code-block:: python
561+
562+ --disable_result_log
563+ --enable_result_log
564+
565+.. _disable/enable_rpl_parse:
566+
567+disable/enable_rpl_parse
568+------------------------
569+
570+:Syntax:
571+
572+:program:`disable_rpl_parse, enable_rpl_parse`
573+
574+This command enables / disables the parsing of statements that allow the statemtents to go to the master or the slave.
575+
576+.. note:: The default setting depends on the C API library
577+
578+:Example:
579+
580+.. code-block:: python
581+
582+ --disable_rpl_parse
583+ --enable_rpl_parse
584+
585+.. _disable/enable_warnings:
586+
587+disable/enable_warnings
588+-----------------------
589+
590+:Syntax:
591+
592+:program:`disable_warnings, enable_warnings`
593+
594+This command enables / disables the display of warnings. When this setting is enabled, drizzletest displays the warnings produced by any SQL statements using the ``SHOW WARNINGS``
595+
596+.. note:: The setting is enabled by default
597+
598+:Example:
599+
600+.. code-block:: python
601+
602+ --disable_warnings
603+ --enable_warnings
604+
605+.. _disconnect:
606+
607+disconnect
608+----------
609+
610+:Syntax:
611+
612+:program:`disconnect connection_name`
613+
614+``disconnect`` closes (terminates) the connection specified by ``connection_name``. If a current connection is closed, then another connection must be created, or switched to another existing connection using the ``connection`` command, before executing any SQL statements.
615+
616+:Example:
617+
618+.. code-block:: python
619+
620+ disconnect conn;
621+
622+.. _echo:
623+
624+echo
625+----
626+
627+:Syntax:
628+
629+:program:`echo text`
630+
631+``echo`` is used to echo the text of test results. Variables can be used in the text. In that case, the value referenced by the variable will be displayed.
632+
633+.. note:: Quotation marks are not need around the text. If they are included, then they are included in the output.
634+
635+:Example:
636+
637+.. code-block:: python
638+
639+ --echo another sql_mode test
640+ echo should return only 1 row;
641+
642+.. _end:
643+
644+end
645+---
646+
647+:Syntax:
648+
649+:program:`end`
650+
651+``end`` is used to close a block, such as an if / while block. If there is no block open, then drizzletest exits with an error.
652+
653+.. note:: } and ``end`` are considered as the same
654+
655+.. _end_timer:
656+
657+end_timer
658+---------
659+
660+:Syntax:
661+
662+:program:`end_timer`
663+
664+``end_timer`` is used to stop the running timer. Usually, the timer stops only when drizzletest exits.
665+
666+.. _error:
667+
668+error
669+-----
670+
671+:Syntax:
672+
673+:program:`error error_code [,error_code[,...]]`
674+
675+``error`` is used to specify the expected error values that might be returned by the next command that is executed. The error_codes are specific to drizzle error numbers or SQLSTATE value. If we specify a SQLSTATE value, then it should start with an ``s`` so that drizzletest can differentiate it from the drizzle error number.
676+
677+:Example:
678+
679+Errors ``1050`` and ``42S01`` are the same.
680+
681+.. note:: SQLSTATE values must be five characters long. It should contain only uppercase alphabets and numbers.
682+
683+.. note:: There are symbolic error representation, in the drizzle_error.h file.
684+
685+:Example:
686+
687+.. code-block:: python
688+
689+ --error ER_TABLE_EXISTS_ERROR
690+
691+If an error other than the ones specified by the ``error`` command occurs, then drizzletest aborts and displays the error message which the drizzle server reports. However, if an error which has been specified in the ``error`` command occurs, then drizzletest does not abort, but displays a message to the result output.
692+
693+.. note:: If one error value is given in the command, then if a command fails with that error during the test, drizzletest reports the error message specific to that error
694+
695+.. code-block:: python
696+
697+ --error S42S02
698+ DROP TABLE table_name;
699+
700+ ERROR 42S02: Unknown table 'table_name'
701+
702+.. note:: If more than one value is given in the command, then if a command fails with any one of the error specified, drizzletest gives a generic report.
703+
704+.. code-block:: python
705+
706+ --error S41S01,S42S02
707+ DROP TABLE table_name;
708+
709+ Got one of the listed errors
710+
711+Error value 0 / S00000 is equivalent to ``no error``. So to indicate that, we expect a success, we can specify this value in the error list.
712+
713+.. note:: If this value is put in other than first positions, then, the test will abort if the statement executes successfully.
714+
715+Other uses of error is to specify shell status values for testing shell commands that are executed via exec command. But this does not apply for system command.
716+
717+If ``error`` is used in combination with other commands like ``reap`` and ``send``, then ``error`` should always used just before ``reap``.
718+
719+.. _eval:
720+
721+eval
722+----
723+
724+:Syntax:
725+
726+:program:`eval statement`
727+
728+``eval`` command replaces all the variables within the statement with their corresponding values. This processed statement is then sent to the server for execution. In short, eval provides ``variable expansion`` unlike using just ``statement`` alone.
729+
730+.. note:: In order to specify a `$` character, use \$.
731+
732+:Example:
733+
734+.. code-block:: python
735+
736+ eval USE $DB;
737+ eval CHANGE MASTER TO MASTER_PORT=$SLAVE_MYPORT;
738+ eval PREPARE STMT FROM "$stmt_1";
739+
740+.. _exec:
741+
742+exec
743+----
744+
745+:Syntax:
746+
747+:program:`exec command [arg1[,arg2[,...]]]`
748+
749+``exec`` executes shell commands using the ``popen()`` library call. Variables used in the command are replaced by their corresponding values. In order to specify a `$` character, use \$
750+
751+.. note:: In Cygwin, the commands are executed from cmd.exe. Some commands such as the ``rm`` cannot be executed using exec. For such cases, use ``system`` command.
752+
753+:Example:
754+
755+.. code-block:: python
756+
757+ --exec $MYSQL_DUMP --xml --skip-create test
758+ --exec rm $MYSQLTEST_VARDIR/tmp/t1
759+ exec $MYSQL_SHOW test -v -v;
760+
761+.. note:: exec and system commands may perform file system operations. But in that case, the test portability is reduced because, the commands tend to be OS specific. In the motive of providing portability, drizzletest makes available several commands like remove_file, chmod_file, mkdir etc.
762+
763+.. _exit:
764+
765+exit
766+----
767+
768+:Syntax:
769+
770+:program:`exit`
771+
772+``exit`` terminates a test. However, the termination is considered as normal and will not consider it as a failure.
773+
774+.. _file_exists:
775+
776+file_exists
777+-----------
778+
779+:Syntax:
780+
781+:program:`file_exists file_name`
782+
783+``file_exists`` returns true if the file ``file_name`` exists, else it returns false. The file name can be provided via variable substitution.
784+
785+:Example:
786+
787+.. code-block:: python
788+
789+ file_exists /etc/passwd;
790+
791+.. _horizontal_results:
792+
793+horizontal_results
794+------------------
795+
796+:Syntax:
797+
798+:program:`horizontal_results`
799+
800+``horizontal_results`` displays the query results in horizontal format. By default, the results are displayed horizontally.
801+
802+:Example:
803+
804+.. code-block:: python
805+
806+ --horizontal_results
807+
808+.. _if:
809+
810+if
811+--
812+
813+:Syntax:
814+
815+:program:`if(expr)`
816+
817+``if`` begins an if block. drizzletest executes the block if the condition / expression evaluates to a non-zero number. The block ends with ``end`` of ``}``.
818+
819+.. note:: if block doesn't have an else block
820+
821+:Example:
822+
823+.. code-block:: python
824+
825+ let $condition=1;
826+ if($condition)
827+ {
828+ echo if block is executed;
829+ }
830+ if(!$condition)
831+ {
832+ echo if block is not executed;
833+ }
834+
835+.. _inc:
836+
837+inc
838+---
839+
840+:Syntax:
841+
842+:program:`inc $var_name`
843+
844+``inc`` increments a variable of the type integer. If the variable is of any other type, the result is undefined.
845+
846+:Example:
847+
848+.. code-block:: python
849+
850+ inc $var;
851+ inc $10
852+
853+.. _let:
854+
855+let
856+---
857+
858+:Syntax:
859+
860+:program:`let $var_name = value`
861+
862+:program:`let $var_name = query_get_value(query, col_name, row_num)`
863+
864+``let`` command assigns a value to a variable. There are certain naming conventions for the variable names. The names cannot contain whitespaces and/or = character. It can contain numbers from [0-9]. The variable name cannot start with a number.
865+
866+.. note:: variable references within a value are replaced by the corresponding values.
867+
868+.. note:: If the command is issued without beginning with ``--``, then everything upto the command delimiter is assigned as the value to the variable.
869+
870+:Example:
871+
872+.. code-block:: python
873+
874+ --let $var = 100
875+ let $var = 100;
876+
877+.. note:: While we assign strings to a variable, we need not include the string within quotes. Moreover, any quotes included within the string will be treated like normal character.
878+
879+.. note:: For assigning the result of executing a query to a variable, we need to enclose the query withing backticks.
880+
881+:Example:
882+
883+.. code-block:: python
884+
885+ let $query = `SELECT * FROM table_name`;
886+
887+The let command is also used to assign values to environment variables. In such cases, we need to drop the $ character preceeding the variable name.
888+
889+:Example:
890+
891+.. code-block:: python
892+
893+ let ENVIR_VAR = value;
894+
895+This is useful in certain cases, where interaction with the external tools is needed. Example, Perl cannot access the test language variables directly. So we can access it through environment variables.
896+
897+.. code-block:: python
898+
899+ print $ENV{'ENVIR_VAR'};
900+
901+.. _mkdir:
902+
903+mkdir
904+-----
905+
906+:Syntax:
907+
908+:program:`mkdir dir_name`
909+
910+``mkdir`` creates a directory with the name specified by ``dir_name``.
911+
912+.. note:: This command returns 0 for success and returns 1 for failure.
913+
914+:Example:
915+
916+.. code-block:: python
917+
918+ --mkdir repodir
919+
920+.. _list_files:
921+
922+list_files
923+----------
924+
925+:Syntax:
926+
927+:program:`list_files dir_name [pattern]`
928+
929+``list_files`` is used to list all the files in the directory given by ``dir_name``. A pattern can be given optionally. If given, ``list_files`` displays the files in the directory ``dir_name`` and matching the given ``pattern``
930+
931+.. note:: The pattern may contain wildcards
932+
933+:Example:
934+
935+.. code-block:: python
936+
937+ --list_files $MYSQLD_DATADIR/test t1*
938+
939+.. _list_files_append_file:
940+
941+list_files_append_file
942+----------------------
943+
944+:Syntax:
945+
946+:program:`list_files_append_file file_name dir_name [pattern]`
947+
948+``list_files_append_file`` is similar to ``list_file``. Unlike list_file, this command lists the file in the given directory ``dir_name`` and appends the result into a file specified by ``file_name``.
949+
950+.. note:: If the file ``file_name`` is not present, then it is created
951+
952+ A pattern can be given optionally. If given, ``list_files_append_file`` displays the files which match the given ``pattern``.
953+
954+.. note:: The pattern may contain wildcards
955+
956+:Example:
957+
958+.. code-block:: python
959+
960+ --list_files_append_file $DRIZZLE_FILE_LIST_DIR/filelist $DRIZZLE_FILE_LIST_DIR/testdir *.txt;
961+
962+.. _list_files_write_file:
963+
964+list_files_write_file
965+---------------------
966+
967+:Syntax:
968+
969+:program:`list_files_write_file file_name dir_name [pattern]`
970+
971+``list_files_write_file`` is similar to ``list_file_append_file``. Unlike list_file_append_file, this command always writes the result into a new file.
972+
973+.. note:: Even if the file ``file_name`` already exists, a new file will be created and the existing file will be replaced with it.
974+
975+:Example:
976+
977+.. code-block:: python
978+
979+ --list_file_write_file $DRIZZLE_FILE_LIST_DIR/filelist $DRIZZLE_FILE_LIST_DIR/testdir *.txt;
980+
981+.. _lowercase_result:
982+
983+lowercase_result
984+----------------
985+
986+:Syntax:
987+
988+:program:`lowercase_result`
989+
990+``lowercase_result`` will convert the resulting output of executing a SQL command into lowercase characters. This command is useful for achieving consistent results across different platforms.
991+
992+.. note:: This command can be used along with other commands like ``replace`` and ``sorted_result``. In that case, lowercase is performed first and followed by the other command
993+
994+:Example:
995+
996+.. code-block:: python
997+
998+ --lowercase_result
999+
1000+.. _move_file:
1001+
1002+move_file
1003+---------
1004+
1005+:Syntax:
1006+
1007+:program:`move_file from_file to_file`
1008+
1009+``move_file`` will move the file contents from the file specified by ``from_file`` to the file specified by ``to_file``.
1010+
1011+.. note:: move_file actually performs a ``file renaming``.
1012+
1013+The ``from_file`` will be deleted after the contents are moved to the ``to_file``
1014+
1015+.. note:: The filenames can be specified using variables.
1016+
1017+:Example:
1018+
1019+.. code-block:: python
1020+
1021+ move_file $DRIZZLE_FILE_LIST_DIR/source $DRIZZLE_FILE_LIST_DIR/destination.out;
1022+
1023+.. _perl:
1024+
1025+perl
1026+----
1027+
1028+:Syntax:
1029+
1030+:program:`perl [terminator]`
1031+
1032+``perl`` command uses ``Perl`` to execute the lines following this command. This processing ends, when a line with the terminator is reached.
1033+
1034+.. note:: The default terminator is ``EOF``. The terminator can be changed by specifying along with the command.
1035+
1036+:Example:
1037+
1038+.. code-block:: python
1039+
1040+ perl;
1041+ print "using Perl to execute this line";
1042+ EOF
1043+
1044+ perl END;
1045+ print "using Perl to execute till END";
1046+ END
1047+
1048+.. _ping:
1049+
1050+ping
1051+----
1052+
1053+:Syntax:
1054+
1055+:program:`ping`
1056+
1057+``ping`` command pings the server. Whenever this command is issued, the drizzle_ping() API function is invoked.
1058+
1059+.. note:: ping is used to reconnect to a server when the connection is lost.
1060+
1061+.. _query:
1062+
1063+query
1064+-----
1065+
1066+:Syntax:
1067+
1068+:program:`query [statement]`
1069+
1070+``query`` command is used to send a query specified by ``statement`` to the server for execution.
1071+
1072+.. note:: This command is useful when we need to execute a SQL statement which begins with a drizzletest command.
1073+
1074+.. _query_get_value:
1075+
1076+query_get_value
1077+---------------
1078+
1079+:Syntax:
1080+
1081+:program:`query_get_value(query,col_name,row_num)`
1082+
1083+``query_get_value`` is used to extract a value / data from the result set of a query, for example a SELECT statement. This command has three arguments, the first one specifying the query that is to be executed, the second and the third arguments together specify the cell from which the data is to be extracted.
1084+
1085+.. note:: Column names are case sensitive. Row numbers begin with 1. ``query_get_value()`` function always appear to the right side of a variable.
1086+
1087+:Example:
1088+
1089+.. code-block:: python
1090+
1091+ SELECT * FROM db;
1092+
1093++---------+---------+
1094+|Database | Market |
1095++=========+=========+
1096+|Oracle | 39.8%|
1097++---------+---------+
1098+|IBM | 30.7%|
1099++---------+---------+
1100+|Microsoft| 14.4%|
1101++---------+---------+
1102+
1103+.. code-block:: python
1104+
1105+ let $market = query_get_value(SELECT * FROM db,Market,2);
1106+ echo $market;
1107+
1108+This would store the value 30.7% in variable ``market``
1109+
1110+.. note:: If a query fails, then an appropriate error message is displayed
1111+
1112+.. _query_horizontal:
1113+
1114+query_horizontal
1115+----------------
1116+
1117+:Syntax:
1118+
1119+:program:`query_horizontal statement`
1120+
1121+``query_horizontal`` is used to execute the SQL specified using ``statement`` and then outputs the result of executing the query in horizontal manner.
1122+
1123+:Example:
1124+
1125+.. code-block:: python
1126+
1127+ query_horizontal SELECT VERSION();
1128+
1129+.. _query_vertical:
1130+
1131+query_vertical
1132+--------------
1133+
1134+:Syntax:
1135+
1136+:program:`query_vertical statement`
1137+
1138+``query_vertical`` is used to execute the SQL specified using ``statement`` and then outputs the result of executing the query in vertical manner.
1139+
1140+:Example:
1141+
1142+.. code-block:: python
1143+
1144+ query_vertical SELECT VERSION();
1145+
1146+.. _real_sleep:
1147+
1148+real_sleep
1149+----------
1150+
1151+:Syntax:
1152+
1153+:program:`real_sleep num`
1154+
1155+``real_sleep`` command is used to sleep for a time specified by ``num``. The time is in seconds. This command should not be used above the required level. This makes the test suite slower.
1156+
1157+
1158+:Example:
1159+
1160+.. code-block:: python
1161+
1162+ --real_sleep 7;
1163+ real_sleep 24
1164+
1165+.. note:: real_sleep is not affected by --sleep command-line option. However sleep command is affected
1166+
1167+.. _reap:
1168+
1169+reap
1170+----
1171+
1172+:Syntax:
1173+
1174+:program:`reap`
1175+
1176+``reap`` command is used to receive a result of an SQL statement that is sent using the ``send`` command.
1177+
1178+.. note:: The reap command should not be used if there is no send command issued prior to that.
1179+
1180+.. _remove_file:
1181+
1182+remove_file
1183+-----------
1184+
1185+:Syntax:
1186+
1187+:program:`remove_file file_name`
1188+
1189+``remove_file`` command is used to remove a file specified using ``file_name``. The file name can be specified using variables.
1190+
1191+:Example:
1192+
1193+.. code-block:: python
1194+
1195+ remove_file $DRIZZLE_FILE_DIR/temp_file;
1196+
1197+.. note:: If the file specified using ``file_name`` is not existing, an error is thrown.
1198+
1199+.. _remove_files_wildcard:
1200+
1201+remove_files_wildcard
1202+---------------------
1203+
1204+:Syntax:
1205+
1206+:program:`remove_files_wildcard dir_name [pattern]`
1207+
1208+This command is used to remove files in a directory specified using ``dir_name``, whose filenames match with the pattern given. Directories, sub-directories and files in sub-directories will not be deleted even if they match the pattern.
1209+
1210+.. note:: ``?`` is used to represent single character. ``* `` is used to represent any sequence of 0 or more characters. ``.`` is treated as normal character. The pattern should not include ``/``
1211+
1212+.. note:: If no pattern is included, then this command deletes all the files in the directory. The directory remains undeleted.
1213+
1214+:Example:
1215+
1216+.. code-block:: python
1217+
1218+ remove_files_wildcard $DRIZZLE_FILE_DIR temp*.txt;
1219+
1220+.. _replace_column:
1221+
1222+replace_column
1223+--------------
1224+
1225+:Syntax:
1226+
1227+:program:`replace_column col_num value [col_num value [,...] ]`
1228+
1229+``replace_column`` is used to replace strings in the output of the next statement that is to be executed. In this command, the content of ``col_num`` is replaced by the content specified by ``value``.
1230+
1231+.. note:: There can be any number of col_num value pairs. Column numbers start with 1
1232+
1233+:Example:
1234+
1235+.. code-block:: python
1236+
1237+ --replace_column 5 !
1238+ replace_column 1 a 2 b
1239+
1240+.. note:: replace_column does not affect the output of exec (which replace_regex and replace_result do), because, the output of exec is not always columnar.
1241+
1242+.. note:: To specify a double quote within the string that replaces, we can use \"
1243+
1244+.. note:: If we use several ``replace_`` commands, for example, replace_regex, replace_result, etc, only the final one applies.
1245+
1246+.. _replace_regex:
1247+
1248+replace_regex
1249+-------------
1250+
1251+:Syntax:
1252+
1253+:program:`replace_regex /pattern/replacement/[i] ...`
1254+
1255+``replace_regex`` takes in two parameter ``pattern`` and ``replacement``. The ``pattern`` is used to find the specified patter in the output of the next statement and ``replacement`` is used to replace the found pattern with the specified replacement pattern. If more than one instance of the pattern is found in the string, then all of them are replaced.
1256+
1257+.. note:: For the match to be case insensitive, we can use ``i`` modifier.
1258+
1259+:Example:
1260+
1261+.. code-block:: python
1262+
1263+ --replace_regex /strawberry/raspberry
1264+
1265+.. note:: The allowable patterns are the same as REGEXP SQL operator. Also, the pattern can contain parantheses for marking it as substrings. To refer to the substring we use ``\N``. \N in the replacement string will result in insertion of N-th substring matched by pattern.
1266+
1267+:Example:
1268+
1269+.. code-block:: python
1270+
1271+ --replace_regex /(strawberry)/raspberry and \1/
1272+
1273+.. note:: We can have multiple ``pattern/replacement``
1274+
1275+.. _replace_result:
1276+
1277+replace_result
1278+--------------
1279+
1280+:Syntax:
1281+
1282+:program:`replace_result from_val to_val [from_val to_val [...]]`
1283+
1284+This command replaces the ``from_val`` character in a string by the character specified using ``to_val``. We can issue more than one (from_val/to_val) pairs.
1285+
1286+:Example:
1287+
1288+.. code-block:: python
1289+
1290+ --replace_result 1024 MAX_KEY_LENGTH 3072 MAX_KEY_LENGTH
1291+ replace_result $MASTER_MYPORT MASTER_PORT;
1292+
1293+.. _require:
1294+
1295+require
1296+-------
1297+
1298+:Syntax:
1299+
1300+:program:`require file_name`
1301+
1302+``require`` command is used to specify a file ``file_name`` for comparing the results of the next query with the contents of the file.
1303+
1304+.. note:: If the contents of the file, does not match with the results of the query / there is some error, then the test aborts.
1305+
1306+:Example:
1307+
1308+.. code-block:: python
1309+
1310+ --require r/test1.result
1311+ --require r/test2.require
1312+
1313+.. _result:
1314+
1315+result
1316+------
1317+
1318+:Syntax:
1319+
1320+:program:`result file_name`
1321+
1322+``result`` command is used to compare the contents of the file specified using ``file_name`` with the result of a test case, only after the test completes. If there is no match, then the result is written to ``r/file_name.reject`` file.
1323+
1324+.. note:: If the --record command-line option is given, then the result is written to the file.result.
1325+
1326+.. _rmdir:
1327+
1328+rmdir
1329+-----
1330+
1331+:Syntax:
1332+
1333+:program:`rmdir dir_name`
1334+
1335+``rmdir`` command is used to delete / remove a directory specified by ``dir_name``. This command return 0 if the operation is successful or 1 if the operation fails.
1336+
1337+:Example:
1338+
1339+.. code-block:: python
1340+
1341+ --rmdir DRIZZLE_DIR/testdir
1342+
1343+.. _save_master_pos:
1344+
1345+save_master_pos
1346+---------------
1347+
1348+:Syntax:
1349+
1350+:program:`save_master_pos`
1351+
1352+``save_master_pos`` saves the current binary log file name and position for master replication server. These can be used with commands like ``sync_with_master`` and ``sync_slave_with_master``
1353+
1354+.. _send:
1355+
1356+send
1357+----
1358+
1359+:Syntax:
1360+
1361+:program:`send [statement]`
1362+
1363+``send`` command is used to send a SQL statement to the server. The result of the statement must be received with reap command.
1364+
1365+.. note:: if statement is missed, then the next statement which is executed, will be sent.
1366+
1367+:Example:
1368+
1369+.. code-block:: python
1370+
1371+ send SELECT VERSION();
1372+
1373+.. code-block:: python
1374+
1375+ send;
1376+ SELECT VERSION();
1377+
1378+.. note:: Another SQL statement cannot be sent on the same connection between the send and reap.
1379+
1380+.. _send_eval:
1381+
1382+send_eval
1383+---------
1384+
1385+:Syntax:
1386+
1387+:program:`send_eval [statement]`
1388+
1389+This command sends the ``statement`` specifying the command, to the server, after evaluation. Thus, its a combination of send + eval.
1390+
1391+:Example:
1392+
1393+.. code-block:: python
1394+
1395+ --send_eval $STATEMENT
1396+
1397+.. _send_quit:
1398+
1399+send_quit
1400+---------
1401+
1402+:Syntax:
1403+
1404+:program:`send_quit [timeout]`
1405+
1406+``send_quit`` command is used to stop the server. This command has a view of the process ID of the server. It waits for the server to close by itself. If the server's process ID is still available even after the stipulated time ``timeout``, the process is killed.
1407+
1408+.. note:: If the timeout is not mentioned, it defaults to 60 seconds.
1409+
1410+:Example:
1411+
1412+.. code-block:: python
1413+
1414+ send_quit;
1415+ send_quit 100;
1416+
1417+.. _shutdown_server:
1418+
1419+shutdown_server
1420+---------------
1421+
1422+:Syntax:
1423+
1424+:program:`shutdown_server [timeout]`
1425+
1426+This command is similar to
1427+:ref:`send_quit` command.
1428+
1429+:Example:
1430+
1431+.. code-block:: python
1432+
1433+ shutdown_server;
1434+ shutdown_server 100;
1435+
1436+.. _skip:
1437+
1438+skip
1439+----
1440+
1441+:Syntax:
1442+
1443+:program:`skip [message]`
1444+
1445+``skip`` is used to terminate the processing of the test file. It stops the execution and displays the message specified as argument.
1446+
1447+:Example:
1448+
1449+.. code-block:: python
1450+
1451+ let $condition=$cond_for_execution
1452+ if(!$condition)
1453+ {
1454+ skip condition fails;
1455+ }
1456+
1457+
1458+.. _sleep:
1459+
1460+sleep
1461+-----
1462+
1463+:Syntax:
1464+
1465+:program:`sleep num`
1466+
1467+``sleep`` command is used to sleep for specified ``num`` seconds. The num value can be fractional too.
1468+
1469+.. note:: If a --sleep command-line argument is also given, it supresses the effect of sleep command.
1470+
1471+:Example:
1472+
1473+If sleep 100 is given along with --sleep=50, then the command sleep 100 will sleep for 50 seconds only
1474+
1475+:Example:
1476+
1477+.. code-block:: python
1478+
1479+ --sleep 50;
1480+ sleep 100;
1481+ sleep 50.25;
1482+
1483+.. _sorted_result:
1484+
1485+sorted_result
1486+-------------
1487+
1488+:Syntax:
1489+
1490+:program:`sorted_result`
1491+
1492+``sorted_result`` is used to sort the results produced from the statement that succeeds this command. If the statement does not produce any outputs, then this command has no effect.
1493+
1494+.. note:: ``sorted_result`` command is applied just before the results are being displayed. If there are other commands like replace_result, replace_column, etc are present, then sorted_result is specified after all these commands.
1495+
1496+:Example:
1497+
1498+.. code-block:: python
1499+
1500+ sorted_result;
1501+ SELECT rwreqps FROM sysbench_run_iterations WHERE concurrency=1;
1502+
1503+If a query contains UNION, procedures, multi-statements, etc, such a query would display the data in certain fashion. However, using sorted_result would make the results to be displayed in some strange manner.
1504+
1505+:Example:
1506+
1507+.. code-block:: python
1508+
1509+ --sorted_result
1510+ SELECT min_req_lat_ms FROM sysbench_run_iterations WHERE concurrency=2;
1511+ UNION
1512+ SELECT max_req_lat_ms FROM sysbench_run_iterations WHERE concurrency=2;
1513+
1514+The outcome of sorted_list can be achieved using ``ORDER BY``. But it can sometimes encounter some problems. For example, there may be different ordering stratergy for different servers. So the output generated from one server, when compared with the output generated from another server could conflict. In such situations, sorted_reults comes out to be handy. sorted_result produces a deterministic row order which eliminates the ordering difference.
1515+
1516+.. note:: sorted_result has the potential of blurring server bugs, thus resulting in some problems with result order.
1517+
1518+.. _source:
1519+
1520+source
1521+------
1522+
1523+:Syntax:
1524+
1525+:program:`source file_name`
1526+
1527+``source`` command is used mainly for creating modular test cases. For example, if we have certain number of tests, all of which perform some basic tasks initially in setting up the server, then those tasks can be written in another file. This file can be invoked in the test by using the ``source`` command.
1528+
1529+.. note:: source command is similar to functions in programming languages like C
1530+
1531+:Example:
1532+
1533+.. code-block:: python
1534+
1535+ --source drizzletest/create_schema.inc
1536+ source drizzletest/create_schema.inc;
1537+
1538+A file can use ``source`` to read other files. The maximum level of nesting allowed is 16.
1539+
1540+Variables can be used to specify the files. If these variables contain quotation marks, then those marks are also considered during variable expansion. So quotes are usually not included.
1541+
1542+.. _start_timer:
1543+
1544+start_timer
1545+-----------
1546+
1547+:Syntax:
1548+
1549+:program:`start_timer`
1550+
1551+This command will restart an existing timer. Initially, the timer is always restarted during the start of each drizzletest.
1552+
1553+.. _sync_slave_with_master:
1554+
1555+sync_slave_with_master
1556+----------------------
1557+
1558+:Syntax:
1559+
1560+:program:`sync_slave_with_master [connection_name]`
1561+
1562+``sync_slave_with_master`` saves the replication coordinates for the current server which acts as the master, and then switches to the slave server till it syncs with the replication coordinates.
1563+
1564+This command is equivalent to
1565+
1566+.. code-block:: python
1567+
1568+ save_master_pos;
1569+ connection connection_name;
1570+ sync_with_mater 0;
1571+
1572+.. _sync_with_master:
1573+
1574+sync_with_master
1575+----------------
1576+
1577+:Syntax:
1578+
1579+:program:`sync_with_master offset`
1580+
1581+``sync_with_master`` command is used for a slave replication server to wait untill it syncs with its master. The position to synchronize is specified by the ``save_master_pos`` and the ``offset``. So just specifying the offset would add its contents to the contents of ``save_master_pos``.
1582+
1583+.. note:: The save_master_pos should contain a value / executed prior executing this command.
1584+
1585+.. _system:
1586+
1587+system
1588+------
1589+
1590+:Syntax:
1591+
1592+:program:`system command [arg1[,arg2[,...]]]`
1593+
1594+``system`` command is used to execute ``shell command`` or ``system related functions`` using the ``system()`` library function.
1595+
1596+.. note:: system command can reduce portablity. This is because, we give the command which are specific to an operating system (say unix-like), which can fail, if run on windows. For this purpose, there are commands like ``remove_file``, ``chmod_file``, which performs the system functions with added portability.
1597+
1598+:Example:
1599+
1600+.. code-block:: python
1601+
1602+ --system rm $DRIZZLE_TEMP_DIR
1603+ --system mkdir $DRIZZLE_REPO
1604+
1605+.. note:: We can use variables as commands. The references of these variables are replaced by their corresponding values. If $ is being used, then preceed it by ``\`` ( \$ )
1606+
1607+.. _vertical_results:
1608+
1609+vertical_results
1610+----------------
1611+
1612+:Syntax:
1613+
1614+:program:`vertical_results`
1615+
1616+This command will display the results in vertical format. Horizontal display is the default format.
1617+
1618+:Example:
1619+
1620+.. code-block:: python
1621+
1622+ --vertical_results
1623+
1624+.. _wait_for_slave_to_stop:
1625+
1626+wait_for_slave_to_stop
1627+----------------------
1628+
1629+:Syntax:
1630+
1631+:program:`wait_for_slave_to_stop`
1632+
1633+This command polls the connection to the slave replication server, by executing SHOW STATUS LIKE `slave_running` statements, untill the result is ``OFF``
1634+
1635+.. _while:
1636+
1637+while
1638+-----
1639+
1640+:Syntax:
1641+
1642+:program:`while(expr)`
1643+
1644+This statment marks the beginning of the while block. This block ends with ``end`` statement. The while block keeps on executing untill the expression ``expr`` evaluated to false.
1645+
1646+.. note:: The expr should evaluate to false at some point of time. Else, the block moves into an infinite loop
1647+
1648+:Example:
1649+
1650+.. code-block:: python
1651+
1652+ let $iter=10;
1653+ while($iter)
1654+ {
1655+ echo "executing this statement";
1656+ dec $iter;
1657+ }
1658+
1659+.. _write_file:
1660+
1661+write_file
1662+----------
1663+
1664+:Syntax:
1665+
1666+:program:`write_file file_name [terminator]`
1667+
1668+``write_file`` command is used to write the lines following it, to the file specified using ``file_name``, untill the terminator is reached.
1669+
1670+.. note:: The default terminator is EOF
1671+
1672+:Example:
1673+
1674+.. code-block:: python
1675+
1676+ write_file $DRIZZLE_FILE_DIR/test;
1677+ test condition 1
1678+ test condition 2
1679+ EOF
1680+
1681+ write_file $DRIZZLE_FILE_DIR/test END;
1682+ test condition 1
1683+ test condition 2
1684+ END
1685+
1686+.. note:: If the file specified using ``file_name`` already exists, an error is thrown.
1687+
1688+

Subscribers

People subscribed via source and target branches

to all changes: