Tim Romano wrote:
> 
> You should keep your id and the imdbid in separate columns, because you 
> can then insert a title even if IMDB does not have it yet.
> 

Ok, I have thought about this and it will be probably simpler to have two
separated ids than using a trigger.
Now, there are some problems:

When I grab the movie info from imdb there is some data that goes in the
movie table that is grabbed after than for example the actors. the insert on
the table movies happens at the end.
I guess there is no option than changing the application to insert the movie
first but there is still another problem...

I have this tables:
CREATE TABLE movies(id integer,imb_id integer,title
text,unique(imdb_id),PRIMARY KEY (id))
CREATE TABLE directors(id integer,name_id integer,unique(id,name_id))
CREATE TABLE names(name_id integer,name text,bio
text,unique(imdb_name_id),PRIMARY KEY (name_id))

The table movies holds info about movies and the table names holds info
about persons, the table directors relate both tables.

The problem is that to insert something in the table directors I must use
last_insert_rowid() after inserting the movie to get the rowid of the movie
but I also need the rowid for the director.
If I insert in names first I can't get the movie id and vice-versa.

I need something like: last_insert_rowid(movies) and
last_insert_rowid(names)

Any idea on how to solve this problem?
-- 
View this message in context: 
http://old.nabble.com/rowid-of-the-current-insert-tp26725353p26779934.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to