php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13763 SQL Compute
Submitted: 2001-10-19 14:57 UTC Modified: 2002-12-23 01:00 UTC
Votes:8
Avg. Score:3.9 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: alahaye at wanadoo dot fr Assigned:
Status: No Feedback Package: Sybase-ct (ctlib) related
PHP Version: 4.2.1 OS: LINUX REDHAT 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
42 + 38 = ?
Subscribe to this entry?

 
 [2001-10-19 14:57 UTC] alahaye at wanadoo dot fr
When i launch a sybase stored procedure with a compute inside, i can't get this resultset in my outpout array. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-19 15:36 UTC] sander@php.net
Can you provide a sample script?
 [2001-10-20 04:50 UTC] alahaye at wanadoo dot fr
Here an exemple :

sybase_connect(SERVER,LOGIN,PASSWORD);
sybase_select_db(DATABASE);
$query = "EXEC MYPROC";
$result = sybase_query($query);

while ($row = sybase_fetch_array($result))
 {
   print $row["COLUMN1"];
   print $row["COLUMN3"];
   print $row["COLUMN3"];
 }

If in this sybase procedure there is not compute all is ok, all the record are return. But if there is a compute all the record are return and when php arrive in the compute line is don't display it.

This bug is encountred when the proc return more than 1 recorset like (in the proc)

SELECT LIB1, LIB2 FROM LIBELLE
SELECT NAME, FNAME FROM PEOPLE

In this exemple this proc is use to make a delivery order, in the same proc, whe make a select to retrive the customer information (name, adress, phone...) and the second select to retrive information about a command of this customer.

Thanks for your help

PS : The library is SYBASE_CT.
 [2001-10-20 05:36 UTC] sander@php.net
I think you're doing something wrong. I don't think it's a bug in PHP. 

Ask support questions on the appropriate mailinglist (see http://www.php.net/support.php). Hint: try print_r($row); somewhere in the while()-loop. 
 [2001-10-23 12:08 UTC] alahaye at wanadoo dot fr
Here an exemple of stored procedure :

Yes, i execute this sybase stored procedure :

SELECT DISTINCT doc1,";", conste+concen 
 +conqtm+conord+coni1+coni2,";", numchg,";
", rais1d,";", cpd,";", intcomd,";", dpliv,";", tcaht, ";", qtet,";", crgro, ";"
FROM fantasio..f_mtf

WHERE datchg>=@debut
AND datchg<=@fin
AND unit='6'
ORDER BY dpliv, rais1d, intcomd, cpd
COMPUTE SUM(tcaht), SUM(qtet) 
BY dpliv, rais1d, intcomd, cpd

PHP stop on COMPUTE... Then it's a bug of PHP

 [2001-10-25 17:45 UTC] jpm@php.net
User reported on php-dev, so adding here:
---

Here a complete example (php and sybase) with the problem of compute sql statement.
PHP stop when he encountred the compute.
?
PHP :
?
??? sybase_query=("EXEC MYPROC");
???
??? $result = sybase_query($query);
?? ?while ($row = sybase_fetch_array($result))
???? {
??????? print $row["COLUMN1"];
??? ??? print $row["COLUMN3"];
??? ??? print $row["COLUMN3"];
?? ??}
?
SYBASE PROC :
?

 SELECT DISTINCT doc1,";", conste+concen 
 +conqtm+conord+coni1+coni2,";", numchg,";
", rais1d,";", cpd,";", intcomd,";",
dpliv,";", tcaht, ";", qtet,";", crgro, ";"
FROM fantasio..f_mtf

WHERE datchg>=@debut
AND datchg<=@fin
AND unit='6'
ORDER BY dpliv, rais1d, intcomd, cpd
COMPUTE SUM(tcaht), SUM(qtet) 
BY dpliv, rais1d, intcomd, cpd

PHP stop on COMPUTE... Then it's a bug of PHP

This error is encountred when i try to return two select.
 [2002-01-13 17:43 UTC] mad at dactar dot ch
I've the same problem. Please resolve this bug. Thanks.

for more info, see bugs #11475

and #13475, #13735, #12074

There's a lot of problem to retrieve multi-result-set from
store procedures (example : sp_help with rules or data types)

So, the solution is to develop #12074 or test/apply the patchs from #11475 & #13735, #13475
 [2002-04-23 08:41 UTC] mad at dactar dot ch
Still needed with 4.2.0

PS : please change status from Bogus to Open
 [2002-05-14 13:50 UTC] mad at dactar dot ch
Still needed with 4.2.1

PS : please change status from Bogus to Open
 [2002-05-14 14:36 UTC] sander@php.net
Reopening on user request.
 [2002-12-07 01:40 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-12-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2003-02-03 13:21 UTC] cyberlovejones at yahoo dot com
if you are having problems with the compute result set, a workaround would be to create an sql query to generate the same result as the compute would.  now you can execute the main query by it self and the "compute or "total" query after it. 

used a transaction to make sure that data doesn't get changed between the 2 queries.  the first statement
in the query should be a phantom update.  

Example
begin transaction

update employee
set name = name
where " this should be the same as your next query "

select from employee
sum(salary), sum(incr) 
group by ...

select * from employee
sum(salary), sum(incr)
group by ....

rollback transaction
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 06:01:28 2024 UTC