diff options
author | wei <> | 2006-07-28 12:39:48 +0000 |
---|---|---|
committer | wei <> | 2006-07-28 12:39:48 +0000 |
commit | 3046b5c41ab51ab5ee9b5136a7f1deeefda4d5b3 (patch) | |
tree | 83e044f9dbe600f5c4f49da8337c01c3008c943a /demos/time-tracker/protected/App_Data/SQLite/time-entry.xml | |
parent | 3386f0fdea56a7c63f37e3dc8f90dff21924ef21 (diff) |
correcting directory name
Diffstat (limited to 'demos/time-tracker/protected/App_Data/SQLite/time-entry.xml')
-rw-r--r-- | demos/time-tracker/protected/App_Data/SQLite/time-entry.xml | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/demos/time-tracker/protected/App_Data/SQLite/time-entry.xml b/demos/time-tracker/protected/App_Data/SQLite/time-entry.xml new file mode 100644 index 00000000..1d7fec37 --- /dev/null +++ b/demos/time-tracker/protected/App_Data/SQLite/time-entry.xml @@ -0,0 +1,100 @@ +<?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(
+ php('date', 'Y-m-d H:i:s'),
+ #Duration#,
+ #Description#,
+ #Category.ID#,
+ #ReportDate, typeHandler=DateTime#,
+ #CreatorUserName#,
+ #Username#
+ )
+ <selectKey property="ID" type="post" resultClass="int">
+ select LAST_INSERT_ROWID() 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.EntryID as EntryID,
+ time_entry.EntryCreated as EntryCreated,
+ time_entry.Duration as Duration,
+ time_entry.Description as Description,
+ time_entry.EntryDate as EntryDate,
+ time_entry.CreatorID as CreatorID,
+ time_entry.UserID as UserID,
+ time_entry.CategoryID as CategoryID,
+ 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 |