Author: rgrabowski
Date: Wed Sep 21 07:04:39 2005
New Revision: 290702
URL: http://svn.apache.org/viewcvs?rev=290702&view=rev
Log:
Applied patch files supplied by David Marzo to fix IBATISNET-106. The Access
tests may need another round of small upgrades before they're in sync with the
rest of tests.
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Document.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Order.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Other.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/ResultClass.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Access/other-init.sql
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Account.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Account.xml?rev=290702&r1=290701&r2=290702&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Account.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Account.xml
Wed Sep 21 07:04:39 2005
@@ -107,6 +107,12 @@
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="GetAccountAsHashtableResultClass"
parameterClass="int"
resultClass="HashMap">
@@ -228,6 +234,15 @@
from Accounts
where Account_ID = #value#
</select>
+
+ <select id="GetAccountJIRA45" parameterClass="int"
resultMap="Account.indexed-account-result">
+ select Account_ID,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_ID = #value#
+ </select>
<select id="GetEmailAddressViaResultMap"
parameterClass="int"
@@ -326,6 +341,7 @@
)
</insert>
+
<!-- Inline Parameters -->
<update id="UpdateAccountViaInlineParameters"
parameterClass="Account">
@@ -398,6 +414,29 @@
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="account-result">
@@ -412,7 +451,13 @@
Account_FirstName = #FirstName# and
Account_LastName = #LastName# and
Account_ID = #Id#
- </select>
+ </select>
+
+ <select id="GetAllAccountsViaCustomTypeHandler"
+ resultMap="account-result">
+ select * from Accounts
+ order by Account_ID
+ </select>
<!-- For procedure, the parameters of the parameterMap must in
the same order
as for the procedure paramaters-->
@@ -430,6 +475,7 @@
============================================= -->
<parameterMaps>
+
<parameterMap id="swap-params">
<parameter property="email1" column="First_Email" />
<parameter property="email2" column="Second_Email" />
@@ -459,4 +505,4 @@
</parameterMaps>
-</sqlMap>
\ No newline at end of file
+</sqlMap>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Document.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Document.xml?rev=290702&r1=290701&r2=290702&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Document.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Document.xml
Wed Sep 21 07:04:39 2005
@@ -7,24 +7,26 @@
<typeAlias alias="Book"
type="IBatisNet.DataMapper.Test.Domain.Book, IBatisNet.DataMapper.Test" />
<typeAlias alias="Newspaper"
type="IBatisNet.DataMapper.Test.Domain.Newspaper, IBatisNet.DataMapper.Test" />
<typeAlias alias="DocumentCollection"
type="IBatisNet.DataMapper.Test.Domain.DocumentCollection,
IBatisNet.DataMapper.Test" />
+ <typeAlias alias="CustomInheritance"
type="IBatisNet.DataMapper.Test.Domain.CustomInheritance,IBatisNet.DataMapper.Test"/>
</alias>
<resultMaps>
<resultMap id="document" class="Document">
<result property="Id"
column="Document_ID"/>
<result property="Title"
column="Document_Title"/>
- <discriminator column="Document_Type" />
+ <discriminator column="Document_Type" type="string" />
<subMap value="Book" resultMapping="book" />
<subMap value="Newspaper" resultMapping="newspaper" />
</resultMap>
- <!-- <resultMap id="document-custom-formula" class="Document">
- <result property="Id"
column="Document_ID"/>
- <result property="Title"
column="Document_Title"/>
- <discriminator formula="MyFormula" />
+ <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>
+
<resultMap id="book" class="Book" extends="document">
<result property="PageNumber"
column="Document_PageNumber"/>
@@ -55,15 +57,14 @@
order by Document_Type, Document_Id
</select>
- <statement id="GetAllDocumentWithFormula"
- resultMap="document-custom-formula">
+ <select id="GetAllDocumentWithCustomTypeHandler"
resultMap="document-custom-handler">
select
- *
- from Documents
+ *
+ from Documents
order by Document_Type, Document_Id
- </statement>
+ </select>
</statements>
-</sqlMap>
\ No newline at end of file
+</sqlMap>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Order.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Order.xml?rev=290702&r1=290701&r2=290702&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Order.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Order.xml
Wed Sep 21 07:04:39 2005
@@ -153,6 +153,23 @@
<result property="FavouriteLineItem"
resultMapping="LineItem.LineItem" />
</resultMap>
+ <resultMap id="order-joined-with-account" class="Order">
+ <result property="Id" column="Order_ID"/>
+ <result property="Date" column="Order_Date"
nullValue="01/01/0001 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.account-result-nullable-email"/>
+ </resultMap>
+
+ <resultMap id="order-hash" class="Hashtable">
+ <result property="Date" column="Order_Date"
nullValue="01/01/0001 00:00:00"/>
+ </resultMap>
+
</resultMaps>
<statements>
@@ -184,6 +201,10 @@
select * from Orders where Order_ID = #value#
</statement>
+ <statement id="GetOrderByHashTable" parameterClass="Integer"
resultMap="order-hash" >
+ select Order_Date from Orders where Order_ID = #value#
+ </statement>
+
<statement id="GetOrderWithLineItems"
parameterClass="Integer"
resultMap="order-with-lines-result" >
@@ -289,6 +310,38 @@
select * from Orders where Order_ID = #value#
</select>
+ <select id="SelectOrderByDate" parameterClass="Hashtable"
resultMap="lite-order-result-by-name">
+ select * from Orders where Order_Date = #Foo#
+ </select>
+
+ <select id="SelectOrderByDateDynamic"
parameterClass="Hashtable" resultMap="lite-order-result-by-name">
+ select * from Orders
+ where 1=1
+ <isNotEmpty prepend="AND" property="Foo">
+ (Order_Date = '$Foo$')
+ </isNotEmpty>
+ </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>
+
</statements>
<parameterMaps>
@@ -324,4 +377,4 @@
</parameterMaps>
-</sqlMap>
\ No newline at end of file
+</sqlMap>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Other.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Other.xml?rev=290702&r1=290701&r2=290702&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Other.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Other.xml
Wed Sep 21 07:04:39 2005
@@ -1,26 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
-<sqlMap namespace="Other" xmlns="http://ibatis.apache.org/mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibatis.apache.org
-http://ibatis.apache.org/xsd/SqlMap.xsd">
+<sqlMap namespace="Other"
+xmlns="http://ibatis.apache.org/mapping"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<alias>
<typeAlias alias="Other"
type="IBatisNet.DataMapper.Test.Domain.Other, IBatisNet.DataMapper.Test"/>
- </alias>
+ <typeAlias alias="A" type="IBatisNet.DataMapper.Test.Domain.A,
IBatisNet.DataMapper.Test"/>
+ <typeAlias alias="B" type="IBatisNet.DataMapper.Test.Domain.B,
IBatisNet.DataMapper.Test"/>
+ <typeAlias alias="C" type="IBatisNet.DataMapper.Test.Domain.C,
IBatisNet.DataMapper.Test"/>
+ <typeAlias alias="D" type="IBatisNet.DataMapper.Test.Domain.D,
IBatisNet.DataMapper.Test"/>
+ <typeAlias alias="E" type="IBatisNet.DataMapper.Test.Domain.E,
IBatisNet.DataMapper.Test"/>
+ <typeAlias alias="F" type="IBatisNet.DataMapper.Test.Domain.F,
IBatisNet.DataMapper.Test"/>
+
+ </alias>
<resultMaps>
<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="Other.B-result"/>
+ <result property="E"
resultMapping="Other.E-result"/>
+ <result property="F"
resultMapping="Other.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="Other.C-result"/>
+ <result property="D"
resultMapping="Other.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>
</resultMaps>
<statements>
+ <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_Long,
+ Other_Bit,
+ Other_String
from Others
<dynamic prepend="WHERE">
<isNotEqual prepend="AND" property="year"
compareValue="0">
@@ -33,6 +101,55 @@
</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="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>
+
</statements>
-
+
+ <parameterMaps>
+ <parameterMap id="insert-params">
+ <parameter property="Int" />
+ <parameter property="Long" />
+ <parameter property="Bool" />
+ <parameter property="Bool2" typeHandler="OuiNonBool"/>
+ </parameterMap>
+ </parameterMaps>
+
</sqlMap>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/ResultClass.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/ResultClass.xml?rev=290702&r1=290701&r2=290702&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/ResultClass.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/ResultClass.xml
Wed Sep 21 07:04:39 2005
@@ -48,15 +48,9 @@
select CDbl(99.5) from Orders where Order_ID= #value#
</statement>
- <!--
- System.InvalidCastException
- No cast function in Access SQL syntax
- -->
- <statement id="GetGuid"
- parameterClass="Int"
- resultClass="guid" >
- select CONVERT(UNIQUEIDENTIFIER,
'CD5ABF17-4BBC-4C86-92F1-257735414CF4') from Orders where Order_ID = #value#
- </statement>
+ <statement id="GetGuid" parameterClass="Int" resultClass="guid"
>
+ select {CD5ABF17-4BBC-4C86-92F1-257735414CF4} from
Orders where Order_ID = #value#
+ </statement>
<statement id="GetInt16"
parameterClass="Int"
@@ -93,4 +87,4 @@
</statement>
</statements>
-</sqlMap>
\ No newline at end of file
+</sqlMap>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Access/other-init.sql
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Access/other-init.sql?rev=290702&r1=290701&r2=290702&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Access/other-init.sql
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Access/other-init.sql
Wed Sep 21 07:04:39 2005
@@ -2,9 +2,11 @@
create table OTHERS
(
- OTHER_INT long,
- OTHER_LONG decimal
+ OTHER_INT long,
+ OTHER_LONG decimal,
+ OTHER_BIT YESNO,
+ OTHER_STRING text(32)
);
-INSERT INTO Others VALUES(1, 8888888);
-INSERT INTO Others VALUES(2, 9999999999);
\ No newline at end of file
+INSERT INTO Others VALUES(1, 8888888, false, 'Oui');
+INSERT INTO Others VALUES(2, 9999999999,true, 'Non');