Board index » delphi » Copying the underlying files for TTable

Copying the underlying files for TTable

Is there any easy way to copy the structure and data contained in a TTable
object.
I am looking for something like TTable.CopyTable (NewTablename).
I dont want to copy the Delphi object, just all the files that make up the
data and structure.
How can I acheive this.

Philip Cook

ps I am using Paradox V7 files as the underlying data set.

 

Re:Copying the underlying files for TTable


Seems like I did something like this once using BDE and BatchMove.

"Philip B Cook" <philipbc...@ntlworld.com> wrote in message
news:3e0dc70c$1@newsgroups.borland.com...

Quote
> Is there any easy way to copy the structure and data contained in a TTable
> object.
> I am looking for something like TTable.CopyTable (NewTablename).
> I dont want to copy the Delphi object, just all the files that make up the
> data and structure.
> How can I acheive this.

> Philip Cook

> ps I am using Paradox V7 files as the underlying data set.

Re:Copying the underlying files for TTable


"Philip B Cook" <philipbc...@ntlworld.com> wrote in message
news:3e0dc70c$1@newsgroups.borland.com...

Quote
> Is there any easy way to copy the structure and data contained in a TTable
> object.
> I am looking for something like TTable.CopyTable (NewTablename).
> I dont want to copy the Delphi object, just all the files that make up the
> data and structure.
> How can I acheive this.

> Philip Cook

> ps I am using Paradox V7 files as the underlying data set.

OK Answering my own question ... this works ..

Find the location of the paradox files by inspecting the TTable.Tablename
property (to see if it has a Path) else lookup the PATH parameter from the
TTable.Databasename alias using Session.GetAliasParams.
Then loop thru all files having the the format TABLENAME.*  and copy them to
NEWTABLENAME.*
It is also a good idea to use TTable.FLUSHBUFFERS ahead of the copy to
ensure the uderlying paradox file is up-to-date.

regards .. Philip

Other Threads