Board index » delphi » How to convert from Paradox 5 to Paradox 7 format

How to convert from Paradox 5 to Paradox 7 format

Hi,

How can tables be converted from 'Paradox 5 for Windows' format to 'Paradox
7' format?
(Of course it's needless to say that it is essential to keep all data
intact...  ;-)

Marz

(___...@xs4all.nl___)

 

Re:How to convert from Paradox 5 to Paradox 7 format


Have you tried creating a new P7 file and importing the records from the P5
file?
Quote
Marz wrote:
> Hi,

> How can tables be converted from 'Paradox 5 for Windows' format to 'Paradox
> 7' format?
> (Of course it's needless to say that it is essential to keep all data
> intact...  ;-)

> Marz

> (___...@xs4all.nl___)

Re:How to convert from Paradox 5 to Paradox 7 format


Quote
>Have you tried creating a new P7 file and importing the records from the P5
>file?

Yes, I have thought about that, but I figure there must be a cleaner way.
I don't believe Borland expects me to write a convertion routine every time
they move on to a higher Paradox level. Or do they?

Marz

Re:How to convert from Paradox 5 to Paradox 7 format


Quote
Marz <_...@xs4all.nl> wrote in message

<7ahqmd$47...@news2.xs4all.nl>...

Quote
>How can tables be converted from 'Paradox 5 for Windows' format to
'Paradox
>7' format?

Marz,

I'm not sure why you feel you want to do this. When you create a
table, the level is set to whatever is appropriate to support the
types of fields and indexes you have defined. You don't gain anything
by changing from level 5 to level 7 - it's not an "upgrade".

However, if you really want to do this, use Database Desktop to
restructure the table, adding a descending index.

--
Stephen Brown

Re:How to convert from Paradox 5 to Paradox 7 format


Quote
Marz wrote:
> How can tables be converted from 'Paradox 5 for Windows' format to 'Paradox
> 7' format?
> (Of course it's needless to say that it is essential to keep all data
> intact...  ;-)

Well, here is some code I took at http://www.inprise.com in developer
support devision, BDE examples.

RestructureTable(Table1, 'LEVEL', '7') is exactly what you need.

//
---------------------------------------------------------------------------
// Purpose: Use the pOptData portion of DbiDoRestructure.
// Remarks: This function calls DbiDoRestructure with the Option to
change
//          and the OptData which is the new value of the option. Since
a
//          database handle is needed and the table cannot be opened
when
//          restructuring is done, a new database handle is created and
set
//          to the directory where the table resides.
// Example: RestructureTable(Table1, 'LEVEL', '7')
//             Change table level to 7
//          RestructureTable(Table1, 'BLOCK SIZE', '4096')
//             Change table block size to 4096
//
procedure RestructureTable(Table: TTable; Option, OptData: string);
var
  hDb: hDBIDb;
  TblDesc: CRTblDesc;
  Props: CurProps;
  pFDesc: FLDDesc;
begin
  // If the table is not opened, raise an error.  Need the table open to
get
  //   the table directory.
  if Table.Active <> True then
    raise EDatabaseError.Create('Table is not opened');
  // If the table is not opened exclusively, raise an error.
DbiDoRestructure
  //   will need exclusive access to the table.
  if Table.Exclusive <> True then
    raise EDatabaseError.Create('Table must be opened exclusively');
  // Get the table properties.
  Check(DbiGetCursorProps(Table.Handle, Props));
  // If the table is not a Paradox type, raise an error.  These options
only
  //   work with Paradox tables.
  if StrComp(Props.szTableType, szPARADOX) <> 0 then
    raise EDatabaseError.Create('Table must be of type PARADOX');
  // Get the database handle.
  Check(DbiGetObjFromObj(hDBIObj(Table.Handle), objDATABASE,
hDBIObj(hDb)));
  // Close the table.
  Table.Close;
  // Setup the Table descriptor for DbiDoRestructure
  FillChar(TblDesc, SizeOf(TblDesc), #0);
  StrPCopy(TblDesc.szTblName, Table.Tablename);
  StrCopy(TblDesc.szTblType, szParadox);
  // The optional parameters are passed in through the FLDDesc
structure.
  //   It is possible to change many Options at one time by using a
pointer
  //   to a FLDDesc (pFLDDesc) and allocating memory for the structure.
  pFDesc.iOffset := 0;
  pFDesc.iLen := Length(OptData) + 1;
  StrPCopy(pFDesc.szName, Option);
  // The changed values of the optional parameters are in a contiguous
memory
  //   space.  Sonce only one parameter is being used, the OptData
variable
  //   can be used as a contiguous memory space.
  TblDesc.iOptParams := 1;  // Only one optional parameter
  TblDesc.pFldOptParams := @pFDesc;
  TblDesc.pOptData := @OptData[1];
  try
    // Restructure the table with the new parameter.
    Check(DbiDoRestructure(hDb, 1, @TblDesc, nil, nil, nil, False));
  finally
    Table.Open;
  end;
end;

--
SY, Alex 0stapov, japh. CDPI: 922447890
mailto:os...@sumy.com   ICQ: 29215380

Re:How to convert from Paradox 5 to Paradox 7 format


Look at:
http://www.inprise.com/devsupport/bde/utilities.html

Here you will find a Paradox table alter utility.

Hope this helps!

Greetings from SA,
Bruce

Other Threads