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 2005/04/06 23:02:56 UTC

svn commit: r160325 - incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration

Author: gbayon
Date: Wed Apr  6 14:02:55 2005
New Revision: 160325

URL: http://svn.apache.org/viewcvs?view=rev&rev=160325
Log:
- Speed up Configuration

Modified:
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/DynamicPrependTest.cs
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml?view=diff&r1=160324&r2=160325
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml Wed Apr  6 14:02:55 2005
@@ -312,6 +312,14 @@
 
 		</select>	
 		
+		<select id="SelectBand" parameterClass="map" resultClass="string">
+			SELECT Name FROM Band WHERE Name = #BandName#
+		</select>
+
+		<select id="SelectBandTest" parameterClass="map" resultClass="string">
+			SELECT Name FROM Band WHERE Name = '####$inlineParameterBandName$####'
+		</select>
+		
 	</statements>
 
 	<parameterMaps>   

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs?view=diff&r1=160324&r2=160325
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs Wed Apr  6 14:02:55 2005
@@ -15,6 +15,7 @@
 
 using IBatisNet.DataMapper.Test.Domain;
 
+
 [assembly:log4net.Config.DOMConfigurator(Watch=true)]
 
 namespace IBatisNet.DataMapper.Test.NUnit.SqlMapTests
@@ -38,7 +39,6 @@
 		/// </summary>
 		static BaseTest()
 		{
-
 			ScriptDirectory = Path.Combine(
 								Path.Combine(
 									Path.Combine(

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/DynamicPrependTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/DynamicPrependTest.cs?view=diff&r1=160324&r2=160325
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/DynamicPrependTest.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/DynamicPrependTest.cs Wed Apr  6 14:02:55 2005
@@ -1,6 +1,8 @@
 using System;
 using System.Collections;
 using System.Configuration;
+using System.Globalization;
+using System.Threading;
 
 using NUnit.Framework;
 
@@ -307,8 +309,13 @@
 			search.Operande = "like";
 			search.StartDateAnd = true;
 			
+			CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
+			Thread.CurrentThread.CurrentCulture =  new CultureInfo("fr-FR");
+
 			IList list = sqlMap.QueryForList("Jira-IBATISNET-11", search);
 
+			Thread.CurrentThread.CurrentCulture = currentCulture;
+
 			Assert.AreEqual(0, list.Count);
 		}
 
@@ -361,11 +368,29 @@
 
 			Assert.AreEqual(1, order.Id);
 
+			CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
+			Thread.CurrentThread.CurrentCulture =  new CultureInfo("en-US");
+
 			order = sqlMap.QueryForObject("SelectOrderByDateDynamic", param) as Order;
 
+			Thread.CurrentThread.CurrentCulture = currentCulture;
+
 			Assert.IsNotNull(order);
 
 			Assert.AreEqual(1, order.Id);
+		}
+
+		/// <summary>
+		/// Test JIRA 29
+		/// </summary>
+		[Test] 
+		public void TestJIRA29Bis() 
+		{
+			Hashtable param = new Hashtable();
+			param["BandName"] = "#The Pound Signs#";
+
+			Hashtable hash = sqlMap.QueryForObject("SelectBand", param) as Hashtable;
+
 		}
 		#endregion
 

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs?view=diff&r1=160324&r2=160325
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs Wed Apr  6 14:02:55 2005
@@ -83,6 +83,7 @@
 		/// </summary>
 		public const string DOT = ".";
 		private const string PARAMETER_TOKEN = "#";
+		private const string PARAM_DELIM = ":";
 
 		/// <summary>
 		/// Token for SqlMapConfig xml root.
@@ -375,6 +376,18 @@
 
 			#endregion
 
+			#region Attach CacheModel to statement
+
+			foreach(DictionaryEntry entry in _configScope.SqlMapper.MappedStatements)
+			{
+				MappedStatement mappedStatement = (MappedStatement)entry.Value;
+				if (mappedStatement.Statement.CacheModelName.Length >0)
+				{
+					mappedStatement.Statement.CacheModel = _configScope.SqlMapper.GetCache(mappedStatement.Statement.CacheModelName);
+				}
+			}
+			#endregion 
+
 			#region Resolve "resulMap" attribut on Result Property + initialize Discriminator property 
 
 			foreach(DictionaryEntry entry in _configScope.SqlMapper.ResultMaps)
@@ -821,16 +834,6 @@
 
 					_configScope.SqlMapper.AddCache( cacheModel );
 				}
-
-				// Attach CacheModel to statement
-				foreach(DictionaryEntry entry in _configScope.SqlMapper.MappedStatements)
-				{
-					MappedStatement mappedStatement = (MappedStatement)entry.Value;
-					if (mappedStatement.Statement.CacheModelName.Length >0)
-					{
-						mappedStatement.Statement.CacheModel = _configScope.SqlMapper.GetCache(mappedStatement.Statement.CacheModelName);
-					}
-				}
 			}
 
 			#endregion
@@ -1058,9 +1061,9 @@
 					} 
 					else 
 					{
-						if (token.IndexOf(':') > -1) 
+						if (token.IndexOf(PARAM_DELIM) > -1) 
 						{
-							StringTokenizer paramParser = new StringTokenizer(token, ":", true);
+							StringTokenizer paramParser = new StringTokenizer(token, PARAM_DELIM, true);
 							IEnumerator enumeratorParam = paramParser.GetEnumerator();
 
 							int n1 = paramParser.TokenNumber;