Question

I was wondering - is there a standard (like a RFC) for the .sch schema file format the BDE uses?

The format is described here and here. It seems based on this Microsoft format, but it's not quite the same.

Example 1 - VARYING format file

CUSTOMER.SCH:

[CUSTOMER]
Filetype=VARYING
Delimiter="
Separator=,
CharSet=ascii
Field1=Customer No,Float,20,04,00
Field2=Name,Char,30,00,20
Field3=Phone,Char,15,00,145
Field4=First Contact,Date,11,00,160

CUSTOMER.TXT:

1221.0000,"Kauai Dive Shoppe","808-555-0269",04/03/1994
1231.0000,"Unisco","809-555-3915",02/28/1994
1351.0000,"Sight Diver","357-6-876708",04/12/1994
1354.0000,"Cayman Divers World Unlimited","809-555-8576",04/17/1994
1356.0000,"Tom Sawyer Diving Centre","809-555-7281",04/20/1994

Example 2 - FIXED format file

CUSTOMER.SCH:

[CUSTOMER]
Filetype=Fixed
CharSet=ascii
Field1=Customer No,Float,20,04,00
Field2=Name,Char,30,00,20
Field3=Phone,Char,15,00,145
Field4=First Contact,Date,08,00,160

CUSTOMER.TXT:

           1221.0000Kauai Dive Shoppe             808-555-0269   04/03/94
           1231.0000Unisco                        809-555-3915   02/28/94
           1351.0000Sight Diver                   357-6-876708   04/12/94
           1354.0000Cayman Divers World Unlimited 809-555-8576   04/17/94
           1356.0000Tom Sawyer Diving Centre      809-555-7281   04/20/94

I'm especially interested in the possible argument-values for 'Filetype', 'Delimiter', 'Separator' and 'CharSet'. I've searched the internet using various terms ('RFC', 'schema', 'filetype', 'standard', etc), but came up blank...

Things I would like to know specifically :

  • What encoding(s) can be used for the .sch file itself? (This is relevant for correctly interpreting the fieldnames and other configurable characters.)
  • How should I specify non-printable Separator and Delimiter characters, for example an Ansi control-character like "Unit Separator" ($1F) or even a simple "Tab" ($09)? (Given the age of the format I think I should use Caret notation, but it'd just like to be sure.)
  • How can I specify to not-use a Delimiter? Should I specifiy an empty value, or leave the setting out altogether?

TIA

PS: Note, I'm not using the BDE itself - it's just these schema files that I have to generate and read correctly.

Was it helpful?

Solution

Search your hard drive for a file called bde32.hlp that is installed with Borland Delphi. It is a Windows Help file that contains a documentation of the BDE API. It also contains a topic titled "Binding external schema to text tables" which describes the format of the *.sch files.

Under the title "Language drivers", the same help file also contains a list of "short names" that can be specified for the CharSet entry in the *.sch file.

So, for example, if you want to use the Windows character set for west european languages (Windows-1252), that you will need for French accented characters or German umlauts, the value to use for CharSet is ANSIINTL like that:

[CUSTOMER]
Filetype=VARYING
Delimiter="
Separator=,
CharSet=ANSIINTL

What encoding(s) can be used for the .sch file itself? (This is relevant for correctly interpreting the fieldnames and other configurable characters.)

Just plain ASCII. There is no scenario that would require or allow you to use anything but good old ASCII characters with character codes from 0-127 and of those (except for line breaks to separate the different lines) only printable characters are meaningful.

For example, no other characters (umlauts, accented chars, etc) are allowed in the table name or column names.

How should I specify non-printable Separator and Delimiter characters, for example an Ansi control-character like "Unit Separator" ($1F) or even a simple "Tab" ($09)? (Given the age of the format I think I should use Caret notation, but it'd just like to be sure.)

Not possible. Only "visible" characters can be used as delimiter and separator. To use a tab, just use an empty assignment:

[CUSTOMER]
Filetype=VARYING
Delimiter="
Separator=
CharSet=ANSIINTL

How can I specify to not-use a Delimiter? Should I specifiy an empty value, or leave the setting out altogether?

In "Fixed" format, no separators and no delimiters are used. In "Varying" format, a delimiter is always used for columns with string/character type and a delimiter is never used for other column types. To not use a delimiter, just use an empty assignment in the schema:

[CUSTOMER]
Filetype=VARYING
Delimiter=
Separator=,
CharSet=ANSIINTL

OTHER TIPS

It'll be really hard to get a definitive answer to your question. BDE has been deprecated for years now, and most of the original developers have moved on to other jobs.

If memory serves me correctly, the text (later ASCII) support of the BDE was already in there when it was first called ODAPI and later IDAPI (Independent Database API, a codevelopment of Borland, Novell, IBM and WordPerfect in the early 90's).

In the mean time, Borland became Inprise, moved its focus to the enterprise market, became Borland again, separated the developer tools and databases group into CodeGear and sold CodeGear to Embarcadero (which finally was developer centric again).

I will try to come up with something decent and extend this answer later on, or ask around at DelphiLive! next week.

Hang on :-)

Edit 1: some more information

Support for ASCII is in idasci32.dll

Value values for these fields:

Filetype:

  • Fixed
  • Delimited

Delimiter: unknown

Separator: unknown

CharSet:

  • ascii
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top