Foreign Key links - "Restrict is specified" error
Dave Addey
listmail1 at dsl.pipex.com
Tue Dec 13 13:31:13 CST 2005
Hi all,
I¹m trying to get a Foreign Key link to work, to link together a list of
Tracks and a list of Playlists (read in from iTunes). But I¹m having some
problems. Here¹s the background.
I¹m reading in the iTunes XML library. I get the Tracks first, then the
Playlists, with each of their PlaylistTracks (showing how tracks are used in
a playlist).
Each Track has a unique integer ID, and so does each Playlist. I have a
third table, ³vPlaylistTracks², which links Playlists and Tracks together.
In the constructor of both my vTracks table and my vPlaylists I have a call
to create the UniqueID:
UniqueID = New VULong("UniqueID", EVFlag.fUnique + EVFlag.fIndexed)
(Both tables have a property called ³UniqueID as VULong²)
In my joining table, I have:
Name = "PlaylistTracks"
PlaylistUniqueIDPtr = New VULong("PlaylistUniqueIDPtr", EVFlag.fIndexed +
EVFlag.fNullable)
TrackUniqueIDPtr = New VULong("TrackUniqueIDPtr", EVFlag.fIndexed +
EVFlag.fNullable)
In my Database constructor, I have:
VDatabase(EVStorageType.kDefault)
vTracks = New vTracksTable
vPlaylists = New vPlaylistsTable
vPlaylistTracks = New vPlaylistTracksTable
vPT_PlaylistUniqueIDLink = CreateForeignKeyLink("PT_PlaylistUniqueIDLink",
vPlaylists.UniqueID, vPlaylistTracks.PlaylistUniqueIDPtr,
EVOnDelete.kSetNull, EVOnUpdate.kCascade, false)
vPT_TrackUniqueIDLink = CreateForeignKeyLink("PT_TrackUniqueIDLink",
vTracks.UniqueID, vPlaylistTracks.TrackUniqueIDPtr, EVOnDelete.kSetNull,
EVOnUpdate.kCascade, false)
I can add Tracks and Playlists to their tables with no problems. But when I
try and add a PlaylistTrack to the vPlaylistTracks table, I get an error.
Here¹s what I am doing:
Dim newRecID as integer
LibraryDB3.vPlaylistTracks.SetBlank(EVValueAccess.forAdd)
LibraryDB3.vPlaylistTracks.PlaylistUniqueIDPtr.Value = inPlaylistID
LibraryDB3.vPlaylistTracks.TrackUniqueIDPtr.Value = inTrackID
newRecID = LibraryDB3.vPlaylistTracks.AddRecord
The AddRecord call raises a Vexception error:
³Restrict is specified. Dropping is un available till constraints exist.²
What does this error mean? What have I done wrong?
Dave.
More information about the Valentina
mailing list