[data.scalar]

data.scalar is a slot in the data namespace, in Hyperlambda, the language of Magic Cloud. Executes SQL and returns a scalar value from the current database connection.

  • Value (sql-scalar), required: SQL statement to execute
  • Returns: Resolves to a scalar value from the current database connection
  • Scope: requires data.connection - Requires an open database connection created by [data.connect]

Arguments

Required arguments come first, then the optional ones in the order they are declared.

Argument Type Required Description
[database-type] string no Database adapter to use instead of the configured default.
any node name object no SQL parameter value; child name is used as the parameter name referenced by the SQL statement. Can be repeated.

Guide

How to use data.scalar

JSON declaration

This is the complete declaration of data.scalar, as the running system describes it. It is also published as slot.json.

JSON declaration
{
  "name": "data.scalar",
  "description": "Executes SQL and returns a scalar value from the current database connection",
  "signature": {
    "input": {
      "kind": "sql-scalar",
      "description": "SQL statement to execute",
      "required": true,
      "mode": "ValueOrExpression"
    },
    "children": {
      "database-type": {
        "type": "string",
        "kind": "database-type",
        "description": "Database adapter to use instead of the configured default",
        "required": false,
        "mode": "ValueOrExpression",
        "cardinality": "ZeroOrOne"
      },
      "*": {
        "type": "object",
        "kind": "sql-parameter-value,text,number,boolean,date,guid,content,value",
        "description": "SQL parameter value; child name is used as the parameter name referenced by the SQL statement",
        "required": false,
        "mode": "ValueOrExpression",
        "cardinality": "ZeroOrMore",
        "role": "Arguments",
        "projection": "Value"
      }
    },
    "scope": {
      "requires": "data.connection",
      "description": "Requires an open database connection created by [data.connect]"
    },
    "output": {
      "mode": "Value",
      "description": "Resolves to a scalar value from the current database connection"
    }
  }
}

← data.read all data.* slots data.select →