Bonjour Marc,

I'have made an Nunit test as
<insert id="InsertAccountDynamic" parameterClass="Account">
INSERT INTO Accounts
(Account_ID, Account_FirstName, Account_LastName, Account_Email)
VALUES(#Id#, #FirstName#, #LastName#
<dynamic prepend=",">
 <isNotNull prepend="," property="EmailAddress">
  #EmailAddress#
 </isNotNull>
 <isNull prepend="," property="EmailAddress">
   null
 </isNull>
</dynamic>
)
</insert>
 
and all is green
here is the log
 

2005-09-20 19:12:21,750 [4460] DEBUG IBatisNet.DataMapper.SqlMapSession [(null)] <(null)> - Open Connection "3625" to "Microsoft SQL Server 7.0/2000, provider V1.0.5000.0 in framework .NET V1.1".

2005-09-20 19:12:21,750 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [InsertAccountDynamic] PreparedStatement : [INSERT INTO Accounts (Account_ID, Account_FirstName, Account_LastName, Account_Email) VALUES( @param0 , @param1 , @param2 , null )]

2005-09-20 19:12:21,765 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [InsertAccountDynamic] Parameters: [EMAIL PROTECTED],10], @param1=[FirstName,Luky], @param2=[LastName,luke]]

2005-09-20 19:12:21,765 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [InsertAccountDynamic] Types: [EMAIL PROTECTED], System.Int32], @param1=[String, System.String ], @param2=[String, System.String]]

2005-09-20 19:12:21,765 [4460] DEBUG IBatisNet.DataMapper.SqlMapSession [(null)] <(null)> - Close Connection "3625" to "Microsoft SQL Server 7.0/2000, provider V1.0.5000.0 in framework .NET V1.1".

2005-09-20 19:12:21,765 [4460] DEBUG IBatisNet.DataMapper.SqlMapSession [(null)] <(null)> - Open Connection "3401" to "Microsoft SQL Server 7.0/2000, provider V1.0.5000.0 in framework .NET V1.1".

2005-09-20 19:12:21,765 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [GetAccountViaColumnIndex] PreparedStatement : [select Account_ID, Account_FirstName, Account_LastName, Account_Email from Accounts where Account_ID = @param0]

2005-09-20 19:12:21,765 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [GetAccountViaColumnIndex] Parameters: [EMAIL PROTECTED],10]]

2005-09-20 19:12:21,781 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [GetAccountViaColumnIndex] Types: [EMAIL PROTECTED], System.Int32]]

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.SqlMapSession [(null)] <(null)> - Close Connection "3401" to "Microsoft SQL Server 7.0/2000, provider V1.0.5000.0 in framework .NET V1.1".

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.SqlMapSession [(null)] <(null)> - Open Connection "3391" to "Microsoft SQL Server 7.0/2000, provider V1.0.5000.0 in framework .NET V1.1".

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [InsertAccountDynamic] PreparedStatement : [INSERT INTO Accounts (Account_ID, Account_FirstName, Account_LastName, Account_Email) VALUES( @param0 , @param1 , @param2 , @param3 )]

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [InsertAccountDynamic] Parameters: [EMAIL PROTECTED],11], @param1=[FirstName,Luky], @param2=[LastName,luke], @param3=[EmailAddress, [EMAIL PROTECTED]]]

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [InsertAccountDynamic] Types: [EMAIL PROTECTED], System.Int32], @param1=[String, System.String ], @param2=[String, System.String], @param3=[String, System.String]]

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.SqlMapSession [(null)] <(null)> - Close Connection "3391" to "Microsoft SQL Server 7.0/2000, provider V1.0.5000.0 in framework .NET V1.1".

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.SqlMapSession [(null)] <(null)> - Open Connection "3386" to "Microsoft SQL Server 7.0/2000, provider V1.0.5000.0 in framework .NET V1.1".

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [GetAccountViaColumnIndex] PreparedStatement : [select Account_ID, Account_FirstName, Account_LastName, Account_Email from Accounts where Account_ID = @param0]

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [GetAccountViaColumnIndex] Parameters: [EMAIL PROTECTED],11]]

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.Commands.DefaultPreparedCommand [(null)] <(null)> - Statement Id: [GetAccountViaColumnIndex] Types: [EMAIL PROTECTED], System.Int32]]

2005-09-20 19:12:21,812 [4460] DEBUG IBatisNet.DataMapper.SqlMapSession [(null)] <(null)> - Close Connection "3386" to "Microsoft SQL Server 7.0/2000, provider V1.0.5000.0 in framework .NET V1.1".

Cheers,
-Gilles

Reply via email to