Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 1 Jahr, 8 Monaten
Letzter Beitrag:
vor 6 Monaten, 2 Wochen
Beteiligte Autoren:
Piet van Zanten, Allard, GuenterP, Joris, Paulo Oliveira

[WX19] HFSQL creates File Links to different database

Startbeitrag von Piet van Zanten am 29.03.2016 11:52

Hi,

When I perform an update of the analysis to several databases the Wizard shows some links from a file in one database to a file in a different database.
I do the update from my development machine to a remote server using "synchronize structure and data deployed" from the analysis pane.
Obviously this is not what I want and I don't understand where this incorrect info comes from.
I discovered several such faulty links in the HFSQL Control Center and deleted them.
But if I try to recreate these links they don't show up in the wizard or still point to to the wrong database.
How can I prevent WX from creating incorrect links and create the correct link (files in the same database) instead?

Regards,
Piet

Antworten:

Normally the problem is in the REP file

http://doc.windev.com/en-US/?3044186

von Paulo Oliveira - am 29.03.2016 13:08
Hi Piet,

We have had the same problem using the automatic hyperfile modification in the setup procedure.
Since then we use the HModifyStructure command in our code. HCreationIfNotFound should create your new links.
I also disabled the REP file => HSetRep(false)

To re create all links of a database you can use WDMODFIC.EXE but you should only select one database at the time.
I have a small procedure in our project from where i can first delete all links and then re-create them again. See below...


LsLinks is string = HListLink("*",G_MF_HFCS)
LsLink is string
MyLink is Link Description

//Delete links...
LiMax is int = StringCount(LsLinks,CR) + 1
FOR i = 1 _TO_ LiMax
LsLink = ExtractString(LsLinks,i,CR)
IF ExtractString(LsLink,1,TAB) "" THEN DeleteLink(G_MF_HFCS,G_MF_HFCS,ExtractString(LsLink,1,TAB))
END

LsLinks = HListLink("*","","",hLstDetail)

//Create links...
LiMax = StringCount(LsLinks,CR) + 1
FOR i = 1 _TO_ LiMax
LsLink = ExtractString(LsLinks,i,CR)
MyLink..Name = ExtractString(LsLink,1,TAB)
MyLink..SourceFile = ExtractString(LsLink,2,TAB)
MyLink..SourceKey = ExtractString(LsLink,3,TAB)
MyLink..MinSourceCardinality = ExtractString(ExtractString(LsLink,4,TAB),1,",")
MyLink..MaxSourceCardinality = hInfiniteCardinality
IF ExtractString(ExtractString(LsLink,4,TAB),2,",") "N" THEN MyLink..MaxSourceCardinality = ExtractString(ExtractString(LsLink,4,TAB),2,",")
MyLink..LinkedFile = ExtractString(LsLink,5,TAB)
MyLink..LinkedKey = ExtractString(LsLink,6,TAB)
MyLink..MinLinkedCardinality = ExtractString(ExtractString(LsLink,7,TAB),1,",")
MyLink..MaxLinkedCardinality = ExtractString(ExtractString(LsLink,7,TAB),2,",")
MyLink..ModificationRule = ExtractString(LsLink,8,TAB)
MyLink..DeletionRule = ExtractString(LsLink,9,TAB)
HAddLink(G_MF_HFCS,G_MF_HFCS,MyLink)
END

Info("Links zijn hersteld...")





Kind regards

Joris

von Joris - am 29.03.2016 13:23
Hi Paulo and Joris,

Thanks for the info.
My .rep files only contain the analysis guid, so I still have no idea why this happens.
Perhaps checking more than one database is the culprit.
I used WDmodfic as Joris suggested, one db at the time, and that fixed the problem.

Joris, bedankt voor de code ik ga inderdaad maar een programmaatje schrijven want telkens op elke db inloggen is zonde van de tijd.

Best regards,
Piet

von Piet van Zanten - am 29.03.2016 14:03
Hi, here are just my 2 cents for that matter ...

1 - never ever use the .REP file management! It can wreak havoc on all of the HFSQL Classic databases with the same structure on your development computer! You just wanted to change / update a single database during development and inadvertantly you find yourself confronted with a bunch of programs not working anymore - the file structures have been changed behind your back! Of course, one can prevent that type of scenario by clean and thoughtful development work but it's not worth your time, believe me. Just switch .REP file management off! Find / know your Classic files by using an .INI file and the function HListFile(..)

2 - For HFSQL C/S Links in a big analysis have been a problem in the past indeed. I don't know yet whether that's still true for v20 and v21, but I'm not willing to use our customers as guinea pigs for seeing whether all of the links where deleted, changed and added properly. So, Joris' example of handling the links in the restructuring process is great!

However, if there's something really weird going on with your HFSQL C/S database then use the HF Control Center and check the List of Links there, compare it to your analysis. It may be that you can find links which shouldn't be there anymore or that new links have not been added. You can delete / change / add Links in the HF Control Center. Again, I don't know whether that's been fixed in v20 & v21 or not. In v19 the problem definitely had been there.

I have yet to test HModifyStructure(..) of the latest versions (20 + 21) for reliably adding / deleting / changing Links. Which it did not do before. Up to v19 the file structure has been modified dependably in all cases but not the Links. Not always at least.

3 - With HModifyStructure(..) the age-old riddle "is the datafile newer or older in structure than the analysis?" has been solved finally. HModifyStructure(..) issues error #70306 and will not work at all. Seems to works just fine.

Note: in the Help it says that the corresponding error for WINDEV 5.5 is # 306. Don't believe it. In WD 55 there's no such command as HModifyStructure and WDMODFIC will endlessly try to restructure the database - there's no such error issued in WD 55.

4 - In the past, it helped a lot to retrieve the names of the datafiles of an analysis by using HListFile(..) and then to HOpen(..) the datafiles one by one instead of using HCreationIfNotFound("*"). HOpen(..) is much faster than HCreationIfNotFound(..) and can detect missing datafiles which you can create by HCreation(..) anyway. In all cases, HOpen(..) returns the broader spectrum of errors.

von GuenterP - am 29.03.2016 15:33
Hi Guenter,

At the present I only use Webdev, so I'm happy to have total control over the data and I never bothered using WDmodfic since I could do it all from my development machine on the analysis pane.
Even though it was a pain because the connections I used sometimes were forgotten by the wizard.
(well we all know that the old white-bearded guys sometimes forget to do their magic, due to old age)
So doing it by code is by far the most efficient and now it seems also the most reliable way.
BTW:
I have set hSetRep to false for as long as I remember (Windev 5) and .rep management has become obsolete since HFSQL became available. (Checked my WB code and yes: hSetRep(False) is still there!
I neither use hCreation nor hCreationIfNotFound, as there is no need for it in HFSQL, since you can use the project description to automatically create files when opened. (which probably triggers hCreationIfNotFound ;-))
Comparing links in the Control Center is not an option, that would just give me a headache for so many links and databases.

Kind regards,
Piet

von Piet van Zanten - am 29.03.2016 21:06
Hi all

Switching the analysis initial connection to CS form hyperfile did it all!!

von Allard - am 31.05.2017 15:12
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.