diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-25 17:55:51 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-25 17:55:51 +0100 |
commit | a3388622287e218beddfa14a47ed677d4307b36b (patch) | |
tree | 1b4c7ac8597b1cc798b6683d4a81c90d38de12f6 /tests/unit/Data/SqlMap/maps/mssql | |
parent | c7fd3e1167b6f2fa7746edbd0fb8f8c1694c61f9 (diff) |
Removed simpletest and moved all tests in the unit tree
Tests are executed now, but a lot of them need fixing.
Diffstat (limited to 'tests/unit/Data/SqlMap/maps/mssql')
-rw-r--r-- | tests/unit/Data/SqlMap/maps/mssql/Account.xml | 606 | ||||
-rw-r--r-- | tests/unit/Data/SqlMap/maps/mssql/Category.xml | 171 | ||||
-rw-r--r-- | tests/unit/Data/SqlMap/maps/mssql/Complex.xml | 21 | ||||
-rw-r--r-- | tests/unit/Data/SqlMap/maps/mssql/Document.xml | 53 | ||||
-rw-r--r-- | tests/unit/Data/SqlMap/maps/mssql/DynamicAccount.xml | 438 | ||||
-rw-r--r-- | tests/unit/Data/SqlMap/maps/mssql/Enumeration.xml | 47 | ||||
-rw-r--r-- | tests/unit/Data/SqlMap/maps/mssql/LineItem.xml | 182 | ||||
-rw-r--r-- | tests/unit/Data/SqlMap/maps/mssql/Order.xml | 475 | ||||
-rw-r--r-- | tests/unit/Data/SqlMap/maps/mssql/Other.xml | 171 | ||||
-rw-r--r-- | tests/unit/Data/SqlMap/maps/mssql/ResultClass.xml | 125 |
10 files changed, 2289 insertions, 0 deletions
diff --git a/tests/unit/Data/SqlMap/maps/mssql/Account.xml b/tests/unit/Data/SqlMap/maps/mssql/Account.xml new file mode 100644 index 00000000..8149d228 --- /dev/null +++ b/tests/unit/Data/SqlMap/maps/mssql/Account.xml @@ -0,0 +1,606 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<sqlMap namespace="Account"> + + + <cacheModel id="account-cache" implementation="LRU" > + <flushInterval hours="24"/> + <flushOnExecute statement="UpdateAccountViaInlineParameters"/> + <flushOnExecute statement="UpdateAccountViaParameterMap"/> + <property id="CacheSize" value="50"/> + </cacheModel> + + + <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="array" > + select top $MaximumAllowed$ * 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 + </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="GetAccountAsarray" + 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="GetAccountAsarrayResultClass" + parameterClass="int" + resultClass="HashMap"> + 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="GetAllAccountsAsarrayViaResultClass" + 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="indexed-account-result"> + select * from Accounts + where Account_Email $value$ '%@%' + order by Account_ID + </select> + + <select id="SimpleDynamicSubstitution" + parameterClass="array" + 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, 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, 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, type=integer# + and Account_ID = #Id, type=integer# + </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="array" + 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="array" + 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"> + <![CDATA[ + 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"> + <![CDATA[SELECT * ]]> + <![CDATA[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> + + <!-- 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> + + <procedure id="GetAccountViaSP" parameterMap="select-params" resultClass="Account"> + ps_SelectAccount + </procedure> + +<!-- ============================================= + OPTIONAL EXPLICIT PARAMETER MAP +============================================= --> + + <parameterMap id="swap-params"> + <parameter property="email1" column="First_Email" /> + <parameter property="email2" column="Second_Email" /> + </parameterMap> + + <parameterMap id="select-params"> + <parameter property="Account_ID" /> + </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> + + + <!-- 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> + + <select id="GetAccountAsHashtable" + parameterClass="Integer" + resultMap="account-hashtable-result"> + select * + from Accounts + where Account_Id = #value# + </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> + +</sqlMap>
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/maps/mssql/Category.xml b/tests/unit/Data/SqlMap/maps/mssql/Category.xml new file mode 100644 index 00000000..6756f1fa --- /dev/null +++ b/tests/unit/Data/SqlMap/maps/mssql/Category.xml @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="utf-8"?> +<sqlMap namespace="Category" > + + + <select id="GetCategory" parameterClass="Integer" resultClass="Category"> + select + Category_ID as Id, + Category_Name as Name, + Category_Guid as Guid + from Categories + where Category_ID = #value# + </select> + + + <!-- Test for statement as insert --> + <statement id="InsertCategory" parameterClass="Category" resultClass="int"> + insert into Categories + (Category_Name, Category_Guid) + values + (#Name#, #Guid:UniqueIdentifier#); + select SCOPE_IDENTITY() as value + </statement><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc --> + + <!-- Test for Guid Parameter Class--> + <statement id="InsertCategoryGuidParameterClass" parameterClass="Guid" resultClass="int"> + insert into Categories + (Category_Name, Category_Guid) + values + ('toto', #value:UniqueIdentifier#); + select SCOPE_IDENTITY() as value + </statement><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc --> + + <!-- JIRA 20 Test without specifying the dbtype--> + <statement id="InsertCategoryGuidParameterClassJIRA20" parameterClass="Guid" resultClass="int"> + insert into Categories + (Category_Name, Category_Guid) + values + ('toto', #value#); + select SCOPE_IDENTITY() as value + </statement> + + <insert id="InsertCategoryViaInsertStatement" parameterClass="Category" > + <selectKey property="Id" type="post" resultClass="int"> + ${selectKey} + </selectKey> + insert into Categories + (Category_Name, Category_Guid) + values + (#Name#, #Guid:UniqueIdentifier#) + </insert><!--Guid for Oledb, UniqueIdentifier for SqlClient, Odbc --> + + <insert id="InsertCategoryWithProperties" parameterClass="Category" > + <selectKey property="Id" type="post" resultClass="int"> + ${selectKey} + </selectKey> + insert into Categories + (Category_Name, Category_Guid) + values + (${MyCategoryName}, #Guid:UniqueIdentifier#) + </insert> + + <statement id="InsertCategoryViaParameterMap" parameterMap="InsertParam" resultClass="int"> + insert into Categories + (Category_Name, Category_Guid) + values + (?,?); + select SCOPE_IDENTITY() as value + </statement> + + <statement id="InsertCategoryNull" parameterMap="insert-null-params" resultClass="int"> + insert into Categories + (Category_Name, Category_Guid) + values + (?,?); + select SCOPE_IDENTITY() as value + </statement> + + <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 @@IDENTITY 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=#Guid:UniqueIdentifier# + </isNotEqual> + </dynamic> + </statement> + + <parameterMap id="category-insert-params"> + <parameter property="Id" column="Category_Id" dbType="Int" /><!-- Int for SqlClient, Obdc; Integer for Oledb --> + <parameter property="Name" column="Category_Name"/> + <parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc --> + </parameterMap> + + <parameterMap id="InsertParam"> + <parameter property="Name" column="Category_Name"/> + <parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc --> + </parameterMap> + + <parameterMap id="insert-null-params"> + <parameter property="Name" column="Category_Name"/> + <parameter property="Guid" column="Category_Guid" nullValue="00000000-0000-0000-0000-000000000000" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc --> + </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="Guid" column="Category_Guid" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc --> + </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="Guid" column="Category_Guid" dbType="UniqueIdentifier"/> + </parameterMap> + + +</sqlMap> diff --git a/tests/unit/Data/SqlMap/maps/mssql/Complex.xml b/tests/unit/Data/SqlMap/maps/mssql/Complex.xml new file mode 100644 index 00000000..91b346ca --- /dev/null +++ b/tests/unit/Data/SqlMap/maps/mssql/Complex.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8" ?> +<sqlMap namespace="Category" > + + + <statement id="ComplexMap" + resultClass="int" > + select Account_ID from Accounts where Account_ID = #obj.Map.Id# + </statement> + + <insert id="InsertComplexAccountViaInlineDefaultNull" + parameterClass="array" > + 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> + + + +</sqlMap> diff --git a/tests/unit/Data/SqlMap/maps/mssql/Document.xml b/tests/unit/Data/SqlMap/maps/mssql/Document.xml new file mode 100644 index 00000000..de02c1ab --- /dev/null +++ b/tests/unit/Data/SqlMap/maps/mssql/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> + + <select id="GetAllDocument" + resultMap="document"> + select + * + from Documents + order by Document_Type, Document_ID + </select> + + <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/Data/SqlMap/maps/mssql/DynamicAccount.xml b/tests/unit/Data/SqlMap/maps/mssql/DynamicAccount.xml new file mode 100644 index 00000000..492cd0c8 --- /dev/null +++ b/tests/unit/Data/SqlMap/maps/mssql/DynamicAccount.xml @@ -0,0 +1,438 @@ +<?xml version="1.0" encoding="utf-8" ?> +<sqlMap namespace="Account" > + <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> +</sqlMap>
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/maps/mssql/Enumeration.xml b/tests/unit/Data/SqlMap/maps/mssql/Enumeration.xml new file mode 100644 index 00000000..c010a8eb --- /dev/null +++ b/tests/unit/Data/SqlMap/maps/mssql/Enumeration.xml @@ -0,0 +1,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> diff --git a/tests/unit/Data/SqlMap/maps/mssql/LineItem.xml b/tests/unit/Data/SqlMap/maps/mssql/LineItem.xml new file mode 100644 index 00000000..33cb9294 --- /dev/null +++ b/tests/unit/Data/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 diff --git a/tests/unit/Data/SqlMap/maps/mssql/Order.xml b/tests/unit/Data/SqlMap/maps/mssql/Order.xml new file mode 100644 index 00000000..87a2d1a0 --- /dev/null +++ b/tests/unit/Data/SqlMap/maps/mssql/Order.xml @@ -0,0 +1,475 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<sqlMap namespace="Order" > + + + <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" 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" 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" 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-with-types-result" class="Order"> + <result property="Id" column="Order_ID" dbType="Int"/><!-- Int for SqlClient, Obdc; Integer for Oledb --> + <result property="Date" type="date" column="Order_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" type="date" column="Order_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-sp-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=Account_ID" select="GetAccountViaSP" /> + </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" 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" 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" 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" + 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> + + <resultMap id="order-hash" class="array"> + <result property="Date" column="Order_Date" nullValue="0001-01-01 00:00:00"/> + </resultMap> + + <statement id="GetOrderByHashTable" + parameterClass="Int" + resultMap="order-hash" > + select Order_Date from Orders where Order_ID = #value# + </statement> + + <statement id="GetOrderLiteByColumnName" + parameterClass="Int" + resultMap="lite-order-result-by-name" > + select * 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" + resultMap="order-with-lines-result" > + 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" + parameterClass="Integer" + 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="GetOrderWithAccountViaSP" + parameterClass="int" + resultMap="order-with-sp-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="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" > + 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"> + <parameter property="Id" dbType="Int"/> <!-- Int for SqlClient, Obdc; Integer for Oledb --> + <parameter property="Account.Id" type="integer"/> + <parameter property="Date" type="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="Int"/> + <parameter property="Account.Id"/> + <parameter property="Date" type="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> + + <statement id="GetOrderWithLineItemsNoLazyLoad" + parameterClass="Integer" + resultMap="order-with-lines-result-no-lazy-load" > + select * from Orders where Order_ID = #value# + </statement> + + <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> + + <statement id="GetOrderWithLineItemCollectionNoLazy" + parameterClass="int" + resultMap="order-with-lines-collection-no-lazy-load" > + select * from Orders where Order_ID = #value# + </statement> + + <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> + +</sqlMap>
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/maps/mssql/Other.xml b/tests/unit/Data/SqlMap/maps/mssql/Other.xml new file mode 100644 index 00000000..5d64f357 --- /dev/null +++ b/tests/unit/Data/SqlMap/maps/mssql/Other.xml @@ -0,0 +1,171 @@ +<?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="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="array" + 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="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> + + + <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> + + + <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> + +</sqlMap> diff --git a/tests/unit/Data/SqlMap/maps/mssql/ResultClass.xml b/tests/unit/Data/SqlMap/maps/mssql/ResultClass.xml new file mode 100644 index 00000000..ac705ac1 --- /dev/null +++ b/tests/unit/Data/SqlMap/maps/mssql/ResultClass.xml @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<sqlMap namespace="ResultClass" > + + <statement id="GetBoolean" + parameterClass="Int" + resultClass="bool" > + select cast(1 as bit) from Orders where Order_ID = #dummy# + </statement> + <statement id="GetBooleanWithoutResultClass" + parameterClass="Int" + extends="GetBoolean"> + </statement> + + <statement id="GetByte" + parameterClass="Int" + resultClass="int" > + select cast(155 as tinyint) from Orders where Order_ID = #value# + </statement> + <statement id="GetByteWithoutResultClass" + parameterClass="Int" + extends="GetByte"> + </statement> + + <statement id="GetChar" + parameterClass="Int" + resultClass="string" > + select cast('a' as char) from Orders where Order_ID = #value# + </statement> + <!-- SQL Server provider doesn't know char type, the resultClass type must be specified --> + <statement id="GetCharWithoutResultClass" + parameterClass="Int" resultClass="string" + extends="GetChar"> + </statement> + + <statement id="GetDate" + parameterClass="Int" + resultClass="date" > + select cast('2003-02-15 8:15:00' as datetime) as datetime from Orders where Order_ID = #value# + </statement> + <statement id="GetDateWithoutResultClass" + parameterClass="Int" + extends="GetDate"> + </statement> + + <statement id="GetDecimal" + parameterClass="Int" + resultClass="decimal" > + select cast(1.56 as decimal(9,2)) from Orders where Order_ID = #value# + </statement> + <statement id="GetDecimalWithoutResultClass" + parameterClass="Int" + extends="GetDecimal"> + </statement> + + <statement id="GetDouble" + parameterClass="Int" + resultClass="double" > + select cast(99.5 as float) from Orders where Order_ID= #value# + </statement> + <statement id="GetDoubleWithoutResultClass" + parameterClass="Int" + extends="GetDouble"> + </statement> + + <statement id="GetGuid" + parameterClass="Int" + resultClass="guid" > + select cast('CD5ABF17-4BBC-4C86-92F1-257735414CF4' as UniqueIdentifier) from Orders where Order_ID = #value# + </statement> + <statement id="GetGuidWithoutResultClass" parameterClass="Int" extends="GetGuid"> + </statement> + + <statement id="GetInt16" + parameterClass="Int" + resultClass="integer" > + select cast(32111 as SmallInt) from Orders where Order_ID = #value# + </statement> + <statement id="GetInt16WithoutResultClass" + parameterClass="Int" + extends="GetInt16"> + </statement> + + <statement id="GetInt32" + parameterClass="Int" + resultClass="int" > + select cast(999999 as int) from Orders where Order_ID = #value# + </statement> + <statement id="GetInt32WithoutResultClass" + parameterClass="Int" + extends="GetInt32"> + </statement> + + <statement id="GetInt64" + parameterClass="Int" + resultClass="float" > + select cast(9223372036854775800 as bigint) from Orders where Order_ID = #value# + </statement> + <statement id="GetInt64WithoutResultClass" + parameterClass="Int" + extends="GetInt64"> + </statement> + + <statement id="GetSingle" + parameterClass="Int" + resultClass="float" > + select cast(92233.5 as real) 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 |