diff options
-rw-r--r-- | .gitattributes | 24 | ||||
-rw-r--r-- | demos/sqlmap/protected/App_Data/person.xml | 16 | ||||
-rw-r--r-- | demos/sqlmap/protected/App_Data/personHelper.xml | 42 | ||||
-rw-r--r-- | demos/sqlmap/protected/App_Data/test.db | bin | 0 -> 5120 bytes | |||
-rw-r--r-- | demos/time-tracker/protected/app/BaseDao.php (renamed from demos/time-tracker/protected/APP_CODE/BaseDao.php) | 0 | ||||
-rw-r--r-- | demos/time-tracker/protected/app/DaoManager.php (renamed from demos/time-tracker/protected/APP_CODE/DaoManager.php) | 0 | ||||
-rw-r--r-- | demos/time-tracker/protected/app/Project.php (renamed from demos/time-tracker/protected/APP_CODE/Project.php) | 0 | ||||
-rw-r--r-- | demos/time-tracker/protected/app/ProjectDao.php (renamed from demos/time-tracker/protected/APP_CODE/ProjectDao.php) | 0 | ||||
-rw-r--r-- | demos/time-tracker/protected/app/TimeTrackerException.php (renamed from demos/time-tracker/protected/APP_CODE/TimeTrackerException.php) | 0 | ||||
-rw-r--r-- | demos/time-tracker/protected/app/TimeTrackerUser.php (renamed from demos/time-tracker/protected/APP_CODE/TimeTrackerUser.php) | 0 | ||||
-rw-r--r-- | demos/time-tracker/protected/app/TimeTrackerUserTypeHandler.php (renamed from demos/time-tracker/protected/APP_CODE/TimeTrackerUserTypeHandler.php) | 0 | ||||
-rw-r--r-- | demos/time-tracker/protected/app/UserDao.php (renamed from demos/time-tracker/protected/APP_CODE/UserDao.php) | 0 | ||||
-rw-r--r-- | demos/time-tracker/protected/app/UserManager.php (renamed from demos/time-tracker/protected/APP_CODE/UserManager.php) | 0 | ||||
-rw-r--r-- | demos/time-tracker/protected/app/exceptions.txt (renamed from demos/time-tracker/protected/APP_CODE/exceptions.txt) | 0 | ||||
-rw-r--r-- | demos/time-tracker/protected/pages/Docs/DatabaseDesign.page | 42 |
15 files changed, 114 insertions, 10 deletions
diff --git a/.gitattributes b/.gitattributes index 6cdc6483..c9ce218a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1012,6 +1012,9 @@ demos/soap/protected/webservices/SimpleService.php -text demos/sqlmap/index.php -text demos/sqlmap/protected/.htaccess -text demos/sqlmap/protected/APP_CODE/Person.php -text +demos/sqlmap/protected/App_Data/person.xml -text +demos/sqlmap/protected/App_Data/personHelper.xml -text +demos/sqlmap/protected/App_Data/test.db -text demos/sqlmap/protected/application.xml -text demos/sqlmap/protected/pages/Manual/BigPicture.page -text demos/sqlmap/protected/pages/Manual/BuildingTSqlMapper.page -text @@ -1056,18 +1059,19 @@ demos/sqlmap/protected/pages/Sample/crud2.page -text demos/sqlmap/protected/pages/Sample/crud2.php -text demos/time-tracker/index.php -text demos/time-tracker/protected/.htaccess -text -demos/time-tracker/protected/APP_CODE/BaseDao.php -text -demos/time-tracker/protected/APP_CODE/DaoManager.php -text -demos/time-tracker/protected/APP_CODE/Project.php -text -demos/time-tracker/protected/APP_CODE/ProjectDao.php -text -demos/time-tracker/protected/APP_CODE/TimeTrackerException.php -text -demos/time-tracker/protected/APP_CODE/TimeTrackerUser.php -text -demos/time-tracker/protected/APP_CODE/TimeTrackerUserTypeHandler.php -text -demos/time-tracker/protected/APP_CODE/UserDao.php -text -demos/time-tracker/protected/APP_CODE/UserManager.php -text -demos/time-tracker/protected/APP_CODE/exceptions.txt -text demos/time-tracker/protected/App_Data/time_tracker.db -text +demos/time-tracker/protected/app/BaseDao.php -text +demos/time-tracker/protected/app/DaoManager.php -text +demos/time-tracker/protected/app/Project.php -text +demos/time-tracker/protected/app/ProjectDao.php -text +demos/time-tracker/protected/app/TimeTrackerException.php -text +demos/time-tracker/protected/app/TimeTrackerUser.php -text +demos/time-tracker/protected/app/TimeTrackerUserTypeHandler.php -text +demos/time-tracker/protected/app/UserDao.php -text +demos/time-tracker/protected/app/UserManager.php -text +demos/time-tracker/protected/app/exceptions.txt -text demos/time-tracker/protected/pages/Docs/CreateBusinessCode.page -text +demos/time-tracker/protected/pages/Docs/DatabaseDesign.page -text demos/time-tracker/protected/pages/Docs/GettingStarted.page -text demos/time-tracker/protected/pages/Docs/Home.page -text demos/time-tracker/protected/pages/Docs/Introduction.page -text diff --git a/demos/sqlmap/protected/App_Data/person.xml b/demos/sqlmap/protected/App_Data/person.xml new file mode 100644 index 00000000..4ffe44d9 --- /dev/null +++ b/demos/sqlmap/protected/App_Data/person.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap>
+
+ <select id="SelectAll" resultClass="Person">
+ SELECT
+ per_id as ID,
+ per_first_name as FirstName,
+ per_last_name as LastName,
+ per_birth_date as BirthDate,
+ per_weight_kg as WeightInKilograms,
+ per_height_m as HeightInMeters
+ FROM
+ person
+ </select>
+
+</sqlMap>
\ No newline at end of file diff --git a/demos/sqlmap/protected/App_Data/personHelper.xml b/demos/sqlmap/protected/App_Data/personHelper.xml new file mode 100644 index 00000000..ea2d4302 --- /dev/null +++ b/demos/sqlmap/protected/App_Data/personHelper.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8" ?>
+
+<sqlMap Name="PersonHelper">
+
+ <select id="Select" parameterClass="int" resultClass="Person">
+ select
+ PER_ID as ID,
+ PER_FIRST_NAME as FirstName,
+ PER_LAST_NAME as LastName,
+ PER_BIRTH_DATE as BirthDate,
+ PER_WEIGHT_KG as WeightInKilograms,
+ PER_HEIGHT_M as HeightInMeters
+ from PERSON
+ WHERE
+ PER_ID = #value#
+ </select>
+
+ <insert id="Insert" parameterClass="Person">
+ insert into PERSON
+ (PER_ID, PER_FIRST_NAME, PER_LAST_NAME,
+ PER_BIRTH_DATE, PER_WEIGHT_KG, PER_HEIGHT_M)
+ values
+ (#ID#, #FirstName#, #LastName#,
+ #BirthDate#, #WeightInKilograms#, #HeightInMeters#)
+ </insert>
+
+ <update id="Update" parameterClass="Person">
+ update PERSON set
+ PER_FIRST_NAME = #FirstName#,
+ PER_LAST_NAME = #LastName#,
+ PER_BIRTH_DATE = #BirthDate#,
+ PER_WEIGHT_KG = #WeightInKilograms#,
+ PER_HEIGHT_M = #HeightInMeters#
+ where PER_ID = #ID#
+ </update>
+
+ <delete id="Delete" parameterClass="int">
+ delete from PERSON
+ where PER_ID = #value#
+ </delete>
+
+</sqlMap>
diff --git a/demos/sqlmap/protected/App_Data/test.db b/demos/sqlmap/protected/App_Data/test.db Binary files differnew file mode 100644 index 00000000..a40c91fe --- /dev/null +++ b/demos/sqlmap/protected/App_Data/test.db diff --git a/demos/time-tracker/protected/APP_CODE/BaseDao.php b/demos/time-tracker/protected/app/BaseDao.php index 63b91def..63b91def 100644 --- a/demos/time-tracker/protected/APP_CODE/BaseDao.php +++ b/demos/time-tracker/protected/app/BaseDao.php diff --git a/demos/time-tracker/protected/APP_CODE/DaoManager.php b/demos/time-tracker/protected/app/DaoManager.php index b8ac55af..b8ac55af 100644 --- a/demos/time-tracker/protected/APP_CODE/DaoManager.php +++ b/demos/time-tracker/protected/app/DaoManager.php diff --git a/demos/time-tracker/protected/APP_CODE/Project.php b/demos/time-tracker/protected/app/Project.php index 660fad04..660fad04 100644 --- a/demos/time-tracker/protected/APP_CODE/Project.php +++ b/demos/time-tracker/protected/app/Project.php diff --git a/demos/time-tracker/protected/APP_CODE/ProjectDao.php b/demos/time-tracker/protected/app/ProjectDao.php index 81902e0c..81902e0c 100644 --- a/demos/time-tracker/protected/APP_CODE/ProjectDao.php +++ b/demos/time-tracker/protected/app/ProjectDao.php diff --git a/demos/time-tracker/protected/APP_CODE/TimeTrackerException.php b/demos/time-tracker/protected/app/TimeTrackerException.php index 64b11405..64b11405 100644 --- a/demos/time-tracker/protected/APP_CODE/TimeTrackerException.php +++ b/demos/time-tracker/protected/app/TimeTrackerException.php diff --git a/demos/time-tracker/protected/APP_CODE/TimeTrackerUser.php b/demos/time-tracker/protected/app/TimeTrackerUser.php index 99ac1209..99ac1209 100644 --- a/demos/time-tracker/protected/APP_CODE/TimeTrackerUser.php +++ b/demos/time-tracker/protected/app/TimeTrackerUser.php diff --git a/demos/time-tracker/protected/APP_CODE/TimeTrackerUserTypeHandler.php b/demos/time-tracker/protected/app/TimeTrackerUserTypeHandler.php index 07c46acc..07c46acc 100644 --- a/demos/time-tracker/protected/APP_CODE/TimeTrackerUserTypeHandler.php +++ b/demos/time-tracker/protected/app/TimeTrackerUserTypeHandler.php diff --git a/demos/time-tracker/protected/APP_CODE/UserDao.php b/demos/time-tracker/protected/app/UserDao.php index 4dc39b2b..4dc39b2b 100644 --- a/demos/time-tracker/protected/APP_CODE/UserDao.php +++ b/demos/time-tracker/protected/app/UserDao.php diff --git a/demos/time-tracker/protected/APP_CODE/UserManager.php b/demos/time-tracker/protected/app/UserManager.php index 1327dc3c..1327dc3c 100644 --- a/demos/time-tracker/protected/APP_CODE/UserManager.php +++ b/demos/time-tracker/protected/app/UserManager.php diff --git a/demos/time-tracker/protected/APP_CODE/exceptions.txt b/demos/time-tracker/protected/app/exceptions.txt index 6568cc72..6568cc72 100644 --- a/demos/time-tracker/protected/APP_CODE/exceptions.txt +++ b/demos/time-tracker/protected/app/exceptions.txt diff --git a/demos/time-tracker/protected/pages/Docs/DatabaseDesign.page b/demos/time-tracker/protected/pages/Docs/DatabaseDesign.page new file mode 100644 index 00000000..a306ba2c --- /dev/null +++ b/demos/time-tracker/protected/pages/Docs/DatabaseDesign.page @@ -0,0 +1,42 @@ +<com:TContent ID="body">
+<h1>Database Design</h1>
+<p>The design steps we take in the sample application is a data centric
+approach. That is, we shall consider the application from the view
+point of data structures, data relationships and data integrity.
+Other designs starting from object and class design are also possible but is
+not the approach taken in this guide.
+</p>
+
+<h2>Entity Relationship</h2>
+<p>We start with the following entity relationship diagram.
+The bold text in each entity indicate required fields. The underline
+text indicates the entity's primary key, also denoted as <tt>PK</tt>.
+Entity relationships are indicated with arrows between entities and
+each relationship field is denoted with <tt>FK</tt>.</p>
+
+<p>The four entities: <tt>Project</tt>, <tt>Categories</tt>, <tt>TimeEntry</tt>
+and <tt>ProjectMembers</tt>
+makes up the time tracker application. While the other entities:
+<tt>Users</tt>, <tt>UserRoles</tt>, <tt>RoleTypes</tt> and <tt>Signon</tt> are
+usually found in applications where membership or user management is required.</p>
+
+<img src=<%~ db.png %> class="figure" />
+</p>
+
+<div class="info"><b>Info:</b>
+See <a href="http://en.wikipedia.org/wiki/Database_normalization">Database Normalization</a>
+for a quick reference regarding database design and normalization, especially the
+3rd normal form (3NF).
+</div>
+
+<h2>MySQL database</h2>
+<p>We shall concentrate on the MySQL database for this sample application.
+Other database engines are also possible and can be quite easily inter-changed.
+The SQL script to initialize the MySQL database is given below. The following
+SQL script was created using MySQL version 4.1.7.
+</p>
+
+<com:TTextHighlighter Language="sql" CssClass="source">
+<%= file_get_contents('protected/data/time-tracker-mysql.sql') %>
+</com:TTextHighlighter>
+</com:TContent>
\ No newline at end of file |