From 76bbd9c4525058cdcf3e3ae6080a84bc5560943f Mon Sep 17 00:00:00 2001 From: ocelot-inc <pgulutzan@ocelot.ca> Date: Thu, 14 Jan 2016 18:22:34 -0700 Subject: [PATCH] conn:eval --- doc/sphinx/book/box/authentication.rst | 2 ++ doc/sphinx/reference/net_box.rst | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/sphinx/book/box/authentication.rst b/doc/sphinx/book/box/authentication.rst index f9d66d8aea..1f1483dae9 100644 --- a/doc/sphinx/book/box/authentication.rst +++ b/doc/sphinx/book/box/authentication.rst @@ -165,6 +165,8 @@ tuple in the _user space, and then drops the user. The maximum number of users is 32. +.. _privileges: + =========================================================== Privileges and the _priv space =========================================================== diff --git a/doc/sphinx/reference/net_box.rst b/doc/sphinx/reference/net_box.rst index 535b7f33f1..5aabd39096 100644 --- a/doc/sphinx/reference/net_box.rst +++ b/doc/sphinx/reference/net_box.rst @@ -5,9 +5,9 @@ -------------------------------------------------------------------------------- The ``net.box`` package contains connectors to remote database systems. One -variant, ``box.net.sql``, is for connecting to MySQL or MariaDB or PostgreSQL — +variant, to be discussed later, is for connecting to MySQL or MariaDB or PostgreSQL — that variant is the subject of the :ref:`SQL DBMS plugins <dbms-plugins>` appendix. -In this section the subject is the built-in variant, ``box.net``. This is for +In this section the subject is the built-in variant, ``net.box``. This is for connecting to tarantool servers via a network. Call ``require('net.box')`` to get a ``net.box`` object, which will be called @@ -58,7 +58,7 @@ necessary to prioritize requests or to use different authentication ids. conn = net_box.new('localhost', 3301) conn = net_box.new('127.0.0.1', box.cfg.listen, { wait_connect = false, - user = 'guest', + user = 'boxer', password = '' }) @@ -153,6 +153,16 @@ necessary to prioritize requests or to use different authentication ids. Example: ``conn:call('function5')`` + .. method:: eval(Lua-string) + + :samp:`conn:eval({Lua-string})` evaluates and executes the expression + in Lua-string, which may be any statement or series of statements. + An :ref:`execute privilege <privileges>` is required; if the user does not have it, + an administrator may grant it with + :codenormal:`box.schema.user.grant(`:codeitalic:`username`:codenormal:`,'execute','universe')`. + + Example: ``conn:eval('return 5+5')`` + .. method:: timeout(timeout) ``timeout(...)`` is a wrapper which sets a timeout for the request that -- GitLab