@query

From TinyMUX
Jump to: navigation, search

@query queries a remote SQL database and controls how the returned results set is processed by softcode.

Usage

Proposed Syntax 1: @query/sql dbref/attribute[/dbname] = query (not feasible because attribute may contain slashes)
Proposed Syntax 2: @query/sql dbname=dbref/attribute:query
Proposed Syntax 3: @query/sql dbname/query=dbref/attribute (not feasible because query may contain equal signs)
Proposed Syntax 4: @query/sql [dbref/attribute]=[dbname]/query
Proposed Syntax 5: @query/sql dbname[/dbref/attribute] = query (matches btmux style)

query is performed on dbname and the result is made available by triggering dbref/attribute within the context of a results set.

dbname may be something of a misnomer as it represents a session or connection to a server and not a particular database or table on a particular host. A dbname would allow MySQL and Postgresql to be used at the same time, two MySQL servers to be used at the same time, or two sessions (with potentially different permissions) to the same MySQL server.

Poll Results

Proposed Syntax 4 favored by Javelin, Ambrosia, Loki, and Talek.
Proposed Syntax 5 favored by Ronan, Anomaly, and Kelvin (of BTMUX).

Examples

@query/sql #123/detail.tr=/SELECT * FROM transtable where player = '%q0'
@query/sql =/INSERT INTO transtable (transno, playerno) VALUES (12345, 23456)

See Also: SQL