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


PHP PMA_Tracker::handleQuery方法代码示例

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


在下文中一共展示了PMA_Tracker::handleQuery方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: tryQuery

 /**
  * 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
  */
 public function tryQuery($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);
     }
     $result = $this->_extension->realQuery($query, $link, $options);
     if ($cache_affected_rows) {
         $GLOBALS['cached_affected_rows'] = $this->affectedRows($link, false);
     }
     if ($GLOBALS['cfg']['DBG']['sql']) {
         $time = microtime(true) - $time;
         $this->_dbgQuery($query, $link, $result, $time);
     }
     if ($result != false && PMA_Tracker::isActive() == true) {
         PMA_Tracker::handleQuery($query);
     }
     return $result;
 }
开发者ID:lcylp,项目名称:wamp,代码行数:35,代码来源:DatabaseInterface.class.php

示例4: 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);
    }
    $result = 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;
        PMA_DBI_DBG_query($query, $link, $result, $time);
    }
    if ($result != false && PMA_Tracker::isActive() == true) {
        PMA_Tracker::handleQuery($query);
    }
    return $result;
}
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:35,代码来源:database_interface.lib.php

示例5: 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

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