本文整理汇总了PHP中MDB2_Driver_Common::raiseError方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB2_Driver_Common::raiseError方法的具体用法?PHP MDB2_Driver_Common::raiseError怎么用?PHP MDB2_Driver_Common::raiseError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDB2_Driver_Common
的用法示例。
在下文中一共展示了MDB2_Driver_Common::raiseError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFunction
/**
* Create a FUNCTION
*/
public function createFunction($name)
{
return $this->db->raiseError(MDB2_ERROR_NOT_CAPABLE, null, null, 'not capable', __FUNCTION__);
}
示例2:
/**
* Create a new MDB2 connection object and connect to the specified
* database
*
* IMPORTANT: In order for MDB2 to work properly it is necessary that
* you make sure that you work with a reference of the original
* object instead of a copy (this is a PHP4 quirk).
*
* For example:
* $mdb =& MDB2::connect($dsn);
* ^^
* And not:
* $mdb = MDB2::connect($dsn);
* ^^
*
* @param mixed $dsn 'data source name', see the MDB2::parseDSN
* method for a description of the dsn format.
* Can also be specified as an array of the
* format returned by MDB2::parseDSN.
* @param array $options An associative array of option names and
* their values.
* @return mixed a newly created MDB2 connection object, or a MDB2
* error object on error
* @access public
* @see MDB2::parseDSN
*/
function &connect($dsn, $options = false)
{
$dsninfo = MDB2::parseDSN($dsn);
if (!isset($dsninfo['phptype'])) {
$error =& MDB2_Driver_Common::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'no RDBMS driver specified');
return $error;
}
$type = $dsninfo['phptype'];
if (is_array($options) && isset($options['debug']) && $options['debug'] >= 2) {
$debug = true;
} else {
$debug = false;
}
$db =& MDB2::factory($type, $debug);
if (MDB2::isError($db)) {
return $db;
}
$db->setDSN($dsninfo);
$err = MDB2::setOptions($db, $options);
if (MDB2::isError($err)) {
$db->disconnect();
return $err;
}
if (isset($dsninfo['database'])) {
$err = $db->connect();
if (MDB2::isError($err)) {
$dsn = $db->getDSN();
$err->addUserInfo($dsn);
return $err;
}
}
return $db;
}
示例3:
/**
* This method is used to communicate an error and invoke error
* callbacks etc. Basically a wrapper for PEAR::raiseError
* without the message string.
*
* @param mixed $code integer error code, or a PEAR error object (all
* other parameters are ignored if this parameter is an object
* @param int $mode error mode, see PEAR_Error docs
* @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the
* error level (E_USER_NOTICE etc). If error mode is
* PEAR_ERROR_CALLBACK, this is the callback function, either as a
* function name, or as an array of an object and method name. For
* other error modes this parameter is ignored.
* @param string $userinfo Extra debug information. Defaults to the last
* query and native error code.
* @param mixed $nativecode Native error code, integer or string depending
* the backend.
* @return object a PEAR error object
* @access public
* @see PEAR_Error
*/
function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
{
$error =& MDB2_Driver_Common::raiseError($code, $mode, $options, $userinfo);
return $error;
}
示例4: raiseError
function raiseError($msg, $xp = null)
{
if (is_null($this->error)) {
if (is_resource($msg)) {
$error = "Parser error: ";
$xp = $msg;
} else {
$error = "Parser error: \"" . $msg . "\"\n";
}
if ($xp != null) {
$byte = @xml_get_current_byte_index($xp);
$line = @xml_get_current_line_number($xp);
$column = @xml_get_current_column_number($xp);
$error .= "Byte: {$byte}; Line: {$line}; Col: {$column}\n";
}
$this->error = MDB2_Driver_Common::raiseError(MDB2_ERROR_MANAGER_PARSE, null, null);
}
return false;
}
示例5: lastInsertID
/**
* Returns the autoincrement ID if supported or $id or fetches the current
* ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
*
* @param string name of the table into which a new row was inserted
* @param string name of the field into which a new row was inserted
*
* @return mixed MDB2 Error Object or id
*/
public function lastInsertID($table = null, $field = null)
{
return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'method not implemented', __FUNCTION__);
}
示例6: readLOB
function readLOB(&$data, $length)
{
$buffer_length = $length == 0 ? $this->buffer_length : $length;
$written_full = 0;
do {
for ($written = 0; !$this->db->datatype->endOfLOB($this->input_lob) && $written < $buffer_length; $written += $read) {
$result = $this->db->datatype->readLOB($this->input_lob, $buffer, $buffer_length);
if (MDB2::isError($result)) {
return $result;
}
$read = strlen($buffer);
if (@fwrite($this->file, $buffer, $read) != $read) {
return MDB2_Driver_Common::raiseError(MDB2_ERROR, null, null, 'MDB2_LOB_Output_File::readLOB: could not write to the output file');
}
}
$written_full += $written;
} while ($length == 0 && !$this->db->datatype->endOfLOB($this->input_lob));
return $written_full;
}