Solved

How to backup and restore a database table.

Posted on 1998-01-30
3
181 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
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
d4jaj1 earned 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi application Soap connection 5 104
Downloading email attachments 2 74
Working with hours 3 58
tidtcpserver connection lost handle 2 86
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

777 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