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/09/13 20:38:30 UTC
svn commit: r443064 - in /ibatis/trunk/cs/mapper: IBatisNet.Common/
IBatisNet.DataMapper.Test/ IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/
IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/
IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/ IBatisNet.DataMapper.T...
Author: gbayon
Date: Wed Sep 13 11:38:29 2006
New Revision: 443064
URL: http://svn.apache.org/viewvc?view=rev&rev=443064
Log:
Fix for IBATISNET-179
Added:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/ps_SelectAllAccount.sql
Modified:
ibatis/trunk/cs/mapper/IBatisNet.Common/AssemblyInfo.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/account-init.sql
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Procedure.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMap.xsd
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/AssemblyInfo.cs?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/AssemblyInfo.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/AssemblyInfo.cs Wed Sep 13 11:38:29 2006
@@ -19,7 +19,7 @@
#else
[assembly: AssemblyConfiguration("net-2.0.win32; Release")]
[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFileAttribute("..\\..\\..\\AssemblyKey.snk")]
+[assembly: AssemblyKeyFile("..\\..\\..\\AssemblyKey.snk")]
#endif
#endif
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?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- 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 Sep 13 11:38:29 2006
@@ -426,6 +426,7 @@
<Content Include="Scripts\MSSQL\order-init.sql" />
<Content Include="Scripts\MSSQL\other-init.sql" />
<Content Include="Scripts\MSSQL\ps_SelectAccount.sql" />
+ <Content Include="Scripts\MSSQL\ps_SelectAllAccount.sql" />
<Content Include="Scripts\MSSQL\ps_SelectLineItem.sql" />
<Content Include="Scripts\MSSQL\README-embed-param.txt" />
<Content Include="Scripts\MSSQL\simple-init.sql" />
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Account.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Account.xml?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Account.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Account.xml Wed Sep 13 11:38:29 2006
@@ -551,7 +551,11 @@
<procedure id="GetAccountViaSP" parameterMap="select-params" resultClass="Account">
ps_SelectAccount
</procedure>
-
+
+ <procedure id="SelectAllAccountViaSP" resultClass="Account">
+ ps_SelectAllAccount
+ </procedure>
+
</statements>
<!-- =============================================
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Account.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Account.xml?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Account.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Account.xml Wed Sep 13 11:38:29 2006
@@ -551,7 +551,11 @@
<procedure id="GetAccountViaSP" parameterMap="select-params" resultClass="Account">
ps_SelectAccount
</procedure>
-
+
+ <procedure id="SelectAllAccountViaSP" resultClass="Account">
+ ps_SelectAllAccount
+ </procedure>
+
</statements>
<!-- =============================================
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml Wed Sep 13 11:38:29 2006
@@ -629,7 +629,11 @@
<procedure id="GetAccountViaSP2" parameterMap="select-params2" resultClass="Account">
ps_SelectAccount
</procedure>
-
+
+ <procedure id="SelectAllAccountViaSP" resultClass="Account">
+ ps_SelectAllAccount
+ </procedure>
+
</statements>
<!-- =============================================
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs Wed Sep 13 11:38:29 2006
@@ -26,7 +26,8 @@
InitScript( sqlMap.DataSource, ScriptDirectory + "account-init.sql" );
InitScript( sqlMap.DataSource, ScriptDirectory + "account-procedure.sql", false );
InitScript( sqlMap.DataSource, ScriptDirectory + "category-procedureWithReturn.sql", false);
- InitScript( sqlMap.DataSource, ScriptDirectory + "ps_SelectAccount.sql", false );
+ InitScript( sqlMap.DataSource, ScriptDirectory + "ps_SelectAccount.sql", false );
+ InitScript( sqlMap.DataSource, ScriptDirectory + "ps_SelectAllAccount.sql", false);
InitScript( sqlMap.DataSource, ScriptDirectory + "swap-procedure.sql" );
}
@@ -71,6 +72,16 @@
}
#endif
+ /// <summary>
+ /// Test get an account via a store procedure.
+ /// </summary>
+ [Test]
+ public void GetAllAccountViaProcedure()
+ {
+ IList accounts = sqlMap.QueryForList("SelectAllAccountViaSP", null);
+ Assert.IsTrue( accounts.Count==5);
+ }
+
/// <summary>
/// Test get an account via a store procedure.
/// </summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/account-init.sql
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/account-init.sql?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/account-init.sql (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/account-init.sql Wed Sep 13 11:38:29 2006
@@ -41,6 +41,9 @@
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_SelectAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[ps_SelectAccount]
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_SelectAllAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
+drop procedure [dbo].[ps_SelectAllAccount]
+
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_swap_email_address]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[ps_swap_email_address]
Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/ps_SelectAllAccount.sql
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/ps_SelectAllAccount.sql?view=auto&rev=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/ps_SelectAllAccount.sql (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/ps_SelectAllAccount.sql Wed Sep 13 11:38:29 2006
@@ -0,0 +1,8 @@
+CREATE PROCEDURE dbo.[ps_SelectAllAccount]
+AS
+select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+from Accounts
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?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs Wed Sep 13 11:38:29 2006
@@ -767,7 +767,11 @@
{
_configScope.SqlMapper = _sqlMapper;
}
-
+
+ ParameterMap emptyParameterMap = new ParameterMap(_configScope.DataExchangeFactory);
+ emptyParameterMap.Id = ConfigurationScope.EMPTY_PARAMETER_MAP;
+ _configScope.SqlMapper.AddParameterMap( emptyParameterMap );
+
_configScope.SqlMapper.IsCacheModelsEnabled = _configScope.IsCacheModelsEnabled;
#region Cache Alias
@@ -1898,34 +1902,6 @@
return MAPPING_NAMESPACE_PREFIX+ ":" + elementName.
Replace("/","/"+MAPPING_NAMESPACE_PREFIX+":");
}
-
-// private String ParsePropertyTokens(string str)
-// {
-// const string OPEN = "${";
-// const string CLOSE = "}";
-//
-//
-// string newString = str;
-// if (str != null && props != null) {
-// int start = newString.indexOf(OPEN);
-// int end = newString.indexOf(CLOSE);
-//
-// while (start > -1 && end > start) {
-// String prepend = newString.substring(0, start);
-// String append = newString.substring(end + CLOSE.length());
-// String propName = newString.substring(start + OPEN.length(), end);
-// String propValue = props.getProperty(propName);
-// if (propValue == null) {
-// newString = prepend + propName + append;
-// } else {
-// newString = prepend + propValue + append;
-// }
-// start = newString.indexOf(OPEN);
-// end = newString.indexOf(CLOSE);
-// }
-// }
-// return newString;
-// }
#endregion
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Procedure.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Procedure.cs?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Procedure.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Procedure.cs Wed Sep 13 11:38:29 2006
@@ -2,7 +2,7 @@
#region Apache Notice
/*****************************************************************************
* $Header: $
- * $Revision: $
+ * $Revision$
* $Date$
*
* iBATIS.NET Data Mapper
@@ -30,6 +30,7 @@
using System.Xml.Serialization;
using IBatisNet.Common.Exceptions;
+using IBatisNet.DataMapper.Configuration.ParameterMapping;
using IBatisNet.DataMapper.Exceptions;
using IBatisNet.DataMapper.Scope;
#endregion
@@ -84,7 +85,8 @@
base.Initialize( configurationScope );
if (this.ParameterMap == null)
{
- throw new ConfigurationException("The parameterMap attribute is required in the procedure tag named '"+ this.Id +"'.");
+ //throw new ConfigurationException("The parameterMap attribute is required in the procedure tag named '"+ this.Id +"'.");
+ this.ParameterMap = configurationScope.SqlMapper.GetParameterMap(ConfigurationScope.EMPTY_PARAMETER_MAP);
}
}
#endregion
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs Wed Sep 13 11:38:29 2006
@@ -47,6 +47,8 @@
/// </summary>
public class ConfigurationScope : IScope
{
+ public const string EMPTY_PARAMETER_MAP = "iBATIS.Empty.ParameterMap";
+
#region Fields
private ErrorContext _errorContext = null;
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMap.xsd
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMap.xsd?view=diff&rev=443064&r1=443063&r2=443064
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMap.xsd (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMap.xsd Wed Sep 13 11:38:29 2006
@@ -73,7 +73,7 @@
<xs:element name="procedure">
<xs:complexType mixed="true">
<xs:attribute name="id" type="xs:string" use="required"/>
- <xs:attribute name="parameterMap" type="xs:string" use="required"/>
+ <xs:attribute name="parameterMap" type="xs:string" />
<xs:attribute name="resultMap" type="xs:string"/>
<xs:attribute name="resultClass" type="xs:string"/>
<xs:attribute name="cacheModel" type="xs:string"/>