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/05/29 15:32:01 UTC
svn commit: r178948 -
/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config
/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
Author: gbayon
Date: Sun May 29 06:31:58 2005
New Revision: 178948
URL: http://svn.apache.org/viewcvs?rev=178948&view=rev
Log:
- Fixed JIRA-75
Modified:
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
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=178948&r1=178947&r2=178948&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 Sun May 29 06:31:58 2005
@@ -2,7 +2,10 @@
<sqlMapConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMapConfig.xsd">
- <properties resource="../../database.config"/>
+ <properties>
+ <propertie resource="../../database.config"/>
+ <propertie key="Hello" value="World" />
+ </properties>
<settings>
<setting useStatementNamespaces="false"/>
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?rev=178948&r1=178947&r2=178948&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs Sun May 29 06:31:58 2005
@@ -52,6 +52,7 @@
using IBatisNet.DataMapper.MappedStatements;
using IBatisNet.DataMapper.Scope;
using IBatisNet.DataMapper.TypeHandlers;
+using log4net;
#endregion
@@ -76,6 +77,9 @@
#region Constant
+ private const string PROPERTY_ELEMENT_KEY_ATTRIB = "key";
+ private const string PROPERTY_ELEMENT_VALUE_ATTRIB = "value";
+
/// <summary>
/// Default congig name
/// </summary>
@@ -134,6 +138,8 @@
#region Fields
+ private static readonly ILog _logger = LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType );
+
private ConfigurationScope _configScope = null;
private InlineParameterMapParser _paramParser = null;
@@ -1337,21 +1343,49 @@
if (nodeProperties != null)
{
- // JIRA-38 Fix
- // <properties> element's InnerXml is currently an empty string anyway
- // since <settings> are in properties file
- //_configScope.ErrorContext.Resource = nodeProperties.InnerXml.ToString();
- _configScope.ErrorContext.Resource = nodeProperties.OuterXml.ToString();
-
- // Load the file defined by the resource attribute
- XmlDocument propertiesConfig = Resources.GetAsXmlDocument(nodeProperties, _configScope.Properties);
+ if (nodeProperties.HasChildNodes)
+ {
+ foreach (XmlNode propertyNode in nodeProperties.SelectNodes("propertie"))
+ {
+ XmlAttribute keyAttrib = propertyNode.Attributes[PROPERTY_ELEMENT_KEY_ATTRIB];
+ XmlAttribute valueAttrib = propertyNode.Attributes[PROPERTY_ELEMENT_VALUE_ATTRIB];
- foreach (XmlNode node in propertiesConfig.SelectNodes("/settings/add"))
+ if ( keyAttrib != null && valueAttrib!=null)
+ {
+ _configScope.Properties.Add( keyAttrib.Value, valueAttrib.Value);
+ _logger.Info( string.Format("Add propertie \"{0}\" value \"{1}\"",keyAttrib.Value,valueAttrib.Value) );
+ }
+ else
+ {
+ // Load the file defined by the attribute
+ XmlDocument propertiesConfig = Resources.GetAsXmlDocument(propertyNode, _configScope.Properties);
+
+ foreach (XmlNode node in propertiesConfig.SelectNodes("/settings/add"))
+ {
+ _configScope.Properties[node.Attributes[PROPERTY_ELEMENT_KEY_ATTRIB].Value] = node.Attributes[PROPERTY_ELEMENT_VALUE_ATTRIB].Value;
+ _logger.Info( string.Format("Add propertie \"{0}\" value \"{1}\"",node.Attributes[PROPERTY_ELEMENT_KEY_ATTRIB].Value,node.Attributes[PROPERTY_ELEMENT_VALUE_ATTRIB].Value) );
+ }
+ }
+ }
+ }
+ else
{
- _configScope.Properties[node.Attributes["key"].Value] = node.Attributes["value"].Value;
+ // JIRA-38 Fix
+ // <properties> element's InnerXml is currently an empty string anyway
+ // since <settings> are in properties file
+
+ _configScope.ErrorContext.Resource = nodeProperties.OuterXml.ToString();
+
+ // Load the file defined by the attribute
+ XmlDocument propertiesConfig = Resources.GetAsXmlDocument(nodeProperties, _configScope.Properties);
+
+ foreach (XmlNode node in propertiesConfig.SelectNodes("/settings/add"))
+ {
+ _configScope.Properties[node.Attributes[PROPERTY_ELEMENT_KEY_ATTRIB].Value] = node.Attributes[PROPERTY_ELEMENT_VALUE_ATTRIB].Value;
+ _logger.Info( string.Format("Add propertie \"{0}\" value \"{1}\"",node.Attributes[PROPERTY_ELEMENT_KEY_ATTRIB].Value,node.Attributes[PROPERTY_ELEMENT_VALUE_ATTRIB].Value) );
+ }
}
}
-
_configScope.ErrorContext.Reset();;
}