ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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. More...
 
 functionTable ()
 return string for internal table used when calling only a function More...
 
 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: More...
 
 substring ($value, $position=1, $length=null)
 return string to call a function to get a substring inside an SQL statement More...
 
 concat ($value1, $value2)
 Returns string to concatenate two or more string parameters. More...
 
 random ()
 return string to call a function to get random value inside an SQL statement More...
 
 lower ($expression)
 return string to call a function to lower the case of an expression More...
 
 upper ($expression)
 return string to call a function to upper the case of an expression More...
 
 guid ()
 Returns global unique identifier. More...
 
- Public Member Functions inherited from MDB2_Module_Common
 __construct ($db_index)
 Constructor. More...
 
 MDB2_Module_Common ($db_index)
 PHP 4 Constructor. More...
 
getDBInstance ()
 Get the instance of MDB2 associated with the module instance. More...
 

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

◆ concat()

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

Definition at line 158 of file Common.php.

159  {
160  $args = func_get_args();
161  return "(".implode(' || ', $args).")";
162  }

◆ executeStoredProc()

& 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

Definition at line 77 of file Common.php.

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

78  {
79  $db =& $this->getDBInstance();
80  if (PEAR::isError($db)) {
81  return $db;
82  }
83 
84  $error =& $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
85  'method not implemented', __FUNCTION__);
86  return $error;
87  }
$error
Definition: Error.php:17
const MDB2_ERROR_UNSUPPORTED
Definition: MDB2.php:78
& getDBInstance()
Get the instance of MDB2 associated with the module instance.
Definition: MDB2.php:4238
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:

◆ functionTable()

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

Definition at line 98 of file Common.php.

99  {
100  return '';
101  }

◆ guid()

MDB2_Driver_Function_Common::guid ( )

Returns global unique identifier.

Returns
string to get global unique identifier public

Definition at line 217 of file Common.php.

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

218  {
219  $db =& $this->getDBInstance();
220  if (PEAR::isError($db)) {
221  return $db;
222  }
223 
224  $error =& $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
225  'method not implemented', __FUNCTION__);
226  return $error;
227  }
$error
Definition: Error.php:17
const MDB2_ERROR_UNSUPPORTED
Definition: MDB2.php:78
& getDBInstance()
Get the instance of MDB2 associated with the module instance.
Definition: MDB2.php:4238
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:

◆ lower()

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.

189  {
190  return "LOWER($expression)";
191  }

◆ now()

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

Definition at line 116 of file Common.php.

117  {
118  switch ($type) {
119  case 'time':
120  return 'CURRENT_TIME';
121  case 'date':
122  return 'CURRENT_DATE';
123  case 'timestamp':
124  default:
125  return 'CURRENT_TIMESTAMP';
126  }
127  }

◆ random()

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

Definition at line 173 of file Common.php.

174  {
175  return 'RAND()';
176  }

◆ substring()

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

Definition at line 138 of file Common.php.

139  {
140  if (!is_null($length)) {
141  return "SUBSTRING($value FROM $position FOR $length)";
142  }
143  return "SUBSTRING($value FROM $position)";
144  }

◆ upper()

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.

204  {
205  return "UPPER($expression)";
206  }

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