Comments

This document describes the comment syntax supported by MatrixOne.

MatrixOne supports three comment styles:

  • Use # character to comment a line.

    mysql> select 100-99;   # This comment continues to the end of line
    +----------+
    | 100 - 99 |
    +----------+
    |        1 |
    +----------+
    1 row in set (0.01 sec)
    
  • Use -- to comment a line. The second dash must be followed by a space, tab, newline, carriage return, or the end of the input.

    mysql> select 100-99;   -- This comment continues to the end of line
    +----------+
    | 100 - 99 |
    +----------+
    |        1 |
    +----------+
    1 row in set (0.01 sec)
    
  • From a /* sequence to the following */ sequence, as in the C programming language. This syntax enables a comment to extend over multiple lines because the beginning and closing sequences need not be on the same line.

    mysql> select 100 /* this is an in-line comment */ -99;
    +----------+
    | 100 - 99 |
    +----------+
    |        1 |
    +----------+
    1 row in set (0.01 sec)
    

    Or:

    mysql> select 100
    /*
    this is an in-line comment
    */
    -99;
    +----------+
    | 100 - 99 |
    +----------+
    |        1 |
    +----------+
    1 row in set (0.01 sec)
    

MatrixOne specific comment syntax

  • MatrixOne supports C comment style as below:

mysql> select 100-99;   // This comment continues to the end of line
+----------+
| 100 - 99 |
+----------+
|        1 |
+----------+
1 row in set (0.03 sec)

Or:

mysql> // This comment continues to the line
    -> select 100-99;
+----------+
| 100 - 99 |
+----------+
|        1 |
+----------+
  • MatrixOne supports executable comments of the form /*! SQL */ and /*!version SQL */: valid SQL inside them is parsed. The following examples fail because Specific code is not valid SQL at that position, rather than because executable comments are unsupported:

mysql> select 100 /*! Specific code */ -99;
ERROR 1064 (HY000): SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 28 near " code */ -99";

Or:

mysql> select 100 /*!50110 Specific code */ -99;
ERROR 1064 (HY000): SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 33 near " code */ -99";

Constraints

MatrixOne does not support nested comments.