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


PHP PMA_Error类代码示例

本文整理汇总了PHP中PMA_Error的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Error类的具体用法?PHP PMA_Error怎么用?PHP PMA_Error使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: PMA_DBI_try_query

/**
 * runs a query and returns the result
 *
 * @param string $query query to run
 * @param resource $link mysql link resource
 * @param integer $options
 * @return mixed
 */
function PMA_DBI_try_query($query, $link = null, $options = 0)
{
    if (empty($link)) {
        if (isset($GLOBALS['userlink'])) {
            $link = $GLOBALS['userlink'];
        } else {
            return false;
        }
    }
    if ($GLOBALS['cfg']['DBG']['sql']) {
        $time = microtime(true);
    }
    if ($options == ($options | PMA_DBI_QUERY_STORE)) {
        $r = mysql_query($query, $link);
    } elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) {
        $r = mysql_unbuffered_query($query, $link);
    } else {
        $r = mysql_query($query, $link);
    }
    if ($GLOBALS['cfg']['DBG']['sql']) {
        $time = microtime(true) - $time;
        $hash = md5($query);
        if (isset($_SESSION['debug']['queries'][$hash])) {
            $_SESSION['debug']['queries'][$hash]['count']++;
        } else {
            $_SESSION['debug']['queries'][$hash] = array();
            $_SESSION['debug']['queries'][$hash]['count'] = 1;
            $_SESSION['debug']['queries'][$hash]['query'] = $query;
            $_SESSION['debug']['queries'][$hash]['time'] = $time;
        }
        $trace = array();
        foreach (debug_backtrace() as $trace_step) {
            $trace[] = PMA_Error::relPath($trace_step['file']) . '#' . $trace_step['line'] . ': ' . (isset($trace_step['class']) ? $trace_step['class'] : '') . (isset($trace_step['type']) ? $trace_step['type'] : '') . (isset($trace_step['function']) ? $trace_step['function'] : '') . '(' . (isset($trace_step['params']) ? implode(', ', $trace_step['params']) : '') . ')';
        }
        $_SESSION['debug']['queries'][$hash]['trace'][] = $trace;
    }
    if ($r != FALSE && PMA_Tracker::isActive() == TRUE) {
        PMA_Tracker::handleQuery($query);
    }
    return $r;
}
开发者ID:wdingsoft,项目名称:test1.jit,代码行数:49,代码来源:mysql.dbi.lib.php

示例2: PMA_DBI_try_query

/**
 * runs a query and returns the result
 *
 * @param string   $query               query to run
 * @param resource $link                mysql link resource
 * @param integer  $options             query options
 * @param bool     $cache_affected_rows whether to cache affected row
 *
 * @return mixed
 */
function PMA_DBI_try_query($query, $link = null, $options = 0, $cache_affected_rows = true)
{
    if (empty($link)) {
        if (isset($GLOBALS['userlink'])) {
            $link = $GLOBALS['userlink'];
        } else {
            return false;
        }
    }
    if ($GLOBALS['cfg']['DBG']['sql']) {
        $time = microtime(true);
    }
    $r = PMA_DBI_real_query($query, $link, $options);
    if ($cache_affected_rows) {
        $GLOBALS['cached_affected_rows'] = PMA_DBI_affected_rows($link, $get_from_cache = false);
    }
    if ($GLOBALS['cfg']['DBG']['sql']) {
        $time = microtime(true) - $time;
        $hash = md5($query);
        if (isset($_SESSION['debug']['queries'][$hash])) {
            $_SESSION['debug']['queries'][$hash]['count']++;
        } else {
            $_SESSION['debug']['queries'][$hash] = array();
            if ($r == false) {
                $_SESSION['debug']['queries'][$hash]['error'] = '<b style="color:red">' . mysqli_error($link) . '</b>';
            }
            $_SESSION['debug']['queries'][$hash]['count'] = 1;
            $_SESSION['debug']['queries'][$hash]['query'] = $query;
            $_SESSION['debug']['queries'][$hash]['time'] = $time;
        }
        $trace = array();
        foreach (debug_backtrace() as $trace_step) {
            $trace[] = PMA_Error::relPath($trace_step['file']) . '#' . $trace_step['line'] . ': ' . (isset($trace_step['class']) ? $trace_step['class'] : '') . (isset($trace_step['type']) ? $trace_step['type'] : '') . (isset($trace_step['function']) ? $trace_step['function'] : '') . '(' . (isset($trace_step['params']) ? implode(', ', $trace_step['params']) : '') . ')';
        }
        $_SESSION['debug']['queries'][$hash]['trace'][] = $trace;
    }
    if ($r != false && PMA_Tracker::isActive() == true) {
        PMA_Tracker::handleQuery($query);
    }
    return $r;
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:51,代码来源:database_interface.lib.php

示例3: logError

 /**
  * log error to configured log facility
  *
  * @param PMA_Error $error the error
  *
  * @return bool
  *
  * @todo finish!
  */
 protected function logError($error)
 {
     return error_log($error->getMessage());
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:13,代码来源:Error_Handler.class.php

示例4: _dbgQuery

 /**
  * Stores query data into session data for debugging purposes
  *
  * @param string   $query  Query text
  * @param resource $link   database link
  * @param resource $result Query result
  * @param integer  $time   Time to execute query
  *
  * @return void
  */
 private function _dbgQuery($query, $link, $result, $time)
 {
     $hash = md5($query);
     if (isset($_SESSION['debug']['queries'][$hash])) {
         $_SESSION['debug']['queries'][$hash]['count']++;
     } else {
         $_SESSION['debug']['queries'][$hash] = array();
         if ($result == false) {
             $_SESSION['debug']['queries'][$hash]['error'] = '<b style="color:red">' . mysqli_error($link) . '</b>';
         }
         $_SESSION['debug']['queries'][$hash]['count'] = 1;
         $_SESSION['debug']['queries'][$hash]['query'] = $query;
         $_SESSION['debug']['queries'][$hash]['time'] = $time;
     }
     $trace = array();
     foreach (debug_backtrace() as $trace_step) {
         $trace[] = (isset($trace_step['file']) ? PMA_Error::relPath($trace_step['file']) : '') . (isset($trace_step['line']) ? '#' . $trace_step['line'] . ': ' : '') . (isset($trace_step['class']) ? $trace_step['class'] : '') . (isset($trace_step['type']) ? $trace_step['type'] : '') . (isset($trace_step['function']) ? $trace_step['function'] : '') . '(' . (isset($trace_step['params']) ? implode(', ', $trace_step['params']) : '') . ')';
     }
     $_SESSION['debug']['queries'][$hash]['trace'][] = $trace;
 }
开发者ID:lcylp,项目名称:wamp,代码行数:30,代码来源:DatabaseInterface.class.php

示例5: PMA_Config_fatalErrorHandler

/**
 * Error handler to catch fatal errors when loading configuration
 * file
 *
 * @return void
 */
function PMA_Config_fatalErrorHandler()
{
    if (isset($GLOBALS['pma_config_loading']) && $GLOBALS['pma_config_loading']) {
        $error = error_get_last();
        if ($error !== null) {
            PMA_fatalError(sprintf('Failed to load phpMyAdmin configuration (%s:%s): %s', PMA_Error::relPath($error['file']), $error['line'], $error['message']));
        }
    }
}
开发者ID:antonchernik,项目名称:virtualbox-environment-gui,代码行数:15,代码来源:Config.class.php

示例6: _dbgQuery

 /**
  * Stores query data into session data for debugging purposes
  *
  * @param string         $query  Query text
  * @param object         $link   database link
  * @param object|boolean $result Query result
  * @param integer        $time   Time to execute query
  *
  * @return void
  */
 private function _dbgQuery($query, $link, $result, $time)
 {
     $dbgInfo = array();
     $error_message = $this->getError($link);
     if ($result == false && is_string($error_message)) {
         $dbgInfo['error'] = '<span style="color:red">' . htmlspecialchars($error_message) . '</span>';
     }
     $dbgInfo['query'] = htmlspecialchars($query);
     $dbgInfo['time'] = $time;
     // Get and slightly format backtrace
     $dbgInfo['trace'] = debug_backtrace();
     foreach ($dbgInfo['trace'] as $key => $step) {
         if (isset($step['file'])) {
             $dbgInfo['trace'][$key]['file'] = PMA_Error::relPath($step['file']);
         }
     }
     $dbgInfo['hash'] = md5($query);
     $_SESSION['debug']['queries'][] = $dbgInfo;
 }
开发者ID:FuhrerMalkovich,项目名称:Blogpost,代码行数:29,代码来源:DatabaseInterface.class.php

示例7: PMA_DBI_try_query

/**
 * runs a query and returns the result
 *
 * @uses    PMA_DBI_QUERY_STORE
 * @uses    PMA_DBI_QUERY_UNBUFFERED
 * @uses    $GLOBALS['userlink']
 * @uses    MYSQLI_STORE_RESULT
 * @uses    MYSQLI_USE_RESULT
 * @uses    mysqli_query()
 * @uses    defined()
 * @param   string          $query      query to execute
 * @param   object mysqli   $link       mysqli object
 * @param   integer         $options
 * @param   boolean         $cache_affected_rows
 * @return  mixed           true, false or result object
 */
function PMA_DBI_try_query($query, $link = null, $options = 0, $cache_affected_rows = true)
{
    if ($options == ($options | PMA_DBI_QUERY_STORE)) {
        $method = MYSQLI_STORE_RESULT;
    } elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) {
        $method = MYSQLI_USE_RESULT;
    } else {
        $method = 0;
    }
    if (empty($link)) {
        if (isset($GLOBALS['userlink'])) {
            $link = $GLOBALS['userlink'];
        } else {
            return false;
        }
    }
    if ($GLOBALS['cfg']['DBG']['sql']) {
        $time = microtime(true);
    }
    $r = mysqli_query($link, $query, $method);
    if ($cache_affected_rows) {
        $GLOBALS['cached_affected_rows'] = PMA_DBI_affected_rows($link, $get_from_cache = false);
    }
    if ($GLOBALS['cfg']['DBG']['sql']) {
        $time = microtime(true) - $time;
        $hash = md5($query);
        if (isset($_SESSION['debug']['queries'][$hash])) {
            $_SESSION['debug']['queries'][$hash]['count']++;
        } else {
            $_SESSION['debug']['queries'][$hash] = array();
            $_SESSION['debug']['queries'][$hash]['count'] = 1;
            $_SESSION['debug']['queries'][$hash]['query'] = $query;
            $_SESSION['debug']['queries'][$hash]['time'] = $time;
        }
        $trace = array();
        foreach (debug_backtrace() as $trace_step) {
            $trace[] = PMA_Error::relPath($trace_step['file']) . '#' . $trace_step['line'] . ': ' . (isset($trace_step['class']) ? $trace_step['class'] : '') . (isset($trace_step['type']) ? $trace_step['type'] : '') . (isset($trace_step['function']) ? $trace_step['function'] : '') . '(' . (isset($trace_step['params']) ? implode(', ', $trace_step['params']) : '') . ')';
        }
        $_SESSION['debug']['queries'][$hash]['trace'][] = $trace;
    }
    if ($r != FALSE && PMA_Tracker::isActive() == TRUE) {
        PMA_Tracker::handleQuery($query);
    }
    return $r;
    // From the PHP manual:
    // "note: returns true on success or false on failure. For SELECT,
    // SHOW, DESCRIBE or EXPLAIN, mysqli_query() will return a result object"
    // so, do not use the return value to feed mysqli_num_rows() if it's
    // a boolean
}
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:66,代码来源:mysqli.dbi.lib.php

示例8: _dbgQuery

 /**
  * Stores query data into session data for debugging purposes
  *
  * @param string         $query  Query text
  * @param object         $link   database link
  * @param object|boolean $result Query result
  * @param integer        $time   Time to execute query
  *
  * @return void
  */
 private function _dbgQuery($query, $link, $result, $time)
 {
     $hash = md5($query);
     if (isset($_SESSION['debug']['queries'][$hash])) {
         $_SESSION['debug']['queries'][$hash]['count']++;
     } else {
         $_SESSION['debug']['queries'][$hash] = array();
         $error_message = $this->getError($link);
         if ($result == false && is_string($error_message)) {
             $_SESSION['debug']['queries'][$hash]['error'] = '<b style="color:red">' . htmlspecialchars($error_message) . '</b>';
         }
         $_SESSION['debug']['queries'][$hash]['count'] = 1;
         $_SESSION['debug']['queries'][$hash]['query'] = htmlspecialchars($query);
         $_SESSION['debug']['queries'][$hash]['time'] = $time;
     }
     $_SESSION['debug']['queries'][$hash]['trace'][] = PMA_Error::formatBacktrace(debug_backtrace(), " ", "\n");
 }
开发者ID:xtreme-jamil-shamy,项目名称:phpmyadmin-cf,代码行数:27,代码来源:DatabaseInterface.class.php

示例9: getArg

 /**
  * Get a single function argument
  *
  * if $function is one of include/require
  * the $arg is converted to a relative path
  *
  * @param string $arg      argument to process
  * @param string $function function name
  *
  * @return string
  */
 public static function getArg($arg, $function)
 {
     $retval = '';
     $include_functions = array('include', 'include_once', 'require', 'require_once');
     $connect_functions = array('mysql_connect', 'mysql_pconnect', 'mysqli_connect', 'mysqli_real_connect', 'connect', '_realConnect');
     if (in_array($function, $include_functions)) {
         $retval .= PMA_Error::relPath($arg);
     } elseif (in_array($function, $connect_functions) && getType($arg) === 'string') {
         $retval .= getType($arg) . ' ********';
     } elseif (is_scalar($arg)) {
         $retval .= getType($arg) . ' ' . htmlspecialchars(var_export($arg, true));
     } else {
         $retval .= getType($arg);
     }
     return $retval;
 }
开发者ID:FuhrerMalkovich,项目名称:Blogpost,代码行数:27,代码来源:Error.class.php

示例10: getArg

 /**
  * Get a single function argument
  *
  * if $function is one of include/require
  * the $arg is converted to a relative path
  *
  * @param string $arg
  * @param string $function
  *
  * @return string
  */
 protected function getArg($arg, $function)
 {
     $retval = '';
     $include_functions = array('include', 'include_once', 'require', 'require_once');
     if (in_array($function, $include_functions)) {
         $retval .= PMA_Error::relPath($arg);
     } elseif (is_scalar($arg)) {
         $retval .= getType($arg) . ' ' . htmlspecialchars($arg);
     } else {
         $retval .= getType($arg);
     }
     return $retval;
 }
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:24,代码来源:Error.class.php

示例11: PMA_DBI_try_query

/**
 * runs a query and returns the result
 *
 * @param string $query query to run
 * @param resource $link mysql link resource
 * @param integer $options
 * @return mixed
 */
function PMA_DBI_try_query($query, $link = null, $options = 0, $cache_affected_rows = true)
{
    //print_r($query);
    if (empty($link)) {
        if (isset($GLOBALS['userlink'])) {
            $link = $GLOBALS['userlink'];
        } else {
            return false;
        }
    }
    if ($GLOBALS['cfg']['DBG']['sql']) {
        $time = microtime(true);
    }
    /*
        if ($options == ($options | PMA_DBI_QUERY_STORE)) {
            $r = mysql_query($query, $link);
        } elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) {
            $r = mysql_unbuffered_query($query, $link);
        } else {
            $r = mysql_query($query, $link);
        }
    */
    $stid = oci_parse($link, $query);
    if (!$stid) {
        $e = oci_error($link);
        // For oci_execute errors pass the statement handle
        PMA_mysqlDie($e['message'], $query);
    }
    $result_sql = oci_execute($stid);
    if (!$result_sql) {
        $e = oci_error($stid);
        // For oci_execute errors pass the statement handle
        //$error_str = ($e['message'])
        //. ($e['sqltext']);
        $sql_str = substr_replace($e['sqltext'], '^', $e['offset'], 0);
        PMA_mysqlDie($e['message'], $sql_str);
    }
    $r = $stid;
    if ($cache_affected_rows) {
        $GLOBALS['cached_affected_rows'] = PMA_DBI_affected_rows($r, $get_from_cache = false);
    }
    if ($GLOBALS['cfg']['DBG']['sql']) {
        $time = microtime(true) - $time;
        $hash = md5($query);
        if (isset($_SESSION['debug']['queries'][$hash])) {
            $_SESSION['debug']['queries'][$hash]['count']++;
        } else {
            $_SESSION['debug']['queries'][$hash] = array();
            $_SESSION['debug']['queries'][$hash]['count'] = 1;
            $_SESSION['debug']['queries'][$hash]['query'] = $query;
            $_SESSION['debug']['queries'][$hash]['time'] = $time;
        }
        $trace = array();
        foreach (debug_backtrace() as $trace_step) {
            $trace[] = PMA_Error::relPath($trace_step['file']) . '#' . $trace_step['line'] . ': ' . (isset($trace_step['class']) ? $trace_step['class'] : '') . (isset($trace_step['type']) ? $trace_step['type'] : '') . (isset($trace_step['function']) ? $trace_step['function'] : '') . '(' . (isset($trace_step['params']) ? implode(', ', $trace_step['params']) : '') . ')';
        }
        $_SESSION['debug']['queries'][$hash]['trace'][] = $trace;
    }
    if ($r != FALSE && PMA_Tracker::isActive() == TRUE) {
        PMA_Tracker::handleQuery($query);
    }
    return $r;
}
开发者ID:bugyak,项目名称:phporadmin,代码行数:71,代码来源:oci.dbi.lib.php


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