diff options
author | xue <> | 2007-04-03 21:43:22 +0000 |
---|---|---|
committer | xue <> | 2007-04-03 21:43:22 +0000 |
commit | 51db38c9423a1d3bf476bb30054cf3288ee16c88 (patch) | |
tree | 370665b0eb19070334b73e73e4080239b1a5c055 /demos/blog-tutorial/protected/pages/Day2 | |
parent | 03dbe16b7762cc1a9e57df4e9e34bc04f46bb57f (diff) |
Added blog-tutorial.
Diffstat (limited to 'demos/blog-tutorial/protected/pages/Day2')
-rw-r--r-- | demos/blog-tutorial/protected/pages/Day2/ConnectDB.page | 8 | ||||
-rw-r--r-- | demos/blog-tutorial/protected/pages/Day2/CreateDB.page | 46 | ||||
-rw-r--r-- | demos/blog-tutorial/protected/pages/Day2/ER.gif | bin | 0 -> 4896 bytes | |||
-rw-r--r-- | demos/blog-tutorial/protected/pages/Day2/ER.vsd | bin | 0 -> 73728 bytes |
4 files changed, 54 insertions, 0 deletions
diff --git a/demos/blog-tutorial/protected/pages/Day2/ConnectDB.page b/demos/blog-tutorial/protected/pages/Day2/ConnectDB.page new file mode 100644 index 00000000..26d8a751 --- /dev/null +++ b/demos/blog-tutorial/protected/pages/Day2/ConnectDB.page @@ -0,0 +1,8 @@ +<com:TContent ID="Main">
+
+<h1>Establishing DB Connection</h1>
+
+<p>
+</p>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/blog-tutorial/protected/pages/Day2/CreateDB.page b/demos/blog-tutorial/protected/pages/Day2/CreateDB.page new file mode 100644 index 00000000..04dd0d90 --- /dev/null +++ b/demos/blog-tutorial/protected/pages/Day2/CreateDB.page @@ -0,0 +1,46 @@ +<com:TContent ID="Main">
+
+<h1>Creating Database</h1>
+
+<p>
+Most Web applications use database to keep data. Our blog system is not an exception. In this section, we will describe how to write database-driven pages for our blog system. We will use techniques including <a href="http://www.pradosoft.com/demos/quickstart/?page=Database.DAO">database access object (DAO)</a> and <a href="http://www.pradosoft.com/demos/quickstart/?page=Database.ActiveRecord">active record</a>.
+</p>
+
+<p>
+For tutorial purpose, we have simplified the requirements of our blog system so that it only needs to deal with user and post data. We thus create two database tables, <tt>users</tt> and <tt>posts</tt>, as shown in the following entity-relationship (ER) diagram.
+</p>
+
+<img src="<%~ ER.gif %>" />
+
+<p>
+The corresponding SQL statements for creating the tables are as follows,
+</p>
+
+<com:TTextHighlighter CssClass="source">
+CREATE TABLE users (
+ username VARCHAR(128) NOT NULL PRIMARY KEY,
+ email VARCHAR(128) NOT NULL UNIQUE,
+ password VARCHAR(128) NOT NULL,
+ first_name VARCHAR(128),
+ last_name VARCHAR(128)
+);
+
+CREATE TABLE posts (
+ post_id INTEGER NOT NULL PRIMARY KEY,
+ author VARCHAR(128) NOT NULL,
+ create_time INTEGER NOT NULL,
+ title VARCHAR(256) NOT NULL,
+ content TEXT NOT NULL,
+ CONSTRAINT "posts_fk" FOREIGN KEY ("author")
+ REFERENCES users ("username")
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+);
+</com:TTextHighlighter>
+
+<p>
+We use a SQLite 3 database to keep our data.
+</p>
+
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/blog-tutorial/protected/pages/Day2/ER.gif b/demos/blog-tutorial/protected/pages/Day2/ER.gif Binary files differnew file mode 100644 index 00000000..53a7a695 --- /dev/null +++ b/demos/blog-tutorial/protected/pages/Day2/ER.gif diff --git a/demos/blog-tutorial/protected/pages/Day2/ER.vsd b/demos/blog-tutorial/protected/pages/Day2/ER.vsd Binary files differnew file mode 100644 index 00000000..52a08530 --- /dev/null +++ b/demos/blog-tutorial/protected/pages/Day2/ER.vsd |