Groups > dBase > dBase shared code > function setLdriverTable() to change language driver of table




function setLdriverTable() to change language driver of
table

function setLdriverTable() to change language driver of table
Sun, 22 Oct 2006 20:22:56 +020
In the binaires.group I posted a zip file containing setLdriverTable.prg and
testLdriver.prg.

SetLdriverTable.prg contains a function which will allow you to change the
language driver of an
existing table. As input it needs the table name, the short name of the language
driver and a
boolean parameter which decides it the table data should be transliterated.

A thanks to Gerald Lightsey who pointed to a thread in the old NG contaning a
long discussion of the
problems encountered when attempting to change the table language driver. After
reading said thread
I decided to include in my code the ability to select/unselect transliteration.

The code works by setting the new language driver name in the table header when
it is a version 7
table or the language driver ID when it is a version 4 or 5 table. If a
production index file exists
the language driver ID will also be written to the mdx file as required. The
code does not work with
a version 3 table ( dBASE III table ).

The code also figures out the language driver ID corresponding to the language
driver name without
having to refer to a separate datasheet or table.


To test the function unzip the zipfile to an empty folder and run
testLdriver.prg which creates and
lists the data from two identical tables where the language driver was first
changed from the one
set in the BDE to the language driver DB437US0, and then changed again to the
language driver
DBWINWE0, for one table with transliteration set to true and for the other table
set to false.

When I set my BDE to use DBWINWE0 I get the following output:


Transferred from DBWINWE0 ( current BDE setting ) to DB437US0 with bTrans =
true
Record#  fName
       4  Æble
       5  Århus
       3  Señor
       2  Müller
       1  André

Transferred from DB437US0 to DBWINWE0 with bTrans = true
Record#  fName
       3  Señor
       2  Müller
       5  Århus
       1  André
       4  Æble

Transferred from DB437US0 to DBWINWE0 with bTrans = false
Record#  fName
       5  ?rhus
       3  Se¤or
       2  M?ller
       1  Andr‚
       4  ’ble

Any comments appreciated. I have only tried the code on small tables and don't
know how slow/fast it
is on large tables. Also it would be interesting to know if it works on tables
with a _DBASELOCK
field.


Ivar B. Jessen







  
 





Post Reply
about | contact