summaryrefslogtreecommitdiff
path: root/tests/simple_unit/SqlMap/maps/mssql/Enumeration.xml
blob: 938a426686288bbd0bfcd071f3e004b7998ba7db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version="1.0" encoding="utf-8"?>
<sqlMap namespace="Enumeration" >

	<resultMap id="enumeration-result"  class="Enumeration" >
		<result property="Id"           column="Enum_ID"/>
		<result property="Day"    column="Enum_Day"/>
		<result property="Color"     column="Enum_Color"/>
		<result property="Month" column="Enum_Month" nullValue="All"/>
	</resultMap>

	<select id="GetEnumerationNullValue" 
		parameterClass="Integer" 
		resultMap="enumeration-result">
		select
			Enum_ID,
			Enum_Day,
			Enum_Color,
			Enum_Month
		from Enumerations  
		where Enum_ID = #value# 
	</select>
	
	<select id="GetEnumeration" parameterClass="Integer" resultClass="Enumeration">
		select
			Enum_ID as Id,
			Enum_Day as Day,
			Enum_Color as Color,
			Enum_Month as Month
		from Enumerations  
		where Enum_ID = #value# 
	</select>
	
	<insert id="InsertEnumViaParameterMap" parameterMap="enum-insert-params" >
		insert into Enumerations  
			(Enum_ID, Enum_Day, Enum_Color, Enum_Month) 
		values 
			(?, ?, ?, ?)
	</insert>
	
	<parameterMap id="enum-insert-params">
		<parameter property="Id" column="Enum_ID" />
		<parameter property="Day" column="Enum_Day"/>
		<parameter property="Color" column="Enum_Color" />
		<parameter property="Month" column="Enum_Month" nullValue="All"/>
	</parameterMap>

</sqlMap>