C++, MySQL and BLOB field
Posted: Wed 20 Apr 2011 12:34
Greetings.
I had a difficulty at what loading or a file in BLOB field MySQL 5.1 package of components MyDAC
Here a code of loading of a file from BLOB fields and preservation on a hard disk of the client
Works normally. A code:
And here with loading on the Server a problem the Code:
Or so: the Code:
Error code:
http://www.imageup.ru/img177/bezymyannyjj635947.jpg
I had a difficulty at what loading or a file in BLOB field MySQL 5.1 package of components MyDAC
Here a code of loading of a file from BLOB fields and preservation on a hard disk of the client
Works normally. A code:
Code: Select all
TMemoryStream *M1 = new TMemoryStream();
TStream *B1 = MyTable1->CreateBlobStream(MyTable1->FieldByName("blob"),bmRead);
M1->CopyFrom(B1,B1->Size);
M1->SaveToFile("C:\Image.jpg");
delete B1;
delete M1;Code: Select all
MyTable1->Edit();
TMemoryStream *M = new TMemoryStream();
M->LoadFromFile("C:\ABOUT.rar");
TStream *B = MyTable1->CreateBlobStream(MyTable1->FieldByName("blob"),bmWrite);
B->CopyFrom(M,M->Size);
delete B;
MyTable1->Post();
delete M;Code: Select all
TBlobField *Fields;
MyQuery1->Insert();
(MyQuery1->FieldByName("blob"),Fields)->LoadFromFile("C:\Image.jpg");
MyQuery1->Post();http://www.imageup.ru/img177/bezymyannyjj635947.jpg