Code Monkey home page Code Monkey logo

Comments (2)

xlhl77 avatar xlhl77 commented on May 18, 2024 2

哦,我只看了mysql的源码部分,以为没有实现prepare stmt。
多谢,明白了。

from drogon.

an-tao avatar an-tao commented on May 18, 2024

prepare stmt是在底层自动进行的,分情况:

  • 对postgreSQL来说,只要使用了绑定参数,底层就自动使用prepare stmt,并且相同的sql不会重复prepare;因为使用Mapper处理ORM对象时都是使用绑定参数的,所以Mapper接口的底层自然也是使用prepare stmt的。
    使用prepare stmt的具体实现在这一部分:
    https://github.com/an-tao/drogon/blob/dc4f8aac380586bd3e6e0002359125883021b738/orm_lib/src/postgresql_impl/PgConnection.cc#L204
  • 对mysql来说,它的异步接口对绑定参数支持的都不太友好,我记得我使用过程中遇到了困难,最后放弃了,所以mysql的所有sql都是独立发送query,没用prepare。如果你有解决方案,欢迎提供建议或者PR。
  • 对sqlite3来说,都是使用prepare stmt的。

from drogon.

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.