query.Prepare;
query.UnPrepare;
都是什么意思

解决方案 »

  1.   

    Delphi Help:
    =========================================================================================
    Call Prepare to have the BDE and a remote database server allocate resources for the query and to perform additional optimizations. Preparing a query consumes some database resources, so it is good practice to call UnPrepare once the query is no longer needed.If the query will only be executed once, the application does not need to explicitly call Prepare or UnPrepare. Executing an unprepared query generates these calls automatically. However, if the same query is to be executed repeatedly, it is more efficient to prevent these automatic calls by calling Prepare and UnPrepare explicitly.
    =========================================================================================if not Query1.Prepared then
    begin
      Query1.Close;
      Query1.Prepare;
      Query1.Open;
    end;
      

  2.   

    query.Prepare;的大致意思是要服务器为QUERY准备好资源如内存空间之类的并把QUERY中的语句先行编译成服务器执行的语句格式.
    UnPrepare大致就是让服务器断开这些服务.
      

  3.   

    同意 GoldShield(小花☆正直人)兄的说法
      

  4.   

    我觉的query.Prepare;可以提高sql语句的执行效率
      

  5.   

    我觉的query.Prepare;可以提高sql语句的执行效率
    ..................
    服务器在执行Prepare时会对查询进行优化并保存,所以上面的E文中不是也说了么,如果你的查询只执行一次的话大可不必使用Prepare
      

  6.   

    同意 GoldShield(小花☆正直人)兄的说法query.Prepare;的大致意思是要服务器为QUERY准备好资源如内存空间之类的!UnPrepare大致就是让服务器断开这些服务.