zoukankan      html  css  js  c++  java
  • Statement VS PrepareStatement

    Many relation database handle a JDBC sql query in blew four steps:

    1, parse the incoming sql

    2, compile the sql

    3, plan/ optimize the sql.

    4, execute the sql and return data

    A Statement will always procceed the four steps for each sql quer sent to the database. A PrepareStatement will pre-execute the steps 1-3.

    Thus, when creating a PreparedStatement some pre-optimization is performed immediately. 

    Another advantage of the PreparedStatement class is the ability to create an incomplete query and supply parameter values at execution time. This type of query is well suited for filtering queries which may differ in parameter value only: 

    preparedStatement also will avoid some sql injection risk.

    callablestatement extend the preparestatement, it can excute a procedure.

  • 相关阅读:
    GitHub Android Libraries Top 100 简介
    GitHub Top 100 的项目(iOS)
    iOS 学习资源
    HTTP和GET/POST请求(NSURLConnection)
    RunLoop
    HTML5 拖放
    网络安全与加密
    Cocoapods的安装
    iOS中的单例模式
    SDWebImage
  • 原文地址:https://www.cnblogs.com/zhonghan/p/3597262.html
Copyright © 2011-2022 走看看