diff --git a/doc/developer/developer.xml b/doc/developer/developer.xml index 3d8797afd6bde03dac4429a7041b2eaa09d8b04b..79cdc6bc42a77d51c8d8030bcda6afe1c85bb095 100644 --- a/doc/developer/developer.xml +++ b/doc/developer/developer.xml @@ -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> diff --git a/doc/user/connectors.xml b/doc/user/connectors.xml index 6c8b16a218ed2d1da22683ce79a75791e8e7c753..28ea2f8ab521e31de4fd76259dc531ec15a70a91 100644 --- a/doc/user/connectors.xml +++ b/doc/user/connectors.xml @@ -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 diff --git a/doc/user/data-model.xml b/doc/user/data-model.xml index 782a73b683d690096df6228c4f355e4d7649c253..7840cd775a097c504aac08d55b6088684c3cdc27 100644 --- a/doc/user/data-model.xml +++ b/doc/user/data-model.xml @@ -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> diff --git a/doc/user/language-reference.xml b/doc/user/language-reference.xml index c7832dca4806af3ad10299df556acd4fbe81bbfe..3e5c15a73e80fe847994edd4ab408288eab2bd07 100644 --- a/doc/user/language-reference.xml +++ b/doc/user/language-reference.xml @@ -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> diff --git a/doc/user/persistence-architecture.xml b/doc/user/persistence-architecture.xml index fd99eb37925229c56945302c53922cb04a3a0377..3c0993fbab7b44f82bb9ab092960eeb02d07761e 100644 --- a/doc/user/persistence-architecture.xml +++ b/doc/user/persistence-architecture.xml @@ -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 diff --git a/doc/user/server-administration.xml b/doc/user/server-administration.xml index 01860432209e4cc8342da9eef8343d714b132686..74a42b4de9ac6137b80b7e162da123d2d828dc70 100644 --- a/doc/user/server-administration.xml +++ b/doc/user/server-administration.xml @@ -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> diff --git a/doc/user/tutorial.xml b/doc/user/tutorial.xml index 044508445d2bcffb7c8a47d49a12670f6cdd9668..56d54aa145d67597f8482c71461f79492a9c2f84 100644 --- a/doc/user/tutorial.xml +++ b/doc/user/tutorial.xml @@ -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> diff --git a/doc/www/content/docs/box-protocol.rst b/doc/www/content/docs/box-protocol.rst index a3ceeff19cbbfbc14e65d4493dab7426c66bba01..31717f033c4f6df716c054f32d64be63e2cad1a6 100644 --- a/doc/www/content/docs/box-protocol.rst +++ b/doc/www/content/docs/box-protocol.rst @@ -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 diff --git a/test/lib/sql.g b/test/lib/sql.g index 39951302adb2d05927cc3e46f08d762c3327d730..226c56b6d2e96d72c4c74d98be5ae3bbb6131e82 100644 --- a/test/lib/sql.g +++ b/test/lib/sql.g @@ -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: diff --git a/test/module/net_sql.mysql.result b/test/module/net_sql.mysql.result index b176fa5145a534f083cb0787c4bc9eb395a5fcdc..cfe1f7bd3fb59751f6645129f5107539c6843f79 100644 --- a/test/module/net_sql.mysql.result +++ b/test/module/net_sql.mysql.result @@ -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') --- diff --git a/test/module/net_sql.mysql.test.lua b/test/module/net_sql.mysql.test.lua index 149e0a37f492ba3cec440c146527d233c91839e7..a22226a658268f160214f95f997a62fb9075422c 100644 --- a/test/module/net_sql.mysql.test.lua +++ b/test/module/net_sql.mysql.test.lua @@ -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') diff --git a/test/module/net_sql.pg.result b/test/module/net_sql.pg.result index 1a6f5601cec0719bc8e72dfb01b2247bbcdb0bc8..c29fd65f8709711261f2ed01cd1ee59c2334a179 100644 --- a/test/module/net_sql.pg.result +++ b/test/module/net_sql.pg.result @@ -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 diff --git a/test/module/net_sql.pg.test.lua b/test/module/net_sql.pg.test.lua index 64f87f5df228354939ead09dda077e699330f61e..14e0f5b2f65271d1b5471216f8e60cb616c9df46 100644 --- a/test/module/net_sql.pg.test.lua +++ b/test/module/net_sql.pg.test.lua @@ -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')