我收到此错误:
”:oci_fetch_array():ORA-24374:在“
”中进行获取或执行并获取之前未完成定义来自header.php第46行。
header.php中的代码
public function dbQuerySafe($statement, $format = '', $args = array(), $outvar = '')
{
$config = include('includes/config.php');
$res = '';
$connectionString = $config['database']['tnsstring'];
$username = $config['database']['user'];
$password = $config['database']['password'];
$connobj = oci_connect($username, $password, $connectionString);
$error = false;
$result = false;
if (!$connobj) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
exit();
}
//print_r($statement);
$stid = oci_parse($connobj, $statement);
if ($stid) {
if (!empty($format) && !empty($args)) {
foreach ($args as $key => $val) {
oci_bind_by_name($stid, $key, $args[$key]);
}
}
if ($format == 'insert' && !empty($outvar)) {
oci_bind_by_name($stid, ':' . $outvar, $res, 32);
}
$rsltflag = oci_execute($stid);
if ($rsltflag && $format != 'insert') {
$result = array();
//line 46 is below
while (($row = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
foreach ($row as $key => $val) {
$c[$key] = $val;
}
$result[] = $c;
}
} else if ($rsltflag && $format == 'insert') {
$result = $res;
} else {
$result = false;
$error = oci_error($stid);
$log = new Logger('header.php- line 57');
$log->pushHandler(new StreamHandler(dirname(__FILE__) . './log/db_queries.log', Logger::ERROR));
// $log->error($error['message'] . '. SQL query which caused the error: ' . $error['sqltext']);
$log->error("Error connecting to database: ", array('username' => $username, 'module' => $_SERVER['PHP_SELF'], 'page_name' => 'header.php', 'error_at' => 'line 57', 'severity' => 'ERROR', 'error_msg' => $error['message'] . '. SQL query which caused the error: ' . substr($error['sqltext'], 0, 250)));
trigger_error(htmlentities($error['message'], ENT_QUOTES), E_USER_ERROR);
}
}
oci_free_statement($stid);
oci_close($connobj);
return array($result, $error);
}
调用此函数的代码是此函数:
public function deleteOldErrorLogEntries()
{
list($q, $error) = $this->dbQuerySafe("
DELETE FROM WAM_ERROR_LOG
WHERE TIME_OCCURRED < sysdate -5
", 'ss');
if (!$error) {
return array($q, false);
} else {
return array(false, $error);
}
// list($q_cnidel, $error_cnidel) = $this->dbQuerySafe(
// "DELETE FROM cni_map WHERE OBJID = :caseid",
// 'ss',
// array(':caseid' => $caseid)
}
.php页面上的一个按钮正在调用哪个。
代码仍在运行,并执行所要求的操作(从表中删除记录)。但是,它将上述错误回显到页面。
我没有从header.php编写OCI连接功能(dbQuerySafe),因为我从另一个开发人员那里接管了一个中游项目。无论如何。有什么想法吗?