neuron
21st January 2009, 18:41
I got two tables (actually, tons, but lets focus on these), this is their setup:
CREATE TABLE Content (id INTEGER NOT NULL PRIMARY KEY, title TEXT NOT NULL, released DATE, rating INTEGER, tagline TEXT,plot TEXT, ended DATE,status TEXT);
CREATE TABLE Url (id INTEGER NOT NULL PRIMARY KEY, contentId INTEGER NOT NULL REFERENCES Content (id), url TEXT NOT NULL, scraper TEXT);
Every content can have a list of url's connected to them. And I got an editwindow that shows all the data in content quite nicely, and then I wanted to add (using sql relations) url's to a view of it's own, that's where my problems come in.
Every example I can find uses a foreign key in the main table to referance a remote table, however I dont have that, it's a foreign key in the remote table linking back.
Is there any way to use sql relations to get a model of urls from the content model? Or will I have to setup a seperate url model?
CREATE TABLE Content (id INTEGER NOT NULL PRIMARY KEY, title TEXT NOT NULL, released DATE, rating INTEGER, tagline TEXT,plot TEXT, ended DATE,status TEXT);
CREATE TABLE Url (id INTEGER NOT NULL PRIMARY KEY, contentId INTEGER NOT NULL REFERENCES Content (id), url TEXT NOT NULL, scraper TEXT);
Every content can have a list of url's connected to them. And I got an editwindow that shows all the data in content quite nicely, and then I wanted to add (using sql relations) url's to a view of it's own, that's where my problems come in.
Every example I can find uses a foreign key in the main table to referance a remote table, however I dont have that, it's a foreign key in the remote table linking back.
Is there any way to use sql relations to get a model of urls from the content model? Or will I have to setup a seperate url model?