How to insert/load blob data

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jouniaro
Posts: 6
Joined: Fri 08 Jul 2011 08:42

How to insert/load blob data

Post by jouniaro » Tue 24 Jan 2012 14:59

I have code that is trying to insert blob data into a blob field in a MySQL database.

I am using TMyQuery and TParam.LoadFromStream(MemoryStream, ftBlob), but I get an AV when the statement is executed with the following call stack

:007f1289 TDAParam.GetIsNull + $11
:00802742 TCustomDASQL.WriteParams + $A6
:00803158 TCustomDASQL.DefineProperties
:d68bd88b

The code is part of a generic component that works with different dataset types and works with other sets, such as TADOQuery.

Is this my problem or MyDAC's problem?

I am using MyDAC 7.1.4 in Delphi XE and XE2.

AndreyZ

Post by AndreyZ » Wed 25 Jan 2012 08:39

Hello,

You must not use the TParam class, you have to use TDAParam class instead ( TDAParam.LoadFromStream(MemoryStream, ftBlob) )

jouniaro
Posts: 6
Joined: Fri 08 Jul 2011 08:42

Post by jouniaro » Wed 25 Jan 2012 11:41

It seems that the object is TDAParam in reality. I am getting it from TMyQuery.Params.

jouniaro
Posts: 6
Joined: Fri 08 Jul 2011 08:42

Post by jouniaro » Wed 25 Jan 2012 11:48

But LoadFromStream is not virtual, I see. I got it working now, ensuring TDAParam.LoadFromStream is used.

Thanks!

AndreyZ

Post by AndreyZ » Wed 25 Jan 2012 12:10

It is good to see that the problem was solved. Feel free to contact us if you have any further questions about MyDAC.

Post Reply