#41393 [Asn->WFx]: affected can't return

From: Date: Thu, 17 Jul 2008 00:56:08 +0000
Subject: #41393 [Asn->WFx]: affected can't return
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-126849@lists.php.net to get a copy of this message
ID: 41393 Updated by: jani@php.net Reported By: hack988 at gmail dot com -Status: Assigned +Status: Wont fix Bug Type: MSSQL related Operating System: windows 2003 PHP Version: 4.4.7 Assigned To: fmk New Comment: We are sorry, but we can not support PHP 4 related problems anymore. Momentum is gathering for PHP 6, and we think supporting PHP 4 will lead to a waste of resources which we want to put into getting PHP 6 ready. Previous Comments: ------------------------------------------------------------------------ [2007-07-03 16:52:30] fmk@php.net The MSSQL server returns two result sets. The first one for the status of the IF statement and the second for the insert. The current implementation will not allow you to access the second result set (the first one must contain columns for the system to establish multiple result sets). Workaround: Use transactions and two querie. One to check if the row exists and one to insert the row. ------------------------------------------------------------------------ [2007-05-15 04:13:50] hack988 at gmail dot com Description: ------------ after executed sql query like that IF NOT EXISTS (SELECT * FROM NumberGroup WHERE (GroupName = 'rrgrrg')) INSERT INTO NumberGroup(GroupName, AddTime) VALUES ('rrgrrg', 1); an executed mssql_rows_affected alway return 0 either GroupName= 'rrgrrg' not in database Reproduce code: --------------- i have no idea to deal with this problem by myself Expected result: ---------------- mssql_query("IF NOT EXISTS (SELECT * FROM NumberGroup WHERE (GroupName = 'rrgrrg')) INSERT INTO NumberGroup(GroupName, AddTime) VALUES ('rrgrrg', 1);"); var_dump(mssql_affected_rows($dblink); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41393&edit=1

« previous php.bugs (#126849) next »