[yunqa.de] Re: TDISQLite3Statement memory leak?

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Mon, 07 Jul 2008 11:44:40 +0200

Clyde wrote:

>Now you have me confused. I am not using TDISQLite3UniDirStatement, but 
>TDISQLite3Statement. There is no component for this so you can't drop it on a 
>form.

My appologies. I mistakenly answered your questions as if they related to 
TDISQLite3UniDirStatement. For TDISQLite3UniDirStatement, my answers are 
correct, but they obviously do not apply to TDISQLite3Statement.

Please allow me try to correct myself and clear the confusion I created.

>My understanding is the TDISQLite3Statement is a wrapper class that you have 
>created from scratch and has no descendant. It has nothing to do with a 
>Tdataset, correct?

100% correct.

>Everything in your reply is quoting TDISQLite3UniDirStatement, but that is not 
>what I am using.

100% correct also.

>Are you saying they are the same thing?

No, TDISQLite3UniDirStatement and TDISQLite3Statement are NOT the same thing!

>TDISQLite3Statement seems to me to be a good way to access tables without the 
>overhead of a tdataset descendant.

Absolutely correct as well.

>Shouldn't you at least have one example that uses TDISQLite3Statement so we 
>can see the correct way to iterate through a table and close it down properly?

These simple demo projects use TDISQLite3Statement in a very similar way to 
yours:

 * DISQLite3_StringGrid
 * DISQLite3_StringList

You will find a structure similar to this:

  Stmt := FDatabase.Prepare16(SqlString);
    try
      finally
        Stmt.Free;
      end;

See the Stmt.Free; ? ;-)

>That way newbies like me probably wouldn't run into this issue.

I have added this text to TDISQLite3Statement.Close:

  Closes the prepared statement and sets the @link(Active) property to
  @False. Closed statements can be reopened with a call to @link(Open).

  <p>You might want to close a prepared statement in order to commit changes
  made to a database. Also, you can only change the @link(SQL) property
  for closed statements only.

  <p>Please note that @Name does not Free the @ClassName instance. You must
  call @ClassName.Free to do so, which implicitly calls @Name.

Ralf 

_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: