You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by ro...@apache.org on 2005/05/06 06:28:48 UTC
svn commit: r168517 -
/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP
/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Oracle
/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Oracle
/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements
Author: roberto
Date: Thu May 5 21:28:47 2005
New Revision: 168517
URL: http://svn.apache.org/viewcvs?rev=168517&view=rev
Log:
~Updated C# DataMapper PreparedStatementFactory.cs for better Oracle ODP/OracleClient provider stored procedure support (Need to test changes with ODBC/OLEDB!)
~Updated C# DataMapper NUnit Oracle SqlMaps (pass NUnit Oracle stored procedure tests) and db script
Modified:
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Account.xml
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Category.xml
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Oracle/ProcedureTest.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Oracle/DataBase.sql
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/PreparedStatementFactory.cs
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Account.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Account.xml?rev=168517&r1=168516&r2=168517&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Account.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Account.xml Thu May 5 21:28:47 2005
@@ -553,17 +553,28 @@
-->
<!-- For procedure, the parameters of the parameterMap must in the same order
as for the procedure paramaters-->
+ <!--
<statement id="InsertAccountViaStoreProcedure" parameterMap="insert-params">
call prc_InsertAccount(?, ?, ?, ?)
</statement>
+ -->
+ <procedure id="InsertAccountViaStoreProcedure" parameterMap="insert-params">
+ prc_InsertAccount
+ </procedure>
<!--
See InsertCategoryViaStoreProcedure issue with ODP.NET due to lack of
DeriveParameters (cannot use <procedure> statement)
-->
+ <!--
<statement id="SwapEmailAddresses" parameterMap="swap-params">
call prc_Swap_Email_Address(?, ?)
</statement>
+ -->
+ <procedure id="SwapEmailAddresses" parameterMap="swap-params">
+ prc_Swap_Email_Address
+ </procedure>
+
</statements>
<!-- =============================================
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Category.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Category.xml?rev=168517&r1=168516&r2=168517&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Category.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Category.xml Thu May 5 21:28:47 2005
@@ -84,27 +84,15 @@
</update>
<!--
- NOTE: ODP.NET does not have a DeriveParameters method
- to allow iBAITS.NET to dynamically infer the stored procedure's parameters.
- You cannot use the <procedure> statement.
-
- This was an attempt at a workaround for using
- a stored proc with 2 Input and 1 Output parameter in a <statement>.
-
- Unfortunately, the retrieving the output parameters doesn't work
- since the procedure param name that iBATIS gets is p_Category_Id,
- but since this is a <statement> the actual param name is :Id!
-
- To get around this property name to paramMap name to proc param name issue,
- use the same name for all, and this should work!
-
- Found in MappedStatement.RetrieveOutputParameters():
- object dataBaseValue = mapping.TypeHandler.GetDataBaseValue( ((IDataParameter)command.Parameters[parameterName]).Value, result.GetType() );
- -->
- <statement id="InsertCategoryViaStoreProcedure" parameterMap="stored-proc-insert-params">
+ <insert id="InsertCategoryViaStoreProcedure" parameterMap="stored-proc-insert-params">
call prc_InsertCategory(?, ?, ?)
- </statement>
-
+ </insert>
+ -->
+ <procedure id="InsertCategoryViaStoreProcedure" parameterMap="stored-proc-insert-params">
+ prc_InsertCategory
+ </procedure>
+
+
<insert id="InsertCategoryGenerate" parameterMap="insert-generate-params">
<selectKey property="Id" type="post" resultClass="int">
select s_categories.nextval as value from dual
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Oracle/ProcedureTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Oracle/ProcedureTest.cs?rev=168517&r1=168516&r2=168517&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Oracle/ProcedureTest.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Oracle/ProcedureTest.cs Thu May 5 21:28:47 2005
@@ -58,7 +58,7 @@
category = new Category();
category.Name = "Nausicaa";
- sqlMap.QueryForObject("InsertCategoryViaStoreProcedure", category);
+ sqlMap.Insert("InsertCategoryViaStoreProcedure", category);
Assert.AreEqual(2, category.Id );
}
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Oracle/DataBase.sql
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Oracle/DataBase.sql?rev=168517&r1=168516&r2=168517&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Oracle/DataBase.sql (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/Oracle/DataBase.sql Thu May 5 21:28:47 2005
@@ -123,7 +123,8 @@
CREATE TABLE OTHERS (
OTHER_INT INT NULL ,
- OTHER_LONG INT NULL
+ OTHER_LONG INT NULL ,
+ OTHER_BIT SMALLINT DEFAULT 0 NOT NULL
)
NOLOGGING
NOCACHE
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/PreparedStatementFactory.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/PreparedStatementFactory.cs?rev=168517&r1=168516&r2=168517&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/PreparedStatementFactory.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/PreparedStatementFactory.cs Thu May 5 21:28:47 2005
@@ -209,16 +209,36 @@
foreach(ParameterProperty property in list)
{
- if (_session.DataSource.Provider.UseParameterPrefixInParameter )
+ // Check if property is part of a parameterMap for naming purposes
+ // used when retrieving output parameters (stored procs/input/output).
+ // property.ColumnName is used when retrieving output parameters,
+ // so it has to be used here as the parameter name!
+ if (_statement.ParameterMap != null &&
+ (property.Direction == ParameterDirection.Output ||
+ property.Direction == ParameterDirection.InputOutput))
{
- // From Ryan Yao: JIRA-27
- // sqlParamName = _parameterPrefix + paramName;
- sqlParamName = _parameterPrefix + "param" + i++;
+ if (_session.DataSource.Provider.UseParameterPrefixInParameter)
+ {
+ sqlParamName = _parameterPrefix + property.ColumnName;
+ }
+ else //obdc/oledb
+ {
+ sqlParamName = property.ColumnName;
+ }
}
- else //obdc/oledb
+ else
{
- // sqlParamName = paramName;
- sqlParamName = "param" + i++;
+ if (_session.DataSource.Provider.UseParameterPrefixInParameter )
+ {
+ // From Ryan Yao: JIRA-27
+ // sqlParamName = _parameterPrefix + paramName;
+ sqlParamName = _parameterPrefix + "param" + i++;
+ }
+ else //obdc/oledb
+ {
+ // sqlParamName = paramName;
+ sqlParamName = "param" + i++;
+ }
}
IDataParameter dataParameter = _session.CreateCommand(_statement.CommandType).CreateParameter();