summaryrefslogtreecommitdiff
path: root/demos/time-tracker/protected/App_Data
diff options
context:
space:
mode:
authorwei <>2006-07-28 12:32:01 +0000
committerwei <>2006-07-28 12:32:01 +0000
commit623447ffea7a49359c773a0bc3a851397885f319 (patch)
tree93676acdeea5697dd00fb10d0eb70948901b549e /demos/time-tracker/protected/App_Data
parentfbf05a159bc1a688940c16dc304eaaf140188b01 (diff)
Add sqlite support for time-tracker.
Diffstat (limited to 'demos/time-tracker/protected/App_Data')
-rw-r--r--demos/time-tracker/protected/App_Data/DateTimeTypeHandler.php33
-rw-r--r--demos/time-tracker/protected/App_Data/MySQL4/category.xml93
-rw-r--r--demos/time-tracker/protected/App_Data/MySQL4/mysql-reset.sql (renamed from demos/time-tracker/protected/App_Data/mysql-reset.sql)0
-rw-r--r--demos/time-tracker/protected/App_Data/MySQL4/projects.xml156
-rw-r--r--demos/time-tracker/protected/App_Data/MySQL4/reports.xml87
-rw-r--r--demos/time-tracker/protected/App_Data/MySQL4/time-entry.xml93
-rw-r--r--demos/time-tracker/protected/App_Data/MySQL4/time-tracker-mysql.sql (renamed from demos/time-tracker/protected/App_Data/time-tracker-mysql.sql)0
-rw-r--r--demos/time-tracker/protected/App_Data/MySQL4/users.xml137
-rw-r--r--demos/time-tracker/protected/App_Data/TimeTrackerUserTypeHandler.php54
-rw-r--r--demos/time-tracker/protected/App_Data/mysql4-sqlmap.xml (renamed from demos/time-tracker/protected/App_Data/mysql-sqlmap.xml)14
-rw-r--r--demos/time-tracker/protected/App_Data/project.xml5
-rw-r--r--demos/time-tracker/protected/App_Data/sqlite-sqlmap.xml26
-rw-r--r--demos/time-tracker/protected/App_Data/time_tracker.dbbin17408 -> 0 bytes
13 files changed, 687 insertions, 11 deletions
diff --git a/demos/time-tracker/protected/App_Data/DateTimeTypeHandler.php b/demos/time-tracker/protected/App_Data/DateTimeTypeHandler.php
new file mode 100644
index 00000000..17f3e14b
--- /dev/null
+++ b/demos/time-tracker/protected/App_Data/DateTimeTypeHandler.php
@@ -0,0 +1,33 @@
+<?php
+
+class DateTimeTypeHandler implements ITypeHandlerCallback
+{
+ /**
+ * Not implemented.
+ */
+ public function getParameter($integer)
+ {
+ return date('Y-m-d H:i:s', $integer);
+ }
+
+ /**
+ * Not implemented.
+ */
+ public function getResult($string)
+ {
+ return strtotime($string);
+ }
+
+ /**
+ * Creates a new instance of TimeTrackerUser
+ * @param array result data
+ * @return TimeTrackerUser new user instance
+ */
+ public function createNewInstance($row=null)
+ {
+ throw new TimeTrackerException('Not implemented');
+ }
+
+}
+
+?> \ No newline at end of file
diff --git a/demos/time-tracker/protected/App_Data/MySQL4/category.xml b/demos/time-tracker/protected/App_Data/MySQL4/category.xml
new file mode 100644
index 00000000..e9248e6d
--- /dev/null
+++ b/demos/time-tracker/protected/App_Data/MySQL4/category.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap>
+
+<resultMap id="category-result" class="CategoryRecord">
+ <result property="Name" column="Name" />
+ <result property="EstimateDuration" column="EstimateDuration" type="float" />
+ <result property="ProjectID" column="ProjectID" type="integer" />
+ <result property="Abbreviation" column="Abbreviation" />
+ <result property="ID" column="CategoryID" type="integer" />
+ <result property="ActualDuration" column="ActualDuration" type="float" />
+</resultMap>
+
+<insert id="AddNewCategory" parameterClass="CategoryRecord">
+ INSERT INTO categories
+ (Name, ProjectID, Abbreviation, EstimateDuration)
+ VALUES(#Name#, #ProjectID#, #Abbreviation#, #EstimateDuration#)
+ <selectKey property="ID" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+</insert>
+
+<select id="GetCategoryByID" parameterClass="integer" resultMap="category-result">
+ SELECT
+ categories.*,
+ sum(time_entry.Duration) as ActualDuration
+ FROM
+ categories
+ LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
+ WHERE
+ categories.CategoryID = #value#
+ GROUP BY
+ categories.CategoryID
+ ORDER BY
+ categories.Name
+</select>
+
+<select id="GetAllCategories" resultMap="category-result">
+ SELECT
+ categories.*,
+ sum(time_entry.Duration) as ActualDuration
+ FROM
+ categories
+ LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
+ GROUP BY
+ categories.CategoryID
+ ORDER BY
+ categories.Name
+</select>
+
+<delete id="DeleteCategory" parameterClass="integer">
+ DELETE FROM categories WHERE CategoryID = #value#
+</delete>
+
+<select id="GetCategoriesByProjectID" resultMap="category-result">
+ SELECT
+ categories.*,
+ sum(time_entry.Duration) as ActualDuration
+ FROM
+ categories
+ LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
+ WHERE
+ categories.ProjectID = #value#
+ GROUP BY
+ categories.CategoryID
+ ORDER BY
+ categories.Name
+</select>
+
+<select id="GetCategoryByNameInProject" parameterClass="array" resultMap="category-result">
+ SELECT
+ categories.*,
+ sum(time_entry.Duration) as ActualDuration
+ FROM
+ categories
+ LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
+ WHERE
+ categories.ProjectID = #project#
+ AND categories.Name = #category#
+ GROUP BY
+ categories.CategoryID
+</select>
+
+<update id="UpdateCategory" parameterClass="CategoryRecord">
+ UPDATE categories SET
+ Abbreviation = #Abbreviation#,
+ EstimateDuration = #EstimateDuration#,
+ Name = #Name#,
+ ProjectId = #ProjectID#
+ WHERE
+ CategoryID = #ID#
+</update>
+
+</sqlMap> \ No newline at end of file
diff --git a/demos/time-tracker/protected/App_Data/mysql-reset.sql b/demos/time-tracker/protected/App_Data/MySQL4/mysql-reset.sql
index e9581952..e9581952 100644
--- a/demos/time-tracker/protected/App_Data/mysql-reset.sql
+++ b/demos/time-tracker/protected/App_Data/MySQL4/mysql-reset.sql
diff --git a/demos/time-tracker/protected/App_Data/MySQL4/projects.xml b/demos/time-tracker/protected/App_Data/MySQL4/projects.xml
new file mode 100644
index 00000000..099e7fef
--- /dev/null
+++ b/demos/time-tracker/protected/App_Data/MySQL4/projects.xml
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap>
+
+<resultMap id="project-result" class="ProjectRecord">
+ <result property="ID" column="ProjectID" type="integer"/>
+ <result property="Name" column="Name" />
+ <result property="Description" column="Description" />
+ <result property="DateCreated" column="CreationDate" typeHandler="DateTime" />
+ <result property="EstimateDuration" column="EstimateDuration" type="float" />
+ <result property="CompletionDate" column="CompletionDate" typeHandler="DateTime" />
+ <result property="CreatorUserName" column="CreatorID" />
+ <result property="ManagerUserName" column="ManagerID" />
+ <result property="ActualDuration" column="ActualDuration" type="float" />
+</resultMap>
+
+<select id="ProjectNameExists" resultClass="boolean">
+ SELECT COUNT(Name) FROM project WHERE Name = #value#
+</select>
+
+<insert id="CreateNewProject" parameterClass="ProjectRecord">
+ INSERT INTO project
+ (Name, Description, CreationDate, EstimateDuration, CompletionDate, CreatorID, ManagerID)
+ VALUES
+ (#Name#, #Description#, NOW(), #EstimateDuration#,
+ #CompletionDate, typeHandler=DateTime#,
+ #CreatorUserName#, #ManagerUserName#)
+ <selectKey property="ID" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+</insert>
+
+<select id="GetProjectByID" parameterClass="integer" resultMap="project-result">
+ SELECT
+ project.ProjectID as ProjectID,
+ project.Name as Name,
+ project.Description as Description,
+ project.CreationDate as CreationDate,
+ project.EstimateDuration as EstimateDuration,
+ project.CompletionDate as CompletionDate,
+ project.CreatorID as CreatorID,
+ project.ManagerID as ManagerID,
+ SUM(time_entry.Duration) as ActualDuration
+ FROM project
+ LEFT JOIN categories ON project.ProjectID = categories.ProjectID
+ LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
+ WHERE
+ project.ProjectID = #value#
+ AND Disabled = 0
+ GROUP BY
+ project.ProjectID
+ ORDER BY
+ project.Name
+</select>
+
+<select id="GetAllProjects" resultMap="project-result">
+ SELECT
+ project.ProjectID as ProjectID,
+ project.Name as Name,
+ project.Description as Description,
+ project.CreationDate as CreationDate,
+ project.EstimateDuration as EstimateDuration,
+ project.CompletionDate as CompletionDate,
+ project.CreatorID as CreatorID,
+ project.ManagerID as ManagerID,
+ SUM(time_entry.Duration) as ActualDuration
+ FROM project
+ LEFT JOIN categories ON project.ProjectID = categories.ProjectID
+ LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
+ WHERE
+ Disabled = 0
+ GROUP BY
+ project.ProjectID
+</select>
+
+<select id="GetAllProjectsOrdered" resultMap="project-result" extends="GetAllProjects">
+ ORDER BY $sort$ $order$
+</select>
+
+<select id="GetProjectsByManagerName" resultMap="project-result">
+ SELECT
+ project.ProjectID as ProjectID,
+ project.Name as Name,
+ project.Description as Description,
+ project.CreationDate as CreationDate,
+ project.EstimateDuration as EstimateDuration,
+ project.CompletionDate as CompletionDate,
+ project.CreatorID as CreatorID,
+ project.ManagerID as ManagerID,
+ SUM(time_entry.Duration) as ActualDuration
+ FROM project
+ LEFT JOIN categories ON project.ProjectID = categories.ProjectID
+ LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
+ WHERE
+ Disabled = 0
+ AND project.ManagerID = #value#
+ GROUP BY
+ project.ProjectID
+ ORDER BY
+ project.Name
+</select>
+
+<select id="GetProjectsByUserName" resultMap="project-result">
+ SELECT
+ project.ProjectID as ProjectID,
+ project.Name as Name,
+ project.Description as Description,
+ project.CreationDate as CreationDate,
+ project.EstimateDuration as EstimateDuration,
+ project.CompletionDate as CompletionDate,
+ project.CreatorID as CreatorID,
+ project.ManagerID as ManagerID,
+ SUM(time_entry.Duration) as ActualDuration
+ FROM project
+ LEFT JOIN categories ON project.ProjectID = categories.ProjectID
+ LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID,
+ project_members
+ WHERE
+ project_members.ProjectID = project.ProjectID
+ AND project_members.UserID = #value#
+ AND project.Disabled = 0
+ GROUP BY
+ project.ProjectID
+ ORDER BY
+ project.Name
+</select>
+
+<update id="DeleteProject" parameterClass="integer">
+ UPDATE project SET Disabled = 1 WHERE ProjectID = #value#
+</update>
+
+<select id="GetProjectMembers" parameterClass="integer">
+ SELECT UserID FROM project_members WHERE ProjectID = #value#
+</select>
+
+<insert id="AddUserToProject" parameterClass="array">
+ INSERT INTO project_members (UserID, ProjectID)
+ VALUES(#username#, #project#)
+</insert>
+
+<delete id="RemoveUserFromProject" parameterClass="array">
+ DELETE FROM project_members WHERE ProjectID = #project# AND UserID = #username#
+</delete>
+
+<update id="UpdateProject" parameterClass="ProjectRecord">
+ UPDATE project
+ SET
+ CompletionDate = #CompletionDate, typeHandler=DateTime#,
+ Description = #Description#,
+ EstimateDuration = #EstimateDuration#,
+ ManagerId =#ManagerUserName#,
+ Name = #Name#
+ WHERE
+ ProjectID = #ID#
+</update>
+
+</sqlMap> \ No newline at end of file
diff --git a/demos/time-tracker/protected/App_Data/MySQL4/reports.xml b/demos/time-tracker/protected/App_Data/MySQL4/reports.xml
new file mode 100644
index 00000000..4b537708
--- /dev/null
+++ b/demos/time-tracker/protected/App_Data/MySQL4/reports.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap>
+
+<resultMap id="project-category-user" class="ProjectReport" GroupBy="ProjectID">
+ <result property="ProjectName" column="ProjectName" />
+ <result property="EstimateHours" column="ProjectEstimate" type="float"/>
+ <result property="EstimateCompletion" column="ProjectCompletion" type="DateTime" />
+ <result property="Categories" type="TList" resultMapping="category-user-report" />
+</resultMap>
+
+<resultMap id="category-user-report" class="CategoryReport" GroupBy="CategoryID" >
+ <result property="CategoryName" column="CategoryName" />
+ <result property="EstimateHours" column="CategoryEstimate" type="float" />
+ <result property="members" type="array" resultMapping="member-report" />
+</resultMap>
+
+<resultMap id="member-report" class="array">
+ <result property="username" column="Username" />
+ <result property="hours" column="ActualDuration" type="float" />
+</resultMap>
+
+<select id="GetTimeReportByProjectIDs" resultMap="project-category-user">
+ SELECT
+ categories.Name as CategoryName,
+ categories.CategoryID as CategoryID,
+ project.ProjectID as ProjectID,
+ categories.EstimateDuration as CategoryEstimate,
+ project.Name as ProjectName,
+ project.EstimateDuration as ProjectEstimate,
+ project.CompletionDate as ProjectCompletion,
+ time_entry.UserID as Username,
+ SUM(time_entry.Duration) as ActualDuration
+ FROM
+ project
+ LEFT JOIN categories ON categories.ProjectID = project.ProjectID
+ LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
+ WHERE
+ project.ProjectID IN ( $value$ )
+ GROUP BY
+ categories.ProjectID,
+ categories.CategoryID,
+ time_entry.UserID
+ ORDER BY
+ project.ProjectID
+</select>
+
+
+<resultMap id="time-entry-user-report" class="UserReport" GroupBy="Username">
+ <result property="Username" column="Username" />
+ <result property="Projects" resultMapping="project-user-report" />
+</resultMap>
+
+<resultMap id="project-user-report" class="UserProjectReport">
+ <result property="ProjectName" column="ProjectName" />
+ <result property="CategoryName" column="CategoryName" />
+ <result property="Duration" column="Duration" type="float" />
+ <result property="Description" column="Description" />
+ <result property="ReportDate" column="EntryDate" type="DateTime" />
+</resultMap>
+
+<select id="GetTimeReportByUsername" resultMap="time-entry-user-report">
+ SELECT
+ users.Username,
+ project.Name as ProjectName,
+ categories.Name as CategoryName,
+ time_entry.Duration,
+ time_entry.Description,
+ time_entry.EntryDate
+ FROM
+ users
+ LEFT JOIN time_entry ON time_entry.UserID = users.Username
+ AND time_entry.EntryDate BETWEEN
+ #startDate, typeHandler=DateTime# AND
+ #endDate, typeHandler=DateTime#
+ LEFT JOIN categories ON time_entry.CategoryID = categories.CategoryID
+ LEFT JOIN project ON categories.ProjectID = project.ProjectID
+ AND project.ProjectID in ($projects$)
+ WHERE
+ users.Username in ($members$)
+ ORDER BY
+ users.Username ASC,
+ time_entry.EntryDate ASC,
+ project.Name ASC,
+ categories.Name ASC
+</select>
+
+</sqlMap> \ No newline at end of file
diff --git a/demos/time-tracker/protected/App_Data/MySQL4/time-entry.xml b/demos/time-tracker/protected/App_Data/MySQL4/time-entry.xml
new file mode 100644
index 00000000..4838e625
--- /dev/null
+++ b/demos/time-tracker/protected/App_Data/MySQL4/time-entry.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap>
+
+<insert id="AddNewTimeEntry" parameterClass="TimeEntryRecord">
+ INSERT INTO time_entry(
+ EntryCreated,
+ Duration,
+ Description,
+ CategoryID,
+ EntryDate,
+ CreatorID,
+ UserID
+ )
+ VALUES(
+ NOW(),
+ #Duration#,
+ #Description#,
+ #Category.ID#,
+ #ReportDate, typeHandler=DateTime#,
+ #CreatorUserName#,
+ #Username#
+ )
+ <selectKey property="ID" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+</insert>
+
+<resultMap id="time-entry-result" class="TimeEntryRecord">
+ <result property="ID" column="EntryID" type="integer" />
+ <result property="DateCreated" column="EntryCreated" typeHandler="DateTime" />
+ <result property="Duration" column="Duration" type="float" />
+ <result property="Description" column="Description" />
+ <result property="Category" column="CategoryID" />
+ <result property="ReportDate" column="EntryDate" typeHandler="DateTime" />
+ <result property="CreatorUserName" column="CreatorID" />
+ <result property="Username" column="UserID" />
+</resultMap>
+
+<resultMap id="time-entry-category-result" class="TimeEntryRecord">
+ <result property="ID" column="EntryID" type="integer" />
+ <result property="DateCreated" column="EntryCreated" typeHandler="DateTime" />
+ <result property="Duration" column="Duration" type="float" />
+ <result property="Description" column="Description" />
+ <result property="Category" resultMapping="entry-category" />
+ <result property="ReportDate" column="EntryDate" typeHandler="DateTime" />
+ <result property="CreatorUserName" column="CreatorID" />
+ <result property="Username" column="UserID" />
+</resultMap>
+
+<resultMap id="entry-category" class="CategoryRecord">
+ <result property="ID" column="CategoryID" />
+ <result property="Name" column="CategoryName" />
+</resultMap>
+
+<select id="GetTimeEntryByID" resultMap="time-entry-result">
+ SELECT
+ *
+ FROM
+ time_entry
+ WHERE
+ EntryID = #value#
+</select>
+
+<delete id="DeleteTimeEntry" parameterClass="integer">
+ DELETE FROM time_entry WHERE EntryID = #value#
+</delete>
+
+<select id="GetAllTimeEntriesByProjectIdAndUser" resultMap="time-entry-category-result">
+ SELECT
+ time_entry.*,
+ categories.Name as CategoryName
+ FROM
+ time_entry, categories
+ WHERE
+ time_entry.UserID = #username#
+ AND time_entry.CategoryID = categories.CategoryID
+ AND categories.ProjectID = #project#
+ ORDER BY
+ EntryID ASC
+</select>
+
+<update id="UpdateTimeEntry" parameterClass="TimeEntryRecord">
+ UPDATE time_entry SET
+ Duration = #Duration#,
+ Description = #Description#,
+ CategoryID = #Category.ID#,
+ EntryDate = #ReportDate, typeHandler=DateTime#,
+ UserID = #Username#
+ WHERE
+ EntryID = #ID#
+</update>
+
+</sqlMap> \ No newline at end of file
diff --git a/demos/time-tracker/protected/App_Data/time-tracker-mysql.sql b/demos/time-tracker/protected/App_Data/MySQL4/time-tracker-mysql.sql
index 89de378a..89de378a 100644
--- a/demos/time-tracker/protected/App_Data/time-tracker-mysql.sql
+++ b/demos/time-tracker/protected/App_Data/MySQL4/time-tracker-mysql.sql
diff --git a/demos/time-tracker/protected/App_Data/MySQL4/users.xml b/demos/time-tracker/protected/App_Data/MySQL4/users.xml
new file mode 100644
index 00000000..6053c7ea
--- /dev/null
+++ b/demos/time-tracker/protected/App_Data/MySQL4/users.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap>
+
+<resultMap id="time-tracker-user" class="TimeTrackerUser" GroupBy="Name">
+ <result property="Name" column="Name" />
+ <result property="EmailAddress" column="EmailAddress" />
+ <result property="Roles" Type="array" resultMapping="user-roles-result" />
+</resultMap>
+
+<resultMap id="user-roles-result">
+ <result column="role" />
+</resultMap>
+
+<!--
+<select id="GetUserByName" parameterClass="string" resultMap="TimeTrackerUser">
+ SELECT
+ users.Username as Name,
+ users.EmailAddress as EmailAddress,
+ user_roles.RoleType as role
+ FROM
+ users
+ LEFT JOIN user_roles ON users.Username = user_roles.UserID
+ WHERE
+ Username = #value#
+ AND
+ Disabled = 0
+</select>
+-->
+
+<select id="UsernameExists" parameterClass="string" resultClass="boolean">
+ SELECT COUNT(Username) FROM users WHERE Username = #value#
+</select>
+
+<select id="GetUserByName" parameterClass="string" resultMap="time-tracker-user">
+ SELECT
+ users.Username as Name,
+ users.EmailAddress as EmailAddress,
+ user_roles.RoleType as role
+ FROM
+ users
+ LEFT JOIN user_roles ON users.Username = user_roles.UserID
+ WHERE
+ Username = #value#
+ AND
+ Disabled = 0
+</select>
+
+<select id="GetAllUsers" resultMap="time-tracker-user">
+ SELECT
+ users.Username as Name,
+ users.EmailAddress as EmailAddress,
+ user_roles.RoleType as role
+ FROM
+ users
+ LEFT JOIN user_roles ON users.Username = user_roles.UserID
+ WHERE
+ Disabled = 0
+</select>
+
+<select id="ValidateUser" resultClass="boolean">
+ SELECT
+ count(Username)
+ FROM
+ users
+ WHERE
+ username = #username# AND password = #password#
+ AND
+ Disabled = 0
+</select>
+
+<insert id="AddNewUser" parameterClass="array">
+ INSERT INTO
+ users (Username, Password, EmailAddress)
+ VALUES
+ (#user.Name#, #password#, #user.EmailAddress#)
+</insert>
+
+<update id="DeleteUserByName">
+ UPDATE users SET Disabled = 1 WHERE username = #value#
+</update>
+
+<insert id="RegisterAutoSignon" parameterClass="array">
+ INSERT INTO
+ signon (SessionToken, Username, LastSignOnDate)
+ VALUES
+ (#token#, #username#, NOW())
+</insert>
+
+<select id="ValidateAutoSignon" resultMap="time-tracker-user">
+ SELECT
+ users.Username as Name,
+ users.EmailAddress as EmailAddress,
+ user_roles.RoleType as role
+ FROM
+ users LEFT JOIN user_roles ON users.Username = user_roles.UserID,
+ signon
+ WHERE
+ users.Username = signon.Username
+ AND signon.SessionToken = #value#
+ AND users.Disabled = 0
+</select>
+
+<update id="UpdateSignon">
+ UPDATE signon SET LastSignOnDate = NOW()
+ WHERE SessionToken = #value#
+</update>
+
+<delete id="DeleteUserRoles" parameterClass="TimeTrackerUser">
+ DELETE FROM user_roles WHERE UserID = #Name#
+</delete>
+
+<update id="AddUserRole" parameterClass="array">
+ INSERT INTO user_roles (UserID, RoleType)
+ VALUES(#username#, #role#)
+</update>
+
+<update id="UpdateUserDetails" parameterClass="TimeTrackerUser">
+ UPDATE users
+ SET EmailAddress = #EmailAddress#
+ WHERE Username = #Name#
+</update>
+
+<update id="UpdateUserDetailsAndPassword" parameterClass="array">
+ UPDATE users
+ SET EmailAddress = #user.EmailAddress#, Password=#password#
+ WHERE Username = #user.Name#
+</update>
+
+<delete id="DeleteAutoSignon">
+ DELETE FROM signon WHERE Username = #value#
+</delete>
+
+<delete id="DeleteAllSignon">
+ DELETE FROM signon
+</delete>
+
+</sqlMap> \ No newline at end of file
diff --git a/demos/time-tracker/protected/App_Data/TimeTrackerUserTypeHandler.php b/demos/time-tracker/protected/App_Data/TimeTrackerUserTypeHandler.php
new file mode 100644
index 00000000..07c46acc
--- /dev/null
+++ b/demos/time-tracker/protected/App_Data/TimeTrackerUserTypeHandler.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * TimeTrackerUserTypeHandler class file.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $16/07/2006: $
+ * @package Demos
+ */
+
+/**
+ * SQLMap type handler for TimeTrackerUser.
+ * The TimeTrackerUser requires an instance of IUserManager in constructor.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Revision: $ $16/07/2006: $
+ * @package Demos
+ * @since 3.1
+ */
+class TimeTrackerUserTypeHandler implements ITypeHandlerCallback
+{
+ /**
+ * Not implemented.
+ */
+ public function getParameter($object)
+ {
+ throw new TimeTrackerException('Not implemented');
+ }
+
+ /**
+ * Not implemented.
+ */
+ public function getResult($string)
+ {
+ throw new TimeTrackerException('Not implemented');
+ }
+
+ /**
+ * Creates a new instance of TimeTrackerUser
+ * @param array result data
+ * @return TimeTrackerUser new user instance
+ */
+ public function createNewInstance($row=null)
+ {
+ $manager = Prado::getApplication()->getModule('users');
+ if(is_null($manager))
+ $manager = new UserManager();
+ return new TimeTrackerUser($manager);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/time-tracker/protected/App_Data/mysql-sqlmap.xml b/demos/time-tracker/protected/App_Data/mysql4-sqlmap.xml
index 3f850955..84468044 100644
--- a/demos/time-tracker/protected/App_Data/mysql-sqlmap.xml
+++ b/demos/time-tracker/protected/App_Data/mysql4-sqlmap.xml
@@ -4,8 +4,10 @@
<typeHandlers>
<typeHandler type="TimeTrackerUser"
callback="TimeTrackerUserTypeHandler"/>
- <typeHandler type="DateTime" callback="DateTimeMySQL" />
+ <typeHandler type="DateTime"
+ callback="DateTimeTypeHandler" />
</typeHandlers>
+
<provider class="TAdodb">
<datasource
@@ -17,11 +19,11 @@
</provider>
<sqlMaps>
- <sqlMap resource="mysql-maps/users.xml"/>
- <sqlMap resource="mysql-maps/projects.xml"/>
- <sqlMap resource="mysql-maps/category.xml" />
- <sqlMap resource="mysql-maps/time-entry.xml" />
- <sqlMap resource="mysql-maps/reports.xml" />
+ <sqlMap resource="MySQL4/users.xml"/>
+ <sqlMap resource="MySQL4/projects.xml"/>
+ <sqlMap resource="MySQL4/category.xml" />
+ <sqlMap resource="MySQL4/time-entry.xml" />
+ <sqlMap resource="MySQL4/reports.xml" />
</sqlMaps>
</sqlMapConfig> \ No newline at end of file
diff --git a/demos/time-tracker/protected/App_Data/project.xml b/demos/time-tracker/protected/App_Data/project.xml
deleted file mode 100644
index 0592f195..00000000
--- a/demos/time-tracker/protected/App_Data/project.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap>
-
-
-</sqlMap> \ No newline at end of file
diff --git a/demos/time-tracker/protected/App_Data/sqlite-sqlmap.xml b/demos/time-tracker/protected/App_Data/sqlite-sqlmap.xml
new file mode 100644
index 00000000..9590b506
--- /dev/null
+++ b/demos/time-tracker/protected/App_Data/sqlite-sqlmap.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<sqlMapConfig>
+
+ <typeHandlers>
+ <typeHandler type="TimeTrackerUser"
+ callback="TimeTrackerUserTypeHandler"/>
+ <typeHandler type="DateTime"
+ callback="DateTimeTypeHandler" />
+ </typeHandlers>
+
+ <provider class="TAdodb">
+ <datasource
+ driver="sqlite"
+ host="Application.App_Data.SQLite"
+ database="time-tracker.db" />
+ </provider>
+
+ <sqlMaps>
+ <sqlMap resource="SQLite/users.xml"/>
+ <sqlMap resource="SQLite/projects.xml"/>
+ <sqlMap resource="SQLite/category.xml" />
+ <sqlMap resource="SQLite/time-entry.xml" />
+ <sqlMap resource="SQLite/reports.xml" />
+ </sqlMaps>
+
+</sqlMapConfig> \ No newline at end of file
diff --git a/demos/time-tracker/protected/App_Data/time_tracker.db b/demos/time-tracker/protected/App_Data/time_tracker.db
deleted file mode 100644
index e7adaec3..00000000
--- a/demos/time-tracker/protected/App_Data/time_tracker.db
+++ /dev/null
Binary files differ