|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19841 RPC stored procedure with many columns return null value
Submitted: 2002-10-09 21:27 UTC Modified: 2003-07-18 18:50 UTC
From: tonyho at fairex dot com Assigned:
Status: No Feedback Package: Sybase (dblib) related
PHP Version: 4.2.3 OS: Sun Solaris 8
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: tonyho at fairex dot com
New email:
PHP Version: OS:


 [2002-10-09 21:27 UTC] tonyho at fairex dot com

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
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
grant execute on sp_test to user

------------ 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");

  $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))
     $i = 0;
     while ($i < $j)
        if ( $row[$i] == NULL )
           printf("<td>%s</td>", $row[$i]);

  // 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");




Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-18 18:50 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jan 25 08:03:35 2022 UTC