summaryrefslogtreecommitdiff
path: root/demos/blog-tutorial/protected/pages/Day2/CreateDB.page
diff options
context:
space:
mode:
authorxue <>2007-05-28 00:58:40 +0000
committerxue <>2007-05-28 00:58:40 +0000
commit82a351192f38cc73268ea7de7a48e2e0425d5cbf (patch)
tree2d91629f8e5c48bb1e26aef8f420d0e95b4f2bb9 /demos/blog-tutorial/protected/pages/Day2/CreateDB.page
parent87b0b5735f95afb8a59124e3007bd6e6d95d3e48 (diff)
Fixed a bug when using renderer in TWizard's sidebar.
Diffstat (limited to 'demos/blog-tutorial/protected/pages/Day2/CreateDB.page')
-rw-r--r--demos/blog-tutorial/protected/pages/Day2/CreateDB.page9
1 files changed, 3 insertions, 6 deletions
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
</com:TTextHighlighter>
<com:NoteBox>
-SQLite does not support <a href="http://www.sqlite.org/omitted.html">foreign key constraint</a> such that
-the constraints can still be defined but will be ignored by SQLite.
-Therefore, we will write PHP code to ensure that the <tt>posts.author_id</tt> field contains valid data.
-Also, we are exploiting the fact that the <tt>posts.post_id</tt> field is <a href="http://www.sqlite.org/autoinc.html">auto-incremental</a> if we assign NULL to it.
+The <tt>fk_author</tt> constraint is ignored by SQLite because SQLite does not support <a href="http://www.sqlite.org/omitted.html">foreign key constraint</a>. 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 <tt>posts.post_id</tt> field is <a href="http://www.sqlite.org/autoinc.html">auto-incremental</a> if we assign NULL to it.
</com:NoteBox>
<p>