Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
9
Erster Beitrag:
vor 1 Jahr, 11 Monaten
Letzter Beitrag:
vor 1 Jahr, 4 Monaten
Beteiligte Autoren:
GuenterP, Curtis, Peter Hite, Fabrice Harari

[WD20] App with Client/Server HFSQL and Local HFSQL

Startbeitrag von Curtis am 08.12.2015 16:08

I have an app that uses client/server data, but I have one file, config, that is a local file. Config is classic HFSQL. When I generate an executable the config files get built on the server for some reason. In the description of the data file the type is HFSQL classic, the connection is none, and the default directory is . I have tried using the connection code below and I have tried with no connection code. I have also tried setting the LocalData..Server setting to many local paths with no luck.


LocalData is connection
LocalData..Provider = hAccessHF7
IF NOT HOpenConnection(LocalData) THEN
Error(HErrorInfo())
ELSE
// Open and connect Config table
HChangeConnection("Config", LocalData)
// Update the structure of Config file if neccessary
HModifyStructure("Config",hmsBackgroundTask)
END

Antworten:

Hi Curtis, the most convenient way to have a local config file is to keep it simple and use an .ini file for that purpose. Reading and even writing an .ini file is even possible in \Programs or \Programs (x86) which is done by WDSETUP too (see the .wx file there, in fact, it is an .ini file with different name). However, a good place for a config.ini is the \ProgramData\YourCompanyName\YourAppName directory defined by fGlobalDirCommon() which takes care of a different drive character too. So, I'd recommend to remove the config.dat from the analysis ... a simple config.ini points the application to the correct HF Classic or HFSQL C/S connection.

von GuenterP - am 08.12.2015 16:28
I would rather use a classic HFSQL file because an .ini would be too easy for the end user to modify.

von Curtis - am 08.12.2015 16:53
Hello Curtis,

your code is okay, but you are missing the hchangerep that you NEED to use at the end to tell the system WHERE the hf classic file is situated

Best regards

von Fabrice Harari - am 08.12.2015 17:41
Hi Curtis, this is easy: just encrypt the .INI entries!

MyPathToHFClassic = MyINIFileDirectory+"\DATA"
IF NOT INIWrite(MyComputerName,"CD",Crypt(MyPathToHFClassic,MyCompanyName,cryptRC516,encodePCS),MyINIFileDirAndName) THEN
Error("Error on Writing MyProgram.INI - line CD")
EndProgram()
END

Decryption wil go like

MyPathToHFClassic = INIRead(MyComputerName,"CD","Not found",MyINIFileDirAndName)
IF MyPathToHFClassic = "Not found" THEN
Error("HF Classic: the parameter *Path to HF-Classic* could not be read from MyProgram.INI !","Configure the MyProgram.INI for this computer !")
END
MyPathToHFClassic = Uncrypt(MyPathToHFClassic,MyCompanyName,cryptRC516,encodePCS)

a real .INI file would look like

[MyComputerName]
GW=+qPuXA
HF=/pxhB+BWRA
CD=54VjtejsG85qUijKBW/KoHglLg //

von GuenterP - am 08.12.2015 18:25
Hi,

I am having the exact same problem. In my analysis in the Info Tab, the "Default directory of the data file" is . This would be perfect except that it is created on the server, not in the application directory. I am using WD21. I can find no information on hchangerep.

Thanks!

von Peter Hite - am 23.06.2016 02:34
Hi Peter, as a rule of thumb: in the analysis, do not define any other directory than the < application directory >. Use an .INI file to open the files either in C/S Mode or in Classic (hf7) Mode and switch if needed (mostly in Classic) to the proper drive / directory.

In regards to the REP-file business: my recommendation: switch it off! The problem with REP files is that they will remember all of the file locations on/to your development computer. Whenever you're keeping several different data sets of different revision levels of the same application name on the same disk, any changes to the analysis will be applied to ALL of these data sets! All working programs (with older revision levels) will be rendered useless because they don't know of the new structure of one or more files which you changed during developing. Even on the customer's site the REP files could change different sets of data in the network ... so, in order to keep control switch REP file management off.

von GuenterP - am 23.06.2016 05:21
Thanks, but I'm not sure I understand. I want the analysis to work like it is supposed to work. In my analysis I have yellow C/S tables (files) and red local/classic tables defined. The Red tables default directory of the data files is in the "application directory". Why should I have to do anything - does the program not know where the application directory is ? - do I need to define that somewhere? So, to be clear, the Red tables are being created like the C/S tables - on the server, not locally as requested. If this is a bug I need to report it.

von Peter Hite - am 23.06.2016 12:30
Hi Peter, the real problems will come up when deploying the application. The files will take "their directory" via the setup file to your customers and mostly they don't have the same configuration and directories there like you have during development. Even in case you only have a single customer and develop for them - when moving around with computers the "old" directory will re-appear like the ghost of Hamlet's father and files in that (now unknown) directory want to be restructured or are "not found". Things become even worse with REP-files. They remember the old configuration and in the worst cases they will even find and mess up files stored for a backup together with older or different version of your program on the same disk. One learns a lot of caveats while using WINDEV for 16 years ...

von GuenterP - am 23.06.2016 18:39
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.