You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org> on 2005/02/20 14:15:49 UTC

[jira] Closed: (IBATISNET-21) Property substitutions do not occur inside statement

     [ http://issues.apache.org/jira/browse/IBATISNET-21?page=history ]
     
Gilles Bayon closed IBATISNET-21:
---------------------------------

      Assign To: Gilles Bayon
     Resolution: Fixed
    Fix Version: DataMapper 1.2

Fix in SVN

> 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
>     Assignee: Gilles Bayon
>      Fix For: DataMapper 1.2

>
> 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