|
Log in |
FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
NSL vs Bytes Order.
Hi.
I am trying to get away from the NSL nuisance nightmare (almost every single PC has some little difference, and needs to Pack the tables when copying the database from one PC to another). 2 Questions. A) For accented languages (French, Spanish, etc) the sort order of the strings indexed would work just fine after this conversion? That is, will it keep the same sort order (for French and Spanish languages)? B) Is is possible to change the Locale in code? If so, how, any hint/example? I know how to change options, but I have no idea of how to change Locale. Thanks |
#2
|
|||
|
|||
Re: NSL vs Bytes Order.
> I am trying to get away from the NSL nuisance nightmare (almost every
> single PC has some little difference, and needs to Pack the tables > when copying the database from one PC to another). You won't be able to; even incremental upgrades to Windows might change the NLS version and require running the table update. > A) For accented languages (French, Spanish, etc) the sort order of the > strings indexed would work just fine after this conversion? That is, > will it keep the same sort order (for French and Spanish languages)? I think you will find that your French etc users won't be very happy with byte order. > B) Is is possible to change the Locale in code? If so, how, any > hint/example? I know how to change options, but I have no idea of how > to change Locale. Use the Source Code generator in EM (right-click database node). -- Eivind Bakkestuen [NDD] |
#3
|
|||
|
|||
Thanks Eivid.
Ok, we DO need NSL. However, I had done a test with the code below (before your anser), and strangely it also changed the fied values (not only the "locale"). For example, lines with 2 ALB?NDIGAS were converted to 2 ALBУNDIGAS. Code:
procedure fixlocale(nxDBase: Tnxdatabase;tablename:string); var idxField,i,idx,idx1: Integer; NewDict, Dict: TnxDataDictionary; TaskInfo: TnxAbstractTaskInfo; Completed: Boolean; TableMapper: TnxTableMapperDescriptor; TaskStatus: TnxTaskStatus; NeedRestruct: Boolean; aindexdescriptior:TnxIndexDescriptor; aIndexFieldDescriptor : TnxKeyFieldDescriptor; begin try tablename:=StringReplace(tablename,'.nx1','',[rfIgnoreCase,rfReplaceAll]); Dict := TnxDataDictionary.Create; nxdbase.GetDataDictionary(Tablename, '', Dict); TableMapper := TnxTableMapperDescriptor.Create;; try NewDict := TnxDataDictionary.Create; NewDict.Assign(Dict); with newdict do begin with newdict.AddLocaleDescriptor do begin Locale := 2; UseStringSort:=true; end; for idx:=0 to NewDict.IndicesDescriptor.IndexCount-1 do begin if NewDict.IndicesDescriptor.IndexDescriptor[idx].KeyDescriptor is TnxCompKeyDescriptor then begin for idx1:=0 to (NewDict.IndicesDescriptor.IndexDescriptor[idx].KeyDescriptor as TnxCompKeyDescriptor).KeyFieldCount-1 do begin (NewDict.IndicesDescriptor.IndexDescriptor[idx].KeyDescriptor as TnxCompKeyDescriptor).KeyFields[idx1].RemoveLocaleDescriptor; end; end; end; end; TableMapper.MapAllTablesAndFieldsByName(Dict, NewDict); // and finally restructure and wait until the process is done nxCheck(nxDBase.RestructureTableEx(Tablename, '', newDict, TableMapper, TaskInfo)); try if Assigned(TaskInfo) then begin repeat TaskInfo.GetStatus(Completed, TaskStatus); if not Completed then begin Sleep(500) end; until Completed; nxCheck(TaskStatus.tsErrorCode); end; finally if Assigned(TaskInfo) then TaskInfo.Free; end; finally Dict.Free; NewDict.free; TableMapper.Free; end; except on e: Sysutils.Exception do showmessage(e.message); end; end; |
#4
|
|||
|
|||
Re: NSL vs Bytes Order.
> and strangely it also changed the fied values (not only the "locale").
> For example, lines with 2 ALB?NDIGAS were converted to 2 > ALBУNDIGAS. I'm pretty sure that changing the locale does not actually change the field value; the bytes stored in the string field would be exactly the same as before. But changing the locale obviously influences how those bytes are interpreted when displayed. -- Eivind Bakkestuen [NDD] |
#5
|
|||
|
|||
Re: NSL vs Bytes Order.
Eivind Bakkestuen wrote:
> > and strangely it also changed the fied values (not only the "locale"). > > For example, lines with 2 ALB?NDIGAS were converted to 2 > > ALBУNDIGAS. > > I'm pretty sure that changing the locale does not actually change the > field value; the bytes stored in the string field would be exactly the > same as before. But changing the locale obviously influences how those > bytes are interpreted when displayed. Changing the locale (and with it, the codepage, in case of non-wide strings) will perform a codepage translation from the previous codepage to the new codepage. In case any characters can not be mapped from the source to target codepage, it depends if the restructure is using dlaBestFit or not. If it's used, the unmappable characters should be mapped to ?, otherwise the restructure should fail. Changing from/to byte order (no locale specified) is a special case, in which the bytes are simply accepted or left as is, and it's your responsibility to make sure the bytes that make up the strings are in the locale/codepage you have specified. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Accessing bytes in a BYTEARRAY | Sue King | nexusdb.public.support.sql | 2 | 6th November 2019 01:50 PM |
Internal error: Could not read exact number of bytes | Ric | nexusdb.public.support | 2 | 4th April 2014 08:46 AM |
SQL Update and set byte array (bytes) field | Jindrich Volek | nexusdb.public.support.sql | 1 | 8th September 2011 07:11 AM |
Can't post attachments larger than 1000000 bytes to binaries | Bert Moorthaemer | nexusdb.public.support | 1 | 1st September 2007 09:49 AM |
Query for 2 bytes charactor problem | J.Y.Han | nexusdb.public.support.sql | 3 | 26th August 2005 05:41 PM |