RE: [PHP] Problem: Sybase, PHP and multiple result sets

2001-08-16 Thread Warren Vail

I appreciate the clearer, more detailed description.  Unfortunately, I
probably cannot help as much with this one.  If it were my problem, I would
try finding and downloading the source for the Sybase modules, then look for
someone to contact in the notes.  I would also exhaust any contacts I have
with Sybase, mostly because much of the original code for the interface
modules probably came from them originally (derived from their old C
interface modules).

Another approach would be to try to unload the source for the Stored
Procedure, and try to split up the queries (I believe the results you are
seeing are produced by a UNION, but I'm not certain).  Sybase can compile
its query procedures on the fly, with only slightly longer run times, or you
could create a new procedure from what you find and store that one.

Good Luck,

Warren Vail

-Original Message-
From:   Herouth Maoz [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, August 15, 2001 12:19 AM
To: Warren Vail; [EMAIL PROTECTED]
Subject:Re: [PHP] Problem: Sybase, PHP and multiple result sets

On Wednesday 15 August 2001 10:07, Warren Vail wrote:
 The ability to select a set from a previously selected set is
 possible in Sybase because the database supports creation of
 temporary tables and the select insert.

No, you seem to have missed my point entirely. So I'll explain in a
little more detail.

I run a stored procedure. Let's assume I run it from the interactive
utility and not from PHP for the moment.

 SP_SOMETHING_OR_OTHER PARAM1 PARAM2 PARAM3

The database returns:

foo   bar
===   ===
1020
3040

field1   field2   field3
==   ==   ==
string   bla  15
nothing  bla  12

As you can see, it returns TWO result sets. One with two numeric
columns. The next with three columns, the first two string and the
last numeric.

This is, of course, just an example.

Now back to the web interface.

If I use PHP, I get only the first result set. That is, I write
something along the lines of:

$rs = sybase_query( SP_SOMETHING_OR_OTHER PARAM1 PARAM2 PARAM3,
$conn );

while ( $row = sybase_fetch_row( $rs ) ) {

   echo $row[0]; // and so on

}

This will only display the results of the first result set - the one
with the two fields, foo and bar.

There is no way for me to reach the second table generated by the
query. This is supposed to be the significant table.

Now, in ASP, there is something like

set rs = rs.NextResultSet

Which sets the rs to the second result set, the one with the three
fields of mixed types, at which point you loop, just like above, and
retrieve the new information. This method or an equivalent of it is
not in the PHP documented set of Sybase functions.

I hope I made myself clearer. And by the way, you don't have to sell
me on the uselessness of ASP, the general uselessness of Microsoft
etc. - I don't use any Microsoft products, even at work.

Herouth


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Problem: Sybase, PHP and multiple result sets

2001-08-15 Thread Warren Vail

The ability to select a set from a previously selected set is possible in
Sybase because the database supports creation of temporary tables and the
select insert.

PHP (which is often packaged with MySQL) does not attempt to mix database
(SQL) with it's own scripting language (unless someone is working on this).
ASP on the other hand will sell you anything that consumes resources thereby
encouraging you to buy the bigger software, requiring bigger hardware (An
old IBM marketing plan, and my personal opinion).  When you talk about a
result set in PHP you must be referring to what is returned by MySQL, not
PHP.  Perhaps someday MySQL will have temp tables and SELECT INSERT
capability.

On the other had PHP does a very nice job of looping thru the result set.

Warren Vail

-Original Message-
From:   Herouth Maoz [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, August 14, 2001 11:35 PM
To: [EMAIL PROTECTED]
Subject:[PHP] Problem: Sybase, PHP and multiple result sets

I have started working with Sybase lately, and it has come to my
knowledge that a single query can return multiple result sets in
Sybase, especially when using stored procedures.

Now, in ASP (sorry...), there are calls that allow retrieving the
next result set from the current result set. So in effect the result
sets are a linked list and you can access all of them.

In PHP, however, the result set returned is the first one, and I
don't see any method for retrieving the next result set. Does anybody
know of such a method? Does anybody have a suggestion for workaround?

Basically, in most of these cases, the important result set is
actually the last one, not the first, as the intermediate result sets
are mostly temporary results.

Herouth


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Problem: Sybase, PHP and multiple result sets

2001-08-15 Thread Herouth Maoz

On Wednesday 15 August 2001 10:07, Warren Vail wrote:
 The ability to select a set from a previously selected set is
 possible in Sybase because the database supports creation of
 temporary tables and the select insert.

No, you seem to have missed my point entirely. So I'll explain in a 
little more detail.

I run a stored procedure. Let's assume I run it from the interactive 
utility and not from PHP for the moment.

 SP_SOMETHING_OR_OTHER PARAM1 PARAM2 PARAM3

The database returns:

foo   bar
===   ===
1020
3040

field1   field2   field3
==   ==   ==
string   bla  15
nothing  bla  12

As you can see, it returns TWO result sets. One with two numeric 
columns. The next with three columns, the first two string and the 
last numeric.

This is, of course, just an example.

Now back to the web interface.

If I use PHP, I get only the first result set. That is, I write 
something along the lines of:

$rs = sybase_query( SP_SOMETHING_OR_OTHER PARAM1 PARAM2 PARAM3, 
$conn );

while ( $row = sybase_fetch_row( $rs ) ) {

   echo $row[0]; // and so on

}

This will only display the results of the first result set - the one 
with the two fields, foo and bar.

There is no way for me to reach the second table generated by the 
query. This is supposed to be the significant table.

Now, in ASP, there is something like 

set rs = rs.NextResultSet

Which sets the rs to the second result set, the one with the three 
fields of mixed types, at which point you loop, just like above, and 
retrieve the new information. This method or an equivalent of it is 
not in the PHP documented set of Sybase functions.

I hope I made myself clearer. And by the way, you don't have to sell 
me on the uselessness of ASP, the general uselessness of Microsoft 
etc. - I don't use any Microsoft products, even at work.

Herouth


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]