php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tonyho at fairex dot com
New email:
PHP Version: OS:

 

 [2002-10-09 21:27 UTC] 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();

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-18 18:50 UTC] sniper@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC