Function Module

Function Module – Module to handle SQL function abstraction


The Function module provides methods for executing non-standard SQL database functions in a consistent way. The following document lists the available methods, providing examples of their use. To include the Function module functionality, you need to load it first.

Loading the Function module

require_once 'MDB2.php';
$dsn 'pgsql://someuser:apasswd@somehost';
$mdb2 =& MDB2::factory($dsn);
if (
PEAR::isError($mdb2)) {

// loading the Function module

After including the module, you can access its methods like this:

Get the length of a string expression

// PHP5
// PHP4 and PHP5

Further in the document the PHP5-compatible way will be used.

Concatenate strings


Execute a Stored Procedure

Supposing we have the following Stored Procedure (MySQL syntax):

CREATE PROCEDURE procedure1 (IN parameter1 INTEGER)
  DECLARE variable1 CHAR(10);
  IF parameter1 = 17 THEN
    SET variable1 = 'birds';
    SET variable1 = 'beasts';
  INSERT INTO table1 VALUES (variable1);

we can call it this way:

Execute a Stored Procedure

= array(17);
Loading and calling modules (Previous) Module for managing database structure (Next)
Last updated: Sat, 28 Nov 2015 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.