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 |
--