#19841 [Opn->Fbk]: RPC stored procedure with many columns return null value
| From: | sniper@php.net | Date: | Fri, 11 Jul 2003 02:10:47 +0000 |
| Subject: | #19841 [Opn->Fbk]: RPC stored procedure with many columns return null value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-43720@lists.php.net to get a copy of this message | ||
ID: 19841
Updated by: sniper@php.net
Reported By: tonyho at fairex dot com
-Status: Open
+Status: Feedback
Bug Type: Sybase (dblib) related
Operating System: Sun Solaris 8
PHP Version: 4.2.3
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2002-10-09 21:27:34] tonyho at fairex dot com
Hi,
I am building a interface to execute a stored procedure on a WAN Sybase
ASE 12.0 from a local Sybase ASE 12.0. However, the result is null when
the stored procedure returned too many columns data. This works fine on
a local Sybase ASE.
----------- SYBASE ------------
Column_name Type Length Prec
--------------------- -------- ------ ----
TradeID varchar 20 NULL
OrderID varchar 20 NULL
SubOrderID int 4 NULL
CurrencyPair char 6 NULL
Rate float 8 NULL
BuySell char 1 NULL
CCY1Amount float 8 NULL
DealDateTime datetime 8 NULL
OriginatorID varchar 10 NULL
TradeType char 1 NULL
CCY2Amount float 8 NULL
TraderID varchar 10 NULL
ValueDate datetime 8 NULL
Status char 2 NULL
IMargin float 8 NULL
MMargin float 8 NULL
Commission float 8 NULL
RatePips float 8 NULL
Lots float 8 NULL
SquareGroupID varchar 20 NULL
HouseRatePips float 8 NULL
AcceptedBy varchar 10 NULL
LastChangedBy varchar 10 NULL
DateTimeLastChanged datetime 8 NULL
AdjustingPips float 8 NULL
CreationDate datetime 8 NULL
SquaredPNL float 8 NULL
GeneratedBy varchar 4 NULL
drop procedure sp_test
go
create procedure sp_test @idstring varchar(15) = NULL as
select TradeID, OrderID, SubOrderID, CurrencyPair, Rate, BuySell,
CCY1Amount, DealDateTime, OriginatorID, TradeType,
CCY2Amount, TraderID, ValueDate, Status, IMargin, MMargin, Commission,
RatePips, Lots, SquareGroupID, HouseRatePips,
AcceptedBy, LastChangedBy, DateTimeLastChanged, AdjustingPips,
CreationDate, SquaredPNL, GeneratedBy
from Trades where TradeID like @idstring
go
grant execute on sp_test to user
go
------------ PHP --------------
<?
$intSecurity = 3;
$intTimeOut = 1800;
$cmd = $HTTP_GET_VARS['cmd'];
$cmd = ereg_replace("\\\'", "'", $cmd);
$cmd = ereg_replace('\\\"', '"', $cmd);
print("<table border=1><tr><th>Command</th>\n");
printf("<td>%s</td></table><br>\n",$cmd);
sybase_connect("sybase","user","user");
$result = sybase_query("$cmd");
//$result = sybase_query("exec syb2...sp_test 'idstr'");
//if ( $result == NULL )
//print("Null result...");
//
// Print Heading In Table Format
//
print("<table border=1>");
while ($row = sybase_fetch_field($result))
{
printf("<th>%s</th>", $row->name);
}
//
// Print Data In Table Format
//
$j = sybase_num_fields($result);
while ($row = sybase_fetch_array($result))
{
print("<tr>");
$i = 0;
while ($i < $j)
{
if ( $row[$i] == NULL )
printf("<td><br></td>");
else
printf("<td>%s</td>", $row[$i]);
$i++;
}
print("</tr>\n");
}
print("</table><br>");
//
// Print Sybase Error Message
//
print("<table border=1>");
$err = sybase_get_last_message();
//if ( $err != "Changed language setting to 'us_english'." )
if ( $err != NULL )
{
printf("<tr><th>Error Message</th></tr>\n");
printf("<tr><td>%s</td></tr>\n",sybase_get_last_message());
}
print("</table>");
sybase_close();
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19841&edit=1