Skip to content
Snippets Groups Projects
Commit 947a66ea authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge branch 'master' of github.com:tarantool/tarantool

parents aac294ed 4e1fb3c6
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@
<itemizedlist>
<listitem><para>a user guide</para></listitem>
<listitem><para>a developer guide (you're reading it)</para></listitem>
<listitem><para>protocol description box-protocol.txt</para></listitem>
<listitem><para>protocol description doc/www/content/docs/box-protocol.rst</para></listitem>
<listitem><para>coding style guides for Lua, Objective C, C, Python (for
other connectors, we use conventions of the connector programming
language community)</para></listitem>
......
......@@ -37,7 +37,7 @@
A complete description of the binary protocol
is maintained in annotated Backus-Naur
form in the source tree: please see
<link xlink:href="https://github.com/tarantool/tarantool/blob/master/doc/box-protocol.txt"><filename>doc/box-protocol.txt</filename></link>.
<link xlink:href="http://tarantool.org/docs/box-protocol.html"><filename>docs/box-protocol.html</filename></link>.
</para>
</section>
......@@ -47,7 +47,7 @@
The Tarantool API exists so that a client program can send a request packet
to the server, and receive a response. Here is an example of a what the client
would send for <command>box.space[513]:insert{'A', 'BB'}</command>. The BNF description of the components
is in file <link xlink:href="https://github.com/tarantool/tarantool/blob/master/doc/box-protocol.txt" xlink:title="A complete BNF of Tarantool client/server protocol">doc/box-protocol.txt</link>.
is in file <link xlink:href="http://tarantool.org/docs/box-protocol.html" xlink:title="A complete BNF of Tarantool client/server protocol">docs/box-protocol.html</link>.
A third-party contribution written in Lua for unpacking Tarantool messages is in file
<link xlink:href="https://github.com/negram/Tnt-dissector/blob/master/tarantool.dis.lua" xlink:title="tarantool.dis.lua">Tnt-dissector</link>.
......@@ -124,7 +124,7 @@ is in file <link xlink:href="https://github.com/tarantool/tarantool/blob/master/
</informaltable>
<para>
Now, one could send that packet to the tarantool server,
and interpret the response (box-protocol.txt has a description
and interpret the response (docs/box-protocol.html has a description
of the packet format for responses as well as requests).
But it would be easier, and less error-prone, if one could
invoke a routine that formats the packet according to typed
......
......@@ -333,7 +333,7 @@ server on the same processor without ill effects.
programming language connector</olink>. The client/server
protocol is open and documented: an annotated BNF can be found
in the source tree, file <filename
xlink:href="https://github.com/tarantool/tarantool/blob/master/doc/box-protocol.txt" xlink:title="A complete BNF of Tarantool client/server protocol">doc/box-protocol.txt</filename>.
xlink:href="http://tarantool.org/docs/box-protocol.html" xlink:title="A complete BNF of Tarantool client/server protocol">doc/box-protocol.html</filename>.
</para>
</section>
......
......@@ -18,7 +18,7 @@
<itemizedlist>
<listitem><para>
Primary port. This port is for handling requests in the
<link xlink:href="https://github.com/tarantool/tarantool/blob/master/doc/box-protocol.txt" xlink:title="A complete BNF of Tarantool client/server protocol">native Tarantool protocol</link>
<link xlink:href="http://tarantool.org/docs/box-protocol.html" xlink:title="A complete BNF of Tarantool client/server protocol">native Tarantool protocol</link>
(also called the "binary protocol"), and provides full data access.
</para>
<para>
......@@ -99,7 +99,7 @@
A complete description of the binary protocol
is maintained in annotated Backus-Naur
form in the source tree: please see
<link xlink:href="https://github.com/tarantool/tarantool/blob/master/doc/box-protocol.txt"><filename>doc/box-protocol.txt</filename></link>.
<link xlink:href="http://tarantool.org/docs/box-protocol.html"><filename>doc/box-protocol.html</filename></link>.
</para>
</section>
......
......@@ -20,9 +20,9 @@ number of the first record in the file, plus an extension <filename>.xlog</filen
<para>Apart from a log sequence number and the data change request
(its format is the same as in the binary protocol and is described
in <link
xlink:href="https://github.com/tarantool/tarantool/blob/master/doc/box-protocol.txt"><filename>doc/box-protocol.txt</filename></link>),
xlink:href="http://tarantool.org/docs/box-protocol.html"><filename>docs/box-protocol.html</filename></link>),
each WAL record contains a header, some metadata, and then the data formatted
according to <link xlink:href="http://wiki.msgpack.org/display/MSGPACK/Format+specification">msgpack rules</link>.
according to <link xlink:href="https://github.com/msgpack/msgpack/blob/master/spec.md">msgpack rules</link>.
For example this is what the WAL file looks like after the first INSERT
request ("s:insert({1})") for the introductory sandbox exercise
<olink
......
......@@ -146,7 +146,7 @@ console.delimiter('')!</programlisting>
<para>
For a condensed Backus-Naur Form [BNF] description of the suggested form of client requests, see
<link xlink:href="https://github.com/tarantool/tarantool/blob/master/doc/box-protocol.txt"><filename>doc/box-protocol.txt</filename></link>
<link xlink:href="http://tarantool.org/docs/box-protocol.html"><filename>docs/box-protocol.html</filename></link>
and
<link xlink:href="https://github.com/tarantool/tarantool/blob/master/doc/sql.txt"><filename>doc/sql.txt</filename></link>.
</para>
......
......@@ -701,7 +701,7 @@ inserted and selected tuples.
There is a new format
(<link xlink:href="https://en.wikipedia.org/wiki/MessagePack">msgpack</link>).
Snapshot and WAL files have
<link xlink:href="https://github.com/tarantool/tarantool/blob/master/doc/box-protocol.txt">an implementation of the msgpack format</link>;
<link xlink:href="http://tarantool.org/docs/box-protocol.html">an implementation of the msgpack format</link>;
incompatible with the old format.
Snapshot and WAL files have the same format (snapshots are logs of inserts).
</para>
......
......@@ -8,9 +8,6 @@
Overview
--------------------------------------------------------------------------------
The latest version of this document can be found in Tarantool source tree,
`doc/box-protocol.txt <https://github.com/tarantool/tarantool/blob/master/doc/box-protocol.txt>`_
IPROTO is a binary request/response protocol. The server begins the dialogue by
sending a fixed-size (128 bytes) text greeting to the client. The first 64 bytes
of the greeting contain server version. The second 64 bytes contain a
......
......@@ -7,7 +7,7 @@ object_no_re = re.compile("[a-z_]*", re.I)
# The grammar below solely covers the functionality provided by
# Tarantool binary protocol, from which follow all the
# limitations. For reference please see doc/box-protocol.txt.
# limitations. For reference please see http://tarantool.org/docs/box-protocol.html
parser sql:
......
......@@ -67,33 +67,48 @@ end;
- true
...
--# setopt delimiter ''
dump({c:execute('SELECT ? AS bool1, ? AS bool2, ? AS nil, ? AS num, ? AS str', true, false, nil, 123, 'abc')})
c:execute('SELECT ? AS bool1, ? AS bool2, ? AS nil, ? AS num, ? AS str', true, false, nil, 123, 'abc')
---
- '[[{"bool2":0,"str":"abc","num":123,"bool1":1}],1]'
- - bool2: 0
str: abc
num: 123
bool1: 1
- 1
...
dump({c:execute('SELECT * FROM (SELECT ?) t WHERE 1 = 0', 2)})
c:execute('SELECT * FROM (SELECT ?) t WHERE 1 = 0', 2)
---
- '[{},0]'
- []
- 0
...
dump({c:execute('CREATE PROCEDURE p1() BEGIN SELECT 1 AS One; SELECT 2 AS Two, 3 AS Three; END')})
c:execute('CREATE PROCEDURE p1() BEGIN SELECT 1 AS One; SELECT 2 AS Two, 3 AS Three; END')
---
- '[{},0]'
- []
- 0
...
dump({c:execute('CALL p1')})
c:execute('CALL p1')
---
- '[[{"One":1},{"Three":3,"Two":2}],2]'
- - One: 1
- Three: 3
Two: 2
- 2
...
dump({c:execute('DROP PROCEDURE p1')})
c:execute('DROP PROCEDURE p1')
---
- '[{},0]'
- []
- 0
...
dump({c:execute('SELECT 1 AS one UNION ALL SELECT 2')})
c:execute('SELECT 1 AS one UNION ALL SELECT 2')
---
- '[[{"one":1},{"one":2}],2]'
- - one: 1
- one: 2
- 2
...
dump({c:execute('SELECT 1 AS one UNION ALL SELECT 2; SELECT ? AS two', 'abc')})
c:execute('SELECT 1 AS one UNION ALL SELECT 2; SELECT ? AS two', 'abc')
---
- '[[{"one":1},{"one":2},{"two":"abc"}],3]'
- - one: 1
- one: 2
- two: abc
- 3
...
c:quote('test \"abc\" test')
---
......
......@@ -36,14 +36,14 @@ do
return err == 'error: src/module/sql/sql.lua:111: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'SEL ECT 1\' at line 1'
end;
--# setopt delimiter ''
dump({c:execute('SELECT ? AS bool1, ? AS bool2, ? AS nil, ? AS num, ? AS str', true, false, nil, 123, 'abc')})
dump({c:execute('SELECT * FROM (SELECT ?) t WHERE 1 = 0', 2)})
dump({c:execute('CREATE PROCEDURE p1() BEGIN SELECT 1 AS One; SELECT 2 AS Two, 3 AS Three; END')})
dump({c:execute('CALL p1')})
dump({c:execute('DROP PROCEDURE p1')})
dump({c:execute('SELECT 1 AS one UNION ALL SELECT 2')})
dump({c:execute('SELECT 1 AS one UNION ALL SELECT 2; SELECT ? AS two', 'abc')})
c:execute('SELECT ? AS bool1, ? AS bool2, ? AS nil, ? AS num, ? AS str', true, false, nil, 123, 'abc')
c:execute('SELECT * FROM (SELECT ?) t WHERE 1 = 0', 2)
c:execute('CREATE PROCEDURE p1() BEGIN SELECT 1 AS One; SELECT 2 AS Two, 3 AS Three; END')
c:execute('CALL p1')
c:execute('DROP PROCEDURE p1')
c:execute('SELECT 1 AS one UNION ALL SELECT 2')
c:execute('SELECT 1 AS one UNION ALL SELECT 2; SELECT ? AS two', 'abc')
c:quote('test \"abc\" test')
......
......@@ -46,57 +46,90 @@ for tk in string.gmatch(os.getenv('PG')..':', '(.-):') do table.insert(connect,
c = box.net.sql.connect('pg', unpack(connect))
---
...
dump({c:execute('SELECT 123::text AS bla, 345')})
c:execute('SELECT 123::text AS bla, 345')
---
- '[[{"?column?":345,"bla":"123"}],1,"SELECT 1"]'
- - ?column?: 345
bla: '123'
- 1
- SELECT 1
...
dump({c:execute('SELECT -1 AS neg, NULL AS abc')})
c:execute('SELECT -1 AS neg, NULL AS abc')
---
- '[[{"neg":-1}],1,"SELECT 1"]'
- - neg: -1
- 1
- SELECT 1
...
dump({c:execute('SELECT -1.1 AS neg, 1.2 AS pos')})
c:execute('SELECT -1.1 AS neg, 1.2 AS pos')
---
- '[[{"neg":-1.1,"pos":1.2}],1,"SELECT 1"]'
- - neg: -1.1
pos: 1.2
- 1
- SELECT 1
...
dump({c:execute('SELECT ARRAY[1,2] AS neg, 1.2 AS pos')})
c:execute('SELECT ARRAY[1,2] AS neg, 1.2 AS pos')
---
- '[[{"neg":"{1,2}","pos":1.2}],1,"SELECT 1"]'
- - neg: '{1,2}'
pos: 1.2
- 1
- SELECT 1
...
dump({c:execute('SELECT ? AS val', 'abc')})
c:execute('SELECT ? AS val', 'abc')
---
- '[[{"val":"abc"}],1,"SELECT 1"]'
- - val: abc
- 1
- SELECT 1
...
dump({c:execute('SELECT ? AS val', 123)})
c:execute('SELECT ? AS val', 123)
---
- '[[{"val":123}],1,"SELECT 1"]'
- - val: 123
- 1
- SELECT 1
...
dump({c:execute('SELECT ? AS val', true)})
c:execute('SELECT ? AS val', true)
---
- '[[{"val":true}],1,"SELECT 1"]'
- - val: true
- 1
- SELECT 1
...
dump({c:execute('SELECT ? AS val', false)})
c:execute('SELECT ? AS val', false)
---
- '[[{"val":false}],1,"SELECT 1"]'
- - val: false
- 1
- SELECT 1
...
dump({c:execute('SELECT ? AS val, ? AS num, ? AS str', false, 123, 'abc')})
c:execute('SELECT ? AS val, ? AS num, ? AS str', false, 123, 'abc')
---
- '[[{"str":"abc","num":123,"val":false}],1,"SELECT 1"]'
- - str: abc
num: 123
val: false
- 1
- SELECT 1
...
dump({c:execute('DROP TABLE IF EXISTS unknown_table')})
c:execute('DROP TABLE IF EXISTS unknown_table')
---
- '[{},0,"DROP TABLE"]'
- []
- 0
- DROP TABLE
...
dump({c:execute('SELECT * FROM (VALUES (1,2), (2,3)) t')})
c:execute('SELECT * FROM (VALUES (1,2), (2,3)) t')
---
- '[[{"column1":1,"column2":2},{"column1":2,"column2":3}],2,"SELECT 2"]'
- - column1: 1
column2: 2
- column1: 2
column2: 3
- 2
- SELECT 2
...
c:ping()
---
- true
...
dump({c:select('SELECT * FROM (VALUES (1,2), (2,3)) t')})
c:select('SELECT * FROM (VALUES (1,2), (2,3)) t')
---
- '[[{"column1":1,"column2":2},{"column1":2,"column2":3}]]'
- - column1: 1
column2: 2
- column1: 2
column2: 3
...
--# setopt delimiter ';'
do
......@@ -108,13 +141,14 @@ end;
- true
...
--# setopt delimiter ''
dump({c:single('SELECT * FROM (VALUES (1,2)) t')})
c:single('SELECT * FROM (VALUES (1,2)) t')
---
- '[{"column1":1,"column2":2}]'
- column1: 1
column2: 2
...
dump({c:perform('SELECT * FROM (VALUES (1,2), (2,3)) t')})
c:perform('SELECT * FROM (VALUES (1,2), (2,3)) t')
---
- '[2]'
- 2
...
--# setopt delimiter ';'
do
......
......@@ -22,19 +22,19 @@ for tk in string.gmatch(os.getenv('PG')..':', '(.-):') do table.insert(connect,
-- postgresql
c = box.net.sql.connect('pg', unpack(connect))
dump({c:execute('SELECT 123::text AS bla, 345')})
dump({c:execute('SELECT -1 AS neg, NULL AS abc')})
dump({c:execute('SELECT -1.1 AS neg, 1.2 AS pos')})
dump({c:execute('SELECT ARRAY[1,2] AS neg, 1.2 AS pos')})
dump({c:execute('SELECT ? AS val', 'abc')})
dump({c:execute('SELECT ? AS val', 123)})
dump({c:execute('SELECT ? AS val', true)})
dump({c:execute('SELECT ? AS val', false)})
dump({c:execute('SELECT ? AS val, ? AS num, ? AS str', false, 123, 'abc')})
dump({c:execute('DROP TABLE IF EXISTS unknown_table')})
dump({c:execute('SELECT * FROM (VALUES (1,2), (2,3)) t')})
c:execute('SELECT 123::text AS bla, 345')
c:execute('SELECT -1 AS neg, NULL AS abc')
c:execute('SELECT -1.1 AS neg, 1.2 AS pos')
c:execute('SELECT ARRAY[1,2] AS neg, 1.2 AS pos')
c:execute('SELECT ? AS val', 'abc')
c:execute('SELECT ? AS val', 123)
c:execute('SELECT ? AS val', true)
c:execute('SELECT ? AS val', false)
c:execute('SELECT ? AS val, ? AS num, ? AS str', false, 123, 'abc')
c:execute('DROP TABLE IF EXISTS unknown_table')
c:execute('SELECT * FROM (VALUES (1,2), (2,3)) t')
c:ping()
dump({c:select('SELECT * FROM (VALUES (1,2), (2,3)) t')})
c:select('SELECT * FROM (VALUES (1,2), (2,3)) t')
--# setopt delimiter ';'
do
stat, err = pcall(c.single, c, 'SELECT * FROM (VALUES (1,2), (2,3)) t')
......@@ -42,8 +42,8 @@ do
return err == 'error: src/module/sql/sql.lua:162: SQL request returned multiply rows'
end;
--# setopt delimiter ''
dump({c:single('SELECT * FROM (VALUES (1,2)) t')})
dump({c:perform('SELECT * FROM (VALUES (1,2), (2,3)) t')})
c:single('SELECT * FROM (VALUES (1,2)) t')
c:perform('SELECT * FROM (VALUES (1,2), (2,3)) t')
--# setopt delimiter ';'
do
stat, err = pcall(c.execute, c, 'SELEC T')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment