From:
Operating system: WINDOWS
PHP version: 5.2.13
Package: COM related
Bug Type: Bug
Bug description:using COM to call MSSQL Stored Procedure
Description:
------------
I wrote a Active Dll to call mssql stored procedure using ADO, something
like below:
Option Explicit
Private db As New ADODB.Connection
Private adocomm As New ADODB.Command
Public Function ExecSP(sql As String) As ADODB.Recordset
Set db = New ADODB.Connection
db.ConnectionString = CONNECT_STRING
db.CursorLocation = adUseClient
db.ConnectionTimeout = 30
db.Open
Set adocomm.ActiveConnection = db
adocomm.CommandType = adCmdStoredProc
adocomm.CommandText = "p_Common_Pagination"
adocomm.Parameters(1) = sql
adocomm.Parameters(2) = 1
adocomm.Parameters(3) = 20
Set ExecSP = adocomm.Execute
End Function
And Tested OK using VB code, there are some chinese characters:
Option Explicit
Private rs As New ADODB.Recordset
Private ESPTest As New espNew.espc
Private sql as String
Private Sub Command1_Click()
sql = "select * from t_User where FUserID>1000 and FName like
'%ä¸å½äºº%' order by FUserID"
Set rs = ESPTest.ExecSP(sql)
End Sub
Below is the Sql Profiler's output:
exec p_Common_Pagination N'select * from t_User where FUserID>1000 and
FName like ''%ä¸å½äºº%'' order by FUserID', 1, 20
But if I use php to call this DLL:
<?php
$sql = "select * from t_User where FUserID>1000 and FName like
'%ä¸å½äºº%' order by FUserID";
$b= new COM("esp.espc");
$list=$b->ExecSP($sql);
?>
The output of the SQL Profiler is :
exec p_Common_Pagination N'select * from t_User where FUserID>1000 and
FName like ''%ä¸å½äºº%'' order by FUserID
The second and the third parameters are missing.
I have tesed for a long time, and I'm sure the code I wroted are all
right.
What's the matter ?
Test script:
---------------
like above
Expected result:
----------------
Fix the bug.
--
Edit bug report at http://bugs.php.net/bug.php?id=51356&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51356&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51356&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51356&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51356&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51356&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51356&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51356&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51356&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51356&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51356&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51356&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51356&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51356&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51356&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51356&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51356&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51356&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51356&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51356&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51356&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51356&r=mysqlcfg