本文整理匯總了PHP中D::stackTrace方法的典型用法代碼示例。如果您正苦於以下問題:PHP D::stackTrace方法的具體用法?PHP D::stackTrace怎麽用?PHP D::stackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類D
的用法示例。
在下文中一共展示了D::stackTrace方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: query
function query($sql, $returnType=null) {
if($this->prepared == false) {
$this->prepare($sql);
}
//echo "\n SQL call = " . $sql . "\n";
$this->queries[] = $sql;
// $this->result = $this->connection->query($sql);
D::log("\n" . $sql, 'SQL call');
$this->result = mysql_query($sql, $this->connection);
$this->prepared = false;
if(!$this->result) {
D::stack();
D::log(mysql_error($this->connection), 'SQL Errors');
return false;
}
$returnArray = array();
/* @todo
get rid of this switch and use an array of functions instead.
*/
if(!isset($returnType)) {
return true;
}
switch ($returnType) {
case 'object':
if(!is_resource($this->result)) {
D::stackTrace();
}
while($row = mysql_fetch_object($this->result)) {
$returnArray[] = $row;
}
return $returnArray;
break;
case 'assoc':
while($row = mysql_fetch_assoc($this->result)) {
$returnArray[] = $row;
}
return $returnArray;
break;
case 'driver':
return $this->result;
break;
case 'raw':
return $this->result;
break;
default:
return true;
}
}