function _adodb_debug_execute(&$zthis, $sql, $inputarr) { $ss = ''; if ($inputarr) { foreach ($inputarr as $kk => $vv) { if (is_string($vv) && strlen($vv) > 64) { $vv = substr($vv, 0, 64) . '...'; } if (is_null($vv)) { $ss .= "({$kk}=>null) "; } else { $ss .= "({$kk}=>'{$vv}') "; } } $ss = "[ {$ss} ]"; } $sqlTxt = is_array($sql) ? $sql[0] : $sql; /*str_replace(', ','##1#__^LF',is_array($sql) ? $sql[0] : $sql); $sqlTxt = str_replace(',',', ',$sqlTxt); $sqlTxt = str_replace('##1#__^LF', ', ' ,$sqlTxt); */ // check if running from browser or command-line $inBrowser = isset($_SERVER['HTTP_USER_AGENT']); $dbt = $zthis->databaseType; if (isset($zthis->dsnType)) { $dbt .= '-' . $zthis->dsnType; } if ($inBrowser) { if ($ss) { $ss = '<code>' . htmlspecialchars($ss) . '</code>'; } if ($zthis->debug === -1) { ADOConnection::outp("<br>\n({$dbt}): " . htmlspecialchars($sqlTxt) . " {$ss}\n<br>\n", false); } else { if ($zthis->debug !== -99) { ADOConnection::outp("<hr>\n({$dbt}): " . htmlspecialchars($sqlTxt) . " {$ss}\n<hr>\n", false); } } } else { $ss = "\n " . $ss; if ($zthis->debug !== -99) { ADOConnection::outp("-----<hr>\n({$dbt}): " . $sqlTxt . " {$ss}\n-----<hr>\n", false); } } $qID = $zthis->_query($sql, $inputarr); /* Alexios Fakios notes that ErrorMsg() must be called before ErrorNo() for mssql because ErrorNo() calls Execute('SELECT @ERROR'), causing recursion */ if ($zthis->databaseType == 'mssql') { // ErrorNo is a slow function call in mssql, and not reliable in PHP 4.0.6 if ($emsg = $zthis->ErrorMsg()) { if ($err = $zthis->ErrorNo()) { if ($zthis->debug === -99) { ADOConnection::outp("<hr>\n({$dbt}): " . htmlspecialchars($sqlTxt) . " {$ss}\n<hr>\n", false); } ADOConnection::outp($err . ': ' . $emsg); } } } else { if (!$qID) { if ($zthis->debug === -99) { if ($inBrowser) { ADOConnection::outp("<hr>\n({$dbt}): " . htmlspecialchars($sqlTxt) . " {$ss}\n<hr>\n", false); } else { ADOConnection::outp("-----<hr>\n({$dbt}): " . $sqlTxt . "{$ss}\n-----<hr>\n", false); } } ADOConnection::outp($zthis->ErrorNo() . ': ' . $zthis->ErrorMsg()); } } if ($zthis->debug === 99) { _adodb_backtrace(true, 9999, 2); } return $qID; }
function adodb_backtrace($printOrArr = true, $levels = 9999) { global $ADODB_INCLUDED_LIB; if (empty($ADODB_INCLUDED_LIB)) { include ADODB_DIR . '/adodb-lib.inc.php'; } return _adodb_backtrace($printOrArr, $levels); }
function adodb_backtrace($printOrArr=true,$levels=9999,$ishtml=null) { global $ADODB_INCLUDED_LIB; if (empty($ADODB_INCLUDED_LIB)) include(ADODB_DIR.'/adodb-lib.inc.php'); return _adodb_backtrace($printOrArr,$levels,0,$ishtml); }