Zend 2: SQLSRV: $prepareParams is not being set

前端 未结 3 1716
感情败类
感情败类 2021-01-24 09:40

Can somebody explain me where the

->setPrepareParams(array $prepareParams) 

is called in Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Statement.php?<

3条回答
  •  梦谈多话
    2021-01-24 09:48

    Are you looking for this code?

    Adapter/Driver/Sqlsrv/Statement::prepare()

    Without looking deeper into it, it looks like the way you are calling the select statement, it expects indices that are numbers: 0, 1, 2, 3, ... and so on.

    So when you call

    array("Personalnummer = $personalnumber")
    

    It is the same as calling

    array(0 => "Personalnummer = $personalnumber")
    

    And since code expects a value at index 0, your code works then. When you use parameterized statements, your code fails. Because it does not expect parameterized arrays (your second way).

    Look into how you set your initial parameters. There may be a configuration option that sets the code to expect parameterized arrays.

提交回复
热议问题