From 82a351192f38cc73268ea7de7a48e2e0425d5cbf Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 28 May 2007 00:58:40 +0000 Subject: Fixed a bug when using renderer in TWizard's sidebar. --- demos/blog-tutorial/protected/pages/Day2/CreateDB.page | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'demos/blog-tutorial/protected/pages/Day2') diff --git a/demos/blog-tutorial/protected/pages/Day2/CreateDB.page b/demos/blog-tutorial/protected/pages/Day2/CreateDB.page index de4e2436..7c914962 100644 --- a/demos/blog-tutorial/protected/pages/Day2/CreateDB.page +++ b/demos/blog-tutorial/protected/pages/Day2/CreateDB.page @@ -30,8 +30,8 @@ CREATE TABLE users ( /* create posts table */ CREATE TABLE posts ( post_id INTEGER NOT NULL PRIMARY KEY, - author_id VARCHAR(128) NOT NULL - CONSTRAINT fk_author REFERENCES users(username), + author_id VARCHAR(128) NOT NULL + CONSTRAINT fk_author REFERENCES users(username), create_time INTEGER NOT NULL, /* UNIX timestamp */ title VARCHAR(256) NOT NULL, /* title of the post */ content TEXT, /* post body */ @@ -45,10 +45,7 @@ INSERT INTO posts VALUES (NULL, 'admin', 1175708482, 'first post', 'this is my f -SQLite does not support foreign key constraint such that -the constraints can still be defined but will be ignored by SQLite. -Therefore, we will write PHP code to ensure that the posts.author_id field contains valid data. -Also, we are exploiting the fact that the posts.post_id field is auto-incremental if we assign NULL to it. +The fk_author constraint is ignored by SQLite because SQLite does not support foreign key constraint. Nevertheless, we still keep the constraint there for the capability of porting our blog system to different DBMS. Also, in the above we are exploiting the fact that the posts.post_id field is auto-incremental if we assign NULL to it.

-- cgit v1.2.3