[
http://issues.apache.org/jira/browse/IBATISNET-21?page=comments#action_58127 ]
Ron Grabowski commented on IBATISNET-21:
----------------------------------------
I saw this code in the ParseDynamicTags method of the DomSqlMapBuilder class:
//data = ParsePropertyTokens(data);
Looking at more of the commented out code:
// private String ParsePropertyTokens(string str)
// {
// const string OPEN = "${";
// const string CLOSE = "}";
It looks like that function does what I need it to do. Perhaps that was the old
function that should have been replaced by ParsePropertyTokens(string,
NameValueCollection)? I replaced the commented code with a call to
ParsePropertyTokens(string, NameValueCollection). I also changed
ParseDynamicTags to accept a NameValueCollection containing global properities.
That seemed to solve the global property substition for top level statements
like <select>, <update>, and <insert> but <selectKey> still contained the
original ${xxxxx} text.
> Property substitutions do not occur inside <selectKey> statement
> ----------------------------------------------------------------
>
> Key: IBATISNET-21
> URL: http://issues.apache.org/jira/browse/IBATISNET-21
> Project: iBatis for .NET
> Type: Bug
> Versions: DataMapper 1.1
> Environment: Windows 2003 Server, IBatis DataMapper v1.0.1.321
> Reporter: Ron Grabowski
>
> When using a properties file:
> <?xml version="1.0" encoding="utf-8" ?>
> <settings>
> <add key="userid" value="xxxxx" />
> <add key="password" value="xxxxx" />
> <add key="database" value="xxxxx" />
> <add key="datasource" value="xxxxx" />
> <add key="selectKey" value="SELECT CAST(@@IDENTITY as int) as value" />
> <add key="now" value="GETDATE()" />
> <add key="true" value="1" />
> <add key="false" value="0" />
> </settings>
> Substitutions work as expected except for the <selectKey> statement:
> <!-- OK -->
> <database>
> <provider name="sqlServer1.1"/>
> <dataSource name="xxxxx" connectionString="data
> source=${datasource};database=${database}..."/>
> </database>
> <!-- OK -->
> <insert id="AddressInsert" parameterClass="Address">
> INSERT INTO Address
> (
> Street,
> City,
> Zip,
> DateAdded
> )
> VALUES
> (
> #Street#,
> #City#,
> #Zip#,
> ${now}
> )
> </insert>
> <!-- WRONG -->
> <insert id="AddressInsert" parameterClass="Address">
> INSERT INTO Address
> (
> Street,
> City,
> Zip,
> DateAdded
> )
> VALUES
> (
> #Street#,
> #City#,
> #Zip#,
> ${now}
> )
> <selectKey property="AddressId" type="post" resultClass="int">
> ${selectKey}
> </selectKey>
> </insert>
> In the last example, ${selectKey} is not replaced by the value defined in the
> properties file. The log file incorrectly list this:
> 'AddressInsert': INSERT INTO Address (Street, City, Zip, DateAdded) VALUES
> (@Street, @City, @zip, GETDATE())
> 'AddressInsert.SelectKey' :${selectKey}
> It should be:
> 'AddressInsert': INSERT INTO Address (Street, City, Zip, DateAdded) VALUES
> (@Street, @City, @zip, GETDATE())
> 'AddressInsert.SelectKey' : SELECT CAST(@@IDENTITY as int) as value
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira