本文整理汇总了PHP中PMA_SQP_throwError函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_SQP_throwError函数的具体用法?PHP PMA_SQP_throwError怎么用?PHP PMA_SQP_throwError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_SQP_throwError函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_SQP_parse
//.........这里部分代码省略.........
break;
case '-':
$type = 'ansi';
$pos = mb_strpos($sql, "\n", $count2);
break;
case '/':
$type = 'c';
$pos = mb_strpos($sql, '*/', $count2);
$pos += 2;
break;
default:
break;
}
// end switch
$count2 = $pos < $count2 ? $len : $pos;
$str = mb_substr($sql, $count1, $count2 - $count1);
PMA_SQP_arrayAdd($sql_array, 'comment_' . $type, $str, $arraysize, $count2);
continue;
}
// end if
// Checks for something inside quotation marks
if (mb_strpos($quote_list, $c) !== false) {
$startquotepos = $count2;
$quotetype = $c;
$count2++;
$pos = $count2;
do {
$oldpos = $pos;
$pos = mb_strpos(' ' . $sql, $quotetype, $oldpos + 1) - 1;
// ($pos === false)
if ($pos < 0) {
if ($c != '`') {
$debugstr = __('Unclosed quote') . ' @ ' . $startquotepos . "\n" . 'STR: ' . htmlspecialchars($quotetype);
PMA_SQP_throwError($debugstr, $sql);
return $sql_array;
}
/*
* Behave same as MySQL and accept end of query as end
* of backtick.
* I know this is sick, but MySQL behaves like this:
*
* SELECT * FROM `table
*
* is treated like
*
* SELECT * FROM `table`
*/
$pos_quote_separator = mb_strpos(' ' . $sql, $GLOBALS['sql_delimiter'], $oldpos + 1) - 1;
if ($pos_quote_separator < 0) {
$len += 1;
$sql .= '`';
$sql_array['raw'] .= '`';
$pos = $len;
} else {
$len += 1;
$sql = mb_substr($sql, 0, $pos_quote_separator) . '`' . mb_substr($sql, $pos_quote_separator);
$sql_array['raw'] = $sql;
$pos = $pos_quote_separator;
}
if (class_exists('PMA_Message') && $GLOBALS['is_ajax_request'] != true) {
PMA_Message::notice(__('Automatically appended backtick to the end of query!'))->display();
}
}
// If the quote is the first character, it can't be
// escaped, so don't do the rest of the code
if ($pos == 0) {
示例2: PMA_SQP_parse
//.........这里部分代码省略.........
$type = 'ansi';
$pos = $GLOBALS['PMA_strpos']($sql, "\n", $count2);
break;
case '/':
$type = 'c';
$pos = $GLOBALS['PMA_strpos']($sql, '*/', $count2);
$pos += 2;
break;
default:
break;
}
// end switch
$count2 = $pos < $count2 ? $len : $pos;
$str = PMA_substr($sql, $count1, $count2 - $count1);
PMA_SQP_arrayAdd($sql_array, 'comment_' . $type, $str, $arraysize);
continue;
}
// end if
// Checks for something inside quotation marks
if (PMA_STR_strInStr($c, $quote_list)) {
$startquotepos = $count2;
$quotetype = $c;
$count2++;
$escaped = FALSE;
$escaped_escaped = FALSE;
$pos = $count2;
$oldpos = 0;
do {
$oldpos = $pos;
$pos = $GLOBALS['PMA_strpos'](' ' . $sql, $quotetype, $oldpos + 1) - 1;
// ($pos === FALSE)
if ($pos < 0) {
$debugstr = $GLOBALS['strSQPBugUnclosedQuote'] . ' @ ' . $startquotepos . "\n" . 'STR: ' . htmlspecialchars($quotetype);
PMA_SQP_throwError($debugstr, $sql);
return $sql;
}
// If the quote is the first character, it can't be
// escaped, so don't do the rest of the code
if ($pos == 0) {
break;
}
// Checks for MySQL escaping using a \
// And checks for ANSI escaping using the $quotetype character
if ($pos < $len && PMA_STR_charIsEscaped($sql, $pos)) {
$pos++;
continue;
} else {
if ($pos + 1 < $len && PMA_substr($sql, $pos, 1) == $quotetype && PMA_substr($sql, $pos + 1, 1) == $quotetype) {
$pos = $pos + 2;
continue;
} else {
break;
}
}
} while ($len > $pos);
// end do
$count2 = $pos;
$count2++;
$type = 'quote_';
switch ($quotetype) {
case '\'':
$type .= 'single';
break;
case '"':
$type .= 'double';
break;
示例3: testPMA_SQP_throwError
/**
* Test PMA_SQP_throwError
*
* @return void
*/
public function testPMA_SQP_throwError()
{
global $SQP_errorString;
$message = "error from testPMA_SQP_throwError";
$sql = "select * from PMA.PMABookmark";
PMA_SQP_throwError($message, $sql);
$this->assertContains("There seems to be an error in your SQL query.", $SQP_errorString);
$this->assertContains('ERROR: ' . $message, $SQP_errorString);
$this->assertContains('SQL: ' . htmlspecialchars($sql), $SQP_errorString);
}