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

View File

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