You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by gb...@apache.org on 2006/07/19 21:18:59 UTC
svn commit: r423574 - in /ibatis/trunk/cs/mapper: IBatisNet.DataMapper.Test/
IBatisNet.DataMapper.Test/Domain/
IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/
IBatisNet.DataMapper.Test/NUnit/SqlMapTests/
IBatisNet.DataMapper/Configuration/
Author: gbayon
Date: Wed Jul 19 12:18:58 2006
New Revision: 423574
URL: http://svn.apache.org/viewvc?rev=423574&view=rev
Log:
Fixed IBATISNET-168
Added:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Query.cs (with props)
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/DynamicAccount.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/DynamicPrependTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Query.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Query.cs?rev=423574&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Query.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Query.cs Wed Jul 19 12:18:58 2006
@@ -0,0 +1,18 @@
+namespace IBatisNet.DataMapper.Test.Domain
+{
+ /// <summary>
+ /// Summary description for Query.
+ /// </summary>
+ public class Query
+ {
+ private object _dataObject;
+
+ public object DataObject
+ {
+ get{return _dataObject; }
+ set { _dataObject = value;}
+ }
+
+ }
+}
+
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Query.cs
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Query.cs
------------------------------------------------------------------------------
svn:keywords = Id LastChangedDate LastChangedBy
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj?rev=423574&r1=423573&r2=423574&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj Wed Jul 19 12:18:58 2006
@@ -174,6 +174,7 @@
<Compile Include="Domain\OuiNonBoolTypeHandlerCallback.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Domain\Query.cs" />
<Compile Include="Domain\Sample.cs">
<SubType>Code</SubType>
</Compile>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj?rev=423574&r1=423573&r2=423574&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj Wed Jul 19 12:18:58 2006
@@ -318,6 +318,11 @@
BuildAction = "Compile"
/>
<File
+ RelPath = "Domain\Query.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "Domain\Sample.cs"
SubType = "Code"
BuildAction = "Compile"
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/DynamicAccount.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/DynamicAccount.xml?rev=423574&r1=423573&r2=423574&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/DynamicAccount.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/DynamicAccount.xml Wed Jul 19 12:18:58 2006
@@ -5,10 +5,35 @@
<alias>
<typeAlias alias="Search" type="IBatisNet.DataMapper.Test.Domain.Search, IBatisNet.DataMapper.Test"/>
+ <typeAlias alias="Query" type="IBatisNet.DataMapper.Test.Domain.Query, IBatisNet.DataMapper.Test"/>
</alias>
<statements>
+ <statement id="DynamicJIRA168"
+ parameterClass="Query"
+ 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="DataObject.Id" >
+ Account_ID = #DataObject.Id#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="DataObject.FirstName" >
+ Account_FirstName = #DataObject.FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="DataObject.LastName" >
+ Account_LastName = #DataObject.LastName#
+ </isNotEmpty>
+ </isParameterPresent>
+ </dynamic>
+ </statement>
+
<!-- IBATISNET-114: remapResults -->
<statement id="DynamicSqlOnColumnSelection"
parameterClass="Account"
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/DynamicPrependTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/DynamicPrependTest.cs?rev=423574&r1=423573&r2=423574&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/DynamicPrependTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/DynamicPrependTest.cs Wed Jul 19 12:18:58 2006
@@ -45,6 +45,22 @@
#region Dynamic Prepend tests
/// <summary>
+ /// Test Dynamic With Prepend (1)
+ /// </summary>
+ [Test]
+ public void TestDynamicJIRA168()
+ {
+ Query query = new Query();
+ Account account = new Account();
+ account.Id = 1;
+ query.DataObject = account;
+
+ account = (Account) sqlMap.QueryForObject("DynamicJIRA168", query);
+
+ AssertAccount1(account);
+ }
+
+ /// <summary>
/// Test Iterate With Prepend (1)
/// </summary>
[Test]
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs?rev=423574&r1=423573&r2=423574&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs Wed Jul 19 12:18:58 2006
@@ -1439,6 +1439,11 @@
DynamicSql dynamic = new DynamicSql( _configScope, statement );
StringBuilder sqlBuffer = new StringBuilder();
+ if (statement.Id=="DynamicJIRA")
+ {
+ Console.Write("tt");
+ }
+
_configScope.ErrorContext.MoreInfo = "process the Sql statement";
// Resolve "extend" attribute on Statement
@@ -1504,7 +1509,7 @@
}
else
{
- sqlText = _paramParser.ParseInlineParameterMap(_configScope, statement, data );
+ sqlText = _paramParser.ParseInlineParameterMap(_configScope, null, data );
}
dynamic.AddChild(sqlText);