本文整理匯總了PHP中SqlParser::parseTableName方法的典型用法代碼示例。如果您正苦於以下問題:PHP SqlParser::parseTableName方法的具體用法?PHP SqlParser::parseTableName怎麽用?PHP SqlParser::parseTableName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SqlParser
的用法示例。
在下文中一共展示了SqlParser::parseTableName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: start
/**
* @param string $sql
*/
public function start($sql)
{
// find caller
$context = array();
$ns = str_replace('\\', '/', __NAMESPACE__);
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10);
foreach ($backtrace as $i => $trace) {
if (strpos($trace['file'], $ns) === false) {
switch ($trace['class']) {
case 'Graphite\\Db\\Connection':
case 'Graphite\\Db\\Query\\AbstractQuery':
$next = $backtrace[$i + 1];
$initiator = $this->_formatClass($next['class'], $next['type'], $next['function']);
break;
case 'Graphite\\Db\\ActiveRecord\\Model':
$initiator = $this->_formatClass($this->staticCaller, $trace['type'], $trace['function']);
break;
case 'Graphite\\Db\\ActiveRecord\\Finder':
$initiator = $this->_formatClass($this->staticCaller, $trace['type'], 'find');
break;
default:
$initiator = $this->_formatClass($trace['class'], $trace['class'], $trace['function']);
}
$context['initiator'] = $initiator;
$context['file'] = empty($this->basePath) ? $trace['file'] : str_replace($this->basePath, '', $trace['file']);
$context['line'] = $trace['line'];
break;
}
}
$this->query = array('sql' => $sql, 'start' => microtime(true), 'type' => $this->parseType($sql), 'table' => SqlParser::parseTableName($sql), 'context' => $context);
if ($this->callback) {
call_user_func($this->callback, 'start', $this->query);
}
}