Allow selectKey node to process dynamic sql -------------------------------------------
Key: IBATISNET-143 URL: http://issues.apache.org/jira/browse/IBATISNET-143 Project: iBatis for .NET Type: New Feature Reporter: Ron Grabowski Assigned to: Gilles Bayon Priority: Minor This does not work correctly: <insert id="SelectKeyWithDynamicSql"> INSERT INTO $AccountsTableName$ ( Account_ID, Account_FirstName, Account_LastName ) VALUES ( #Account.Id#, #Account.FirstName#, #Account.LastName# ) <selectKey property="AccountId" type="post" resultClass="int"> SELECT Account_ID FROM $AccountsTableName$ WHERE Account_ID = #Account.Id# </selectKey> </insert> [Test] public void TestSelectKeyWithDynamicSql() { Account account = new Account(); account.Id = 99999; account.FirstName = "R"; account.LastName = "G"; Hashtable param = new Hashtable(2); param["Account"] = account; param["AccountsTableName"] = "Accounts"; sqlMap.Insert("SelectKeyWithDynamicSql", param); Assert.IsTrue(param.ContainsKey("AccountId")); Assert.AreEqual(99999, (int)param["AccountId"]); } Statement Id: [SelectKeyWithDynamicSql] PreparedStatement : [INSERT INTO Accounts (Account_ID, Account_FirstName, Account_LastName) VALUES (?param0, ?param1, ?param2)] Statement Id: [SelectKeyWithDynamicSql] Parameters: [?param2=[Account.LastName,G]] Statement Id: [SelectKeyWithDynamicSql] Types: [?param0=[Int32, System.Int32], ?param1=[String, System.String], ?param2=[String, System.String]] Statement Id: [SelectKeyWithDynamicSql.SelectKey] PreparedStatement : [SELECT Account_ID FROM $AccountsTableName$ WHERE Account_ID = #Account.Id#] This line also looks incorrect: Statement Id: [SelectKeyWithDynamicSql] Parameters: [?param2=[Account.LastName,G]] Its missing the param0 and param1. -- 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 - For more information on JIRA, see: http://www.atlassian.com/software/jira