php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14664 A query that fails makes all subsquent calls to ifx_query fail
Submitted: 2001-12-22 20:10 UTC Modified: 2002-03-22 07:14 UTC
From: mlemos at acm dot org Assigned:
Status: Closed Package: Informix related
PHP Version: 4.1.0 OS: Linux 2.2.x
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mlemos at acm dot org
New email:
PHP Version: OS:

 

 [2001-12-22 20:10 UTC] mlemos at acm dot org
As demonstrated by the following example if the first (real) query (besides DATABASE query) fails, any subsequent calls to ifx_query fail with the same error, suggesting that something from first query failure state is incorrectly affecting the execution of any following query.

<?php
	$informix_server="demo_on";
	$database_name="test";
	$user="testuser";
	$password="testpassword";
	PutEnv("INFORMIXSERVER=$informix_server");
	if(($connection=ifx_connect("@".$informix_server,$user,$password)))
	{
		if(($result=@ifx_query("DATABASE $database_name",$connection)))
		{
			echo "Database: $database_name, Result: $result\n";
			ifx_free_result($result);
			if(($result=ifx_query("DROP TABLE test",$connection)))
				ifx_free_result($result);
			else
			{
				$first_query_error=ifx_errormsg();
				if(($result=ifx_query("CREATE TABLE test",$connection)))
					ifx_free_result($result);
				else
					echo "First query error: $first_query_error\nSecond query error: ".ifx_errormsg(),"\n";
			}
		}
		else
			echo "Database: $database_name Query error: ".ifx_errormsg(),"\n";
		ifx_Close($connection);
	}
	else
		echo "Connection error: ".ifx_errormsg(),"\n";
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-22 07:10 UTC] samuel_carriere at hotmail dot com
I found how to correct this :
in the file /ext/informix/ifc.ec
in the function PHP_FUNCTION(ifx_query)
you have to insert the line
   EXEC SQL set connection :ifx;
just before the line
	PHP_IFX_CHECK_CONNECTION(ifx);

(in the PHP 4.1.1 release, it corresponds to the line 777)

Can someone add this to the official sources ?
(i am not part of the php developers team)
 [2002-03-22 07:14 UTC] derick@php.net
Fixed in cvs, fix will be in 4.2.0
Thx!

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 13:01:29 2024 UTC