| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2009-04-25 15:03 UTC] jani@php.net
  [2009-05-03 01:00 UTC] php-bugs at lists dot php dot net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 12:00:01 2025 UTC | 
Description: ------------ The order of parameters in a stored procedure must be strictly followed in PDO, otherwise, the parameters will get swapped around in the trace. Reproduce code: --------------- CREATE a stored procedure in SQL with two parameters in order: @param1 nvarchar(100), @param2 nvarchar(100) Run a trace in profiler to watch what PDO prepares and executes against the server. Prepare the EXEC statement but swap the order of the parameters. If you prepare and execute a query in the form: $statement = connection->prepare( "EXEC dbo.sptest @param2=:param2,@param1=:param1" ); $statement->execute(array(':param1' => 'test1', ':param2' => 'test2')); Expected result: ---------------- I would expect that the stored procedure will be prepared by PDO in the form: declare @p1 int set @p1=NULL exec sp_prepare @p1 output,N'@test1 nvarchar(100),@test2 nvarchar(100)',N'EXECUTE runtest @test2 = @test2, @test1 = @test1',1 select @p1 Actual result: -------------- I would expect that the stored procedure will be prepared by PDO in the form: declare @p1 int set @p1=NULL exec sp_prepare @p1 output,N'@test1 nvarchar(100),@test2 nvarchar(100)',N'EXECUTE runtest @test2 = @test1, @test1 = @test2',1 select @p1