dbTalk Databases Forums  

How do you determine table structure using DTI?

comp.databases.btrieve comp.databases.btrieve


Discuss How do you determine table structure using DTI? in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Greg D
 
Posts: n/a

Default How do you determine table structure using DTI? - 08-21-2007 , 04:02 PM






I have a database with DDF files and am looking for a way to determine what
the table and index structures are by using the DTI.

The PvGetTable() function returns field info, but not the field offset and
the "flag" does not specify that fields are nullable so I can't find a way
to infer the field offsets. Is there another function that I should use
that can give me the field offsets and information about nullable fields?

Thanks
- Greg



Reply With Quote
  #2  
Old   
Bill Bach
 
Posts: n/a

Default Re: How do you determine table structure using DTI? - 08-26-2007 , 04:36 PM






The FLAGS field in the ColumnMap structure should contain the Nullable
info you need. If you AND the Flags value with B_FLAG_NULLABLE (4) and
you get a non-zero value, then the field is nullable, and you should
add one byte to the structure before this field. Otherwise, the first
field will start at Offset Zero, and you can simply count the lengths.

Another solution is to query the DDF's directly, like this:
SELECT * FROM X$Field
INNER JOIN X$File on Xe$File = Xf$Id
WHERE
Xe$Datatype < 227
AND Xf$Name = 'tablename'
ORDER BY Xe$Offset

There is a Stored Procedure available in PSQLv9.5 called psp_columns(),
but this doesn't include the ORDER BY, and as such, can be useless for
systems that have had FILE.DDF rebuilt at one point or another.
Goldstar Software Inc.
Pervasive-based Products, Training & Services
Bill Bach
BillBach (AT) goldstarsoftware (DOT) com
http://www.goldstarsoftware.com
*** Chicago: Pervasive Service & Support Class - 08/28/2007***


Greg D wrote:

Quote:
I have a database with DDF files and am looking for a way to
determine what the table and index structures are by using the DTI.

The PvGetTable() function returns field info, but not the field
offset and the "flag" does not specify that fields are nullable so I
can't find a way to infer the field offsets. Is there another
function that I should use that can give me the field offsets and
information about nullable fields?

Thanks
- Greg


--



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.