On 12 Jun 2013, at 11:14am, dd <durga.d...@gmail.com> wrote:

> Yes Simon. I am looking for it. ON DELETE RESTRICT.
> 
> I got the answer.
> 
> Should I enable foreign key support to use on delete restrict?(
> http://www.sqlite.org/foreignkeys.html)

I think that that fits with your earlier description: it will make SQLite 
refuse to delete an author if they have books in the database.

> I have x databases without enabling foreign key support. Can I enable
> foreign key support for x+1 database only?

Turning on FOREIGN KEY support on a database that has no foreign keys does no 
harm.  It might slow some things down a millisecond perhaps.

However, if you have separate applications for separate databases then you can 
turn on FOREIGN KEY support just in your 'books’ application.  In that 
application, just execute the SQL command

PRAGMA foreign_keys = ON

before you open the database file.  Then everything will work as expected.

You must, of course, be using SQLite version 3.6.19 or later.

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

Reply via email to