Integrity and C/S HFSQL

Startbeitrag von Steven Sitas am 25.03.2014 08:48

Hi,
If I got it right, the only difference between a Classic HF database and a C/S HF database is the "handling" of INTEGRITY.

(1) In Classic mode, the integrity rules are somewhere INSIDE the file/table structure and that's why HModifyStructure can change/update the integrity rules.

(2) In C/S mode, the integrity rules are described by info residing in the file "mydatabase\_system\Integrity.fic"
Some observations for C/S:
(I) HCreationIfNotFound() CREATES the above links/integrity rules (for this table) IF the file/table is NOT found (probably the first time you run the app against a Database).
(II) HModifyStructure cannot update the integrity rules, in a C/S HF database.
(III) Only WDMODFIC can do the above

So is there a way - by programming - to TOTALLY delete integrity.fic and recreate it from info that resides in my analysis ???

I know I can use HDescribeLink and so on, but I am looking for a more automatic way of doing things ...

Steven Sitas

Antworten:

Hi Steven,

I think you are generally correct.

I use this code :

G_MF_HFCS is Connection
...
...

IF G_MF_HFCS..Database = "" THEN
Error("This runs only for C/S databases!")
RETURN
END

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

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

//Create them back...
LsLinks = HListLink("*","","",hLstDetail)
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


von Joris - am 25.03.2014 09:53
Hi Joris and thank you very much !!!!

If I understand things correctly, I must do the following in a C/S application:

1. If the data structure (not links) has changed I can use HModifyStructure to update my database AND my other users DON'T have to exit the app. WD will "catch" this with an error ....

2. Since there is NO way my application can AUTOMATICALLY check for differences between my Links(Integrity) in my Analysis and my C/S database, I should do it manually.
So that would be (at the beginning of my app):
(I) Check to see if there are differences between Analysis and the C/S Integrity file, using your type of code.
(II) If there are differences, I recreate the integrity file with your code, then CLOSE my app (or close and re open my connection).
(III) I must "enforce" my other users, to also close and reopen their apps

Does this look OK?

Steven Sitas

von Steven Sitas - am 25.03.2014 10:16
Hi Steven,

I'm not 100% sure because we use the 'automatic modification of data files' in the the setup created by WinDev.

Indeed it seems that HModifystructure does not update the integrity constraints
Indeed there does not seem to exist a command to check if the integrity rules on the server are ok
(That is why I created this procedure to clean and re-create all integrity rules.)

I don't think that other users must restart the application because of changes in the integrity rules.

Kind regards,
Joris

von Joris - am 25.03.2014 13:50
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.