Link error

Joakim Schramm joakim at astrocalc.com
Tue May 23 22:22:32 CDT 2006


Hi Ruslan, 

> -----Original Message-----
> From: valentina-bounces at lists.macserve.net 
> [mailto:valentina-bounces at lists.macserve.net] On Behalf Of 
> Ruslan Zasukhin
> Sent: 23 May 2006 22:04
> To: valentina at lists.macserve.net
> Subject: Re: Link error
> 
> On 5/23/06 10:20 PM, "Joakim Schramm" <joakim at astrocalc.com> wrote:
> 
> Hi Joakim,
> 
> > I think I have tracked down what this is now, it's the 
> compacting of 
> > dbs that breakes binary links. Not all though for some still works.
> > 
> > I started all over again, removed a field and reindexed the 
> dbs untill 
> > all unneeded fields was removed. The database works fine 
> ine my code. 
> > Diagnose also is fine.
> > 
> > I Compact database, run diagnose and get error as below, also same 
> > error when running my code. So you need to look at compact code, it 
> > seem to be a link slauther now.
> > 
> > Please let me know if you need any structure and link data 
> if this is 
> > a speacial case with my dbs.
> 
> Aha, 
> 
> what kinds of links do you use ?
> 
I use 3 binary links and 1 ObjectPtr, here is complete structure from my
little program that creates and populates database.

Private Sub CreateStructure()
Dim mTblCountry As VTable
'Dim mTblCountryAlias As VTable
Dim mTblZones As VTable
Dim mTblPlaces As VTable
Dim mTblZoneData As VTable
Dim blink As VLink

Set mTblCountry = mDatabase.CreateTable(tblCountry)

With mTblCountry
    .CreateVarCharField "Name_en", 200, fIndexed
    .CreateVarCharField "Name_es", 200, fIndexed
    .CreateVarCharField "Name_se", 200, fIndexed
    .CreateVarCharField "Name_de", 200, fIndexed
    .CreateVarCharField "Name_no", 200, fIndexed
    .CreateVarCharField "CID", 12, fIndexed <-- REMOVED WHEN ALL LINKING IS
DONE
End With

'Not in use
'Set mTblCountryAlias = mDatabase.CreateTable(tblCountryAlias)
'
'With mTblCountryAlias
'    .CreateVarCharField "CName", 200, fIndexed
'    .CreateVarCharField "CID", 12, fIndexed
'    .CreateObjectPtrField ptrCountryAlias, mTblCountry, kCascade +
kRestrict, , ptrCountryAlias
'End With

Set mTblZones = mDatabase.CreateTable(tblTimeZones)

With mTblZones
    .CreateVarCharField "FK_CID", 12, fIndexed <-- REMOVED WHEN ALL LINKING
IS DONE
    .CreateShortField "ZID"
End With

Set mTblPlaces = mDatabase.CreateTable(tblPlaces)

With mTblPlaces
    .CreateVarCharField "PName", 200, fIndexed
    .CreateByteField "LongDeg", fIndexed
    .CreateByteField "LongMin"
    .CreateByteField "LongSec"
    .CreateByteField "LongSign", fIndexed '0 = West, 1 = East
    .CreateByteField "LatDeg", fIndexed
    .CreateByteField "LatMin"
    .CreateByteField "LatSec"
    .CreateByteField "LatSign", fIndexed '0 = South, 1 = North
    .CreateVarCharField "FK_CID", 12, fIndexed <-- REMOVED WHEN ALL LINKING
IS DONE
    .CreateShortField "FK_ZID", fIndexed <-- REMOVED WHEN ALL LINKING IS
DONE
    .CreateBooleanField "CustRec"
   Set fldZonePtr = .CreateObjectPtrField(ptrZonePlaces, mTblZones,
kCascade, , ptrZonePlaces)
End With

Set mTblZoneData = mDatabase.CreateTable(tblZoneData)

With mTblZoneData
    .CreateDateTimeField "DateChange", fIndexed
    .CreateVarCharField "TimeDiff", 24, fNone
    .CreateVarCharField "FK_CID", 12, fIndexed <-- REMOVED WHEN ALL LINKING
IS DONE
    .CreateShortField "FK_ZID", fIndexed <-- REMOVED WHEN ALL LINKING IS
DONE
End With

End Sub

Sub CreateLinks()
Dim mTblCountry As VTable
Dim mTblPlaces As VTable
Dim mTblZoneData As VTable
Dim mTblZones As VTable
Dim blink As VLink

' get table references
Set mTblCountry = mDatabase.Table(tblCountry)
Set mTblZones = mDatabase.Table(tblTimeZones)
Set mTblPlaces = mDatabase.Table(tblPlaces)
Set mTblZoneData = mDatabase.Table(tblZoneData)
' create BINARY LINK between 2 tables.

Set blink = mDatabase.CreateBinaryLink(lnkCountryHasPlaces, mTblCountry,
mTblPlaces, EVLinkType.kOne, EVLinkType.kMany)
Set blink = mDatabase.CreateBinaryLink(lnkCountryHasZones, mTblCountry,
mTblZones, EVLinkType.kOne, EVLinkType.kMany)
Set blink = mDatabase.CreateBinaryLink(lnkZoneHasData, mTblZones,
mTblZoneData, EVLinkType.kOne, EVLinkType.kMany)
End Sub

It is the last link that seem to get into trouble after Compact. If you need
further info on how the whole thing is populated and linked please let me
know. I will be out most of the day tomorrow but back in the evening.

Just a short explaination of how it works, each recPlace has an ObjectPtr to
a record in tblTimeZones. This TimeZones record has several links to records
in TimeZoneData. This ObjectPtr is so Place knows from were to pull
TimeZoneData, via TimeZone binary link. It is this structure Compact breaks
in some way.

I hope this helps. I am still here for an hours or so btw.

Joakim
> --
> Best regards,
> 
> Ruslan Zasukhin
> VP Engineering and New Technology
> Paradigma Software, Inc
> 
> Valentina - Joining Worlds of Information http://www.paradigmasoft.com
> 
> [I feel the need: the need for speed]
> 
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
> 



More information about the Valentina mailing list