Giter Club home page Giter Club logo

Comments (2)

weierophinney avatar weierophinney commented on August 19, 2024

Hm, I was found that problem occurs not for All PDO drivers. For sqlite: - all fine, but for pgsql: problem was present.

(Sorry, do not have time for continue analyze, I will fix it for me by implement alternative approach)


Originally posted by @AndrejAndb at zendframework/zend-validator#178 (comment)

from laminas-validator.

weierophinney avatar weierophinney commented on August 19, 2024

I will try to continue :)

source code of validator: https://github.com/zendframework/zend-validator/blob/2868a943818de387c1747f2ca966d4914e18bebb/src/Db/AbstractDb.php#L315-L325

    protected function query($value)
    {
        $sql = new Sql($this->getAdapter());
        $select = $this->getSelect();
        $statement = $sql->prepareStatementForSqlObject($select);
        $parameters = $statement->getParameterContainer();
        $parameters['where1'] = $value;
        $result = $statement->execute()

source code of https://github.com/zendframework/zend-db/blob/b1c79192c76b817062c1fa4e81ef2dcf1afea73e/src/Sql/AbstractSql.php#L136

        if (! isset($this->instanceParameterIndex[$namedParameterPrefix])) {
            $this->instanceParameterIndex[$namedParameterPrefix] = 1;
        }
        $expressionParamIndex = &$this->instanceParameterIndex[$namedParameterPrefix];

        .....

        $name = $namedParameterPrefix . $expressionParamIndex++;

so, for Select Object we have ever-increased number postfix for named parameter markers: where1, where2, etc...

But for sqlite is Ok, because Zend\Db\Sql\Platform\Platform has Select decorator for sqlite, and Platform object was re-instantiated for each 'validation call', and in this case we have that $this->instanceParameterIndex reset each time

:)

I am not sure that it is must be fixed on zend-db side, looks like better implement some alternative approach for validator :)


Originally posted by @AndrejAndb at zendframework/zend-validator#178 (comment)

from laminas-validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.