#19841 [NEW]: RPC stored procedure with many columns return null value

From: Date: Thu, 10 Oct 2002 02:27:35 +0000
Subject: #19841 [NEW]: RPC stored procedure with many columns return null value
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-22005@lists.php.net to get a copy of this message
From: tonyho@fairex.com Operating system: Sun Solaris 8 PHP version: 4.2.3 PHP Bug Type: Sybase (dblib) related Bug description: RPC stored procedure with many columns return null value 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 bug report at http://bugs.php.net/?id=19841&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=19841&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=19841&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=19841&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=19841&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=19841&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=19841&r=support Expected behavior: http://bugs.php.net/fix.php?id=19841&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=19841&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=19841&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=19841&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=19841&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=19841&r=dst IIS Stability: http://bugs.php.net/fix.php?id=19841&r=isapi

« previous php.bugs (#22005) next »