1 alias
Allows you to set an alias to a column or expression.
<alias name='name'/>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aname | string | Alias name. |
Example
Copy
COUNT(*) <alias name='num_registros'/>
2 matches
<matches>
<expresion /> *
</matches>
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Eexpresion | string | Tag content must be enclosed in single quotes. |
Example
Copy
<matches>'M*'</matches>
3 regexp
<regexp>
<reg-col /> !
<reg-expr /> !
</regexp>
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Ereg-col | string | A character expression, such as a character column. | |||
Ereg-expr | string |
A character expression. The following escape wildcards are accepted:
|
CHAR type
CHAR type may have fixed size, that is, CHAR(4) will occuppy 4 characters even if its inserted content is only 'A', one character. This may interfere withregexp
correct functioning.
3.1 Examples
Copy
Table creation and insertions.
CREATE TABLE test_regexp ( a char(4) ); INSERT INTO test_regexp(a) VALUES ('A'); INSERT INTO test_regexp(a) VALUES ('AB'); INSERT INTO test_regexp(a) VALUES ('*?'); INSERT INTO test_regexp(a) VALUES ('?*') INSERT INTO test_regexp(a) VALUES ('AAA'); INSERT INTO test_regexp(a) VALUES ('X'); -- will not match
Copy
Example 1
<select> <columns> COUNT(*) </columns> <from table='test_regexp' /> <where> <regexp> <reg-col>a</reg-col> <!-- 'A' 0 or 1 times --> <reg-expr>'A?'</reg-expr> </regexp> </where> </select>
1 -- AB
Copy
Example 2
<select> <columns> COUNT(*) </columns> <from table='test_regexp' /> <where> <regexp> <reg-col>a</reg-col> <!-- 0 or more characters + 'A' + 0 or more characters --> <reg-expr>'*A*'</reg-expr> </regexp> </where> </select>
3 -- A, AB, AAA
Copy
Example 3
<select> <columns> COUNT(*) </columns> <from table='test_regexp' /> <where> <regexp> <reg-col>a</reg-col> <-- 1 to 3 consecutive 'A' --> <reg-expr>'A{1,3}'</reg-expr> </regexp> </where> </select>
2 -- A, AAA
Copy
Example 4
<select> <columns> COUNT(*) </columns> <from table='test_regexp' /> <where> <regexp> <reg-col>a</reg-col> <!-- 'B' preceded by a character that must not be 'A' <reg-expr>'[^A]B'</reg-expr> </regexp> </where> </select>
0
Copy
Example 5
<select> <columns> COUNT(*) </columns> <from table='test_regexp' /> <where> <regexp> <reg-col>a</reg-col> <!-- '*' + a single character + 0 or more characters --> <reg-expr>'\*.*'</reg-expr> </regexp> </where> </select>
1 -- *?
Copy
Example 6
<select> <columns> COUNT(*) </columns> <from table='test_regexp' /> <where> <regexp> <reg-col>a</reg-col> <!-- 2 characters that must be '*' or '?' --> <reg-expr>'[\*\?]{2}'</reg-expr> </regexp> </where> </select>
2 -- *?, ?*
4 rowid
Allows retrieving the name of the unique identifier (rowid) of a row in a table.
<rowid table='table'/>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Atable | string | Table name. |
Example
Copy
<rowid table='gcompedh'/>
5 user
Retrieve the name of the database session user.
<user />
Example
Copy
<user/>