ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Help with SaveToFile with Store procedure
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

ali

Iran
110 Posts

Posted - Nov 16 2023 :  04:20:43  Show Profile  Reply
Hi Nigel
In below codes I can export all images of my database to a folder.
but in 15000 records is working good but for heavy database for example 50000 show error :''out of memory'.
I think which for each save picture for each record I most create BF TBlobField and free BF.
Also i use BF.free for this line //BF.Fre show error :'nvalid pointer position'.
my ram is 16 GB and windows 10 64bit.
Please help me.

procedure TMainForm.BitBtn9Click(Sender: TObject);
var BF: TBlobField;
begin
 
while( not(Mainform.ADOQuery_PictureTable.Eof)) do
  begin
    Mainform.spGetCardPicture.Close;
    Mainform.spGetCardPicture.Parameters.ParamByName('@siCard').Value := Mainform.ADOQuery_PictureTable.FieldByName('sicard').AsInteger;
    Mainform.spGetCardPicture.Open;
    If not (Mainform.spGetCardPicture.FieldByName('photo').IsNull)
      then
         begin
          BF := Mainform.spGetCardPicture.FieldByName('photo') as TBlobField;
          BF.SaveToFile('c:\Export'+'\'+Mainform.ADOQuery_PictureTable.FieldByName(Field_name1).AsString+'.jpg');
          //BF.Free;

         Mainform.ADOQuery_PictureTable.Next;
        end
          else
            begin
             Mainform.ADOQuery_PictureTable.Next;
             ProgressBar1.Position:=ProgressBar1.Position+1;
             Label2.Caption :=IntToStr(ProgressBar1.Position)+'/'+IntToStr(Max);
            end;
      end;

end;

Best Regards

Ali Abbasi

xequte

38225 Posts

Posted - Nov 16 2023 :  13:56:28  Show Profile  Reply
Hi Ali

I cannot see any obvious errors in your code.

You should NOT free BF as its just referencing a field in your table.

However this is a forum for ImageEn queries, so you may get better advice from a general site like StackOverflow.


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

ali

Iran
110 Posts

Posted - Nov 16 2023 :  23:14:58  Show Profile  Reply
Hi Nigel

Thank you very much from your attention.
I cannot create BF and free BF in this section of my code for each times save to file.if my for you pleae help me otherwise I ask in stack over flow website.

If not (Mainform.spGetCardPicture.FieldByName('photo').IsNull)
then
begin
//I cannot creat BF here because show error pointer position.
BF := Mainform.spGetCardPicture.FieldByName('photo') as TBlobField;
BF.SaveToFile('c:\Export'+'\'+Mainform.ADOQuery_PictureTable.FieldByName(Field_name1).AsString+'.jpg');
/I cannot free BF here because show error pointer position.

Mainform.ADOQuery_PictureTable.Next;
end.



Best Regards

Ali Abbasi
Go to Top of Page

xequte

38225 Posts

Posted - Nov 19 2023 :  18:39:11  Show Profile  Reply
Hi Ali

I see that the learned Remy Lebeau has answered you on StackOverflow. Were you able to resolve the issue then?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

ali

Iran
110 Posts

Posted - Nov 20 2023 :  10:32:17  Show Profile  Reply
Hi

I tested Remy Lebeau code and Delphi show error.
Tomorrow I will test and report Delphi error.

unfortunately this link closed.
https://stackoverflow.com/questions/77500492/delphi-stored-procedure-memory-free

Best Regards

Ali Abbasi
Go to Top of Page

xequte

38225 Posts

Posted - Nov 20 2023 :  22:51:03  Show Profile  Reply
Hi Ali

It is closed because you have not provided sufficient debugging information for them (StackOverflow is quite strict). Follow the advice in the blue box at:
https://stackoverflow.com/questions/77500492/delphi-stored-procedure-memory-free


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: