ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gba...@apache.org
Subject svn commit: r168300 - /incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test /incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc /incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb /incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests /incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug /incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands /incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements
Date Thu, 05 May 2005 09:20:31 GMT
Author: gbayon
Date: Thu May  5 02:20:30 2005
New Revision: 168300

URL: http://svn.apache.org/viewcvs?rev=168300&view=rev
Log:
- Updated Nunit tests for Oledb, Odbc provider
- Updated loggind for parameters
- Updated code for PrepareStatementFactory

Modified:
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/DataBase-Template.config
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/DynamicAccount.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Order.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/ResultClass.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/DynamicAccount.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Order.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/ResultClass.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ParameterMapTest.cs
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/PreparedStatementFactory.cs

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/DataBase-Template.config
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/DataBase-Template.config?rev=168300&r1=168299&r2=168300&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/DataBase-Template.config (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/DataBase-Template.config Thu
May  5 02:20:30 2005
@@ -11,7 +11,7 @@
 	<add key="datasource" value="(local)\NetSDK" />
 	<add key="useridHibernate" value="NHibernate" />
 	<add key="databaseHibernate" value="NHibernate" />
-	<add key="driverOdbc" value="{SQL Server}" />
+	<add key="connectionStringOdbc" value="Driver={SQL Server};Server=(local)\NetSDK;Database=IBatisNet;Uid=IBatisNet;Pwd=test;"
/>
 	<add key="datasourceMySql" value="localhost" />
 	<add key="selectKey" value="select @@IDENTITY as value" />
 	<add key="MyCategoryName" value="'Film'" />

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/DynamicAccount.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/DynamicAccount.xml?rev=168300&r1=168299&r2=168300&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/DynamicAccount.xml
(original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/DynamicAccount.xml
Thu May  5 02:20:30 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?> 
-<sqlMap namespace="Category" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+<sqlMap namespace="Account" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 		xsi:noNamespaceSchemaLocation="SqlMap.xsd">
 		
 	<alias>

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Order.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Order.xml?rev=168300&r1=168299&r2=168300&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Order.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Order.xml Thu
May  5 02:20:30 2005
@@ -320,6 +320,18 @@
 			</isNotEmpty> 
 		</select>
 				
+		<select id="GetAccountJIRA45"
+				parameterClass="int"
+				resultMap="Account.account-result">
+			select
+			Account_ID,
+			Account_FirstName,
+			Account_LastName,
+			Account_Email
+			from Accounts
+			where Account_ID = #value#
+		</select>
+		
 	</statements>
 
 	<parameterMaps>   

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/ResultClass.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/ResultClass.xml?rev=168300&r1=168299&r2=168300&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/ResultClass.xml
(original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/ResultClass.xml
Thu May  5 02:20:30 2005
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 
-<sqlMap namespace="Order" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+<sqlMap namespace="ResultClass" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

 	xsi:noNamespaceSchemaLocation="SqlMap.xsd">
 
 	<statements>	

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/DynamicAccount.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/DynamicAccount.xml?rev=168300&r1=168299&r2=168300&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/DynamicAccount.xml
(original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/DynamicAccount.xml
Thu May  5 02:20:30 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?> 
-<sqlMap namespace="Category" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+<sqlMap namespace="Account" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 		xsi:noNamespaceSchemaLocation="SqlMap.xsd">
 		
 	<alias>

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Order.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Order.xml?rev=168300&r1=168299&r2=168300&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Order.xml
(original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Order.xml
Thu May  5 02:20:30 2005
@@ -319,6 +319,18 @@
 			</isNotEmpty> 
 		</select>
 				
+		<select id="GetAccountJIRA45"
+				parameterClass="int"
+				resultMap="Account.account-result">
+			select
+			Account_ID,
+			Account_FirstName,
+			Account_LastName,
+			Account_Email
+			from Accounts
+			where Account_ID = #value#
+		</select>
+		
 	</statements>
 
 	<parameterMaps>   

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/ResultClass.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/ResultClass.xml?rev=168300&r1=168299&r2=168300&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/ResultClass.xml
(original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/ResultClass.xml
Thu May  5 02:20:30 2005
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 
-<sqlMap namespace="Order" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+<sqlMap namespace="ResultClass" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

 	xsi:noNamespaceSchemaLocation="SqlMap.xsd">
 
 	<statements>	

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ParameterMapTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ParameterMapTest.cs?rev=168300&r1=168299&r2=168300&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ParameterMapTest.cs
(original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ParameterMapTest.cs
Thu May  5 02:20:30 2005
@@ -1,14 +1,11 @@
 using System;
 using System.Collections;
-using System.Configuration;
 using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
-
-using NUnit.Framework;
-
 using IBatisNet.Common.Utilities;
 using IBatisNet.DataMapper.Test.Domain;
+using NUnit.Framework;
 
 namespace IBatisNet.DataMapper.Test.NUnit.SqlMapTests
 {
@@ -127,7 +124,7 @@
 			order.CardNumber = "154564656";
 			order.CardType = "Visa";
 			order.City = "Lyon";
-			order.Date = System.DateTime.MinValue; //<-- null replacement
+			order.Date = DateTime.MinValue; //<-- null replacement
 			order.PostalCode = "69004";
 			order.Province = "Rhône";
 			order.Street = "rue Durand";
@@ -207,7 +204,7 @@
 			order.CardNumber = "154564656";
 			order.CardType = "Visa";
 			order.City = "Lyon";
-			order.Date = System.DateTime.MinValue; 
+			order.Date = DateTime.MinValue; 
 			order.PostalCode = "69004";
 			order.Province = "Rhône";
 			order.Street = "rue Durand";
@@ -258,7 +255,7 @@
 			order.CardNumber = "154564656";
 			order.CardType = "Visa";
 			order.City = "Lyon";
-			order.Date = System.DateTime.MinValue; //<-- null replacement
+			order.Date = DateTime.MinValue; //<-- null replacement
 			order.PostalCode = "69004";
 			order.Province = "Rhône";
 			order.Street = "rue Durand";

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config?rev=168300&r1=168299&r2=168300&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config
(original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config
Thu May  5 02:20:30 2005
@@ -14,7 +14,7 @@
 	<database>	
 		<provider name="Odbc1.1"/>
 		<!-- You can't use ${propertie} because the string Driver={SQL Server} interfer with
the ${propertie} syntax analyser-->
-		<dataSource name="iBatisNet" connectionString="Driver={SQL Server};Server=TOMATE;Database=IBatisNet;Uid=IBatisNet;Pwd=test;"/>
+		<dataSource name="iBatisNet" connectionString="${connectionStringOdbc}"/>
 	</database>
 	
 	<alias>

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs?rev=168300&r1=168299&r2=168300&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs
(original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs
Thu May  5 02:20:30 2005
@@ -97,8 +97,7 @@
 		{
 			ArrayList properties = request.PreparedStatement.DbParametersName;
 			ArrayList parameters = request.PreparedStatement.DbParameters;
-			StringBuilder valueList = new StringBuilder(); // Log info
-			StringBuilder typeList = new StringBuilder(); // Log info 
+			StringBuilder logList = new StringBuilder(); // Log info
 
 			object parameterValue = null;
 
@@ -152,15 +151,19 @@
 
 				if (parameterValue == System.DBNull.Value) 
 				{
-					valueList.Append("null,");
-					typeList.Append("null,");
+					logList.Append(sqlParameter.ParameterName);
+					logList.Append("=[");
+					logList.Append("null");
+					logList.Append( "], " );
 				} 
 				else 
-				{
-					valueList.Append( parameterValue.ToString() );
-					valueList.Append( "," );
-					typeList.Append( parameterValue.GetType().ToString() );
-					typeList.Append( "," );
+				{ 
+					logList.Append(sqlParameter.ParameterName);
+					logList.Append("=[");
+					logList.Append( parameterValue.ToString() );
+					logList.Append( "," );
+					logList.Append( parameterValue.GetType().ToString().Replace("System.",string.Empty)
);
+					logList.Append( "], " );
 				}
 				#endregion 
 
@@ -214,11 +217,13 @@
 				command.Parameters.Add( parameterCopy );
 			}
 
+			#region Logging
+
 			if (_logger.IsDebugEnabled && properties.Count>0)
 			{
-				_logger.Debug("Parameters: [" + valueList.ToString().Remove(valueList.ToString().Length-1,1)
+ "]");
-				_logger.Debug("Types: [" + typeList.ToString().Remove(typeList.ToString().Length-1,1)
+ "]");
+				_logger.Debug("Parameters: [" + logList.ToString(0, logList.Length - 2)  + "]");
 			}
+			#endregion 
 		}
 
 		#endregion

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=168300&r1=168299&r2=168300&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 02:20:30 2005
@@ -25,25 +25,21 @@
 #endregion
 
 #region Using
+
 using System;
-using System.Data;
 using System.Collections;
 using System.Collections.Specialized;
-using System.Text.RegularExpressions;
+using System.Data;
+using System.Reflection;
 using System.Text;
-
-using log4net;
-
 using IBatisNet.Common;
-using IBatisNet.DataMapper.Configuration.Alias;
-using IBatisNet.DataMapper.Configuration;
-using IBatisNet.DataMapper.Configuration.Statements;
+using IBatisNet.Common.Utilities;
+using IBatisNet.Common.Utilities.Objects;
 using IBatisNet.DataMapper.Configuration.ParameterMapping;
 using IBatisNet.DataMapper.Exceptions;
 using IBatisNet.DataMapper.Scope;
-using IBatisNet.DataMapper.Configuration.Sql.Dynamic;
-using IBatisNet.Common.Utilities;
-using IBatisNet.Common.Utilities.Objects;
+using log4net;
+
 #endregion
 
 namespace IBatisNet.DataMapper.Configuration.Statements
@@ -65,9 +61,8 @@
 		private RequestScope _request = null;
 		// (property, DbParameter)
 		private HybridDictionary _propertyDbParameterMap = new HybridDictionary();
-		private ArrayList _mapping = new ArrayList();
 
-		private static readonly ILog _logger = LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
);
+		private static readonly ILog _logger = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType
);
 
 		#endregion
 
@@ -206,21 +201,17 @@
 
 			foreach(ParameterProperty property in list)
 			{
-				StringBuilder stringBuilder = new StringBuilder(property.PropertyName);
-				stringBuilder = stringBuilder.Replace('.', '_').Replace('[','P').Replace(']','D');
-				string paramName =  stringBuilder.ToString();
-
-				//				if (_session.DataSource.Provider.UseParameterPrefixInParameter )
-				//				{
-
-				// From Ryan Yao: JIRA-27
-				//sqlParamName = _parameterPrefix + paramName;
-				sqlParamName = _parameterPrefix + "param" + i++;
-				//				}
-				//				else //obdc/oledb
-				//				{
-				//					sqlParamName = paramName;
-				//				}
+				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();
 
@@ -259,7 +250,7 @@
 
 				dataParameter.ParameterName = sqlParamName;
 
-				_preparedStatement.DbParametersName.Add( paramName );
+				_preparedStatement.DbParametersName.Add( property.PropertyName );
 				_preparedStatement.DbParameters.Add( dataParameter );	
 
 				if ( _session.DataSource.Provider.UsePositionalParameters == false)



Mime
View raw message