Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread test file for a field
Mon, Aug 14 2006 10:04 PMPermanent Link

Jerry Blumenthal
Is there a way to test a file for the presence of a field without
opening it?  Or is the only thing you can test Major Version, Minor Version?

I tried using code like:

dbtemp.Databasename := isamdb.DatabaseName;
dbtemp.TableName := 'person.dat';
try
  if dbtemp.fieldbyname('pwd').asboolean = false then;
  except
    result:= true;
    exit;
  end;

I always get an edatabase exception in the IDE and no exception when not
in the IDE.  And the file DOES have the pwd field.  So this test is not
working.

Jerry
Tue, Aug 15 2006 4:00 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jerry


What about testing FieldDefs - I'm not sure if the table has to be open or not though.

Roy Lambert
Tue, Aug 15 2006 12:04 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jerry,

<< Is there a way to test a file for the presence of a field without opening
it?  Or is the only thing you can test Major Version, Minor Version? >>

The only way to do so is via low-level reads of the .dat header.  ElevateDB
can do so, however, because this information is stored in the database
catalog and not in the actual table files.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Aug 15 2006 1:06 PMPermanent Link

Jerry Blumenthal
Tim Young [Elevate Software] wrote:
> Jerry,
>
> << Is there a way to test a file for the presence of a field without opening
> it?  Or is the only thing you can test Major Version, Minor Version? >>
>
> The only way to do so is via low-level reads of the .dat header.  ElevateDB
> can do so, however, because this information is stored in the database
> catalog and not in the actual table files.
>


"via low-level reads of the .dat header"

How might I do that?  I used a Hex Editor to look at a DAT file, and I
can see the names of the fields there, but I'm not sure if I should do a
blockread or something else to look at the header.

And I dont know how much to read, to look for the field, altho, of
course, I do know the structure of the table in question.

Also- the length of the record is longer in the version of the table
that has that extra (boolean) field.  Could that help?

Jerry
Tue, Aug 15 2006 6:32 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jerry,

<< How might I do that?  I used a Hex Editor to look at a DAT file, and I
can see the names of the fields there, but I'm not sure if I should do a
blockread or something else to look at the header. >>

Do you have the DBISAM source ?  If not, send me an email with what version
of DBISAM you want the header structures for and I'll send them to you.  You
can then just use normal file I/O using a TFileStream object to read the
headers.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image