Board index » delphi » When to prepare and unprepare a TQuery??
Joe Nodeland
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
|
Joe Nodeland
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
When to prepare and unprepare a TQuery??My application typically goes in the following cycle. 1:Create a datamodule. Question: Do I need to unprepare the querys before freeing the Sometimes the typical cycle is as follows. 1:Create a datamodule. Question: Do I need to unprepare the TQuery between steps 3 and 4? |
Sundial Servic
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:When to prepare and unprepare a TQuery??QuoteIn article <34084574.4...@EasySoft-Law.com> Joe Nodeland <J...@EasySoft-Law.com> writes: view the SQL text and construct the corresponding execution plan. You are asking the engine to do this at a certain time so that you can control exactly when it occurs. You do not have to do this. If the query is simply run, and it has not yet been prepared, the engine will do this automatically. According to the manual, "When you change the text of a query at run time, However, what I recommend is... if you explicitly prepare it, finish the job |
J?rgen Aas
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:When to prepare and unprepare a TQuery??QuoteJoe Nodeland wrote: faster becasue it parses, validates and compiles the sql statement. TQquery.SQL.Add(...); Unpreparing the query releases the resources used by Prepare. Here's what i often do Create a query If you frequently Open and Close queries, its better to use a TDataBase |
Mark Icke
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:When to prepare and unprepare a TQuery??By "Unprepare" of the TQuery are you just talking about TQuery.Close? I'm What I did discover is that it only happens when using BDE v3.5. With BDE Quote> "Preparing" a query is an explicit request to the database engine for it |
adas
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:When to prepare and unprepare a TQuery??Quote> By "Unprepare" of the TQuery are you just talking about TQuery.Close? suspect it has a thread sync problem), DbiOpenCursor returns an invalid handle, so when TQuery uses this hanle to retrieve data, it gets an Access Violation. Workaround? hum, thinking about.... -- MailTo:robert.ce...@eunet.si |