BLOB size different. With FireDAC ok but not with MyDAC
Posted: Sat 04 Feb 2017 14:57
I have the following issue. When I load a JPG file of 25 kB into a LARGEBLOB ( MySQL 5.5.54 ) with .LoadFromFile() and 'immediatly' do a .SaveToFile() the file is 39 kB in size. And not readable. But I tried this on exactly the same place in code with FireDAC then the storage of the BLOB is okay. But not with MyDAC. Just dropped a TMyQuery on the form and the TMyConnection is also standard, just set the character set to LATIN1 ( this is the standard of MYSQL ), but i tried also different character sets. I tried options like compression on or off ( now is as I told you ) default. No data mappings used. But FireDAC is okay and MyDAC not....
I am using XE6, and I am not a newbie, 15 years Delphi experience.
The code ( and there is no code between!!!). The in.jpg is 25Kb and the out.jpg is 39kB
FDQuery1.Insert;
FDQuery1LogoBedrijf.LoadFromFile('C:\Users\emile\Desktop\perifact\Compiled FULL\in.jpg');
FDQuery1.Post;
FDQuery1.Close;
FDQuery1.Open;
FDQuery1LogoBedrijf.SaveToFile('C:\Users\emile\Desktop\perifact\Compiled FULL\out.jpg');
The table definition is:
CREATE TABLE `reportsettings` (
`PrintLayout` INT(11) NOT NULL,
`LogoBedrijfStretch` TINYINT(1) NOT NULL,
`LogoExtraStretch` TINYINT(1) NOT NULL,
`LogoFooterStretch` TINYINT(1) NOT NULL,
`LogoHeigthBedrijf` INT(11) NOT NULL,
`LogoHeigthExtra` INT(11) NOT NULL,
`LogoHeigthFooter` INT(11) NOT NULL,
`LogoLeftBedrijf` INT(11) NOT NULL,
`LogoLeftExtra` INT(11) NOT NULL,
`LogoLeftFooter` INT(11) NOT NULL,
`LogoTopBedrijf` INT(11) NOT NULL,
`LogoTopExtra` INT(11) NOT NULL,
`LogoTopFooter` INT(11) NOT NULL,
`LogoWidthBedrijf` INT(11) NOT NULL,
`LogoWidthExtra` INT(11) NOT NULL,
`LogoWidthFooter` INT(11) NOT NULL,
`LayoutPresentation` INT(11) NOT NULL,
`LabelSumTekstTotaalVanFactuurIncBTW` VARCHAR(250) NOT NULL,
`LabelSumTekstFactuurBtwBedrag` VARCHAR(250) NOT NULL,
`LabelSumTekstTotaalVanFactuurExcBTW` VARCHAR(250) NOT NULL,
`LabelSumTekstTotaalVanOfferteIncBTW` VARCHAR(250) NOT NULL,
`LabelSumTekstOfferteBtwBedrag` VARCHAR(250) NOT NULL,
`LabelSumTekstTotaalVanOfferteExcBTW` VARCHAR(250) NOT NULL,
`TekstFactuurStatusOpen` VARCHAR(4096) NOT NULL,
`TekstFactuurStatusBetaald` VARCHAR(4096) NOT NULL,
`PrintAreaBedrijf1` BLOB NULL,
`PrintAreaBedrijf2` BLOB NULL,
`PrintAreaBedrijf3` BLOB NULL,
`PrintAreaBedrijf4` BLOB NULL,
`TekstFactuurStatusCreditFactuur` VARCHAR(4096) NOT NULL,
`DefaultFactuurVoetregel` VARCHAR(4096) NOT NULL,
`DefaultOfferteVoetregel` VARCHAR(4096) NOT NULL,
`LogoBedrijf` LONGBLOB NOT NULL,
`LogoExtra` LONGBLOB NOT NULL,
`LogoFooter` LONGBLOB NOT NULL
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB;
I am using XE6, and I am not a newbie, 15 years Delphi experience.
The code ( and there is no code between!!!). The in.jpg is 25Kb and the out.jpg is 39kB
FDQuery1.Insert;
FDQuery1LogoBedrijf.LoadFromFile('C:\Users\emile\Desktop\perifact\Compiled FULL\in.jpg');
FDQuery1.Post;
FDQuery1.Close;
FDQuery1.Open;
FDQuery1LogoBedrijf.SaveToFile('C:\Users\emile\Desktop\perifact\Compiled FULL\out.jpg');
The table definition is:
CREATE TABLE `reportsettings` (
`PrintLayout` INT(11) NOT NULL,
`LogoBedrijfStretch` TINYINT(1) NOT NULL,
`LogoExtraStretch` TINYINT(1) NOT NULL,
`LogoFooterStretch` TINYINT(1) NOT NULL,
`LogoHeigthBedrijf` INT(11) NOT NULL,
`LogoHeigthExtra` INT(11) NOT NULL,
`LogoHeigthFooter` INT(11) NOT NULL,
`LogoLeftBedrijf` INT(11) NOT NULL,
`LogoLeftExtra` INT(11) NOT NULL,
`LogoLeftFooter` INT(11) NOT NULL,
`LogoTopBedrijf` INT(11) NOT NULL,
`LogoTopExtra` INT(11) NOT NULL,
`LogoTopFooter` INT(11) NOT NULL,
`LogoWidthBedrijf` INT(11) NOT NULL,
`LogoWidthExtra` INT(11) NOT NULL,
`LogoWidthFooter` INT(11) NOT NULL,
`LayoutPresentation` INT(11) NOT NULL,
`LabelSumTekstTotaalVanFactuurIncBTW` VARCHAR(250) NOT NULL,
`LabelSumTekstFactuurBtwBedrag` VARCHAR(250) NOT NULL,
`LabelSumTekstTotaalVanFactuurExcBTW` VARCHAR(250) NOT NULL,
`LabelSumTekstTotaalVanOfferteIncBTW` VARCHAR(250) NOT NULL,
`LabelSumTekstOfferteBtwBedrag` VARCHAR(250) NOT NULL,
`LabelSumTekstTotaalVanOfferteExcBTW` VARCHAR(250) NOT NULL,
`TekstFactuurStatusOpen` VARCHAR(4096) NOT NULL,
`TekstFactuurStatusBetaald` VARCHAR(4096) NOT NULL,
`PrintAreaBedrijf1` BLOB NULL,
`PrintAreaBedrijf2` BLOB NULL,
`PrintAreaBedrijf3` BLOB NULL,
`PrintAreaBedrijf4` BLOB NULL,
`TekstFactuurStatusCreditFactuur` VARCHAR(4096) NOT NULL,
`DefaultFactuurVoetregel` VARCHAR(4096) NOT NULL,
`DefaultOfferteVoetregel` VARCHAR(4096) NOT NULL,
`LogoBedrijf` LONGBLOB NOT NULL,
`LogoExtra` LONGBLOB NOT NULL,
`LogoFooter` LONGBLOB NOT NULL
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB;