Author: rgrabowski
Date: Sun Jun 28 02:07:51 2009
New Revision: 789033

URL: http://svn.apache.org/viewvc?rev=789033&view=rev
Log:
Call Trim() before setting the CommandText of a stored procedure call to ensure 
the store procedure name is not prefixed with whitespace.

Modified:
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/Model/Statements/PreparedStatementFactory.cs

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/Model/Statements/PreparedStatementFactory.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/Model/Statements/PreparedStatementFactory.cs?rev=789033&r1=789032&r2=789033&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/Model/Statements/PreparedStatementFactory.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/Model/Statements/PreparedStatementFactory.cs
 Sun Jun 28 02:07:51 2009
@@ -114,10 +114,10 @@
                {
                        preparedStatement = new PreparedStatement();
 
-                       preparedStatement.PreparedSql = commandText;
-
                        if (statement.CommandType == CommandType.Text)
                        {
+                preparedStatement.PreparedSql = commandText;
+
                                if (request.ParameterMap != null) 
                                {
                                        CreateParametersForTextCommand();
@@ -126,6 +126,10 @@
                        }
                        else if (statement.CommandType == 
CommandType.StoredProcedure) // StoredProcedure
                        {
+                // Necessary to prevent stored procedures with extra space 
around their name like 
+                // " ps_SelectAccount " to be sent to the database as 
"ps_SelectAccount".
+                preparedStatement.PreparedSql = commandText.Trim();
+
                                if (request.ParameterMap == null) // No 
parameterMap --> error
                                {
                                        throw new DataMapperException("A 
procedure statement tag must have a parameterMap attribute, which is not the 
case for the procedure '"+statement.Id+"."); 


Reply via email to