FireDAC and FetchBlobs with MySQL 5.5 and Delphi XE5

I try to obtain a stream of blob field stored in MySQL Database.
With Oracle and MSSQL, it works great but with MYSQL, it doesn't work.

I proceed like it's indicated in the documentation: 
ms-help://embarcadero.rs_xe5/libraries/FireDAC.Comp.DataSet.TFDDataSet.FetchBlobs.html

{code}
FDQuery1.FetchOptions.Items := FDQuery1.FetchOptions.Items - [fiBlobs];
FDQuery1.Open;
.....
FDQuery1.FetchBlobs;
oStr := FDQuery1.CreateBlobStream(FDQuery1.FieldByName('image'), bmRead);
try
// process image
finally
oStr.Free;
end; 
{code}

Does somebody succeed loading blob in mySQL database?
Thanks
0
Frederic
4/7/2015 3:42:41 PM
embarcadero.delphi.firedac 822 articles. 2 followers. Follow

3 Replies
1114 Views

Similar Articles

[PageSpeed] 41

Please provide the query text and the table DDL's used in this query.

-- 
With best regards,
Dmitry Arefiev / FireDAC Architect
0
Dmitry
4/7/2015 4:16:24 PM
Thanks Dmitry.

In fact, the program uses a TFDTable (instead of a FDQuery)

Before opening the table, we remove the +fiBlobs+ option because data are loaded faster without the blobs.

FDTable1.FetchOptions.Items := FDTable1.FetchOptions.Items - [fiBlobs];

When we need the image, we load it with this code :
{code}
FDTable1.FetchBlobs;
oStr := FDTable1.CreateBlobStream(FDTable1.FieldByName('image'), bmRead);
{code}

If we don't remove the +fiBlobs+ option, the image is well loaded by CreateBlobStream but opening the table is quite slow.
If we remove the the +fiBlobs+ option, I noticed that +FDTable1.FetchBlobs+ does nothing, so +CreateBlobStream+ doesn't load the image


The image is saved in a blob field by this way :
{code}
CREATE TABLE Images ( 
PicNum int NOT NULL AUTO_INCREMENT PRIMARY KEY, 
image BLOB 
); 
{code}

We don't have the problem with Oracle or MSSQL database.


> {quote:title=Dmitry Arefiev wrote:}{quote}
> Please provide the query text and the table DDL's used in this query.
> 
> -- 
> With best regards,
> Dmitry Arefiev / FireDAC Architect

Edited by: Frederic Wagner on Apr 16, 2015 5:56 AM
0
Frederic
4/16/2015 12:56:38 PM
I cannot reproduce this issue on XE8 code base. Seems this issue was fixed. 
Although I cannot find specific change in the change log. But in XE7 the BLOB
handling was refactored in many aspects.

Regarding MySQL and deferred BLOB fetching. Actually there is no sense to
use deferred BLOB fetching with MySQL, because MySQL transfers BLOB
values by value, not by reference like Oracle or SQL Server. So, excluding
fiBlobs from FetchOptions.Items should have no effect with MySQL.

Other note. Try to replace TFDTable with TFDQuery, if the performance is
important for you. TFDTable sends several SELECT statements behind the
scene. And all of them will fetch records with all fields, including BLOB's.
With TFDQuery you will explicitly control what and when to fetch.

-- 
With best regards,
Dmitry Arefiev / FireDAC Architect
0
Dmitry
4/17/2015 8:42:11 AM
Reply:

Similar Artilces:

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi and 5.5
Hello! I work with Delphi5 and SQL Anywhere 5.5 for DBMS-applications developing. There are 2 questions. 1. For desktop application. I'd like to include necessary files of SQL Anywhere into distribution to make installation procedure most simpler for user. Which files of SQL Anywhere should I put into installational package and also which additions should I make in Windows registry? 2. How can I register DB alias in ODBC? 3. The same for CS-application. Is it possible at all? TIA I believe all your questions about SQL Anywhere can be answered by reading the on-...

Attempting to compile Delphi 5 code in Delphi XE5 is failing
Greetings All, If I'm not in the correct formum please tell me which one I should be in. Just upgraded to Delphi XE5 and am attempting to compile one of my Delphi 5 projects. I used Interbase Express I use either TDataSource -> TCDSProvider -> TDataSetProvider -> TIBQuery or TDataSource -> TClientDataSet -> TDataSetProvider -> TIBQuery Also used TIBDatabase, TIBTransaction, and TIBStoredProc I open the smallest project I have and click compile and almost immediately I receive this error Checking project dependencies... Compiling CITranEngine.dproj...

Delphi 5 direct access components to SA 5.5
Hello! I am before the choice. Which components set is better for subject? I'd like to ask people who have definitive experience in testing of such components. We have a such number: NativeDB ASADAC ODBCExpress SQLDirect Titan Which is better? Any valid conclusion is very appreciated. Thanks in advance. I haven't tried all of the products you list, but I can recommend NativeDB. It is made specifically for SQL Anywhere, so it supports some features of SQL Anywhere that multi-target middleware does not support. The vendor supports the product very promptl...

Delphi&5.5
Hello! I try to implement SQL-query using TQuery componenet SELECT count(*) FROM dba.M_F where id_f=6 and date_now > '01.01.2000' Then I get an error message General SQL error [Sybase][ODBC driver]: cannot convert 01.01.2000 to a date/time. What's a matter (I tried any different variants of date kind)? Does anyone this problem encounter? Alter your SELECT statement to the following : SELECT count(*) from dba.M_F where id_f = 6 and date_now > '2000-01-01' note that date picture is 'yyyy-mm-dd' for SQL Anywhere. <Nicolay_A._Vasiliev&...

Delphi 5 to Delphi 6 and up
Dear List, Trying to add 7Zip compression support to my delphi application. I am using the ported 7Zip sdk (see their website, they have a link). I am stumped on how to rewrite a single function: function ReverseDecode(var Models: array of SmallInt; ....): ..... where the input is mostly a fixed size array of SmallInt. This code perfectly compiles and functions in Delphi 6 and up, but in Delphi 5 I get the error: There is no overloaded version of 'ReverseDecode' that can be called with these arguments And obviously, the input (fixed) isn't the same as the param de...

Delphi 5 to Delphi XE4
Thinking about making the conversion. Of course we have numerous components such as: TurboPower AsyncPro, TurboPower Orpheus ICS2 Synactis All-In-The-Box. You guys have any advice as to the effort and time it may possibly take. It is a large application, several hundred thousand lines. And that's what happens when using third party components, a lot of extra work. I have been burned a few times. I now minimize the use to a few well known suppliers, like TMS. I have "banned" a lot of other components. Regards, Ole > > Thinking about making the conver...

Delphi 5 To Delphi 2009
I upgraded to Delphi 2009 from D5. The install says I can install Delphi and/or C++. Delphi installed OK but I see nothing of C++. What am I missing or does my upgrade not include C++? Thanks It depends on what you bought. If you bought Delphi 2009 only, that's what you get. If you bought Delphi 2009 and C++ Builder 2009 you get both. My guess is you got Delphi 2009 only. The simplest way to verify is look your invoice - it should say I would think. You could also go to members.embarcadero.com, login, then click on my registered products. There will be a textual description of...

Converting Delphi 2007 Indy 10.2.3 to Delphi 2009 Indy 10.5.5 [Edit]
Hello, I am currently attempting to port over a Delphi 2007 project that uses Indy 10.2.3 (very successfully) to Delphi 2009 and Indy 10.5.5 (I just got the latest development build this morning). I think I am running into an encoding issue, but am not sure. Specifically, IDHTTP with SSL calls an old CGI and the CGI returns a .zip file and I then save it to the disk. In 2007 and before this worked perfectly. In 2009, it is not. Here is the examples of the 2 different results (though cut way short in the post) I am getting back: 2007: 'PK'#3#4#$14#0#0#0#8#0'rLQ9žrPb€'#0...

Upgrading 5.5.5 to 6.5.5
I am going to be upgrading from GW 5.5.5 to GW6.5.5 Anybody aware of any gotcha's or have any advice? LauraB@itdynamics.co.za wrote: > I am going to be upgrading from GW 5.5.5 to GW6.5.5 Anybody aware of > any gotcha's or have any advice? Not really. Before you upgrade rebuilt the post offices and domains or do at least a validate of the databases. If you are not really experienced I recommend to purchase the caledonia upgrade guide. -- Cheers, Edward ...

Migration from Delphi 5 to Delphi 2005
Hi, Currently we are using Delphi 5 in that we have lot of source file now we planned to migrate from Delphi 5 to Delphi 2005. My question is - 1. Is it possible to migrate directly from Delphi 5 to Delphi 2005, my old code was developed using Delphi 5 IDE. Can we able to compile and build without any issue in Delphi 2005? 2. If we can able to do then what are the ways to migrate to Delphi 2005 IDE and also provide some link regarding this migrate? Thanks, Rizwan Rizwan Ahmed schrieb: > Hi, Currently we are using Delphi 5 in that we have lot of source > f...

Upgrading to Delphi 2009 from Delphi 5
I've decided it's time to upgrade to Delphi 2009 Professional from my current Delphi 5 Professional which (according to the FAQ) makes me eligible for the upgrade pricing. However, I'd just like to clarify how this process works. My concern is that my Delphi 5 is not registered on the CodeGear site and this doesn't seem to be possible as far as I can tell. When installing the trial I noticed that Delphi 2009 registers itself with your CodeGear account so does this mean that the previous version must be registered there to verify you own a Professional edition? I plan to o...

Delphi 5 to Delphi 6 conversion
Hi We are moving our product from D5 to D6. I have dealt with all the deprecated functions. However, we are getting various platform specifc warnings. These include: Symbol 'FileGetAttr' is specific to a platform Symbol 'FileSetAttr' is specific to a platform Symbol 'faReadOnly' is specific to a platform We want this conversion to be carried out correctly. We don't view the simple solution of switching off those warnings or symbols as being the correct way. What we want is the same platform independence as other functions. For example, all o...

FireDAC / Delphi XE7 / Firebird 2.5 + Dialect 3: Key fields turn upper case
Hi, When working wih a SQL dialect 3 database and field names in upper/lower case, I used to reference those fields in double quotes on my old Delphi 2010 with IBX, which worked well enough. After migrating to XE7 with the latest FireDAC, I set IndexFieldNames to "Mmm" including the double quotes. When opening the table, FireDAC executes an SQL statement that ends with {code}ORDER BY A."Mmm" ASC, A.MMM ASC{code} which of course delivers an exception because there is no field MMM. I hope it is ok if I post some single lines of code here to explain the issue - no copyri...