Git Product home page Git Product logo

Comments (5)

craigfrancis avatar craigfrancis commented on June 12, 2024 1

I don't have any real examples, but how about?

  • SELECT * FROM cmsdomain WHERE url LIKE "%?%";
  • SELECT * FROM cmsdomain WHERE url LIKE "%:tag_name%";
  • SELECT * FROM cmsdomain WHERE cmsdomainid IN (1,2) /* What about 3? */
  • SELECT * FROM cmsdomain WHERE 1=2; -- :TODO?

from phpstan-dba.

craigfrancis avatar craigfrancis commented on June 12, 2024

Might be worth looking at the PDO function that parses parameters, to see how it works.

It seems to use pdo_parse_params(), which is a bit more complicated than using the BINDCHR regex by itself (used later as PDO_PARSER_BIND).

It supports escaped question marks (??), comments (/* What about X? */ or -- To fix?), and quoted string values (see ANYNOEOF?).

from phpstan-dba.

staabm avatar staabm commented on June 12, 2024

Would be great if you could provide failling testcases if you have special cases in mind

from phpstan-dba.

staabm avatar staabm commented on June 12, 2024

I don't have any real examples, but how about?

* `SELECT * FROM cmsdomain WHERE url LIKE "%?%";`

* `SELECT * FROM cmsdomain WHERE url LIKE "%:tag_name%";`

* `SELECT * FROM cmsdomain WHERE cmsdomainid IN (1,2) /* What about 3? */`

* `SELECT * FROM cmsdomain WHERE 1=2; -- :TODO?`

these basic examples are now covered by #145

still on the long run we might better use a sql parser. lets see whether people report problems with their queries when running phpstan-dba on real projects

from phpstan-dba.

staabm avatar staabm commented on June 12, 2024

on twitter the SQLFTW/sqlftw project was suggested as a proper parser

from phpstan-dba.

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.