Welcome! Log In Create A New Profile

Advanced

[WD21] HRestoreBackup

Posted by dje 
dje
[WD21] HRestoreBackup
September 20, 2018 03:54AM
Hi
I need to programatically duplicate a CS database. There are 150 odd tables in the database with several of them having in excess of 1 million records so I thought the best option would be to backup, & then restore under a different name. Finally I could then go into the duplicate database and make any necessary adjustments.

I use HBackup to backup the required database & then use
HRestoreBackup(DataConnection,iBackupId,"OldDBaseName","NewDbaseName",PROG_Process)
to restore it. According to my reading of the Help file this syntax should restore the database as NewDBaseName. However what it actually does is create a folder called NewDbaseName and then restores OldDbaseName under it.

I can set a connection as DataConnection..Database = NewDbaseName\OldDbaseName and this works for HRead etc, however I cannot run any queries on it as the database name is not a valid HFSQL name because of the backslash.

All I really want/need it to do is duplicate it at the same level,as the help suggests it should. Any ideas or alternative suggestions would be greatly appreciated.

Thanks

David
Re: [WD21] HRestoreBackup
September 20, 2018 01:11PM
Hi Dje

does it have to be programmatically? I'm asking because it's a 10 seconds job doing it by hand in the HF control center...

if it HAS TO be by code, then you could try (I have not tested) to modify the content of the info file that is created at the root of the backup. If I remember correctly, that's where the name of the DB is stored as text, and you hsould be able to change it by code easily.

Best regards

Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on [www.fabriceharari.com]
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: