http://www.cubrid.org/manual/843/en/
解释器是一种SQL-style(标准化查询语言风格)的方法;SQL-style注释以双破折号(--)开始,双破折号后的部分被视为注释内容。此外,支持C++风格,即以双斜线开始,还有C风格,即分别以/*和*/为起始标志。
以下是CSQL解释器中所支持的注释的例子。
-- 这是一个SQL-style注释。
// 这是一个C++风格的注释。
/* 这是一个C风格的注释。 */
/* 这是一个用C风格
将两行内容作为注释的例子。 */
可以归类为标示符的有表名,索引名,视图名,列名和用户名。在CSQL解释器中创建标示符的要求如下:
< 标示符>
:: = < 标示符字母> [ { < 其他字母> } ]
< 标示符字母>
:: = < 大写字母>
| < 小写字母>
< 其他标示符>
:: = < 标示符字母>
| < 数字>
| _
| #
< 数字>
:: = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
< 大写字母>
:: = A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P| Q | R | S | T | U | V | W | X | Y | Z
< 小写字母>
:: = a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p| q | r | s | t | u | v | w | x | y | z
标示符必须以字母开头。允许使用除运算符外的其他特殊符号。以下是合法标示符的例子。
a
a_b
ssn#
this_is_an_example_#
封闭在双引号,方括号,单引号中
如下所示的标示符和保留字是被禁止的。可是,如果他们封闭在双引号,方括号或者单引号中,可以允许被作为例外情况。特别是,当ansi_quotes参数被设置为yes时双引号可以作为封闭标示符的标志。如果这个值被设置成no,双引号将被用作封闭字符串的标志。以下是合法标示符的例子。
" select"
" @lowcost"
" low cost"
" abc" " def"
[position]
以特殊字符和数字开头
标示符不能以特殊符号或数字开头。作为例外,下划线(_) 和井号 (#) 可以作为首字符。
_a
#ack
%nums
2fer
88abs
标示符包含空格
标示符中不能包含空格。
col1 t1
标示符中包含运算符
标示符中不能包含运算符 (+, -, *, /, %, ||, !, < , > , =, |, ^, & , ~ ) .
col+
col~
col& &
标示符名称的最大长度
下面的表格总结了每个标示符名称所允许的最大长度。注意单位是字节,各字符集使用的字符数和字节是不同的(例如,在UTF-8中一个韩文字符的长度是三个字节)。
标示符 |
最大字节数 |
---|---|
Database |
17 |
Table |
254 |
Column |
254 |
Index |
254 |
Constraint |
254 |
Java Stored Procedure |
254 |
Trigger |
254 |
View |
254 |
Serial |
254 |
下面的关键字在CUBRID中作为命令,函数名或类型名而被保留。不能用作类名,属性名,变量名。注意,这些保留关键字如果被被封闭在双引号,方括号,单引号(`)中,那么,可被用作标示符。
ABSOLUTE |
ACTION |
ADD |
ADD_MONTHS |
AFTER |
ALL |
ALLOCATE |
ALTER |
AND |
ANY |
ARE |
AS |
ASC |
ASSERTION |
AT |
ATTACH |
ATTRIBUTE |
AVG |
BEFORE |
BETWEEN |
BIGINT |
BIT |
BIT_LENGTH |
BLOB |
BOOLEAN |
BOTH |
BREADTH |
BY |
|
|
CALL |
CASCADE |
CASCADED |
CASE |
CAST |
CATALOG |
CHANGE |
CHAR |
CHARACTER |
CHECK |
CLASS |
CLASSES |
CLOB |
CLOSE |
COALESCE |
COLLATE |
COLLATION |
COLUMN |
COMMIT |
CONNECT |
CONNECT_BY_ISCYCLE |
CONNECT_BY_ISLEAF |
CONNECT_BY_ROOT |
CONNECTION |
CONSTRAINT |
CONSTRAINTS |
CONTINUE |
CONVERT |
CORRESPONDING |
COUNT |
CREATE |
CROSS |
CURRENT |
CURRENT_DATE |
CURRENT_DATETIME |
CURRENT_TIME |
CURRENT_TIMESTAMP |
CURRENT_USER |
CURSOR |
CYCLE |
||
DATA |
DATA_TYPE |
DATABASE |
DATE |
DATETIME |
DAY |
DAY_HOUR |
DAY_MILLISECOND |
DAY_MINUTE |
DAY_SECOND |
DEALLOCATE |
DEC |
DECIMAL |
DECLARE |
DEFAULT |
DEFERRABLE |
DEFERRED |
DELETE |
DEPTH |
DESC |
DESCRIBE |
DESCRIPTOR |
DIAGNOSTICS |
DIFFERENCE |
DISCONNECT |
DISTINCT |
DISTINCTROW |
DIV |
DO |
DOMAIN |
DOUBLE |
DUPLICATE |
DROP |
EACH |
ELSE |
ELSEIF |
END |
EQUALS |
ESCAPE |
EVALUATE |
EXCEPT |
EXCEPTION |
EXEC |
EXECUTE |
EXISTS |
EXTERNAL |
EXTRACT |
|
FALSE |
FETCH |
FILE |
FIRST |
FLOAT |
FOR |
FOREIGN |
FOUND |
FROM |
FULL |
FUNCTION |
|
GENERAL |
GET |
GLOBAL |
GO |
GOTO |
GRANT |
GROUP |
||
HAVING |
HOUR |
HOUR_MILLISECOND |
HOUR_MINUTE |
HOUR_SECOND |
|
IDENTITY |
IF |
IGNORE |
IMMEDIATE |
IN |
INDEX |
INDICATOR |
INHERIT |
INITIALLY |
INNER |
INOUT |
INPUT |
INSERT |
INT |
INTEGER |
INTERSECT |
INTERSECTION |
INTERVAL |
INTO |
IS |
ISOLATION |
JOIN |
||
KEY |
||
LANGUAGE |
LAST |
LEADING |
LEAVE |
LEFT |
LESS |
LEVEL |
LIKE |
LIMIT |
LIST |
LOCAL |
LOCAL_TRANSACTION_ID |
LOCALTIME |
LOCALTIMESTAMP |
LOOP |
LOWER |
||
MATCH |
MAX |
METHOD |
MILLISECOND |
MIN |
MINUTE |
MINUTE_MILLISECOND |
MINUTE_SECOND |
MOD |
MODIFY |
MODULE |
MONETARY |
MONTH |
MULTISET |
MULTISET_OF |
NA |
NAMES |
NATIONAL |
NATURAL |
NCHAR |
NEXT |
NO |
NONE |
NOT |
NULL |
NULLIF |
NUMERIC |
OBJECT |
OCTET_LENGTH |
OF |
OFF |
ON |
ONLY |
OPEN |
OPTIMIZATION |
OPTION |
OR |
ORDER |
OUT |
OUTER |
OUTPUT |
OVERLAPS |
PARAMETERS |
PARTIAL |
POSITION |
PRECISION |
PREPARE |
PRESERVE |
PRIMARY |
PRIOR |
PRIVILEGES |
PROCEDURE |
||
QUERY |
||
READ |
REAL |
RECURSIVE |
REF |
REFERENCES |
REFERENCING |
RELATIVE |
RENAME |
REPLACE |
RESIGNAL |
RESTRICT |
RETURN |
RETURNS |
REVOKE |
RIGHT |
ROLE |
ROLLBACK |
ROLLUP |
ROUTINE |
ROW |
ROWNUM |
ROWS |
||
SAVEPOINT |
SCHEMA |
SCOPE |
SCROLL |
SEARCH |
SECOND |
SECOND_MILLISECOND |
SECTION |
SELECT |
SENSITIVE |
SEQUENCE |
SEQUENCE_OF |
SERIALIZABLE |
SESSION |
SESSION_USER |
SET |
SET_OF |
SETEQ |
SHARED |
SIBLINGS |
SIGNAL |
SIMILAR |
SIZE |
SMALLINT |
SOME |
SQL |
SQLCODE |
SQLERROR |
SQLEXCEPTION |
SQLSTATE |
SQLWARNING |
STATISTICS |
STRING |
SUBCLASS |
SUBSET |
SUBSETEQ |
SUBSTRING |
SUM |
SUPERCLASS |
SUPERSET |
SUPERSETEQ |
SYS_CONNECT_BY_PATH |
SYS_DATE |
SYS_DATETIME |
SYS_TIME |
SYS_TIMESTAMP |
SYSDATE |
SYSDATETIME |
SYSTEM_USER |
SYSTIME |
|
TABLE |
TEMPORARY |
THEN |
TIME |
TIMESTAMP |
TIMEZONE_HOUR |
TIMEZONE_MINUTE |
TO |
TRAILING |
TRANSACTION |
TRANSLATE |
TRANSLATION |
TRIGGER |
TRIM |
TRUE |
TRUNCATE |
||
UNDER |
UNION |
UNIQUE |
UNKNOWN |
UPDATE |
UPPER |
USAGE |
USE |
USER |
USING |
UTIME |
|
VALUE |
VALUES |
VARCHAR |
VARIABLE |
VARYING |
VCLASS |
VIEW |
||
WHEN |
WHENEVER |
WHERE |
WHILE |
WITH |
WITHOUT |
WORK |
WRITE |
|
XOR |
||
YEAR |
YEAR_MONTH |
|
ZONE |