Hello,
I encounter a problem with converting data with delphi XE8 - devart liteDac 2,7 or 3.0.2
If I dont use any MAPRULES the data is converted correctly but all the text is in MEMO format unreadable in the datagrid to make any change.
If I create MAPRULES
TEXT -> string,
all text are good but the blob images become unreadable.
If i create MAPRULES
blob, integer,... but with no text maprules - blob image is correct
as soon as I add the text line it does not work anymore
I can give you a sqlite base to try if you want
MAPRULES PROBLEM
Re: MAPRULES PROBLEM
We cannot check the correctness of the applied Data Type Mapping Rules without having the information about the used tables structure and the tasks you have. Note that LiteDAC allows using Data Type Mapping not only for any data types, but also for a particular field: https://www.devart.com/litedac/docs/?da ... apping.htm (the "Rules for a particular field" section)
Re: MAPRULES PROBLEM
Hello,
I have write you a mail with inside a sqlite database with just one table
and a screenshot for see the configuration of maprules
I have download the version 3.1.3 today
But the problem is the same
If i use ConnexionData.DataTypeMap.AddDBTypeRule(liteText, ftString); then the field [Photo] BLOB is not correctly converted.
ConnexionData.DataTypeMap.Clear;
ConnexionDatar.DataTypeMap.AddDBTypeRule(liteBlob, ftBlob);
ConnexionData.DataTypeMap.AddDBTypeRule(liteText, ftString);
The create table database
CREATE TABLE ETIQUETTE ( [CODEIN] TEXT, [NbreCopies] INTEGER, [GENCOD] TEXT, [Libelle1] TEXT, [Libelle2] TEXT, [LibCourt] TEXT, [PV] NUMERIC, [PVDeviseSecondaire] NUMERIC, [PrixUnite] NUMERIC, [Unite] TEXT, [Devise] TEXT, [CodeFournisseur] TEXT, [TauxTva] NUMERIC, [MontantTva] NUMERIC, [CodeNomenclature] TEXT, [Commentaire] TEXT, [Largeur] NUMERIC, [Longueur] NUMERIC, [Hauteur] NUMERIC, [EcotaxeTTC] NUMERIC, [CodePub] TEXT, [PrixPub] NUMERIC, [DateDebutPub] TEXT, [DateFinPub] TEXT, [Reference] TEXT, [PrixAchat] NUMERIC, [LibelleMarque] TEXT, [CheminPhoto] TEXT, [NomPhoto] TEXT, [NomDuPoste] TEXT, [DateEdition] TEXT, [Ancien_Prix] NUMERIC, [PrixEuros] TEXT, [PrixCents] TEXT, [NumLigne] NUMERIC, [Photo] BLOB, [EcoMobilier] NUMERIC, [Colisage] NUMERIC, [Commentaire2] TEXT, [ArtCentrale] TEXT, [LibellePub] TEXT, [STOCK] NUMERIC, [PrixEurosAncien] TEXT, [PrixCentsAncien] TEXT, [Prmp] NUMERIC, [NomFournisseur] TEXT, [DatDerVente] TEXT, [DatDerRecep] TEXT, [LibNomenclature] TEXT, [CodeGamme] TEXT, [LibelleGamme] TEXT, [Libre1] TEXT, [Libre2] TEXT, [Libre3] TEXT, [Libre4] TEXT, [Libre5] TEXT, [Libre6] TEXT, [NumSemaine] INTEGER, [COMMENTAIRE3] TEXT, [COMMENTAIRE4] TEXT, [IA] TEXT, [CodeNomenclatureN2] TEXT, [LibNomenclatureN2] TEXT, [CodeNomenclatureN1] TEXT, [LibNomenclatureN1] TEXT)
Do you have a solution ?
I have write you a mail with inside a sqlite database with just one table
and a screenshot for see the configuration of maprules
I have download the version 3.1.3 today
But the problem is the same
If i use ConnexionData.DataTypeMap.AddDBTypeRule(liteText, ftString); then the field [Photo] BLOB is not correctly converted.
ConnexionData.DataTypeMap.Clear;
ConnexionDatar.DataTypeMap.AddDBTypeRule(liteBlob, ftBlob);
ConnexionData.DataTypeMap.AddDBTypeRule(liteText, ftString);
The create table database
CREATE TABLE ETIQUETTE ( [CODEIN] TEXT, [NbreCopies] INTEGER, [GENCOD] TEXT, [Libelle1] TEXT, [Libelle2] TEXT, [LibCourt] TEXT, [PV] NUMERIC, [PVDeviseSecondaire] NUMERIC, [PrixUnite] NUMERIC, [Unite] TEXT, [Devise] TEXT, [CodeFournisseur] TEXT, [TauxTva] NUMERIC, [MontantTva] NUMERIC, [CodeNomenclature] TEXT, [Commentaire] TEXT, [Largeur] NUMERIC, [Longueur] NUMERIC, [Hauteur] NUMERIC, [EcotaxeTTC] NUMERIC, [CodePub] TEXT, [PrixPub] NUMERIC, [DateDebutPub] TEXT, [DateFinPub] TEXT, [Reference] TEXT, [PrixAchat] NUMERIC, [LibelleMarque] TEXT, [CheminPhoto] TEXT, [NomPhoto] TEXT, [NomDuPoste] TEXT, [DateEdition] TEXT, [Ancien_Prix] NUMERIC, [PrixEuros] TEXT, [PrixCents] TEXT, [NumLigne] NUMERIC, [Photo] BLOB, [EcoMobilier] NUMERIC, [Colisage] NUMERIC, [Commentaire2] TEXT, [ArtCentrale] TEXT, [LibellePub] TEXT, [STOCK] NUMERIC, [PrixEurosAncien] TEXT, [PrixCentsAncien] TEXT, [Prmp] NUMERIC, [NomFournisseur] TEXT, [DatDerVente] TEXT, [DatDerRecep] TEXT, [LibNomenclature] TEXT, [CodeGamme] TEXT, [LibelleGamme] TEXT, [Libre1] TEXT, [Libre2] TEXT, [Libre3] TEXT, [Libre4] TEXT, [Libre5] TEXT, [Libre6] TEXT, [NumSemaine] INTEGER, [COMMENTAIRE3] TEXT, [COMMENTAIRE4] TEXT, [IA] TEXT, [CodeNomenclatureN2] TEXT, [LibNomenclatureN2] TEXT, [CodeNomenclatureN1] TEXT, [LibNomenclatureN1] TEXT)
Do you have a solution ?
Re: MAPRULES PROBLEM
We received the sent SQLite DB and tried to reproduce the issue by using it. However, we did not manage to do it. The possible reason of this may be insignificant issue description. To test fetching BLOB field, stored in the sent DB, we used the following console application :
Please change the source code of this project in such a way that the issue would appear. In addition, describe in more detail what exactly and under which conditions does not happen when fetching the "photo" field.
Code: Select all
program ReadBLOB;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
LiteCall, LiteConsts, Data.DB, MemDS, DBAccess, LiteAccess, LiteDataTypeMap;
var
LiteConnection: TLiteConnection;
LiteQuery: TLiteQuery;
begin
LiteConnection := TLiteConnection.Create(nil);
try
LiteConnection.Database := ExtractFilePath(ParamStr(0)) + 'RPRINTER189.bd';
LiteConnection.Options.Direct := True;
LiteQuery := TLiteQuery.Create(nil);
try
LiteQuery.Connection := LiteConnection;
LiteConnection.DataTypeMap.AddDBTypeRule(liteBlob, ftBlob);
LiteConnection.DataTypeMap.AddDBTypeRule(liteText, ftString);
LiteQuery.SQL.Text := 'Select codein, Libelle1, photo From Etiquette';
LiteQuery.Open;
TBlobField(LiteQuery.FieldByName('photo')).SaveToFile(ExtractFilePath(ParamStr(0)) + 'MyPhoto.jpg');
finally
LiteQuery.Free;
end;
finally
LiteConnection.Free;
end;
end.
Re: MAPRULES PROBLEM
Hello,
thank you for your reply.
Effectively the problem does not come from LITEDAC but from the provider used to connect the data that is not compatible with LITEDAC.
I still have a problem if I use this line
ConnectionData.DataTypeMap.AddDBTypeRule (liteText, ftWideString);
all character strings are cut to 20 characters
or
ConnectionData.DataTypeMap.AddDBTypeRule (liteText, ftWideString, 20000);
I wrote with 20,000 because it's the biggest size variable, but it's not very pretty.
All field are 20000 size length
Is there a different way to do this ?
thank you
thank you for your reply.
Effectively the problem does not come from LITEDAC but from the provider used to connect the data that is not compatible with LITEDAC.
I still have a problem if I use this line
ConnectionData.DataTypeMap.AddDBTypeRule (liteText, ftWideString);
all character strings are cut to 20 characters
or
ConnectionData.DataTypeMap.AddDBTypeRule (liteText, ftWideString, 20000);
I wrote with 20,000 because it's the biggest size variable, but it's not very pretty.
All field are 20000 size length
Is there a different way to do this ?
thank you
Re: MAPRULES PROBLEM
Yes, it is true, by default, when creating fields with the TWideStringField type the Size property value will equal 20. Therefore, to work with strings of large size you should explicitly specify the required FieldSize value when adding the corresponding DataType Rule.