Giter Site home page Giter Site logo

SQL sanitization? about pq HOT 3 CLOSED

iwinux avatar iwinux commented on August 21, 2024
SQL sanitization?

from pq.

Comments (3)

bmizerany avatar bmizerany commented on August 21, 2024

Yes. It uses Postgres's prepared statements.

See Bind
http://www.postgresql.org/docs/9.0/static/protocol-message-formats.html

Example:

// This will be parsed and bound by postgres.
// Never use ... " WHERE foo = " + mystring and you'll be as safe as
postgres makes you safe.
db.Query("SELECT * FROM mytable WHERE foo = ?", "bar")

On Sun, Oct 21, 2012 at 4:49 AM, Limbo Peng [email protected]:

Will this library provides SQL-sanitization that helps avoid SQL-injection?


Reply to this email directly or view it on GitHubhttps://github.com/bmizerany/pq/issues/48.

from pq.

iwinux avatar iwinux commented on August 21, 2024

thanks :)

Two related questions:

  1. should I do anything to escape some special characters?
  2. how can I inspect the final SQL statement that is actually executed?

from pq.

bmizerany avatar bmizerany commented on August 21, 2024

That's a great question for the Postgres mailing list. I'm sure these
question have been answered in more detail there than I can do here.

In short:
You'll need to see the manual on escape characters in psql and check out
how to debug queries in Postgres.

On Monday, October 22, 2012, Limbo Peng wrote:

thanks :)

Two related questions:

  1. should I do anything to escape some special characters?

  2. how can I inspect the final SQL statement that is actually
    executed?


    Reply to this email directly or view it on GitHubhttps://github.com/bmizerany/pq/issues/48#issuecomment-9685628.

from pq.

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.