StoredFunction
About 1 min
StoredFunction
Trait StoredFunction.
trait StoredFunctionProvides a set of methods for managing SQL stored functions in the database, including listing, checking existence, describing, creating, and dropping functions. Intended for use in DBI adapters that support SQL function operations.
Methods
listFunctions
List defined functions in the current schema.
public listFunctions(bool $includeParameters): voidParameters
| Parameter | Type | Description |
|---|---|---|
$includeParameters | bool | if true, returns an array with parameter details for each function; otherwise, returns an array of function names |
functionExists
Check if a function exists in the database.
public functionExists(string $functionName, ?string $argTypes): boolParameters
| Parameter | Type | Description |
|---|---|---|
$functionName | string | the name of the function to check for existence |
$argTypes | string | optional argument types to further specify the function signature (not currently used) |
describeFunction
Describe a database function, including its parameters, return type, body, and language.
public describeFunction(string $name, ?string $schemaName, false $): voidParameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the function to describe |
$schemaName | string | Optional schema name. If null, uses the current schema. |
$ | false |
createFunction
Create a new database function.
public createFunction(string $name, mixed $spec, bool $replace): boolParameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the function to create |
$spec | mixed | The function specification, typically the array returned from describeFunction(). Should include keys: 'params', 'returnType', 'body', and 'lang'. |
$replace | bool | if true, replaces an existing function with the same name |
dropFunction
Remove a function from the database.
public dropFunction(string $name, null $argTypes, bool $cascade, bool $ifExists): boolParameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the function to remove |
$argTypes | null | the argument list of the function to remove, if required (for overloaded functions) |
$cascade | bool | whether to perform a DROP CASCADE operation, removing dependent objects |
$ifExists | bool | if true, only drops the function if it exists |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000