Skip to content

Commit 3ff14f8

Browse files
authored
Fixes gh-842, gh-914, gh-919, gh-958 by onvember (#969)
Fixes gh-842 Make each function a link Fixes gh-914 Module string Fixes gh-919 Update index definition description Fixes gh-958 Module utf8
1 parent c332a2f commit 3ff14f8

File tree

6 files changed

+118
-86
lines changed

6 files changed

+118
-86
lines changed

doc/book/box/box_space.rst

Lines changed: 61 additions & 61 deletions
Large diffs are not rendered by default.

doc/book/box/data_model.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ field #1 of each tuple:
9595

9696
.. code-block:: tarantoolsession
9797
98-
tarantool> i = s:create_index('primary', {type = 'hash', parts = {1, 'unsigned'}})
98+
tarantool> i = s:create_index('primary', {type = 'hash', parts = {field = 1, type = 'unsigned'}})
9999
100100
The effect is that, for all tuples in space 'tester', field #1 must exist and
101101
must contain an unsigned integer.
@@ -107,7 +107,7 @@ of each tuple:
107107

108108
.. code-block:: tarantoolsession
109109
110-
tarantool> i = s:create_index('secondary', {type = 'tree', parts = {2, 'string'}})
110+
tarantool> i = s:create_index('secondary', {type = 'tree', parts = {field = 2, type = 'string'}})
111111
112112
The effect is that, for all tuples in space 'tester', field #2 must exist and
113113
must contain a string.
@@ -389,7 +389,7 @@ As an example, take some Russian words:
389389

390390
.. code-block:: tarantoolsession
391391
392-
tarantool> box.space.T:create_index('I', {parts = {{1,'str', collation='unicode'}}})
392+
tarantool> box.space.T:create_index('I', {parts = {{field = 1, type = 'str', collation='unicode'}}})
393393
...
394394
tarantool> box.space.T.index.I:select()
395395
---
@@ -412,7 +412,7 @@ As an example, take some Russian words:
412412

413413
.. code-block:: tarantoolsession
414414
415-
tarantool> box.space.T:create_index('I', {parts = {{1,'str', collation='unicode_ci'}}})
415+
tarantool> box.space.T:create_index('I', {parts = {{field = 1, type ='str', collation='unicode_ci'}}})
416416
...
417417
tarantool> box.space.S.index.I:select()
418418
---
@@ -841,7 +841,7 @@ The following SELECT variations exist:
841841
842842
tarantool> box.schema.space.create('bitset_example')
843843
tarantool> box.space.bitset_example:create_index('primary')
844-
tarantool> box.space.bitset_example:create_index('bitset',{unique=false,type='BITSET', parts={2,'unsigned'}})
844+
tarantool> box.space.bitset_example:create_index('bitset',{unique=false,type='BITSET', parts={field = 2, type = 'unsigned'}})
845845
tarantool> box.space.bitset_example:insert{1,1}
846846
tarantool> box.space.bitset_example:insert{2,4}
847847
tarantool> box.space.bitset_example:insert{3,7}
@@ -865,7 +865,7 @@ The following SELECT variations exist:
865865
866866
tarantool> box.schema.space.create('rtree_example')
867867
tarantool> box.space.rtree_example:create_index('primary')
868-
tarantool> box.space.rtree_example:create_index('rtree',{unique=false,type='RTREE', parts={2,'ARRAY'}})
868+
tarantool> box.space.rtree_example:create_index('rtree',{unique=false,type='RTREE', parts={field = 2, type = 'ARRAY'}})
869869
tarantool> box.space.rtree_example:insert{1, {3, 5, 9, 10}}
870870
tarantool> box.space.rtree_example:insert{2, {10, 11}}
871871
tarantool> box.space.rtree_example.index.rtree:select({4, 7, 5, 9}, {iterator = 'GT'})

doc/book/sql.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail
6161
| E021-03 | Character literals | ``insert into t45 values ('');`` | Okay, and the bad practice of accepting ""'s for |
6262
| | | | character literals is avoided. |
6363
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
64-
| E021-04 | CHARACTER_LENGTH function | ``select character_length(s1) from t;`` | Fail. There is no such function. There is a function |
65-
| | | | LENGTH(), which is okay. |
64+
| E021-04 | :ref:`CHARACTER_LENGTH <sql_function_length>` | ``select character_length(s1) from t;`` | Fail. There is no such function. There is a function |
65+
| | function | | LENGTH(), which is okay. |
6666
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
6767
| E021-05 | OCTET_LENGTH | ``select octet_length(s1) from t;`` | Fail. There is no such function. |
6868
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
@@ -71,7 +71,8 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail
7171
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
7272
| E021-07 | Character concatenation | ``select 'a' || 'b' from t;`` | Okay. |
7373
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
74-
| E021-08 | UPPER and LOWER functions | ``select upper('a'),lower('B') from t;`` | Okay. |
74+
| E021-08 | :ref:`UPPER <sql_function_upper>` and | ``select upper('a'),lower('B') from t;`` | Okay. |
75+
| | :ref:`LOWER <sql_function_lower>` functions | | SUBSTR(x,n,n) which is okay. |
7576
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
7677
| E021-09 | TRIM function | ``select trim('a ') from t;`` | Okay. |
7778
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
@@ -99,14 +100,14 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail
99100
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
100101
| E051-01 | SELECT DISTINCT | ``select distinct s1 from t;`` | Okay. |
101102
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
102-
| E051-02 | GROUP BY clause | ``select distinct s1 from t group by s1;`` | Okay. |
103+
| E051-02 | :ref:`GROUP BY <sql_group_by>` clause | ``select distinct s1 from t group by s1;`` | Okay. |
103104
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
104105
| E051-04 | GROUP BY can contain columns not in select | ``select s1 from t group by lower(s1);`` | Okay. |
105106
| | list | | |
106107
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
107108
| E051-05 | Select list items can be renamed | ``select s1 as K from t order by K;`` | Okay. |
108109
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
109-
| E051-06 | HAVING clause | ``select count(*) from t having count(*) > 0;`` | Okay. GROUP BY is not mandatory before HAVING. |
110+
| E051-06 | :ref:`HAVING <sql_having>` clause | ``select count(*) from t having count(*) > 0;`` | Okay. GROUP BY is not mandatory before HAVING. |
110111
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
111112
| E051-07 | Qualified * in select list | ``select t.* from t;`` | Okay. |
112113
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
@@ -185,15 +186,15 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail
185186
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
186187
| E091 | Set functions |
187188
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
188-
| E091-01 | AVG | ``select avg(s1) from t7;`` | Fail. No warning that nulls were eliminated. |
189+
| E091-01 | :ref:`AVG <sql_aggregate_avg>` | ``select avg(s1) from t7;`` | Fail. No warning that nulls were eliminated. |
189190
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
190-
| E091-02 | COUNT | ``select count(*) from t7 where s1 > 0;`` | Okay. |
191+
| E091-02 | :ref:`COUNT <sql_aggregate_count_row>` | ``select count(*) from t7 where s1 > 0;`` | Okay. |
191192
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
192-
| E091-03 | MAX | ``select max(s1) from t7 where s1 > 0;`` | Okay. |
193+
| E091-03 | :ref:`MAX <sql_aggregate_max>` | ``select max(s1) from t7 where s1 > 0;`` | Okay. |
193194
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
194-
| E091-04 | MIN | ``select min(s1) from t7 where s1 > 0;`` | Okay. |
195+
| E091-04 | :ref:`MIN <sql_aggregate_min>` | ``select min(s1) from t7 where s1 > 0;`` | Okay. |
195196
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
196-
| E091-05 | SUM | ``select sum(1) from t7 where s1 > 0;`` | Okay. |
197+
| E091-05 | :ref:`SUM <sql_aggregate_sum>` | ``select sum(1) from t7 where s1 > 0;`` | Okay. |
197198
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
198199
| E091-06 | ALL quantifier | ``select sum(all s1) from t7 where s1 > 0;`` | Okay. |
199200
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+

doc/reference/reference_lua/string.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ Below is a list of all additional ``string`` functions.
284284
:param input-string: (string) the string to split
285285
:param split-string: (string) the string to find within ``input-string``.
286286
Default = space.
287-
:param max: (integer) maximum number of delimiters to process counting from the beginning of the input string. Result will contain max + 1 parts maximum.
287+
:param max: (integer) maximum number of delimiters to process counting
288+
from the beginning of the input string. Result will
289+
contain max + 1 parts maximum.
288290

289291
:Return: table of strings that were split from ``input-string``
290292
:Rtype: table

doc/reference/reference_lua/utf8.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ there are comparison functions which understand the default ordering
1818
for Cyrillic (Capital Letter Zhe Ж = Small Letter Zhe ж)
1919
and Japanese (Hiragana A = Katakana A).
2020

21-
The module is fully built-in so ``require('utf8')`` is not necessary.
22-
2321
.. container:: table
2422

2523
.. rst-class:: left-align-column-1

doc/reference/reference_sql/sql.rst

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,17 @@ definition.
127127
Rules:
128128

129129
* A primary key is necessary; it can be specified with a table constraint
130-
PRIMARY KEY.
130+
``PRIMARY KEY``.
131131
* There must be at least one column.
132-
* When IF NOT EXISTS is specified, and there is already a table with the same
132+
* When ``IF NOT EXISTS`` is specified, and there is already a table with the same
133133
name, the statement is ignored.
134134

135135
Actions:
136136

137137
#. Tarantool evaluates each column definition and *table-constraint*,
138138
and returns an error if any of the rules is violated.
139139
#. Tarantool makes a new definition in the schema.
140-
#. Tarantool makes new indexes for PRIMARY KEY or UNIQUE constraints.
140+
#. Tarantool makes new indexes for ``PRIMARY KEY`` or ``UNIQUE`` constraints.
141141
A unique index name is created automatically.
142142
#. Tarantool effectively executes a ``COMMIT`` statement.
143143

@@ -1717,21 +1717,29 @@ GROUP BY clause is omitted, then Tarantool assumes
17171717

17181718
NULLs are ignored for all aggregate functions except COUNT(*).
17191719

1720+
.. _sql_aggregate_avg:
1721+
17201722
``AVG([DISTINCT] expression)``
17211723
Return the average value of expression.
17221724

17231725
Example: :samp:`AVG({column1})`
17241726

1727+
.. _sql_aggregate_count_exp:
1728+
17251729
``COUNT([DISTINCT] expression)``
17261730
Return the number of occurrences of expression.
17271731

17281732
Example: :samp:`COUNT({column1})`
17291733

1734+
.. _sql_aggregate_count_row:
1735+
17301736
``COUNT(*)``
17311737
Return the number of occurrences of a row.
17321738

17331739
Example: :samp:`COUNT(*)`
17341740

1741+
.. _sql_aggregate_group_concat:
1742+
17351743
``GROUP_CONCAT(expression-1 [, expression-2])``
17361744
Return a list of *expression-1* values, separated
17371745
by commas if *expression-2* is omitted, or separated
@@ -1740,21 +1748,29 @@ NULLs are ignored for all aggregate functions except COUNT(*).
17401748

17411749
Example: :samp:`GROUP_CONCAT({column1})`
17421750

1751+
.. _sql_aggregate_max:
1752+
17431753
``MAX([DISTINCT] expression)``
17441754
Return the maximum value of expression.
17451755

17461756
Example: :samp:`MAX({column1})`
17471757

1758+
.. _sql_aggregate_min:
1759+
17481760
``MIN([DISTINCT] expression)``
17491761
Return the minimum value of expression.
17501762

17511763
Example: :samp:`MIN({column1})`
17521764

1765+
.. _sql_aggregate_sum:
1766+
17531767
``SUM([DISTINCT] expression)``
17541768
Return the sum of values of expression.
17551769

17561770
Example: :samp:`SUM({column1})`
17571771

1772+
.. _sql_aggregate_total:
1773+
17581774
``TOTAL([DISTINCT] expression)``
17591775
Return the sum of values of expression.
17601776

@@ -2665,7 +2681,7 @@ Syntax:
26652681
Return the value of the first non-NULL expression, or, if both
26662682
expression values are NULL, return NULL. Thus
26672683
``IFNULL(expression, expression)`` is the same as
2668-
``COALESCE(expression, expression)``.
2684+
:ref:`COALESCE(expression, expression) <sql_function_coalesce>`.
26692685

26702686
Example:
26712687
``IFNULL(NULL, 17)`` is 17
@@ -2696,6 +2712,21 @@ Examples:
26962712
* ``LENGTH(CHAR(0,65))`` is 2, '\0' does not mean 'end of string'.
26972713
* ``LENGTH(X'410041')`` is 3, X'...' byte sequences have type VARBINARY.
26982714

2715+
.. _sql_function_lower:
2716+
2717+
***********************************************
2718+
LOWER
2719+
***********************************************
2720+
2721+
Syntax:
2722+
2723+
:samp:`LOWER(string-expression)`
2724+
2725+
Return the expression, with upper-case characters converted to lower case.
2726+
This is the reverse of :ref:`UPPER(string-expression) <sql_function_upper>`.
2727+
2728+
Example: ``LOWER('-4ЩL')`` is '-4щl'.
2729+
26992730
.. _sql_function_nullif:
27002731

27012732
***********************************************
@@ -2787,7 +2818,7 @@ Syntax:
27872818

27882819
Return the Unicode code point value of the first character of **string-expression**.
27892820
If *string-expression* is empty, the return is NULL.
2790-
This is the reverse of CHAR(integer).
2821+
This is the reverse of :ref:`CHAR(integer) <sql_function_char>`.
27912822

27922823
Example: ``UNICODE('Щ')`` is 1065 (hexadecimal 0429).
27932824

@@ -2802,7 +2833,7 @@ Syntax:
28022833
:samp:`UPPER(string-expression)`
28032834

28042835
Return the expression, with lower-case characters converted to upper case.
2805-
This is the reverse of LOWER(string-expression).
2836+
This is the reverse of :ref:`LOWER(string-expression)<sql_function_lower>`.
28062837

28072838
Example: ``UPPER('-4щl')`` is '-4ЩL'.
28082839

0 commit comments

Comments
 (0)