php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56681 ocierror must keep the last error until new query
Submitted: 2005-11-29 12:31 UTC Modified: 2008-03-12 12:57 UTC
From: adrianob at gmail dot com Assigned:
Status: Closed Package: oci8 (PECL)
PHP Version: 4.4.0 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: adrianob at gmail dot com
New email:
PHP Version: OS:

 

 [2005-11-29 12:31 UTC] adrianob at gmail dot com
Description:
------------
I'm using OCI8 1.1.1, and I think that ocierror function  
must keep the last ocurred error for more than one call to  
ocierror. 
 
I have made some tests with SQLite and MySQL, and this 
feature that I request is implemented by these database 
modules. 

Reproduce code:
---------------
<?php
	$conn = ocilogon('user', 'pass', 'db');
	if (!$conn) die('Not possible to connect to database');
        // There is a constraint here
	$query = 'DELETE FROM SGR_ATIVIDADE WHERE CDATIVIDADE=2';
	$stmt  = ociparse($conn, $query);
	$ret   = ociexecute($stmt);

	if ($ret) echo 'Atividade deleted.';
	else {
		$cnt = 10;
		while ($cnt-- > 0) {
			$aError = ocierror($stmt);
			echo (10-$cnt) .' -> '.$aError['message'] ."\n";
		}
	}

	ocilogoff($conn);
?>

Expected result:
----------------
1 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES)  
violated - child record found  
2 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES)  
violated - child record found 
3 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES)  
violated - child record found 
4 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES)  
violated - child record found 
5 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES)  
violated - child record found 
6 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES)  
violated - child record found 
7 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES)  
violated - child record found 
8 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES)  
violated - child record found 
9 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES)  
violated - child record found 
10 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES)  
violated - child record found 

Actual result:
--------------
1 -> ORA-02292: integrity constraint (SISCORP.ATV_GRPPES) 
violated - child record found 
2 -> 
3 -> 
4 -> 
5 -> 
6 -> 
7 -> 
8 -> 
9 -> 
10 -> 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-12 12:57 UTC] christopher dot jones at oracle dot com
Thank you for taking the time to write to us, but this is not
a bug.

This is expected behavior. The underlying Oracle libraries pop the error from their own stack.  PHP OCI8 has had this same functionality so long that changing it would break applications.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 15:01:29 2024 UTC