| // +----------------------------------------------------------------------+ // // $Id$ // require_once 'MDB2/Driver/Function/Common.php'; /** * MDB2 MySQLi driver for the function modules * * @package MDB2 * @category Database * @author Lukas Smith */ class MDB2_Driver_Function_mysqli extends MDB2_Driver_Function_Common { // }}} // {{{ executeStoredProc() /** * Execute a stored procedure and return any results * * @param string $name string that identifies the function to execute * @param mixed $params array that contains the paramaters to pass the stored proc * @param mixed $types array that contains the types of the columns in * the result set * @param mixed $result_class string which specifies which result class to use * @param mixed $result_wrap_class string which specifies which class to wrap results in * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure * @access public */ function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) { $db = $this->getDBInstance(); if (MDB2::isError($db)) { return $db; } $multi_query = $db->getOption('multi_query'); if (!$multi_query) { $db->setOption('multi_query', true); } $query = 'CALL '.$name; $query .= $params ? '('.implode(', ', $params).')' : '()'; $result = $db->query($query, $types, $result_class, $result_wrap_class); if (!$multi_query) { $db->setOption('multi_query', false); } return $result; } // }}} // {{{ unixtimestamp() /** * return string to call a function to get the unix timestamp from a iso timestamp * * @param string $expression * * @return string to call a variable with the timestamp * @access public */ function unixtimestamp($expression) { return 'UNIX_TIMESTAMP('. $expression.')'; } // }}} // {{{ concat() /** * Returns string to concatenate two or more string parameters * * @param string $value1 * @param string $value2 * @param string $values... * @return string to concatenate two strings * @access public **/ function concat($value1, $value2) { $args = func_get_args(); return "CONCAT(".implode(', ', $args).")"; } // }}} // {{{ guid() /** * Returns global unique identifier * * @return string to get global unique identifier * @access public */ function guid() { return 'UUID()'; } // }}} } ?>