Home > PHP > Function > SQLite (PDO) > PDO::sqliteCreateFunction()

PDO::sqliteCreateFunction()

PDO::sqliteCreateFunction - Registers a User Defined Function for use in SQL statements

Syntax

bool PDO::sqliteCreateFunction (string $function_name, callback $callback, int $num_args)

Arguments

  • function_name - The name of the function used in SQL statements.
  • callback - Callback function to handle the defined SQL function. Note: Callback functions should return a type understood by SQLite (i.e. scalar type).
  • num_args - Hint to the SQLite parser if the callback function accepts a predetermined number of arguments.

Description

This method allows you to register a PHP function with SQLite as an UDF(User Defined Function), so that it can be called from within your SQL statements.

Version

PHP 5.1.0, PECL pdo_sqlite >= 1.0.0

Return value

Returns TRUE on success or FALSE on failure.