Skip to content

Commit 73cc9dd

Browse files
committed
Fixes gh-751 Document new box.execute() method
1 parent d1b5254 commit 73cc9dd

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

doc/2.1/book/sql.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail
272272
| | | | SQLSTATE exists. |
273273
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
274274
| E182 | Host language binding | | Okay. Any of the Tarantool connectors should be able |
275-
| | | | to call ``box.sql.execute()``. |
275+
| | | | to call ``box.execute()``. |
276276
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
277277
| F031 | Basic schema manipulation |
278278
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+

doc/2.1/tutorials/sql_tutorial.rst

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Tarantool 2.x series. There are two ways to go through this tutorial:
1010
* read what we say the results are and take our word for it, or
1111
* copy and paste each section and see everything work with Tarantool 2.1.
1212

13-
You'll encounter all the functionality that you'd encounter in an "SQL-101"
13+
You will encounter all the functionality that you'd encounter in an "SQL-101"
1414
course.
1515

1616
.. _sql_tutorial-starting_up_with_a_first_table_and_selects:
@@ -74,11 +74,15 @@ The result of the ``SELECT`` statement will look like this:
7474
- - [1, 'B']
7575
...
7676
77+
Reality check: actually the result will include include initial fields
78+
called "metadata", the names and data types of each column. For all
79+
SELECT examples we show only the result rows without showing the metadata.
80+
7781
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7882
CREATE TABLE
7983
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8084

81-
Here's ``CREATE TABLE`` with more details:
85+
Here is ``CREATE TABLE`` with more details:
8286

8387
* There are multiple columns, with different data types.
8488
* There is a ``PRIMARY KEY`` (unique and not-null) for two of the columns.
@@ -91,7 +95,7 @@ Here's ``CREATE TABLE`` with more details:
9195
column4 FLOAT,
9296
PRIMARY KEY (column1, column2));
9397
94-
The result will be: "``---``" (no error).
98+
The result will be: "``rowcount: 1``" (no error).
9599

96100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97101
INSERT
@@ -246,7 +250,7 @@ values in ``column4``. However, it is not an error that
246250
247251
CREATE UNIQUE INDEX i ON table2 (column4);
248252
249-
The result will be: "``---``" (no error).
253+
The result will be: "``rowcount: 1``" (no error).
250254

251255
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252256
Create a subset table
@@ -675,7 +679,7 @@ Calling from a host language to make a big table
675679
--------------------------------------------------------------------------------
676680

677681
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
678-
box.sql.execute()
682+
box.execute()
679683
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
680684

681685
Now we will change the settings so that the
@@ -685,7 +689,7 @@ will exist in Tarantool clients in our next version.)
685689

686690
This doesn't mean we have left the SQL world though, because we
687691
can invoke SQL statements using a Lua function:
688-
``box.sql.execute(string)``.
692+
``box.execute(string)``.
689693

690694
Here we'll switch languages,
691695
and ask to select again what's in ``table3``.
@@ -694,7 +698,7 @@ These statements must be entered separately.
694698
.. code-block:: tarantoolsession
695699
696700
tarantool> \set language lua
697-
tarantool> box.sql.execute([[SELECT * FROM table3;]]);
701+
tarantool> box.execute([[SELECT * FROM table3;]]);
698702
699703
Showing both the statements and the results:
700704

@@ -703,7 +707,7 @@ Showing both the statements and the results:
703707
tarantool> \set language lua
704708
---
705709
...
706-
tarantool> box.sql.execute([[SELECT * FROM table3;]]);
710+
tarantool> box.execute([[SELECT * FROM table3;]]);
707711
---
708712
- - [-1000, '']
709713
- [0, '!!!']
@@ -726,7 +730,7 @@ instructions and wait for about a minute.
726730

727731
.. code-block:: lua
728732
729-
box.sql.execute("CREATE TABLE tester (s1 INT PRIMARY KEY, s2 VARCHAR(10))");
733+
box.execute("CREATE TABLE tester (s1 INT PRIMARY KEY, s2 VARCHAR(10))");
730734
731735
function string_function()
732736
local random_number
@@ -744,7 +748,7 @@ instructions and wait for about a minute.
744748
for i = 1,1000000,1 do
745749
string_value = string_function()
746750
sql_statement = "INSERT INTO tester VALUES (" .. i .. ",'" .. string_value .. "')"
747-
box.sql.execute(sql_statement)
751+
box.execute(sql_statement)
748752
end
749753
end;
750754
start_time = os.clock();
@@ -771,8 +775,8 @@ an index, because for ``s2`` we didn't say
771775

772776
.. code-block:: lua
773777
774-
box.sql.execute([[SELECT * FROM tester WHERE s1 = 73446;]]);
775-
box.sql.execute([[SELECT * FROM tester WHERE s2 LIKE 'QFML%';]]);
778+
box.execute([[SELECT * FROM tester WHERE s1 = 73446;]]);
779+
box.execute([[SELECT * FROM tester WHERE s2 LIKE 'QFML%';]]);
776780
777781
The result is:
778782

doc/2.1/whats_new.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ and generally ensure SQL is a first class query language in Tarantool.
310310

311311
Functionality added or changed:
312312

313-
* A new function ``box.sql.execute()`` was added to query Tarantool databases
313+
* A new function ``box.sql.execute()`` (later changed to ``box.execute``
314+
in Tarantool 2.1) was added to query Tarantool databases
314315
using SQL statements, e.g.:
315316

316317
.. code-block:: tarantoolsession

0 commit comments

Comments
 (0)