PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WX19] HSQL links not correctly updated in client-server mode
[WX19] HSQL links not correctly updated in client-server mode
Débuté par Piet van Zanten, 18 nov. 2014 19:06 - 15 réponses
Posté le 18 novembre 2014 - 19:06
Hi,

I found that links between two files of which one of them has been removed from the analysis and also has been physically removed still remain in the list of links on the server. Thus generating an integrity error.
So be warned if you get integrity errors that do not seem to make sense!.
Look for an obsolete integrity rule in the Control Centre and delete it manually.

I have several databases based on the same analysis and found substantial differences between the lists of integrity rules for each database.
Looking into this I found that a synchronization of the structure of a HFSQL database only creates the links on the HFSQL server of files that have already been created.
If that is normal behaviour (which I find strange behaviour) then you should always create ALL FILES in your database BEFORE doing a structure synchronization. Otherwise you may need to do end up with no integrity rules at all!

Regards,
Piet
Posté le 18 novembre 2014 - 19:28
Hi Piet,

this is an old error, I'm sick to find and point out unfixed problems to PC Soft again and again.

However. After any changes to HFSQL databases which do an add / remove / change of links, you can use the HF Control Center to inspect the results and manually delete superfluous links which inevitably will result in integrity errors out of the blue. New files (= those which cannot be found in the database by HFileExist(..) ) have always to be initialized by using HCreation(filename), it's the only command which allows to create the links in the best manner. Imho, HCreationIfNotFound(..) is much slower than HCreation(..) and cannot deal with several difficult situations.
Posté le 18 novembre 2014 - 20:44
Hi guys,

We ran into problems with links in version 19, especially because we use HModifyStructure() and that the command does not update the links. We sent reports on this and a suggestion went in to create a kind of HModifyLinks() function so to be able to properly update all links in a database. (I would not be surprised to see it next year.)

As Guenter said, HCreate is the official and conservative way to recreate the links. You (1) move the DB folder somewhere else, (2) create the DB again, (3) copy over all the FIC, NDX, MMO, FTX files (only) over the newly created DB. (You must start and stop the DB service between copy operations.)

But we use a simpler and faster way on client sites, and quite a radical one (the free tech support discouraged us to do so, so I'm not encouraging anyone to do so, but for us it work quite well). We simply (1) stop the database server, (2) go in the database folder and (3) delete both the __system and __internal hidden folders of the specific database which is problematic. Then (4) we restart the server, and our application, and «Voilà!» Fixed, with well-working integrity checks.

That being said, we always make a backup first, just in case, but we never had problems. (While waiting for an official solution from PCSoft we plan to make a service application on the server to remotely ask it to do all that automatically for a specific DB after an update has been made. It would be called from our personalized server setup (WDSETUP) and could be called manually from our application for a given DB.)

Best regards,
Alexandre Leclerc
Posté le 18 novembre 2014 - 21:18
Alexandre,
don't you need a (5) run wdmodfic once, to recreate the links?
I afaik the links are stored in the __System\Integrity file of each database
Posté le 18 novembre 2014 - 22:28
Hi Arie,

There are no missing steps. No wdmodfic required. It work all the time. You can try in a test DB if you want (making a backup, etc). It does work very well for us.

We had issues where the software analysis had proper integrity links but the database no. So deleting these folders (only in the .\DB\YOURDBNAME\__*, not the .\DB\__* ones) is kind of flushing the cache and it's rebuilt properly afterward when the software is started again.

I don't know how and when, but for us (and maybe the way we coded our applications?) it's working very well. If you test with success for one of your project, tell me.

Best regards,
Alexandre Leclerc
Posté le 19 novembre 2014 - 09:14
Well, I just gave it a try but I must be missing something.
The system-map is recreated by de hf-engine, but with empty files (integrity, trigger and so on). You can even open them i.e. with WDMAP.
Also the correpsonding pages in hf-controlcentre do not show any links.
I tried reindexing from the controlcentre and reindexing from my application. No go.
Only after a wdmodfic the links were back again. Maybe you use HModifyStructure in the startup of your application?
Posté le 19 novembre 2014 - 15:03
Hi Arie,

I pushed my tests and you are absolutely right. One must execute at least once wdmodfic so that the integrity links be recreated aright again.

Thank you for the test you did on your side, it helped me understand the whole thing. I'll be able to better fix the link problems when they come again.

Best regards,
Alexandre Leclerc
Posté le 19 novembre 2014 - 15:51
Hi,

Well, let's all request some "new" features:
In HFSQL Control Centre there should be an option to supply an analysis (just as when importing a "Classic" database) when creating a new database. That should take care of the links, even if files are not yet created.
The same option should be available by programming.
Regards,
Piet
Posté le 19 novembre 2014 - 16:09
Hi Piet,
there are HLink functions already
HAddLink, HDeleteLink and HListLink
Never used them but useable for (re)creating links by programming?
Posté le 19 novembre 2014 - 16:14
Hi Piet,

Hmm. I donnot really get what you mean. I made that in my application and thus far it work great. I made some changes lately and things need be tested but so far it can be done

In my app new connections can be made. Its an accouting app where a connection stands for a new administration. It creates and updates everythingjust fine

regards

Allard
Posté le 19 novembre 2014 - 16:19
Hi Arie,

these functions are useful indeed - e.g. when creating / accessing a file system without using an analysis or accessing a foreign database. Note: added links using HAddLink(...) will not be shown in the analysis but show up physically in the HF Control Center. It's exactly the situation we want to avoid here: having links on the database system which stay undocumented in the analysis.
Posté le 19 novembre 2014 - 16:32
Guenter,
I agree with that.
But I thought HListLink could be used to read the links from our analysis file.
And then we can recreate them in the database with HDeleteLink and HAddLink
Posté le 19 novembre 2014 - 16:57
Hi Arie,

HlistLink(...) lists the links of a file in the analysis only. Unfortunatley, it does not list the physical file links as shown in HF Control Center. However, while HListLink(...) works on the analysis only, HDeleteLink(...) can be used to delete physical links, not shown / documented in the analysis. Theoretically, one could remove all of the physical links of a database using HListFile(...) / HDeleteLink(...) and let them recreate - according to the analysis - by using WDMODFIC. Imho this is nice but only a workaround for the not so fine working mechanism in the Analysis Editor.
Posté le 19 novembre 2014 - 17:38
Hi Guenter,

I tried to make my own HModifyLinks() procedure some months ago... but with no success because of HListLink(). But I just saw that there is an example on how to delete all links from a database without considering the analysis (second syntax of HListLink). <a class="ExternalLink" rel="nofollow" target="_blank" href="http://doc.windev.com/en-US/?3044314">http://doc.windev.com/en-US/&hellip;</a>

So one would be able to get the existing links from the DB, compare with the analysis, and add/remove them manually.

I don't know why I did not see that some months back, but it would be possible according to the doc. I'll have to give that it a try.

Best regards,
Alexandre Leclerc
Posté le 19 novembre 2014 - 17:53
Hi Alexandre,

oh you are right!! The second syntax lists all of the links of the phyiscal HF database. Now, it should be possible to HListLink(..) the links with the first syntax too and compare both sets of links! When finding differences, one could delete / add links according to the analysis and voila, analysis and database would be identical. Without using WDMODFIC and without doing any manual compare operation. That looks promising indeed!
Posté le 20 novembre 2014 - 11:03
Hi Alexandre and Guenter and all the others,

I tried the HDeleteLink() path a couple of months ago.
After some emails to PCSofts support I finally gave up, since it didn't work here ...
When I moved to v19 I did some furher investigation.
Here is what I found:

The HDeleteLink function works fine (as far back as v17), except for ONE case ....
For some reason - I don't know why and when - I had a link that was between 2 files in 2 different databases !!!!
This database - a test database - came from v15 and a LOT of HDModfics was used against it. So sometime something went wrong and the links got mixed up ...

In this situation, you can't delete these links, because you don't have the info to describe them for HDeleteLink ...
HDeleteLink will not access/delete this kind of links (between 2 databases) without giving it FULL information for the links.

I have asked PCSoft for a function that "wipes out" all links for a database, without a lot of questions <img src="/NG2013_WEB/ui/smiley/1.gif" align=absmiddle border=0 alt=":)">