Skip to Content.
Sympa Menu

freetds - Re: [freetds] dbresults

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Arnar Birgisson" <ArnarB AT oddi.is>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] dbresults
  • Date: Mon, 26 May 2003 10:26:17 +0000

Any word of this at all?

Here's a test php script..

<?php

$conn = mssql_connect("stmdatabase", "stmkerfi_arnarb", "xxx");
mssql_select_db("starfsmannakerfi");
$sp = mssql_init("sp_get_athugasemdir_starfsmanns");
$kt = '2704814509';
mssql_bind($sp, "@kennitala", $kt, SQLCHAR, false, false, 10);
$res = mssql_execute($sp);
print("res #1\n");
while ($data = mssql_fetch_assoc($res)) {
print_r($data);
}
$i=1;
while (mssql_next_result($res)) {
print("res #".++$i."\n");
while ($data = mssql_fetch_assoc($res)) {
print_r($data);
}
}

?>

Running this on linux (with freetds) yields..

res #1
Array
(
[mat] => 1
[dags_planad] => 2003-05-11 00:00:00
[dags_tekid] =>
[fj_athugasemda] => 2
[fj_opinna] => 2
)
res #2
Array
(
[stada] => 1
[fjoldi] => 1
)
Array
(
[stada] => 2
[fjoldi] => 2
)
res #3
Array
(
[athugasemd] => 4
[eigandi] => arnarb2
[titill] => Prufuathugasemd hjá arnarb2
[dags_skrad] => 2003-05-21 14:09:54
[sidast_breytt] => 2003-05-21 14:10:25
[dags_deadline] =>
[birt_vegna] => 1
)

but the same script run on windows, with the same version of php linked
against microsoft's dblib, correctly yields

res #1
res #2
Array
(
[mat] => 1
[dags_planad] => May 11 2003 12:00AM
[dags_tekid] =>
[fj_athugasemda] => 2
[fj_opinna] => 2
)
res #3
Array
(
[stada] => 1
[fjoldi] => 1
)
Array
(
[stada] => 2
[fjoldi] => 2
)
res #4
Array
(
[athugasemd] => 4
[eigandi] => arnarb2
[titill] => Prufuathugasemd hjá arnarb2
[dags_skrad] => May 21 2003 2:09PM
[sidast_breytt] => May 21 2003 2:10PM
[dags_deadline] =>
[birt_vegna] => 1
)

The procedure returns 4 resultsets, and for the parameter tested, the first
one is, and should be an empty set.

Arnar

>>> ArnarB AT oddi.is 22.5.2003 16:01:31 >>>
Hello there..

I'm running a stored procedure on mssql server 2000 through php. The
stored procedure returns (in all cases) four result sets. Now.. I use
php's mssql_next_result, which in turn calls dbresults in the normal
way, to process each result set. The problem is that when one result
set, say the second one, contains no rows, mssql_next_result goes
straight to result set #3. I suspect that this is not normal behaviour,
correct me if I'm wrong.

I haven't stepped through the code yet, but a quick look indicates that
php's mssql_next_result is correct, at least according to ms
documentation on db-lib.

Have any of you heard of this before?

Arnar
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds




  • [freetds] dbresults, Arnar Birgisson, 05/22/2003
    • <Possible follow-up(s)>
    • Re: [freetds] dbresults, Arnar Birgisson, 05/26/2003

Archive powered by MHonArc 2.6.24.

Top of Page