summaryrefslogtreecommitdiff
path: root/tests/unit/SQLMap/maps/MySql
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/SQLMap/maps/MySql')
-rw-r--r--tests/unit/SQLMap/maps/MySql/Account.xml624
-rw-r--r--tests/unit/SQLMap/maps/MySql/Category.xml162
-rw-r--r--tests/unit/SQLMap/maps/MySql/Complex.xml23
-rw-r--r--tests/unit/SQLMap/maps/MySql/Document.xml53
-rw-r--r--tests/unit/SQLMap/maps/MySql/DynamicAccount.xml448
-rw-r--r--tests/unit/SQLMap/maps/MySql/Enumeration.xml59
-rw-r--r--tests/unit/SQLMap/maps/MySql/LineItem.xml188
-rw-r--r--tests/unit/SQLMap/maps/MySql/Order.xml468
-rw-r--r--tests/unit/SQLMap/maps/MySql/Other.xml170
-rw-r--r--tests/unit/SQLMap/maps/MySql/ResultClass.xml130
10 files changed, 2325 insertions, 0 deletions
diff --git a/tests/unit/SQLMap/maps/MySql/Account.xml b/tests/unit/SQLMap/maps/MySql/Account.xml
new file mode 100644
index 00000000..146e0e90
--- /dev/null
+++ b/tests/unit/SQLMap/maps/MySql/Account.xml
@@ -0,0 +1,624 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<sqlMap namespace="Account" >
+
+ <!-- =============================================
+ <resultMap
+ name="name"
+ class="name"
+ extend="resultMapId"
+ >
+ <result
+ property="name"
+ column="name"
+ columnIndex="name"
+ nullValue="value"
+ select="name"
+ resultMap="name"
+ lazyLoad="true/false"
+ dbType=""
+ />
+ <procedure
+ name="name"
+ parameterMap="name"
+ >
+ <statement
+ name="name"
+ parameterClass="name"
+ parameterMap="name"
+ resultClass="name"
+ resultMap="name"
+ listClass="name"
+ >
+ <parameterMap
+ name="name"
+ class=""
+ >
+ <parameter
+ property="name"
+ dbType=""
+ output="true/false"
+ type=""
+ nullValue=""
+ extend="parameterMapId"
+ />
+
+ ============================================= -->
+
+ <cacheModel id="account-cache" implementation="LRU" >
+ <flushInterval hours="24"/>
+ <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
+ <flushOnExecute statement="UpdateAccountViaParameterMap"/>
+ <property name="size" value="10"/>
+ </cacheModel>
+
+ <!--
+ <cacheModel name="account-cache" implementation="LRU" >
+ <flushInterval hours="24"/>
+ <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
+ <flushOnExecute statement="UpdateAccountViaParameterMap"/>
+ <property name="CacheSize" value="50"/>
+ </cacheModel>
+ -->
+
+
+ <alias>
+ <typeAlias alias="HundredsBool" type="IBatisNet.DataMapper.Test.Domain.HundredsTypeHandlerCallback, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+ <resultMap id="account-result" class="Account" >
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email" nullValue="no_email@provided.com"/>
+ <result property="BannerOptions" column="Account_Banner_Option" dbType="Varchar" typeHandler="OuiNonBool"/>
+ <result property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
+ </resultMap>
+ <resultMap id="indexed-account-result" class="Account">
+ <result property="Id" column="Account_Id" columnIndex="0"/>
+ <result property="FirstName" column="Account_FirstName" columnIndex="1"/>
+ <result property="LastName" column="Account_LastName" columnIndex="2"/>
+ <result property="EmailAddress" column="Account_Email" columnIndex="3" nullValue="no_email@provided.com"/>
+ </resultMap>
+ <resultMap id="account-result-nullable-email" class="Account">
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email"/>
+ </resultMap>
+
+ <resultMap id="email-result" class="string">
+ <result property="value" column="Account_Email"/>
+ </resultMap>
+
+ <resultMap id="account-hashtable-result" class="array">
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email"/>
+ </resultMap>
+
+
+ <!-- =============================================
+ MAPPED STATEMENTS - w/Inline Parameters
+ =============================================
+ -->
+
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="TList">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAccountsDynamic" resultMap="account-result" parameterClass="Hashtable" >
+ select * from Accounts
+ <dynamic prepend="where">
+ <isParameterPresent>
+ <isNotEmpty prepend="and" property="FirstName" >
+ Account_FirstName LIKE '%$FirstName$%'
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName LIKE '%$LastName$%'
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="EmailAddress" >
+ Account_Email LIKE '%$EmailAddress$%'
+ </isNotEmpty>
+ </isParameterPresent>
+ </dynamic>
+ order by Account_LastName
+ limit 0, $MaximumAllowed$
+ </select>
+
+ <select id="SelectWithProperty"
+ resultMap="account-result">
+ select *
+ from Accounts
+ where Account_FirstName = ${accountName}
+ </select>
+
+ <select id="GetCachedAccountsViaResultMap"
+ resultMap="account-result"
+ cacheModel="account-cache" >
+ select *
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetNoAccountWithCache"
+ parameterClass="Integer"
+ resultMap="account-hashtable-result"
+ cacheModel="account-cache">
+ select *
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAccountAsHashtable"
+ parameterClass="Integer"
+ resultMap="account-hashtable-result">
+ select *
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllAccountsAsHashMapViaResultMap"
+ resultMap="account-hashtable-result">
+ select *
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAccountAsHashtableResultClass"
+ parameterClass="int"
+ resultClass="array">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllAccountsAsHashtableViaResultClass"
+ resultClass="array">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAccountViaColumnName"
+ parameterClass="int"
+ resultMap="account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email,
+ Account_Banner_Option,
+ Account_Cart_Option
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAccountViaColumnIndex"
+ parameterClass="int"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllAccountsViaResultMap"
+ resultMap="account-result">
+ select * from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAllAccountsViaResultClass"
+ resultClass="Account">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetFewAccountsViaResultMap"
+ resultMap="account-result">
+ <![CDATA[
+ select * from Accounts
+ where Account_Id < 2
+ order by Account_Id
+ ]]>
+ </select>
+
+ <select id="GetNoAccountsViaResultMap"
+ resultMap="account-result">
+ select * from Accounts
+ where Account_Id > 1000
+ order by Account_Id
+ </select>
+
+
+ <select id="GetAccountNullableEmail"
+ resultMap="account-result-nullable-email">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAccountViaResultClass"
+ resultClass="Account">
+ <![CDATA[
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_Id = #value#
+ ]]>
+ </select>
+
+ <select id="GetAccountViaInlineParameters"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #Id# and Account_Id = #Id#
+ </select>
+
+ <select id="GetEmailAddressViaResultClass" resultClass="string">
+ select Account_Email as value
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetEmailAddressViaResultMap"
+ parameterClass="int"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllEmailAddressesViaResultClass"
+ resultClass="string">
+ select Account_Email
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAllEmailAddressesViaResultMap"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <insert id="InsertAccountViaParameterMap"
+ parameterMap="account-insert-params">
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option)
+ values
+ (?, ?, ?, ?, ?, ?)
+ </insert>
+
+ <update id="UpdateAccountViaParameterMap"
+ parameterMap="update-params">
+ update Accounts set
+ Account_FirstName = ?,
+ Account_LastName = ?,
+ Account_Email = ?
+ where
+ Account_Id = ?
+ </update>
+
+ <update id="UpdateAccountViaParameterMap2"
+ parameterMap="update-params2">
+ update Accounts set
+ Account_Id = ?,
+ Account_FirstName = ?,
+ Account_LastName = ?,
+ Account_Email = ?
+ where
+ Account_Id = ?
+ </update>
+
+ <delete id="DeleteAccountViaInlineParameters">
+ delete from Accounts
+ where
+ Account_Id = #Id#
+ </delete>
+
+ <select id="GetAccountComplexMapping"
+ resultMap="indexed-account-result"
+ parameterClass="array">
+ select *
+ from Accounts
+ where
+ Account_FirstName = #Account.FirstName#
+ And Account_LastName = #Order.City#
+ </select>
+
+ <select id="GetDynamicOrderedEmailAddressesViaResultMap"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ order by $value$
+ </select>
+
+ <!-- Dynamic statements -->
+ <select id="GetAllAccountsViaResultMapWithDynamicElement"
+ resultMap="account-result">
+ select * from Accounts
+ where Account_Email $value$ '%@%'
+ order by Account_Id
+ </select>
+
+ <select id="SimpleDynamicSubstitution"
+ parameterClass="Hashtable"
+ resultClass="Account">
+ $statement$
+ </select>
+
+ <!-- Public Fields -->
+ <insert id="InsertAccountViaPublicFields">
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#Id#, #FirstName#, #LastName#, #EmailAddress#
+ )
+ </insert>
+
+
+ <!-- Inline Parameters -->
+ <update id="UpdateAccountViaInlineParameters"
+ parameterClass="Account">
+ update Accounts set
+ Account_FirstName = #FirstName#,
+ Account_LastName = #LastName#,
+ Account_Email = #EmailAddress, dbType=VarChar, nullValue=no_email@provided.com#
+ where
+ Account_Id = #Id#
+ </update>
+
+ <insert id="InsertAccountViaInlineParameters"
+ parameterClass="Account" >
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar, nullValue=no_email@provided.com#
+ )
+ </insert>
+
+ <insert id="InsertAccountNullableEmail"
+ parameterClass="Account" >
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
+ </insert>
+
+ <insert id="InsertAccountUknownParameterClass">
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
+ </insert>
+
+ <delete id="DeleteAccount"
+ parameterClass="Account">
+ delete from Accounts
+ where Account_Id = #Id#
+ and Account_Id = #Id#
+ </delete>
+
+ <!-- Extends statement -->
+ <select id="GetAllAccounts"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ </select>
+
+ <select id="GetAllAccountsOrderByName"
+ extends="GetAllAccounts"
+ resultMap="indexed-account-result">
+ order by Account_FirstName
+ </select>
+
+ <select id="GetOneAccount"
+ extends="GetAllAccounts"
+ resultMap="indexed-account-result">
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetSomeAccount"
+ extends="GetAllAccounts"
+ parameterClass="Hashtable"
+ resultMap="indexed-account-result">
+ where Account_Id between #lowID# and #hightID#
+ </select>
+
+ <select id="SelectAccountJIRA29" parameterClass="map" resultClass="Account">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_FirstName = '##$AccountName$##'
+ </select>
+
+ <select id="SelectAccountJIRA29-2"
+ parameterClass="Hashtable"
+ resultClass="Account">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where 1=1
+ <isNotEmpty prepend="AND" property="Foo">
+ (Account_FirstName = '##$Foo$##')
+ </isNotEmpty>
+ </select>
+
+ <select id="GetAccountWithRepeatingProperty"
+ parameterClass="Account"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #Id# and
+ Account_Id = #Id# and
+ Account_FirstName = #FirstName# and
+ Account_LastName = #LastName# and
+ Account_Id = #Id#
+ </select>
+
+ <select id="GetAllAccountsViaCustomTypeHandler"
+ resultMap="account-result">
+ select * from Accounts
+ order by Account_Id
+ </select>
+
+ <!-- JIRA-110 -->
+ <select id="GetManyAccound" resultClass="Account">
+ SELECT
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ FROM Accounts
+ </select>
+
+ <select id="Get1Account" extends="GetManyAccound" resultClass="Account">WHERE Account_Id=1</select>
+
+ <statement id="GetAccounts" resultMap="account-result">
+ SELECT *
+ FROM
+ Accounts
+ </statement>
+ <!-- JIRA-110 -->
+
+ <insert id="InsertAccountDynamic" parameterClass="Account">
+ INSERT INTO Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ VALUES(#Id#, #FirstName#, #LastName#
+ <dynamic prepend=",">
+ <isNotNull prepend="," property="EmailAddress">
+ #EmailAddress#
+ </isNotNull>
+ <isNull prepend="," property="EmailAddress">
+ null
+ </isNull>
+ </dynamic>
+ )
+ </insert>
+
+
+ <!-- accounts and orders -->
+
+ <select id="getAccountWithOrders" resultMap="Account-with-Orders">
+ SELECT * FROM accounts
+ LEFT JOIN orders ON
+ accounts.account_id = orders.account_id
+ </select>
+
+ <resultMap id="Account-with-Orders" class="AccountWithOrders" groupBy="Account_Id">
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email" />
+ <result property="Orders" resultMapping="account-orders" />
+ </resultMap>
+
+ <resultMap id="account-orders" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ </resultMap>
+
+
+ <!-- For procedure, the parameters of the parameterMap must in the same order
+ as for the procedure paramaters-->
+ <procedure id="InsertAccountViaStoreProcedure" parameterMap="account-insert-params">
+ ps_InsertAccount
+ </procedure>
+
+ <procedure id="SwapEmailAddresses" parameterMap="swap-params">
+ ps_swap_email_address
+ </procedure>
+
+ <!-- =============================================
+ OPTIONAL EXPLICIT PARAMETER MAP
+ ============================================= -->
+
+ <parameterMap id="swap-params">
+ <parameter property="email1" column="First_Email" />
+ <parameter property="email2" column="Second_Email" />
+ </parameterMap>
+
+ <parameterMap id="account-insert-params">
+ <parameter property="Id" />
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="BannerOptions" dbType="Varchar" type="bool"/>
+ <parameter property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
+ </parameterMap>
+
+ <parameterMap id="update-params">
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="Id" />
+ </parameterMap>
+
+ <parameterMap id="update-params2">
+ <parameter property="Id" />
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="Id" />
+ </parameterMap>
+
+
+</sqlMap> \ No newline at end of file
diff --git a/tests/unit/SQLMap/maps/MySql/Category.xml b/tests/unit/SQLMap/maps/MySql/Category.xml
new file mode 100644
index 00000000..ec81449b
--- /dev/null
+++ b/tests/unit/SQLMap/maps/MySql/Category.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Category" >
+
+ <alias>
+ <typeAlias alias="Category" type="IBatisNet.DataMapper.Test.Domain.Category, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+
+ <select id="GetCategory" parameterClass="Integer" resultClass="Category">
+ select
+ Category_ID as Id,
+ Category_Name as Name,
+ Category_Guid as GuidString
+ from Categories
+ where Category_ID = #value#
+ </select>
+
+ <select id="GetCategoryGuid" parameterClass="Integer" resultClass="guid">
+ select
+ Category_Guid as value
+ from Categories
+ where Category_ID = #value#
+ </select>
+
+ <!-- Test for statement as insert -->
+ <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
+ <insert id="InsertCategory" parameterClass="Category">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (#Name#, #GuidString:Varchar#);
+ </insert>
+
+ <!-- -->
+ <insert id="InsertCategoryViaInsertStatement" parameterClass="Category" >
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (#Name#, #GuidString:Varchar#)
+ </insert>
+
+ <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
+ <insert id="InsertCategoryViaParameterMap" parameterMap="InsertParam">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (?,?);
+ </insert>
+
+ <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
+ <insert id="InsertCategoryNull" parameterMap="insert-null-params">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (?,?);
+ </insert>
+
+ <update id="UpdateCategoryViaParameterMap" parameterMap="UpdateParam">
+ update Categories set
+ Category_Name =?,
+ Category_Guid = ?
+ where
+ Category_Id = ?
+ </update>
+
+ <procedure id="InsertCategoryViaStoreProcedure" parameterMap="category-insert-params">
+ ps_InsertCategorie
+ </procedure>
+
+ <insert id="InsertCategoryGenerate" parameterMap="insert-generate-params">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ <generate table="Categories" />
+ </insert>
+
+ <update id="UpdateCategoryGenerate" parameterMap="update-generate-params">
+ <generate table="Categories" by="Category_Id"/>
+ </update>
+
+ <delete id="DeleteCategoryGenerate" parameterMap="delete-generate-params">
+ <generate table="Categories" by="Category_Id, Category_Name"/>
+ </delete>
+
+ <select id="SelectByPKCategoryGenerate" resultClass="Category" parameterClass="Category" parameterMap="select-generate-params">
+ <generate table="Categories" by="Category_Id"/>
+ </select>
+
+ <select id="SelectAllCategoryGenerate" resultClass="Category" parameterMap="select-generate-params">
+ <generate table="Categories" />
+ </select>
+
+ <statement id="DynamicGuid"
+ resultClass="Category"
+ parameterClass="Category">
+ select
+ Category_ID as Id,
+ Category_Name as Name,
+ Category_Guid as Guid
+ from Categories
+ <dynamic prepend="where">
+ <isNotEqual prepend="and" property="Guid" compareProperty="EmptyGuid">
+ Category_Guid=#GuidString:Varchar#
+ </isNotEqual>
+ </dynamic>
+ </statement>
+ <parameterMap id="category-insert-params">
+ <parameter property="Id" column="Category_Id" dbType="Int32" />
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="InsertParam">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="insert-null-params">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" nullValue="00000000-0000-0000-0000-000000000000" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="UpdateParam" extends="InsertParam">
+ <parameter property="Id" column="Category_Id" />
+ </parameterMap>
+
+ <!-- Used by generated statement -->
+
+ <parameterMap id="insert-generate-params">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="update-generate-params" extends="insert-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ </parameterMap>
+
+ <parameterMap id="delete-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ <parameter property="Name" column="Category_Name"/>
+ </parameterMap>
+
+ <parameterMap id="select-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+
+</sqlMap>
diff --git a/tests/unit/SQLMap/maps/MySql/Complex.xml b/tests/unit/SQLMap/maps/MySql/Complex.xml
new file mode 100644
index 00000000..f6da811d
--- /dev/null
+++ b/tests/unit/SQLMap/maps/MySql/Complex.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Complex" >
+
+ <statements>
+
+ <statement id="ComplexMap"
+ resultClass="int" >
+ select Account_ID from Accounts where Account_ID = #obj.Map.Id#
+ </statement>
+
+ <insert id="InsertComplexAccountViaInlineDefaultNull"
+ parameterClass="Hashtable" >
+ insert into Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#obj.Map.acct.Id#, #obj.Map.acct.FirstName#, #obj.Map.acct.LastName#, #obj.Map.acct.EmailAddress:Varchar:no_email@provided.com#
+ )
+ </insert>
+
+ </statements>
+
+
+</sqlMap>
diff --git a/tests/unit/SQLMap/maps/MySql/Document.xml b/tests/unit/SQLMap/maps/MySql/Document.xml
new file mode 100644
index 00000000..40608c97
--- /dev/null
+++ b/tests/unit/SQLMap/maps/MySql/Document.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Document" >
+ <resultMap id="document" class="Document">
+ <result property="Id" column="Document_Id"/>
+ <result property="Title" column="Document_Title"/>
+ <discriminator column="Document_Type" type="string"/>
+ <subMap value="Book" resultMapping="book" />
+ <subMap value="Newspaper" resultMapping="newspaper" />
+ </resultMap>
+
+ <resultMap id="document-custom-handler" class="Document">
+ <result property="Id" column="Document_Id"/>
+ <result property="Title" column="Document_Title"/>
+ <discriminator column="Document_Type" typeHandler="CustomInheritance"/>
+ <subMap value="Book" resultMapping="book" />
+ <subMap value="Newspaper" resultMapping="newspaper" />
+ </resultMap>
+
+ <resultMap id="book" class="Book" extends="document">
+ <result property="PageNumber" column="Document_PageNumber"/>
+ </resultMap>
+
+ <resultMap id="newspaper" class="Newspaper" extends="document">
+ <result property="City" column="Document_City"/>
+ </resultMap>
+
+
+ <statement id="GetAllDocument"
+ resultMap="document">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_Id
+ </statement>
+
+ <select id="GetTypedCollection"
+ listClass="DocumentCollection"
+ resultMap="document">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_Id
+ </select>
+
+ <select id="GetAllDocumentWithCustomTypeHandler"
+ resultMap="document-custom-handler">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_Id
+ </select>
+
+</sqlMap> \ No newline at end of file
diff --git a/tests/unit/SQLMap/maps/MySql/DynamicAccount.xml b/tests/unit/SQLMap/maps/MySql/DynamicAccount.xml
new file mode 100644
index 00000000..ff89720b
--- /dev/null
+++ b/tests/unit/SQLMap/maps/MySql/DynamicAccount.xml
@@ -0,0 +1,448 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Account" >
+
+ <alias>
+ <typeAlias alias="Search" type="IBatisNet.DataMapper.Test.Domain.Search, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+ <statements>
+
+ <select id="DynamicAll"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ </select>
+
+ <select id="DynamicWithExtend"
+ extends="DynamicAll"
+ parameterClass="Account"
+ resultClass="Account">
+ <dynamic prepend="WHERE" >
+ <isGreaterThan prepend="AND" property="Id" compareValue="0" >
+ Account_ID = #Id#
+ </isGreaterThan>
+ <isNotNull prepend="AND" property="Ids" >
+ Account_ID in
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </isNotNull>
+ <isNotEmpty prepend="AND" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="EmailAddress" >
+ <isEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = 'clinton.begin@ibatis.com'
+ </isEqual>
+ <isNotEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = #EmailAddress#
+ </isNotEqual>
+ </isNotEmpty>
+ </dynamic>
+ </select>
+
+ <!-- IBATISNET-114: remapResults -->
+ <statement id="DynamicSqlOnColumnSelection"
+ parameterClass="Account"
+ resultClass="Account"
+ remapResults="true">
+ SELECT
+ Account_ID as Id,
+ <dynamic>
+ <isEqual property="LastName" compareValue="Dalton" >
+ Account_FirstName as FirstName,
+ </isEqual>
+ <isEqual property="LastName" compareValue="Dalton" >
+ Account_LastName as LastName,
+ </isEqual>
+ </dynamic>
+
+ Account_Email as EmailAddress
+ FROM
+ Accounts
+ </statement>
+
+ <statement id="DynamicIsEqual"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isEqual compareValue="Joe" >
+ where Account_FirstName = 'Joe'
+ </isEqual>
+ </statement>
+
+ <statement id="DynamicIsParameterPresent"
+ parameterClass="integer"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isParameterPresent >
+ where Account_ID = #value#
+ </isParameterPresent>
+ </statement>
+
+ <statement id="DynamicIsNotEmpty"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isNotEmpty>
+ where Account_FirstName = #value#
+ </isNotEmpty>
+ </statement>
+
+ <statement id="DynamicIsGreater"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isGreaterThan compareValue="3" >
+ where Account_ID = 1
+ </isGreaterThan>
+ </statement>
+
+ <statement id="DynamicIsGreaterEqual"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isGreaterEqual compareValue="3" >
+ where Account_ID = 1
+ </isGreaterEqual>
+ </statement>
+
+ <statement id="DynamicIsLess"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isLessThan compareValue="3" >
+ where Account_ID = 1
+ </isLessThan>
+ </statement>
+
+ <statement id="DynamicIsLessEqual"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isLessEqual compareValue="3" >
+ where Account_ID = 1
+ </isLessEqual>
+ </statement>
+
+ <statement id="DynamicIsNotNull"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isNotNull>
+ where Account_ID = 1
+ </isNotNull>
+ </statement>
+
+ <statement id="DynamicIsPropertyAvailable"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isPropertyAvailable property="Id" >
+ where Account_ID = 1
+ </isPropertyAvailable>
+ </statement>
+
+
+ <statement id="DynamicSubst"
+ parameterClass="map"
+ resultClass="Account">
+ <dynamic>
+ $statement$
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterate"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </statement>
+
+ <statement id="DynamicIterate2"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </statement>
+
+ <statement id="MultiDynamicIterate"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ and Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </statement>
+
+
+ <statement id="DynamicQueryByExample"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="WHERE" >
+ <isGreaterThan prepend="AND" property="Id" compareValue="0" >
+ Account_ID = #Id#
+ </isGreaterThan>
+ <isNotNull prepend="AND" property="Ids" >
+ Account_ID in
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </isNotNull>
+ <isNotEmpty prepend="AND" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="EmailAddress" >
+ <isEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = 'clinton.begin@ibatis.com'
+ </isEqual>
+ <isNotEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = #EmailAddress#
+ </isNotEqual>
+ </isNotEmpty>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend1"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend2"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ <iterate open="(" close=")" conjunction="OR">
+ Account_ID = #[]#
+ </iterate>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend3"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ <isParameterPresent prepend="BLAH!" >
+ <iterate open="(" close=")" conjunction="OR">
+ Account_ID = #[]#
+ </iterate>
+ </isParameterPresent>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicWithPrepend"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isParameterPresent>
+ <isNotEmpty prepend="and" property="Id" >
+ Account_ID = #Id#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ </isParameterPresent>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicWithTwoDynamicElements"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isNotEmpty prepend="BLAH!" property="Id" >
+ Account_ID = #Id#
+ </isNotEmpty>
+ </dynamic>
+ <dynamic prepend="and">
+ <isNotEmpty prepend="BLAH!" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ </dynamic>
+ </statement>
+
+ <statement id="ComplexDynamicStatement"
+ cacheModel="account-cache"
+ resultClass="Account"
+ parameterClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="WHERE">
+ <isNotNull prepend="AND" property="FirstName">
+ (Account_FirstName = #FirstName#
+ <isNotNull prepend="OR" property="LastName">
+ Account_LastName = #LastName#
+ </isNotNull>
+ )
+ </isNotNull>
+ <isNotNull prepend="AND" property="EmailAddress">
+ Account_Email like #EmailAddress#
+ </isNotNull>
+ <isGreaterThan prepend="AND" property="Id" compareValue="0">
+ Account_ID = #Id#
+ </isGreaterThan>
+ </dynamic>
+ order by Account_LastName
+ </statement>
+
+ <statement id="Jira-IBATISNET-11"
+ resultClass="Account"
+ parameterClass="Search">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isNotNull prepend="and" property="NumberSearch">
+ ((Account_ID $Operande$ #NumberSearch#) or
+ (Account_ID $Operande$ #NumberSearch#))
+ </isNotNull>
+ <isEqual prepend="and" property="StartDate" compareValue="25/12/2004">
+ <![CDATA[Account_FirstName >= #StartDate# ]]>
+ </isEqual>
+ <isEqual prepend="and" property="StartDateAnd" compareValue="true">
+ <![CDATA[Account_LastName >= #StartDate# ]]>
+ </isEqual>
+ </dynamic>
+
+ order by Account_LastName
+ </statement>
+ </statements>
+
+
+</sqlMap> \ No newline at end of file
diff --git a/tests/unit/SQLMap/maps/MySql/Enumeration.xml b/tests/unit/SQLMap/maps/MySql/Enumeration.xml
new file mode 100644
index 00000000..b321259e
--- /dev/null
+++ b/tests/unit/SQLMap/maps/MySql/Enumeration.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Enumeration" >
+
+ <alias>
+ <typeAlias alias="Enumeration" type="IBatisNet.DataMapper.Test.Domain.Enumeration, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+ <resultMaps>
+ <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>
+ </resultMaps>
+
+ <statements>
+
+ <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="insert-params" >
+ insert into Enumerations
+ (Enum_ID, Enum_Day, Enum_Color, Enum_Month)
+ values
+ (?, ?, ?, ?)
+ </insert>
+
+ </statements>
+
+ <parameterMaps>
+ <parameterMap id="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>
+ </parameterMaps>
+
+</sqlMap>
diff --git a/tests/unit/SQLMap/maps/MySql/LineItem.xml b/tests/unit/SQLMap/maps/MySql/LineItem.xml
new file mode 100644
index 00000000..c9778d9d
--- /dev/null
+++ b/tests/unit/SQLMap/maps/MySql/LineItem.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="LineItem" >
+
+ <alias>
+ <typeAlias alias="LineItem" type="IBatisNet.DataMapper.Test.Domain.LineItem, IBatisNet.DataMapper.Test" />
+ <typeAlias alias="LineItemCollection" type="IBatisNet.DataMapper.Test.Domain.LineItemCollection, IBatisNet.DataMapper.Test" />
+ </alias>
+
+ <resultMap id="LineItem-Price" class="float">
+ <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="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#
+ <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="line-item-insert-params" >
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (?, ?, ?, ?, ?);
+ </statement>
+
+ <statement id="InsertLineItemWithPicture"
+ parameterMap="line-item-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, type=float#)
+ <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, type=float#)
+ </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, type=float#)
+ </insert>
+
+ <!-- JIRA 23 -->
+ <delete id="DeleteWithComments" >
+ <!-- Delete LineItems -->
+ delete from LineItems where Order_ID = 10;
+ <!-- Delete LineItems -->
+ </delete>
+
+ <parameterMap id="line-item-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="line-item-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="Blob" />
+ </parameterMap>
+
+</sqlMap> \ No newline at end of file
diff --git a/tests/unit/SQLMap/maps/MySql/Order.xml b/tests/unit/SQLMap/maps/MySql/Order.xml
new file mode 100644
index 00000000..2e4eb616
--- /dev/null
+++ b/tests/unit/SQLMap/maps/MySql/Order.xml
@@ -0,0 +1,468 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="Order">
+
+ <alias>
+ <typeAlias alias="Order" type="IBatisNet.DataMapper.Test.Domain.Order, IBatisNet.DataMapper.Test" />
+ </alias>
+
+ <!-- If the type is not specified, ADO.NET infers the
+ data provider Type of the Parameter from the Value property
+ of the Parameter object. -->
+
+
+ <resultMap id="credit-card-result" class="string">
+ <result property="value" column="Order_CardNumber"/>
+ </resultMap>
+ <!-- -->
+ <resultMap id="order-with-lines-result" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" lazyLoad="true" type="TList" column="Order_Id" select="GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-result-no-lazy-load" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" type="TList" column="Order_Id" select="GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-result-statement-namespaces" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" lazyLoad="true" type="TList" column="Order_Id" select="LineItem.GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-collection" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItems" column="Order_Id" lazyLoad="true"
+ select="GetLineItemsForOrderWithListClass" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-collection-no-lazy-load" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItems" column="Order_Id"
+ select="GetLineItemsForOrderWithListClass" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-array" class="Order"
+ extends="lite-order-result-by-name">
+ <result property="LineItemsArray" column="Order_Id" select="GetLineItemsForOrder"/>
+ </resultMap>
+
+ <resultMap id="lite-order-map-result" class="array">
+ <result property="Id" type="Int" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" type="string" column="Order_CardExpiry"/>
+ <result property="CardType" type="string" column="Order_CardType"/>
+ <result property="CardNumber" type="string" column="Order_CardNumber"/>
+ <result property="Street" type="string" column="Order_Street"/>
+ <result property="City" type="string" column="Order_City"/>
+ <result property="Province" type="string" column="Order_Province"/>
+ <result property="PostalCode" type="string" column="Order_PostalCode"/>
+ </resultMap>
+
+ <resultMap id="lite-order-result-by-name" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ </resultMap>
+
+ <resultMap id="order-hash" class="array">
+ <result property="Date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ </resultMap>
+
+ <resultMap id="order-with-types-result" class="Order">
+ <result property="Id" column="Order_Id" dbType="Int32"/>
+ <result property="Date" column="Order_Date" type="date" dbType="DateTime "/>
+ <result property="CardExpiry" column="Order_CardExpiry" dbType="VarChar"/>
+ <result property="CardType" column="Order_CardType" dbType="VarChar"/>
+ <result property="CardNumber" column="Order_CardNumber" dbType="VarChar"/>
+ <result property="Street" column="Order_Street" dbType="VarChar"/>
+ <result property="City" column="Order_City" dbType="VarChar"/>
+ <result property="Province" column="Order_Province" dbType="VarChar"/>
+ <result property="PostalCode" column="Order_PostalCode" dbType="VarChar"/>
+ </resultMap>
+
+ <resultMap id="lite-order-result-by-index" class="Order">
+ <result property="Id" column="Order_Id" columnIndex="0"/>
+ <result property="Date" column="Order_Date" type="date" columnIndex="1" />
+ <result property="CardExpiry" column="Order_CardExpiry" columnIndex="2"/>
+ <result property="CardType" column="Order_CardType" columnIndex="3" />
+ <result property="CardNumber" column="Order_CardNumber" columnIndex="4" />
+ <result property="Street" column="Order_Street" columnIndex="5" />
+ <result property="City" column="Order_City" columnIndex="6" />
+ <result property="Province" column="Order_Province" columnIndex="7"/>
+ <result property="PostalCode" column="Order_PostalCode" columnIndex="8" />
+ </resultMap>
+
+ <resultMap id="order-with-account-result" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="Account" column="Account_Id" select="GetAccountViaColumnName" />
+ </resultMap>
+
+ <resultMap id="order-with-collection-result" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="LineItemsList" column="Order_Id" select="GetLineItemsForOrder" />
+ <result property="LineItems" column="Order_Id" select="GetLineItemsForOrder" lazyLoad="false" />
+ </resultMap>
+
+ <resultMap id="order-with-favourite-line-item" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem"
+ column="Order_ID=Order_Id,LineItem_ID=Order_FavouriteLineItem"
+ select="GetSpecificLineItem" />
+ </resultMap>
+
+ <resultMap id="order-with-dyn-favourite-line-item" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem"
+ column="Order_ID=Order_Id,LineItem_ID=Order_FavouriteLineItem"
+ select="GetDynSpecificLineItem" />
+ </resultMap>
+
+ <resultMap id="order-joined-favourite" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem" resultMapping="LineItem" />
+ </resultMap>
+
+ <resultMap id="order-joined-favourite2" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem.Id" column="LineItem_Id"/>
+ <result property="FavouriteLineItem.Code" column="LineItem_Code"/>
+ <result property="FavouriteLineItem.Quantity" column="LineItem_Quantity"/>
+ <result property="FavouriteLineItem.Price" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="order-joined-with-account" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="Account" resultMapping="account-result-nullable-email" />
+ </resultMap>
+
+ <statement id="GetOrderLiteByColumnName"
+ parameterClass="integer"
+ resultMap="lite-order-result-by-name" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderByHashTable"
+ parameterClass="Int"
+ resultMap="order-hash" >
+ select Order_Date from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderLiteByColumnIndex"
+ parameterClass="Int"
+ resultMap="lite-order-result-by-index" >
+ select
+ Order_Id,
+ Order_Date,
+ Order_CardExpiry,
+ Order_CardType,
+ Order_CardNumber,
+ Order_Street,
+ Order_City,
+ Order_Province,
+ Order_PostalCode
+ from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithTypes"
+ parameterClass="Int"
+ resultMap="order-with-types-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItems"
+ parameterClass="Integer"
+ ListClass="TList"
+ resultMap="order-with-lines-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+
+ <statement id="GetOrderWithLineItemsNoLazyLoad"
+ parameterClass="Integer"
+ resultMap="order-with-lines-result-no-lazy-load" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemsUsingStatementNamespaces"
+ parameterClass="Integer"
+ resultMap="order-with-lines-result-statement-namespaces" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetAllOrderWithLineItems"
+ resultMap="order-with-lines-result" >
+ select * from Orders
+ </statement>
+
+ <statement id="GetOrderCardExpiryViaResultClass"
+ parameterClass="int"
+ resultClass="date">
+ select
+ Order_Date as 'datetime'
+ from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithAccount"
+ parameterClass="int"
+ resultMap="order-with-account-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemsCollection"
+ parameterClass="Integer"
+ resultMap="order-with-collection-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite"
+ parameterClass="Integer"
+ resultMap="order-joined-favourite" >
+ select * from Orders, LineItems
+ where Orders.Order_Id = LineItems.Order_Id
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite2"
+ parameterClass="Integer"
+ resultMap="order-joined-favourite2" >
+ select * from Orders, LineItems
+ where Orders.Order_Id = LineItems.Order_Id
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite3"
+ parameterClass="Integer"
+ resultClass="Order" >
+ select
+ Orders.Order_Id as Id,
+ Order_Date as Date,
+ Order_CardExpiry as CardExpiry,
+ Order_CardType as CardType,
+ Order_CardNumber as CardNumber,
+ Order_Street as Street,
+ Order_City as City,
+ Order_Province as Province,
+ Order_PostalCode as PostalCode,
+ LineItem_ID as "FavouriteLineItem.Id",
+ LineItem_Code as "FavouriteLineItem.Code",
+ LineItem_Quantity as "FavouriteLineItem.Quantity",
+ LineItem_Price as "FavouriteLineItem.Price"
+ from Orders, LineItems
+ where Orders.Order_Id = LineItems.Order_Id
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithFavouriteLineItem"
+ parameterClass="int"
+ resultMap="order-with-favourite-line-item" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemCollection"
+ parameterClass="int"
+ resultMap="order-with-lines-collection" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemCollectionNoLazy"
+ parameterClass="int"
+ resultMap="order-with-lines-collection-no-lazy-load" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderAsHastable"
+ parameterClass="Integer"
+ resultMap="lite-order-map-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemArray"
+ parameterClass="int"
+ resultMap="order-with-lines-array">
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetAllCreditCardNumbersFromOrders"
+ resultMap="credit-card-result" >
+ select distinct Order_CardNumber from Orders
+ order by Order_CardNumber
+ </statement>
+
+ <statement id="InsertOrderViaParameterMap"
+ parameterMap="order-insert-params-full" >
+ insert into Orders
+ (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ </statement>
+
+ <statement id="InsertOrderViaExtendParameterMap"
+ parameterMap="insert-extend" >
+ insert into Orders
+ (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ </statement>
+
+ <statement id="InsertOrderViaPublicFields">
+ insert into Orders
+ (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (#Id#, #Account.Id#, #Date#, #CardExpiry#, #CardType#, #CardNumber#, #Street#, #City#, #Province#, #PostalCode#)
+ </statement>
+
+ <select id="GetOrderWithDynFavouriteLineItem"
+ parameterClass="Integer"
+ resultMap="order-with-dyn-favourite-line-item">
+ select * from Orders where Order_Id = #value#
+ </select>
+
+ <select id="SelectOrderByDate"
+ parameterClass="array"
+ resultMap="lite-order-result-by-name">
+ select * from Orders where Order_Date = #Foo#
+ </select>
+
+ <select id="SelectOrderByDateDynamic"
+ parameterClass="array"
+ resultMap="lite-order-result-by-name">
+ select * from Orders
+ where 1=1
+ <isNotEmpty prepend="AND" property="Foo">
+ (Order_Date = '$Foo$')
+ </isNotEmpty>
+ </select>
+
+ <select id="GetAccountJIRA45"
+ parameterClass="int"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetOrderJoinWithAccount"
+ parameterClass="Integer"
+ resultMap="order-joined-with-account">
+ select
+ Order_Id,
+ Order_Date,
+ Order_CardExpiry,
+ Order_CardType,
+ Order_CardNumber,
+ Order_Street,
+ Order_City,
+ Order_Province,
+ Order_PostalCode,
+ acc.Account_ID,
+ acc.Account_FirstName,
+ acc.Account_LastName,
+ acc.Account_Email
+ from Orders as ord
+ LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
+ where Order_Id = #value#
+ </select>
+
+ <parameterMap id="order-insert-params-full">
+ <parameter property="Id" dbType="Int32"/>
+ <parameter property="Account.Id"/>
+ <parameter property="Date" nullValue="0001-01-01 00:00:00" />
+ <parameter property="CardExpiry" />
+ <parameter property="CardType" />
+ <parameter property="CardNumber" />
+ <parameter property="Street" />
+ <parameter property="City" />
+ <parameter property="Province" />
+ <parameter property="PostalCode" />
+ </parameterMap>
+
+ <parameterMap id="params-parent"> <!-- 1043181 support request -->
+ <parameter property="Id" dbType="Int32"/>
+ <parameter property="Account.Id"/>
+ <parameter property="Date" nullValue="0001-01-01 00:00:00" />
+ <parameter property="CardExpiry" />
+ <parameter property="CardType" />
+ <parameter property="CardNumber" />
+ <parameter property="Street" />
+ <parameter property="City" />
+ <parameter property="Province" />
+ <parameter property="PostalCode" />
+ </parameterMap>
+
+ <parameterMap id="insert-extend" extends="params-parent">
+ </parameterMap>
+
+</sqlMap> \ No newline at end of file
diff --git a/tests/unit/SQLMap/maps/MySql/Other.xml b/tests/unit/SQLMap/maps/MySql/Other.xml
new file mode 100644
index 00000000..ca9b7a33
--- /dev/null
+++ b/tests/unit/SQLMap/maps/MySql/Other.xml
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Other" >
+
+ <resultMap id="other-result" class="Other" >
+ <result property="Int" column="Other_Int"/>
+ <result property="Long" column="Other_Long"/>
+ <result property="Bool" column="Other_Bit"/>
+ <result property="Bool2" column="Other_String" typeHandler="OuiNonBool"/>
+ </resultMap>
+
+ <resultMap id="other-result-V1" class="Other" >
+ <result property="Int" column="Other_Int"/>
+ <result property="Long" column="Other_Long"/>
+ <result property="Bool" column="Other_Bit"/>
+ <result property="Bool2" column="Other_String" />
+ </resultMap>
+
+ <resultMap id="A-result" class="A" >
+ <result property="Id" column="A_ID"/>
+ <result property="Libelle" column="A_Libelle"/>
+ <result property="B" resultMapping="B-result"/>
+ <result property="E" resultMapping="E-result"/>
+ <result property="F" resultMapping="F-result"/>
+ </resultMap>
+
+ <resultMap id="B-result" class="B" >
+ <result property="Id" column="B_ID"/>
+ <result property="Libelle" column="B_Libelle"/>
+ <result property="C" resultMapping="C-result"/>
+ <result property="D" resultMapping="D-result"/>
+ </resultMap>
+
+ <resultMap id="C-result" class="C" >
+ <result property="Id" column="C_ID"/>
+ <result property="Libelle" column="C_Libelle"/>
+ </resultMap>
+
+ <resultMap id="D-result" class="D" >
+ <result property="Id" column="D_ID"/>
+ <result property="Libelle" column="D_Libelle"/>
+ </resultMap>
+
+ <resultMap id="E-result" class="E" >
+ <result property="Id" column="E_ID"/>
+ <result property="Libelle" column="E_Libelle"/>
+ </resultMap>
+
+ <resultMap id="F-result" class="F" >
+ <result property="Id" column="F_ID"/>
+ <result property="Libelle" column="F_Libelle"/>
+ </resultMap>
+
+ <select id="SelectComplexJoined" resultMap="A-result">
+ SELECT
+ A.Id AS A_ID,
+ A.A_Libelle AS A_Libelle,
+ B.ID AS B_ID,
+ B.B_Libelle AS B_Libelle,
+ C.ID AS C_ID,
+ C.C_Libelle AS C_Libelle,
+ D.ID AS D_ID,
+ D.D_Libelle AS D_Libelle,
+ E.ID AS E_ID,
+ E.E_Libelle AS E_Libelle,
+ F.ID AS F_ID,
+ F.F_Libelle AS F_Libelle
+ FROM A
+ LEFT OUTER JOIN B ON A.B_ID = B.ID
+ LEFT OUTER JOIN C ON B.C_ID = C.ID
+ LEFT OUTER JOIN D ON B.D_ID = D.ID
+ LEFT OUTER JOIN E ON A.E_ID = E.ID
+ LEFT OUTER JOIN F ON A.F_ID = F.ID
+ </select>
+
+
+ <statement id="DynamicSelectByIntLong"
+ parameterClass="Hashtable"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ <dynamic prepend="WHERE">
+ <isNotEqual prepend="AND" property="year" compareValue="0">
+ Other_Int = #year#
+ </isNotEqual>
+
+ <isNotEqual prepend="AND" property="areaid" compareValue="0">
+ Other_Long = #areaid#
+ </isNotEqual>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicSelectByBool"
+ parameterClass="Other"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Bit = #Bool#
+ </statement>
+
+ <statement id="InsertBool"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, 'Yes')
+ </statement>
+
+ <statement id="InsertCustomTypeHandler"
+ parameterMap="other-insert-params">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( ?, ?, ?, ?)
+ </statement>
+
+ <statement id="SelectByInt"
+ parameterClass="int"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Int = #value#
+ </statement>
+
+ <statement id="SelectByIntV1"
+ parameterClass="int"
+ resultMap="other-result-V1">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Int = #value#
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,type=bool,dbType=Varchar#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,typeHandler=OuiNonBool#)
+ </statement>
+
+ <parameterMap id="other-insert-params">
+ <parameter property="Int" />
+ <parameter property="Long" />
+ <parameter property="Bool" />
+ <parameter property="Bool2" typeHandler="OuiNonBool"/>
+ </parameterMap>
+</sqlMap>
diff --git a/tests/unit/SQLMap/maps/MySql/ResultClass.xml b/tests/unit/SQLMap/maps/MySql/ResultClass.xml
new file mode 100644
index 00000000..3d44ec98
--- /dev/null
+++ b/tests/unit/SQLMap/maps/MySql/ResultClass.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="ResultClass" >
+
+ <statement id="GetBoolean"
+ parameterClass="Int"
+ resultClass="bool" >
+ select 1 from Orders where Order_ID = #dummy#
+ </statement>
+ <statement id="GetBooleanWithoutResultClass"
+ parameterClass="Int"
+ extends="GetBoolean">
+ </statement>
+
+ <statement id="GetByte"
+ parameterClass="Int"
+ resultClass="string" >
+ select 155 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetByteWithoutResultClass"
+ parameterClass="Int"
+ extends="GetByte">
+ </statement>
+
+ <!--
+ NOTE: Use MySql 4.0.2 or higher for "cast"
+ -->
+ <statement id="GetChar"
+ parameterClass="Int"
+ resultClass="string" >
+ select cast('a' as char) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetCharWithoutResultClass"
+ parameterClass="Int"
+ extends="GetChar">
+ </statement>
+
+ <statement id="GetDate"
+ parameterClass="Int"
+ resultClass="TDateTime" >
+ select '2003-02-15 8:15:00' as datetime from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetDateWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDate">
+ </statement>
+
+ <statement id="GetDecimal"
+ parameterClass="Int"
+ resultClass="float" >
+ select 1.56 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetDecimalWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDecimal">
+ </statement>
+
+ <statement id="GetDouble"
+ parameterClass="Int"
+ resultClass="float" >
+ select 99.5 from Orders where Order_ID= #value#
+ </statement>
+ <statement id="GetDoubleWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDouble">
+ </statement>
+
+ <!--
+ Use binary for cast for MySql
+ -->
+ <statement id="GetGuid"
+ parameterClass="Int"
+ resultClass="guid" >
+ select cast('CD5ABF17-4BBC-4C86-92F1-257735414CF4' as binary) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetGuidWithoutResultClass" parameterClass="Int" extends="GetGuid">
+ </statement>
+
+ <statement id="GetInt16"
+ parameterClass="Int"
+ resultClass="int" >
+ select 32111 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt16WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt16">
+ </statement>
+
+ <statement id="GetInt32"
+ parameterClass="Int"
+ resultClass="int" >
+ select 999999 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt32WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt32">
+ </statement>
+
+ <statement id="GetInt64"
+ parameterClass="Int"
+ resultClass="double" >
+ select 9223372036854775800 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt64WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt64">
+ </statement>
+
+ <statement id="GetSingle"
+ parameterClass="Int"
+ resultClass="float" >
+ select 92233.5 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetSingleWithoutResultClass"
+ parameterClass="Int"
+ extends="GetSingle">
+ </statement>
+
+ <statement id="GetString"
+ parameterClass="Int"
+ resultClass="string" >
+ select 'VISA'
+ from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetStringWithoutResultClass"
+ parameterClass="Int"
+ extends="GetString">
+ </statement>
+
+</sqlMap> \ No newline at end of file