当前位置: 首页>>代码示例>>PHP>>正文


PHP MDB2::errorMessage方法代码示例

本文整理汇总了PHP中MDB2::errorMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB2::errorMessage方法的具体用法?PHP MDB2::errorMessage怎么用?PHP MDB2::errorMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MDB2的用法示例。


在下文中一共展示了MDB2::errorMessage方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @description 构造函数,创建一个连接
  *
  */
 public function __construct($host, $port, $user, $passwd, $dbName, $logFile = null)
 {
     $dsn = "mysql://{$user}:{$passwd}@{$host}:{$port}/{$dbName}?charset=utf8&new_link=true";
     $options = array('debug' => 2, 'portability' => MDB2_PORTABILITY_ALL);
     $this->_mConnection =& MDB2::connect($dsn, $options);
     if (MDB2::isError($this->_mConnection)) {
         die(MDB2::errorMessage($this->_mConnection));
     }
     $this->_logFile = str_replace('.date.', date('.Ymd.'), $logFile);
     $this->_logFile = str_replace('dbname', $dbName, $this->_logFile);
 }
开发者ID:cmooony,项目名称:d4d-studio,代码行数:15,代码来源:DataBase.class.php

示例2: errorMessage

 function errorMessage($value)
 {
     return MDB2::errorMessage($value);
 }
开发者ID:BackupTheBerlios,项目名称:wcms,代码行数:4,代码来源:peardb.php

示例3: list

 /**
  * 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    integer error code, or a PEAR error object (all
  *                 other parameters are ignored if this parameter is
  *                 an object
  *
  * @param int      error mode, see PEAR_Error docs
  *
  * @param mixed    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   Extra debug information.  Defaults to the last
  *                 query and native error code.
  *
  * @return object  a PEAR error object
  *
  * @see PEAR_Error
  */
 function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
 {
     // The error is yet a MDB2 error object
     if (is_object($code)) {
         return PEAR::raiseError($code, null, null, null, null, null, true);
     }
     if (is_null($userinfo) && isset($this->connection) && $this->connection) {
         if (!empty($this->last_query)) {
             $userinfo = "[Last query: {$this->last_query}]\n";
         }
         $native_errno = $native_msg = null;
         list($code, $native_errno, $native_msg) = $this->errorInfo($code);
         if ($native_errno !== null) {
             $userinfo .= "[Native code: {$native_errno}]\n";
         }
         if ($native_msg !== null) {
             $userinfo .= "[Native message: " . strip_tags($native_msg) . "]\n";
         }
     } else {
         $userinfo = "[Error message: {$userinfo}]\n";
     }
     if (empty($code)) {
         $code = MDB2_ERROR;
     }
     $msg = MDB2::errorMessage($code);
     return PEAR::raiseError("MDB2 Error: {$msg}", $code, $mode, $options, $userinfo);
 }
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:52,代码来源:MDB2.php

示例4: deleteMail

 /**
  * Remove from queue mail with $id identifier.
  *
  * @param integer $id  Mail ID
  * @return bool  True on success else Mail_Queue_Error class
  *
  * @access public
  */
 function deleteMail($id)
 {
     $query = 'DELETE FROM ' . $this->mail_table . ' WHERE id = ' . $this->db->quote($id, 'text');
     $res = $this->db->query($query);
     if (PEAR::isError($res)) {
         return new Mail_Queue_Error(MAILQUEUE_ERROR_QUERY_FAILED, $this->pearErrorMode, E_USER_ERROR, __FILE__, __LINE__, 'MDB2::query failed - "' . $query . '" - ' . MDB2::errorMessage($res));
     }
     return true;
 }
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:17,代码来源:mdb2.php

示例5: MDB2_Error

 /**
  * MDB2_Error constructor.
  *
  * @param mixed   $code      MDB error code, or string with error message.
  * @param integer $mode      what 'error mode' to operate in
  * @param integer $level     what error level to use for
  *                           $mode & PEAR_ERROR_TRIGGER
  * @param smixed  $debuginfo additional debug info, such as the last query
  */
 function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
 {
     if (is_int($code)) {
         $this->PEAR_Error('MDB2 Error: ' . MDB2::errorMessage($code), $code, $mode, $level, $debuginfo);
     } else {
         $this->PEAR_Error("MDB2 Error: {$code}", MDB2_ERROR, $mode, $level, $debuginfo);
     }
 }
开发者ID:BackupTheBerlios,项目名称:wcms,代码行数:17,代码来源:MDB2.php

示例6: __construct

 /**
  * MDB2_Error constructor.
  *
  * @param   mixed   MDB2 error code, or string with error message.
  * @param   int     what 'error mode' to operate in
  * @param   int     what error level to use for $mode & PEAR_ERROR_TRIGGER
  * @param   mixed   additional debug info, such as the last query
  */
 function __construct($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null, $dummy = null)
 {
     if (null === $code) {
         $code = MDB2_ERROR;
     }
     $this->PEAR_Error('MDB2 Error: ' . MDB2::errorMessage($code), $code, $mode, $level, $debuginfo);
 }
开发者ID:Alphenus,项目名称:ilmomasiina-php,代码行数:15,代码来源:MDB2.php

示例7: bugs_get_bug

    exit;
}
// fetch info about the bug into $bug
$bug = bugs_get_bug($bug_id);
if (!is_array($bug)) {
    echo json_encode(array('result' => array('error' => 'No such bug')));
    exit;
}
if (!bugs_has_access($bug_id, $bug, $pwd, $user_flags)) {
    echo json_encode(array('result' => array('error' => 'No access to bug')));
    exit;
}
if (!empty($_POST['ncomment']) && !empty($_POST['user'])) {
    $user = htmlspecialchars(trim($_POST['user']));
    $ncomment = htmlspecialchars(trim($_POST['ncomment']));
    $prep = $dbh->prepare("\n\t\tINSERT INTO bugdb_comments (bug, email, ts, comment, reporter_name, comment_type)\n\t\tVALUES (?, ?, NOW(), ?, ?, 'svn')\n\t");
    $res = $prep->execute(array($bug_id, "{$user}@php.net", $ncomment, $user));
    if ($res) {
        echo json_encode(array('result' => array('status' => $bug)));
        exit;
    } else {
        echo json_encode(array('result' => array('error' => MDB2::errorMessage($res))));
        exit;
    }
} else {
    if (!empty($_POST['getbug'])) {
        echo json_encode(array('result' => array('status' => $bug)));
        exit;
    }
}
echo json_encode(array('result' => array('error' => 'Nothing to do')));
开发者ID:rgeissert,项目名称:web-bugs,代码行数:31,代码来源:rpc.php

示例8: errorMessage

 /**
  * DB::errorMessage()
  */
 public static function errorMessage($value)
 {
     return MDB2::errorMessage($value);
 }
开发者ID:gauthierm,项目名称:MDB2,代码行数:7,代码来源:peardb.php

示例9: _preload

 /**
  * Preload mail to queue.
  *
  * @return mixed  True on success else Mail_Queue_Error object.
  * @access private
  */
 protected function _preload()
 {
     $res = $this->_checkConnection();
     $query = 'SELECT * FROM ' . $this->db->quoteIdentifier($this->mail_table) . ' WHERE sent_time IS NULL AND try_sent < ' . $this->retry . ' AND time_to_send <= ' . $this->db->quote(date('Y-m-d H:i:s'), 'timestamp') . ' ORDER BY time_to_send';
     $this->db->setLimit($this->limit, $this->offset);
     $res = $this->query($query);
     $this->_last_item = 0;
     $this->queue_data = array();
     //reset buffer
     $errors = array();
     while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
         //var_dump($row['headers']);
         if (!is_array($row)) {
             $msg = sprintf($this->error_tpl, $query, MDB2::errorMessage($res));
             $errors[] = new Mail_Queue2_Exception($msg, Mail_Queue2::ERROR_QUERY_FAILED);
             continue;
         }
         $body = new Mail_Queue2_Body();
         $body->setId($row['id'])->setCreateTime($row['create_time'])->setTimeToSend($row['time_to_send'])->setSentTime($row['sent_time'])->setIdUser($row['id_user'])->setIp($row['ip'])->setSender($row['sender'])->setRecipient($this->_isSerialized($row['recipient']) ? unserialize($row['recipient']) : $row['recipient'])->setHeaders(unserialize($row['headers']))->setBody(unserialize($row['body']))->setDeleteAfterSend($row['delete_after_send'])->setTrySent($row['try_sent']);
         $this->queue_data[$this->_last_item] = $body;
         $this->_last_item++;
     }
     if (count($errors) > 0) {
         return $errors;
     }
     return true;
 }
开发者ID:marco76tv,项目名称:mail_queue2,代码行数:33,代码来源:MDB2.php

示例10: __construct

 public function __construct($path)
 {
     global $db;
     if (is_string($path)) {
         $_CONF['smbind_ng'] = $path;
         $_CONF['title'] = "SMBind-ng";
         $_CONF['version'] = 'v0.91c';
         $_CONF['footer'] = $_CONF['title'] . $_CONF['version'];
         $_CONF['marker'] = "Forked by PtY 2015(GPL)";
         $_CONF['template'] = "default";
         $_CONF['recaptcha'] = false;
         $_CONF['tmp_path'] = $path . "tmp";
         $_CONF['nocaptcha'] = array();
         $_CONF['path'] = "/etc/smbind-ng/zones/";
         $_CONF['conf'] = "/etc/smbind-ng/smbind-ng.conf";
         $_CONF['namedcheckconf'] = is_executable("/usr/sbin/named-checkconf") ? "/usr/sbin/named-checkconf" : "";
         $_CONF['namedcheckzone'] = is_executable("/usr/sbin/named-checkzone") ? "/usr/sbin/named-checkzone" : "";
         $_CONF['rndc'] = is_executable("/usr/sbin/rndc") ? "/usr/sbin/rndc" : "";
         $_CONF['zonesigner'] = "/usr/sbin/zonesigner";
         $_CONF['rollinit'] = "/usr/sbin/rollinit";
         $_CONF['isdnssec'] = false;
         $_CONF['dig'] = is_executable("/usr/bin/dig") ? "/usr/bin/dig" : "";
         include $path . 'config/config.php';
         $_CONF['zonesigner'] = is_executable($_CONF['zonesigner']) ? $_CONF['zonesigner'] : "";
         $_CONF['rollinit'] = is_executable($_CONF['rollinit']) ? $_CONF['rollinit'] : "";
         $_CONF['isdnssec'] = $_CONF['isdnssec'] === true && $_CONF['zonesigner'] != "" && $_CONF['rollinit'] != "" ? true : false;
         $_CONF['recaptcha'] = $_CONF['recaptcha'] === true && strlen($_CONF['rc_pubkey']) > 0 && strlen($_CONF['rc_privkey']) > 0 ? true : false;
         if (!isset($_CONF['db_host'])) {
             $_CONF['db_host'] = 'localhost';
         }
         if (!isset($_CONF['db_port'])) {
             switch ($_CONF['db_type']) {
                 case 'mysql':
                 case 'mysqli':
                     $_CONF['db_port'] = '3306';
                     break;
                 case 'pgsql':
                     $_CONF['db_port'] = '5432';
                     break;
             }
         }
         $dsn = array('phptype' => $_CONF['db_type'], 'username' => $_CONF['db_user'], 'password' => $_CONF['db_pass'], 'database' => $_CONF['db_db'], 'hostspec' => $_CONF['db_host'], 'port' => $_CONF['db_port'], 'charset' => 'utf8');
         $dbopt = array('persistent' => true);
         $db = MDB2::factory($dsn, $dbopt);
         if (MDB2::isError($db)) {
             die("Database error: " . MDB2::errorMessage($db));
         } else {
             $db->setFetchMode(MDB2_FETCHMODE_ASSOC);
         }
         $query = $db->query("SELECT prefkey, prefval FROM options WHERE preftype = 'normal'");
         if (MDB2::isError($query)) {
             $err = $query->getMessage() . "\n" . $query->getDebugInfo();
             error_log($err);
             die($err);
         }
         while ($res = $query->fetchRow()) {
             $key = $res['prefkey'];
             switch ($key) {
                 case 'prins':
                 case 'secns':
                     $keyparam = substr($key, 0, 3) . '_d' . substr($key, -2);
                     break;
                 default:
                     $keyparam = $key;
             }
             $_CONF[$keyparam] = $res['prefval'];
         }
         $query = $db->query("SELECT prefkey FROM options WHERE prefval = 'on' AND preftype = 'record' ORDER BY prefkey");
         $_CONF['parameters'] = array();
         while ($res = $query->fetchRow()) {
             $_CONF['parameters'][] = $res['prefkey'];
         }
         $query = $db->query("SELECT DISTINCT type FROM records");
         while ($res = $query->fetchRow()) {
             $_CONF['parameters'][] = $res['type'];
         }
         $_CONF['parameters'] = array_unique($_CONF['parameters']);
         $_CONF['dsn'] = $dsn;
         $this->info = $_CONF;
     }
 }
开发者ID:PtY1968,项目名称:smbind-ng,代码行数:81,代码来源:smbind.class.php

示例11: __construct

 /**
  * MDB2_Error constructor.
  *
  * @param   mixed   MDB2 error code, or string with error message.
  * @param   int     what 'error mode' to operate in
  * @param   int     what error level to use for $mode & PEAR_ERROR_TRIGGER
  * @param   smixed   additional debug info, such as the last query
  */
 function __construct($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
 {
     parent::__construct('MDB2 Error: ' . MDB2::errorMessage($code), $code, $mode, $level, $debuginfo);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:12,代码来源:MDB2.php

示例12: log_db_error

function log_db_error($error_result, $query, $msg)
{
    if ($msg) {
        $log_msg = "DB ERROR {$msg}: \"";
    } else {
        $log_msg = "DB ERROR: \"";
    }
    $log_msg .= MDB2::errorMessage($error_result);
    $log_msg .= "\" for query \"{$query}\"";
    error_log($log_msg);
}
开发者ID:ahelsing,项目名称:geni-portal,代码行数:11,代码来源:db_utils.php

示例13: array

                $order_by_clauses = array("COUNT(v.bug) {$direction}");
                break;
        }
    } elseif ($order_by != '') {
        $order_by_clauses = array("{$order_by} {$direction}");
    }
    if ($status == 'Feedback') {
        $order_by_clauses[] = "bugdb.ts2 {$direction}";
    }
    if (count($order_by_clauses)) {
        $query .= ' ORDER BY ' . implode(', ', $order_by_clauses);
    }
    if ($limit != 'All' && $limit > 0) {
        $query .= " LIMIT {$begin}, {$limit}";
    }
    if (stristr($query, ';')) {
        $errors[] = 'BAD HACKER!! No database cracking for you today!';
    } else {
        $res = $dbh->prepare($query)->execute();
        if (!PEAR::isError($res)) {
            $rows = $res->numRows();
            $total_rows = $dbh->prepare('SELECT FOUND_ROWS()')->execute()->fetchOne();
        } else {
            $error = MDB2::errorMessage($res);
            $errors[] = $error;
        }
        if (defined('MAX_BUGS_RETURN') && $total_rows > $rows) {
            $warnings[] = 'The search was too general, only ' . MAX_BUGS_RETURN . ' bugs will be returned';
        }
    }
}
开发者ID:phpsource,项目名称:web-bugs,代码行数:31,代码来源:query.php


注:本文中的MDB2::errorMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。