PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD23] HFCS HCopyFile + warnings
[WD23] HFCS HCopyFile + warnings
Débuté par GuenterP, 10 aoû. 2018 07:14 - 5 réponses
Posté le 10 août 2018 - 07:14
Hi,

in order to be able to painlessly switch from HFCS to Classic and back I'm trying to backup a HFCS directory by HCopyFile(..) and copy back these files to the HFCS Server. Using HCopyFile(...) to retrieve the files from the server works just fine, no problem at all. But. Putting those copied files back to the same server directory is a pain. There's no way because a few files are always "in use" though these files are closed by HClose(FileName) before a copy takes place. Any ideas?

BEWARE: using HBackup(YourConnection,"DataBaseName/*+System") will backup the database plus the vital server files correctly. But. It will NOT be able to restore anything of it! HFCS Control Center is unable to restore the backup! Therefore do not use the "System" switch! Backup the whole server directory from time to time.

BEWARE: the HFCS Control Center still cannot upload HF Classic files as advertised except the logical and the physical file names are identical AND the file extension of all files is .fic
Posté le 10 août 2018 - 08:24
Hi,

HCopyFile(..) works just fine if a connection to a differently named directory is opened. But now I have the data in a directory with the "wrong" name. Only thing: I'd have to delete the original directory and rename the newly made directory to that "old" name.

However, commands like HDeleteDirectory(...) and HRenameDirectory(...) seem to be missing?? Is there any way to delete a Server directory and is there another command to rename a directory? I couldn't find any ...
Posté le 10 août 2018 - 10:41
Hi Guenter,

When I first started using Hyperfile, (in the previous century, even before it was called HFSQL) I for some reason wanted to change the file extension too. I felt it should be .dat or .dta.
As a result back then there were even more problems than you are facing now.
Soon I realized that nobody would ever notice or care what the file extensions look like and that it was not worth the trouble to change them.
So I have been using .fic ever since.

For moving files back and forth between local and server I always use HFSQL Control Center;
- Import Classical Database for import to the server
- Copy Files from server for a local copy of the file.
With both options I used a locally accessible BD directory of a HFSQL Server as a local source or destination (Classical db).

I'm not sure if this is safe (no problems sofar), but if you just physically change the name of a database folder on disk, then the db name also changes in HFSQL Control Center. Adding an empty folder in the BD folder will also add an empty db.
I'assuming that a database is the equivalent of a folder name in the BD folder of the server.
If there's no _system folder after the copy, then you need to do a synchronization of the data and structure afterwards.

Kind regards,
Piet
Posté le 10 août 2018 - 23:01
Hi Guenter,

I also could not find a HRenameDirectory command (or anything equivalent), but WD version 15 and newer ones do have the HDeleteDirectory() command.

Best regards
Ola
Posté le 11 août 2018 - 07:59
Hi Ola, thank you!

I did not see the command HDeleteDirectory(..), it islisted for C/S only. That's a HUGE step forward! I could delete the directory BEFORE copying the data files to the correctly named directory. I propose a backup of the original data before doing the copy anyway!
Posté le 11 août 2018 - 08:18
Hi Piet,

changing the extension from .fic to something else is a logical move. The homophone "fick" to "fic" is in German the same as "fuck" in English. My first WD 5.5 program did have this extension and there were several user questions in regards to this extension. "Are we going to be fucked by your program?" was one of the questions in regards to that curiously named file extension. So, .DAT became the standard.

the use of different logical and physical file names is very practical! I have a several - differently priced - programs which are addressing the same audience. We can copy all the procedures and even windows from one program to the other, add some fields and voila! there is a proven and testeed part of the new program! To mask that from our customers and keep them from inadvertently copying the wrong files around, they have a different physical name on disk. Mostly using a prefix which points to the program. Like OurProgA_CUSTOMERS and OurProgB_CUSTOMERS.

However, all of this is part of the Analysis and I'd really miss it in case it wouldn't be there anymore! I cannot understand why PC Soft does not follow their own rules in the HF CC. If they did not want their users to have flexible file extensions and different physical names on disk why the hell did they introduce those features in the Analysis?