Difference between Statement and PreparedStatement

前端 未结 15 1360
野的像风
野的像风 2020-11-22 02:49

The Prepared Statement is a slightly more powerful version of a Statement, and should always be at least as quick and easy to handle as a Statement.
The Prepared Stateme

15条回答
  •  暖寄归人
    2020-11-22 03:06

    Another characteristic of Prepared or Parameterized Query: Reference taken from this article.

    This statement is one of features of the database system in which same SQL statement executes repeatedly with high efficiency. The prepared statements are one kind of the Template and used by application with different parameters.

    The statement template is prepared and sent to the database system and database system perform parsing, compiling and optimization on this template and store without executing it.

    Some of parameter like, where clause is not passed during template creation later application, send these parameters to the database system and database system use template of SQL Statement and executes as per request.

    Prepared statements are very useful against SQL Injection because the application can prepare parameter using different techniques and protocols.

    When the number of data is increasing and indexes are changing frequently at that time Prepared Statements might be fail because in this situation require a new query plan.

提交回复
热议问题