ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
MDB2_Driver_Function_Common Class Reference
+ Inheritance diagram for MDB2_Driver_Function_Common:
+ Collaboration diagram for MDB2_Driver_Function_Common:

Public Member Functions

executeStoredProc ($name, $params=null, $types=null, $result_class=true, $result_wrap_class=false)
 Execute a stored procedure and return any results.
 functionTable ()
 return string for internal table used when calling only a function
 now ($type= 'timestamp')
 Return string to call a variable with the current timestamp inside an SQL statement There are three special variables for current date and time:
 substring ($value, $position=1, $length=null)
 return string to call a function to get a substring inside an SQL statement
 concat ($value1, $value2)
 Returns string to concatenate two or more string parameters.
 random ()
 return string to call a function to get random value inside an SQL statement
 lower ($expression)
 return string to call a function to lower the case of an expression
 upper ($expression)
 return string to call a function to upper the case of an expression
 guid ()
 Returns global unique identifier.
- Public Member Functions inherited from MDB2_Module_Common
 __construct ($db_index)
 Constructor.
 MDB2_Module_Common ($db_index)
 PHP 4 Constructor.
getDBInstance ()
 Get the instance of MDB2 associated with the module instance.

Additional Inherited Members

- Data Fields inherited from MDB2_Module_Common
 $db_index

Detailed Description

Definition at line 61 of file Common.php.

Member Function Documentation

MDB2_Driver_Function_Common::concat (   $value1,
  $value2 
)

Returns string to concatenate two or more string parameters.

Parameters
string$value1
string$value2
string$values,...
Returns
string to concatenate two strings public

Reimplemented in MDB2_Driver_Function_mysqli, and MDB2_Driver_Function_mysql.

Definition at line 158 of file Common.php.

{
$args = func_get_args();
return "(".implode(' || ', $args).")";
}
& MDB2_Driver_Function_Common::executeStoredProc (   $name,
  $params = null,
  $types = null,
  $result_class = true,
  $result_wrap_class = false 
)

Execute a stored procedure and return any results.

Parameters
string$namestring that identifies the function to execute
mixed$paramsarray that contains the paramaters to pass the stored proc
mixed$typesarray that contains the types of the columns in the result set
mixed$result_classstring which specifies which result class to use
mixed$result_wrap_classstring which specifies which class to wrap results in
Returns
mixed a result handle or MDB2_OK on success, a MDB2 error on failure public

Reimplemented in MDB2_Driver_Function_mysql, MDB2_Driver_Function_mysqli, MDB2_Driver_Function_oci8, and MDB2_Driver_Function_pgsql.

Definition at line 77 of file Common.php.

References MDB2_Module_Common\getDBInstance(), PEAR\isError(), and MDB2_ERROR_UNSUPPORTED.

{
$db =& $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
$error =& $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
'method not implemented', __FUNCTION__);
return $error;
}

+ Here is the call graph for this function:

MDB2_Driver_Function_Common::functionTable ( )

return string for internal table used when calling only a function

Returns
string for internal table used when calling only a function public

Reimplemented in MDB2_Driver_Function_oci8.

Definition at line 98 of file Common.php.

{
return '';
}
MDB2_Driver_Function_Common::guid ( )

Returns global unique identifier.

Returns
string to get global unique identifier public

Reimplemented in MDB2_Driver_Function_oci8, MDB2_Driver_Function_mysqli, and MDB2_Driver_Function_mysql.

Definition at line 217 of file Common.php.

References MDB2_Module_Common\getDBInstance(), PEAR\isError(), and MDB2_ERROR_UNSUPPORTED.

{
$db =& $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
$error =& $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
'method not implemented', __FUNCTION__);
return $error;
}

+ Here is the call graph for this function:

MDB2_Driver_Function_Common::lower (   $expression)

return string to call a function to lower the case of an expression

Parameters
string$expression
Returns
return string to lower case of an expression public

Definition at line 188 of file Common.php.

{
return "LOWER($expression)";
}
MDB2_Driver_Function_Common::now (   $type = 'timestamp')

Return string to call a variable with the current timestamp inside an SQL statement There are three special variables for current date and time:

  • CURRENT_TIMESTAMP (date and time, TIMESTAMP type)
  • CURRENT_DATE (date, DATE type)
  • CURRENT_TIME (time, TIME type)
Returns
string to call a variable with the current timestamp public

Reimplemented in MDB2_Driver_Function_oci8.

Definition at line 116 of file Common.php.

{
switch ($type) {
case 'time':
return 'CURRENT_TIME';
case 'date':
return 'CURRENT_DATE';
case 'timestamp':
default:
return 'CURRENT_TIMESTAMP';
}
}
MDB2_Driver_Function_Common::random ( )

return string to call a function to get random value inside an SQL statement

Returns
return string to generate float between 0 and 1 public

Reimplemented in MDB2_Driver_Function_oci8, and MDB2_Driver_Function_pgsql.

Definition at line 173 of file Common.php.

{
return 'RAND()';
}
MDB2_Driver_Function_Common::substring (   $value,
  $position = 1,
  $length = null 
)

return string to call a function to get a substring inside an SQL statement

Returns
string to call a function to get a substring public

Reimplemented in MDB2_Driver_Function_oci8.

Definition at line 138 of file Common.php.

{
if (!is_null($length)) {
return "SUBSTRING($value FROM $position FOR $length)";
}
return "SUBSTRING($value FROM $position)";
}
MDB2_Driver_Function_Common::upper (   $expression)

return string to call a function to upper the case of an expression

Parameters
string$expression
Returns
return string to upper case of an expression public

Definition at line 203 of file Common.php.

{
return "UPPER($expression)";
}

The documentation for this class was generated from the following file: