本文整理汇总了PHP中error::pitch方法的典型用法代码示例。如果您正苦于以下问题:PHP error::pitch方法的具体用法?PHP error::pitch怎么用?PHP error::pitch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类error
的用法示例。
在下文中一共展示了error::pitch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile_error
function compile_error($message, $file, $line)
{
error::reset();
error::pitch(new FAError($message, $file, $line));
critical_error();
}
示例2: alterTable
function alterTable($table, $alterdefs)
{
if ($alterdefs != '') {
$result = sqlite_query($this->link, "SELECT sql, name, type FROM sqlite_master WHERE tbl_name = '" . $table . "' ORDER BY type DESC");
if (sqlite_num_rows($result) > 0) {
$row = sqlite_fetch_array($result);
//table sql
$tmpname = 't' . time();
$origsql = trim(preg_replace("/[\\s]+/", " ", str_replace(",", ", ", preg_replace("/[\\(]/", "( ", $row['sql'], 1))));
$createtemptableSQL = 'CREATE TEMPORARY ' . substr(trim(preg_replace("'" . $table . "'", $tmpname, $origsql, 1)), 6);
$createindexsql = array();
$i = 0;
$defs = preg_split("/[,]+/", $alterdefs, -1, PREG_SPLIT_NO_EMPTY);
$prevword = $table;
/* Doesn't work with decimal() columns.. e.g. decimal(5,2) */
$oldcols = preg_split("/[,]+/", substr(trim($createtemptableSQL), strpos(trim($createtemptableSQL), '(') + 1), -1, PREG_SPLIT_NO_EMPTY);
$newcols = array();
for ($i = 0; $i < count($oldcols); $i++) {
$colparts = preg_split("/[\\s]+/", $oldcols[$i], -1, PREG_SPLIT_NO_EMPTY);
$oldcols[$i] = $colparts[0];
$newcols[$colparts[0]] = $colparts[0];
}
$newcolumns = '';
$oldcolumns = '';
reset($newcols);
while (list($key, $val) = each($newcols)) {
$newcolumns .= iif($newcolumns, ', ', '') . $val;
$oldcolumns .= iif($oldcolumns, ', ', '') . $key;
}
$copytotempsql = 'INSERT INTO ' . $tmpname . '(' . $newcolumns . ') SELECT ' . $oldcolumns . ' FROM ' . $table;
$dropoldsql = 'DROP TABLE ' . $table;
$createtesttableSQL = $createtemptableSQL;
foreach ($defs as $def) {
$defparts = preg_split("/[\\s]+/", $def, -1, PREG_SPLIT_NO_EMPTY);
$action = strtolower($defparts[0]);
switch ($action) {
case 'add':
if (sizeof($defparts) <= 2) {
error::pitch(new FAError('An error occured near "' . $defparts[0] . iif($defparts[1], ' ' . $defparts[1], '') . '": syntax error.', __FILE__, __LINE__));
return FALSE;
}
$createtesttableSQL = substr($createtesttableSQL, 0, strlen($createtesttableSQL) - 1) . ',';
for ($i = 1; $i < sizeof($defparts); $i++) {
$createtesttableSQL .= ' ' . $defparts[$i];
}
$createtesttableSQL .= ')';
break;
case 'change':
if (count($defparts) <= 3) {
error::pitch(new FAError('An error occured near "' . $defparts[0] . iif($defparts[1], ' ' . $defparts[1], '') . iif($defparts[2], ' ' . $defparts[2], '') . '": syntax error.', __FILE__, __LINE__));
return FALSE;
}
if ($severpos = strpos($createtesttableSQL, ' ' . $defparts[1] . ' ')) {
if ($newcols[$defparts[1]] != $defparts[1]) {
error::pitch(new FAError('unknown column "' . $defparts[1] . '" in "' . $table . '"', __FILE__, __LINE__));
return FALSE;
}
$newcols[$defparts[1]] = $defparts[2];
$nextcommapos = strpos($createtesttableSQL, ',', $severpos);
$insertval = '';
for ($i = 2; $i < count($defparts); $i++) {
$insertval .= ' ' . $defparts[$i];
}
if ($nextcommapos) {
$createtesttableSQL = substr($createtesttableSQL, 0, $severpos) . $insertval . substr($createtesttableSQL, $nextcommapos);
} else {
$createtesttableSQL = substr($createtesttableSQL, 0, $severpos - iif(strpos($createtesttableSQL, ','), 0, 1)) . $insertval . ')';
}
} else {
error::pitch(new FAError('Unknown column "' . $defparts[1] . '" in "' . $table . '"', __FILE__, __LINE__));
return FALSE;
}
break;
case 'drop':
if (count($defparts) < 2) {
error::pitch(new FAError('An error occured near "' . $defparts[0] . iif($defparts[1], ' ' . $defparts[1], '') . '": syntax error.', __FILE__, __LINE__));
return FALSE;
}
if ($severpos = strpos($createtesttableSQL, ' ' . $defparts[1] . ' ')) {
$nextcommapos = strpos($createtesttableSQL, ',', $severpos);
if ($nextcommapos) {
$createtesttableSQL = substr($createtesttableSQL, 0, $severpos) . substr($createtesttableSQL, $nextcommapos + 1);
} else {
$createtesttableSQL = substr($createtesttableSQL, 0, $severpos - (strpos($createtesttableSQL, ',') ? 0 : 1) - 1) . ')';
}
unset($newcols[$defparts[1]]);
} else {
error::pitch(new FAError('Unknown column "' . $defparts[1] . '" in "' . $table . '".', __FILE__, __LINE__));
return FALSE;
}
break;
default:
error::pitch(new FAError('An error occured near "' . $prevword . '": syntax error.', __FILE__, __LINE__));
return FALSE;
}
$prevword = $defparts[count($defparts) - 1];
}
/**
* this block of code generates a test table simply to verify that the columns
* specifed are valid in an sql statement this ensures that no reserved words
//.........这里部分代码省略.........
示例3: render
function render()
{
$filename = $this->getFilename(TPL_SOURCE);
$compiled = $this->getFilename(TPL_COMPILED);
if ($filename == $compiled) {
error::pitch(new FAError("The source and compiled templates are the same: {$filename}", __FILE__, __LINE__));
return FALSE;
}
if (!is_readable($filename) || !file_exists($filename)) {
error::pitch(new FAError("Cannot read template file or file does not exist: {$filename}", __FILE__, __LINE__));
return FALSE;
}
require_once TPL_BASE_DIR . '/runtime.php';
if ($this->context == NULL) {
$this->context =& new TPL_Context($this->vars, $this->lists);
}
$template = $this;
$context =& $this->context;
if (!$this->cache) {
$source =& new TPL_Source($filename);
$buffer = $source->compile();
eval(" ?>{$buffer}<?php ");
} else {
if ($this->getForce() || !file_exists($compiled) || filemtime($filename) > filemtime($compiled)) {
$source =& new TPL_Source($filename);
$source->compileTo($compiled);
}
if (!file_exists($compiled)) {
error::pitch(new FAError("The compiled template does not exist or could not be created: " . $compiled, __FILE__, __LINE__));
return FALSE;
}
include $compiled;
}
}