diff options
author | wei <> | 2006-12-04 02:42:57 +0000 |
---|---|---|
committer | wei <> | 2006-12-04 02:42:57 +0000 |
commit | 562979c4a8fe47952edf7986d4144624e41630f7 (patch) | |
tree | b79c3fd28e1aedb40d04e148da4b0763c928a3a5 /tests/simple_unit/SqlMap/maps/mssql/LineItem.xml | |
parent | 91fe694c8755aa2d05743946a3681be7232420b6 (diff) |
add unit tests for active record and sqlmap
Diffstat (limited to 'tests/simple_unit/SqlMap/maps/mssql/LineItem.xml')
-rw-r--r-- | tests/simple_unit/SqlMap/maps/mssql/LineItem.xml | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/tests/simple_unit/SqlMap/maps/mssql/LineItem.xml b/tests/simple_unit/SqlMap/maps/mssql/LineItem.xml new file mode 100644 index 00000000..ced09b52 --- /dev/null +++ b/tests/simple_unit/SqlMap/maps/mssql/LineItem.xml @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="LineItem" >
+
+ <resultMap id="LineItem-Price" class="decimal">
+ <result property="value" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="LineItem" class="LineItem">
+ <result property="Id" column="LineItem_ID"/>
+ <result property="Code" column="LineItem_Code"/>
+ <result property="Quantity" column="LineItem_Quantity"/>
+ <result property="Price" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="LineItemWithNullReplacement" class="LineItem">
+ <result property="Id" column="LineItem_ID"/>
+ <result property="Code" column="LineItem_Code"/>
+ <result property="Quantity" column="LineItem_Quantity"/>
+ <result property="Price" column="LineItem_Price" nullValue="-77.77"/>
+ </resultMap>
+
+ <statement id="GetLineItemPrice"
+ parameterClass="array"
+ resultMap="LineItem-Price" >
+ select
+ LineItem_Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <statement id="GetLineItemsForOrder"
+ parameterClass="int"
+ listClass="TList"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems where Order_ID = #value#
+ </statement>
+
+ <statement id="GetLineItemsForOrderWithListClass"
+ parameterClass="int"
+ listClass="LineItemCollection"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems where Order_ID = #value#
+ order by LineItem_Code
+ </statement>
+
+ <statement id="GetSpecificLineItem"
+ parameterClass="array"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <statement id="GetSpecificLineItemWithPicture"
+ parameterClass="array"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price,
+ LineItem_Picture as PictureData
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <select id="GetDynSpecificLineItem"
+ parameterClass="HashMap"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ <dynamic>
+ <isNotNull property="LineItem_ID">
+ and LineItem_ID = #LineItem_ID#
+ </isNotNull>
+ </dynamic>
+ </select>
+
+ <statement id="GetSpecificLineItemWithNullReplacement"
+ parameterClass="int"
+ resultMap="LineItemWithNullReplacement">
+ select
+ LineItem_ID,
+ LineItem_Code,
+ LineItem_Quantity,
+ LineItem_Price
+ from LineItems
+ where LineItem_ID = #value#
+ </statement>
+
+ <statement id="InsertLineItem"
+ parameterMap="lineitem-insert-params" >
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (?, ?, ?, ?, ?);
+ </statement>
+
+ <statement id="InsertLineItemWithPicture"
+ parameterMap="lineitem-insert-params-picture" >
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price, LineItem_Picture)
+ values
+ (?, ?, ?, ?, ?, ?);
+ </statement>
+
+ <insert id="InsertLineItemPostKey" parameterClass="LineItem">
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, dbType=Decimal#)
+ <selectKey property="Id" type="post" resultClass="int" >
+ select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
+ </selectKey>
+ </insert>
+
+ <insert id="InsertLineItemPreKey" parameterClass="LineItem">
+ <selectKey property="Id" type="pre" resultClass="int" >
+ select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
+ </selectKey>
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, dbType=Decimal#)
+ </insert>
+
+ <insert id="InsertLineItemNoKey" parameterClass="LineItem">
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, dbType=Decimal#)
+ </insert>
+
+ <!-- JIRA 23 -->
+ <delete id="DeleteWithComments" >
+ <!-- Delete LineItems -->
+ delete from LineItems where Order_ID = 10
+ <!-- Delete LineItems -->
+ delete from LineItems where Order_ID = 9
+ </delete>
+
+ <parameterMap id="lineitem-insert-params">
+ <parameter property="Id" />
+ <parameter property="Order.Id" />
+ <parameter property="Code" />
+ <parameter property="Quantity" />
+ <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
+ </parameterMap>
+
+ <parameterMap id="lineitem-insert-params-picture">
+ <parameter property="Id" />
+ <parameter property="Order.Id" />
+ <parameter property="Code" />
+ <parameter property="Quantity" />
+ <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
+ <parameter property="PictureData" dbType="Binary" /><!-- or Image -->
+ </parameterMap>
+
+</sqlMap>
\ No newline at end of file |