本文整理汇总了PHP中ExceptionHandler::dbexInvalidSQL方法的典型用法代码示例。如果您正苦于以下问题:PHP ExceptionHandler::dbexInvalidSQL方法的具体用法?PHP ExceptionHandler::dbexInvalidSQL怎么用?PHP ExceptionHandler::dbexInvalidSQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExceptionHandler
的用法示例。
在下文中一共展示了ExceptionHandler::dbexInvalidSQL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: countResultset
function countResultset($schStr = '', $schField = -1, $schArr = false)
{
if ($this->flg_select == 'true') {
// check whether the flg_select is 'True'
$arrayFieldList = $this->arr_select;
//assign the sql_format->arr_select instance variable to arrayFieldList
$countArrSize = count($arrayFieldList);
// check the array size
$SQL1 = 'SELECT count(*) FROM ' . strtolower($this->table_name);
//Tail of the SQL statement
if ($schField != -1) {
$SQL1 = $SQL1 . ' WHERE ';
if ($schArr) {
for ($i = 0; $i < count($schField); $i++) {
if ($schField[$i] != -1) {
$SQL1 = $SQL1 . $arrayFieldList[$schField[$i]] . ' LIKE \'%' . trim(mysql_real_escape_string($schStr[$i])) . '%\' AND ';
}
}
$SQL1 = substr($SQL1, 0, -1 - 4);
} else {
$SQL1 = $SQL1 . $arrayFieldList[$schField] . ' LIKE \'%' . trim(mysql_real_escape_string($schStr)) . '%\'';
}
}
//$exception_handler = new ExceptionHandler();
//$exception_handler->logW($SQL1);
return $SQL1;
//returning the SQL1 which has the SQL Query
} else {
$exception_handler = new ExceptionHandler();
$exception_handler->dbexInvalidSQL();
echo "ERROR";
// put Exception Handling
exit;
}
}
示例2: sqlQuery
/**
* This method will execute an SQL statement using mysql_query() function
* @param String $sql SQL statement to be executed
* @return ResultResource If the statement executed success, boolean false in an error
*/
public function sqlQuery($sql)
{
if (isset($this->conn) && $sql != '') {
$this->result = mysql_query($sql);
if ($this->result) {
return $this->result;
}
/*
* Return false if duplicate key is entered
* TODO: Throw an exception here, and chanage code to catch it on model level
*/
if (mysql_errno() == 1062) {
return false;
}
$exception_handler = new ExceptionHandler();
$exception_handler->dbexInvalidSQL($sql);
return false;
} else {
$exception_handler = new ExceptionHandler();
$exception_handler->dbexNoQueryFound($sql);
return false;
}
}
示例3: sqlQuery
function sqlQuery($sql)
{
if (isset($this->conn) && $sql != '') {
$this->result = mysql_query($sql);
if ($this->result) {
return $this->result;
}
if (mysql_errno() == 1062) {
return false;
}
$exception_handler = new ExceptionHandler();
$exception_handler->dbexInvalidSQL($sql);
return false;
} else {
$exception_handler = new ExceptionHandler();
$exception_handler->dbexNoQueryFound($sql);
return false;
}
}