-
Notifications
You must be signed in to change notification settings - Fork 5
CALL procedure clause
Marijn van Wezel edited this page Dec 13, 2022
·
8 revisions
The CALL procedure
clause is used to call a procedure deployed in the database. It accepts a procedure to call and a list of variables to yield.
Query::callProcedure(Procedure|string $procedure, AnyType|bool|float|int|array|Pattern|string|(AnyType|bool|float|int|array|Pattern|string)[] $yields = []): Query
-
$procedure
: The procedure to call. -
$yields
: The result fields that should be returned.
-
setProcedure(Procedure $procedure): self
: Sets the procedure to call. This overwrites any previously set procedure. -
addYield(Alias|string|Variable $yields): self
: Adds one or more variables to yield.
$statement = query()
->callProcedure("apoc.json")
->build();
$this->assertSame("CALL `apoc.json`()", $statement);
$statement = query()
->callProcedure("dbms.procedures", [
variable('name'),
variable('signature'),
])
->build();
$this->assertSame("CALL `dbms.procedures`() YIELD name, signature", $statement);
$procedure = Procedure::raw("dbms.security.createUser", ['example_username', 'example_password', false]);
$statement = query()
->callProcedure($procedure)
->build();
$this->assertSame("CALL `dbms.security.createUser`('example_username', 'example_password', false)", $statement);