|
| [WD20] App with Client/Server HFSQL and Local HFSQL |
| Iniciado por guest, 08,dic. 2015 17:08 - 5 respuestas |
| |
| | | |
|
| |
| Publicado el 08,diciembre 2015 - 17: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 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2015 - 17:28 |
| 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. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2015 - 17:53 |
| I would rather use a classic HFSQL file because an .ini would be too easy for the end user to modify. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2015 - 18:41 |
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 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2015 - 19:25 |
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 //<<== this one ("CD") we encrypted / decrypted here! SV=cPXE PW=cPXE AN=Y/syUbw AP=FHz13F386w SP=NVL17fRgTxIIEEV80NRe DB=cncbuFvFocu6/TA
Now, let them try ... |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,enero 2016 - 16:17 |
I would tend not to use a file with an extension of .ini as it will cause issues with Windows.
I do something similar to what you are trying to achieve. In my case I store the data directory of the common data files in a text file called local.dat which itself is stored locally. On startup I check and read this file. If the location no longer exists then I revert the data files back to the local drive (in my case 'startdirectory' as below). This saves crashes and errors being reported.
startdirectory = CompleteDir(fCurrentDir()) IF sCurrentwindowsversion ="VISTA" OR sCurrentwindowsversion = "7" OR sCurrentwindowsversion = "8" OR sCurrentwindowsversion = "10" THEN startdirectory=CompleteDir(fDataDirCommon()) END lookfor = startdirectory+"local.dat"
I then read the contents of the file to give me the location of the data files and then do a Hchangedir for all my data files to that directory. I can even have local and shared files as a result if I please.
If the wheel comes off I can use Notepad to alter the contents of the local file manually. |
| |
| |
| | | |
|
| | | | |
| | |
|