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): arrayReturns: array
Parameters
| 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): boolReturns: bool
Parameters
| 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): array|falseReturns: array|false
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the function to describe |
$schemaName | string | Optional schema name. If null, uses the current schema. |
createFunction
Create a new database function.
public createFunction(string $name, array $spec, bool $replace): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the function to create |
$spec | array | 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, array|string|null $argTypes, bool $cascade, bool $ifExists): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the function to remove |
$argTypes | array | string |
$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 Fri, 04 Sep 2026 23:32:16 +0000