[Tarantool-patches] [PATCH 4/4] sql: provide a user friendly frontend for accessing session settings
Timur Safin
tsafin at tarantool.org
Mon Apr 13 10:50:52 MSK 2020
:
: I changed it to the following (the main problem with reserved word
: persists):
:
: +///////////////////////////// The SET SESSION command
: ////////////////////////
: +//
: +cmd ::= SET SESSION nm(X) EQ term(Y). {
: + sql_setting_set(pParse,&X,Y.pExpr);
: +}
: +
:
..
: ==========================================================================
: =====
:
: Currently if a user wants to change session setting with SQL, one has
: to execute UPDATE query like:
: [[UPDATE "_session_settings" SET "value" = true WHERE "name" = 'name']]
: However, direct access to system spaces isn't considered to be a good
: practice.
: To avoid that and a bit simplify user's life, we introduce SQL shortcut
: command
: SET SESSION.
:
: Closes #4711
:
: @TarantoolBot document
: Title: API for accessing _session_settings space.
: There are two ways of updating values of session settings:
: via Lua and SQL.
:
...
: SQL:
: Instead of typing long UPDATE query one can use the SET SESSION command:
: `box.execute([[SET SESSION "<setting_name>" = <new_value>]])`.
: Note, that this query is case sensitive so the name must be quoted.
: Also, SET SESSION doesn't provide any implicit casts, so <new_value> must
: be of the type corresponding to the setting being updated.
:
: Example:
: ```
: tarantool> box.execute([[set session "sql_default_engine" = 'memtx']])
: ---
: - row_count: 1
: ...
:
: tarantool> box.execute([[set session "sql_defer_foreign_keys" = true]])
: ---
: - row_count: 1
: ...
:
Like it!
(The least intrusive way possible, but still is short for user to write)
Timur
More information about the Tarantool-patches
mailing list