?
Solved

How to backup and restore a database table.

Posted on 1998-01-30
3
Medium Priority
?
189 Views
Last Modified: 2010-04-04
I am kind of stuck (AGAIN)


I am currently using a paradox table and would like to if possible
backup and restore a table on disk.

I have thought of using the BatchMove by setting it mode property to baCopy but I was not sure if it allowed you to backup the table to disk.

P.S. A small bit a code if possible would be appreciated....




0
Comment
Question by:delbrad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
d4jaj1 earned 200 total points
ID: 1358052
Batchmove will do.  If the table doesn't exist, it will create it for you.  Although batchmove (baCopy) works, I prefer to do a regular DOS copy to move all of the files from one directory to another (your Backup directory).  I prefer this method because the batchmove doesn't copy the referential integrity, indexes, validity checks, etc., just the table's structure.  Using the DOS method allows you to keep your tables and other of their associated files in tact.

In terms of code, I would suggest a REALLY good Freeware component that automatically gets all fields specified in a MASK, e.g., Customers.*, and moves/copies them to a directory.  It's called FileOps and can be found at Torry's Delphi website.  If you can't find it there, add I comment and I'll send it to you.

If your set on using the batchmove, first create the table like your existing table and perform the move.  You will have to add val checks & ref-integrity yourself.

try
 with table1 do //your existing table
 begin
 fielddefs.update;
 indexdefs.update;
 end;
 tempdb := ttable.create(nil);  // create a new table from scratch to look just like your existing table
 with tempdb do begin
 DataBaseName := table1.databasename;
 tableName := 'backup.db';
 TableType := table1.tabletype;
 fielddefs.assign(table1.fielddefs);
 indexdefs.assign(table1.indexdefs);
 createtable;
 open;
 end;
 table1.batchmove(temdb, batcopy)
 tempdb.free;
except
 raise;
 end;

Any questions, please add a comment.  Good Luck!

Jay
0
 

Author Comment

by:delbrad
ID: 1358053
To  d4jaj1

Went to Torry's Delphi Page and could not find the freeware component called FileOps

Could you send it to me at

delbrad@brigadoon.com

thank you

P.S. will also try provide code to see which one I like the best...
0
 
LVL 3

Expert Comment

by:d4jaj1
ID: 1358054
Will send it to you.  The code for the Batchmove is above, the FileOperations component has an example program (source code included) in the zip file.  It is compatible with D2 & D3.

Good Luck.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question