lundi 4 avril 2016

Db browser for SQLite allows violate primary key

Good day time,

The situation is as fallows I have created a SQLite database using C# with the fallowing 2 queries:

string sql = "create table program(ProgramID varchar(10) PRIMARY KEY,name varchar(30))";
string sql = "create table Course(CourseID INTEGER PRIMARY KEY,name varchar(30),ProgramID varchar(10),Year int,FOREIGN KEY(ProgramID)REFERENCES program(ProgramID))";

Then using DB Browser for SQLite I inserted into firstly, to table "program" 2 record as fallows:

insert into program (ProgramID,name) values("1111","any");
insert into program (ProgramID,name) values("1112","any");

and when I started to add to table "course" it allowed me to add any value for "FK ProgramID".

I have made a research on it and came out with the fallowing:

Unfortunately, if a user edits the database using an external tool or if there is a bug in an application, rows might be inserted into the track table that do not correspond to any row in the artist table

on the fallowing website: http://ift.tt/1eCkxPY

So my question is, am I right supposing that because I am using an "External tool" it does allow me to do it? if not why does it do it? If yes will it not allow to do it later on when I insert records with C# application?I have double checked all the relationship in the Database and it is fine as well C# would through me an exception if something would be wrong during creation I assume.

Thank you.

Aucun commentaire:

Enregistrer un commentaire