fcl-db/dbase: further improvement on r24253 though no solution yet.

git-svn-id: trunk@24254 -
This commit is contained in:
reiniero 2013-04-15 11:18:46 +00:00
parent a0455a4673
commit 996b26b936
2 changed files with 8 additions and 16 deletions

View File

@ -195,7 +195,6 @@ type
destructor Destroy; override;
function CodePageInstalled(ACodePage: Integer): Boolean;
function CreateFoxProLangID(NewCodePage: integer): Byte;
property CurrencyAsBCD: Boolean read FCurrencyAsBCD write FCurrencyAsBCD;
property DefaultOpenCodePage: Integer read FDefaultOpenCodePage write FDefaultOpenCodePage;
@ -630,21 +629,19 @@ begin
// determine codepage & locale
if FDbfVersion in [xFoxPro, xVisualFoxPro] then
begin
if FFileLangId = 0 then
FFileLangId := DbfGlobals.CreateFoxProLangID(DbfGlobals.DefaultCreateCodePage);
FFileCodePage := LangId_To_CodePage[FFileLangId];
lLocaleID := LangId_To_Locale[FFileLangId];
FUseCodePage := FFileCodePage;
// Don't use DbfGlobals default language ID as it is dbase-based
FFileLangId := ConstructLangId(LangId_To_CodePage[FFileLangId],GetUserDefaultLCID, true);
end
else
begin
// DBase
if FFileLangId = 0 then
FFileLangId := DbfGlobals.DefaultCreateLangId;
FFileCodePage := LangId_To_CodePage[FFileLangId];
lLocaleID := LangId_To_Locale[FFileLangId];
FUseCodePage := FFileCodePage;
end;
FFileCodePage := LangId_To_CodePage[FFileLangId];
lLocaleID := LangId_To_Locale[FFileLangId];
FUseCodePage := FFileCodePage;
// prepare header size
if FDbfVersion = xBaseVII then
@ -3088,11 +3085,6 @@ begin
Result := FCodePages.IndexOf(Pointer(ACodePage)) >= 0;
end;
function TDbfGlobals.CreateFoxProLangID(NewCodePage: integer): Byte;
begin
ConstructLangId(NewCodePage, GetUserDefaultLCID, true);
end;
initialization
finalization
FreeAndNil(DbfGlobals);

View File

@ -521,8 +521,7 @@ begin
end;
const
// range of Dbase / FoxPro locale; these are INCLUSIVE
// range of Dbase / FoxPro locales; these are INCLUSIVE
dBase_RegionCount = 4;
dBase_Regions: array[0..dBase_RegionCount*2-1] of Byte =
($00, $00,
@ -538,6 +537,7 @@ begin
DbfRes := 0;
FoxRes := 0;
// scan
//todo: verify this for visual foxpro; it doesn't seem to work.
for I := 0 to $FF do
begin
// check if need to advance to next region