Uploaded image for project: 'iBatis for .NET'
  1. iBatis for .NET
  2. IBATISNET-295

Cannot use questionMark and use variables in sharps (#variable#)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • DataMapper 1.6.1
    • None
    • DataMapper
    • None

    Description

      When inserted a literal questionMark, using variables with # # breaks the parser:

      <select id="countrySearch" parameterClass="Core.DataAccess.Table, Core" resultClass="System.Collections.Hashtable">
      SELECT * FROM table AS T
      WHERE T.id = #Id#
      AND
      T.Name = '?'
      </select>

      The error with stacktrace:

      System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
      Parameter name: index
      at IBatisNet.DataMapper.Configuration.ParameterMapping.ParameterPropertyCollection.get_Item(Int32 index)
      at IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory.EvaluateParameterMap()
      at IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory.Prepare()
      at IBatisNet.DataMapper.Configuration.Sql.SimpleDynamic.SimpleDynamicSql.BuildPreparedStatement(ISqlMapSession session, RequestScope request, String sqlStatement)
      at IBatisNet.DataMapper.Configuration.Sql.SimpleDynamic.SimpleDynamicSql.GetRequestScope(IMappedStatement mappedStatement, Object parameterObject, ISqlMapSession session)
      at IBatisNet.DataMapper.MappedStatements.CachingStatement.ExecuteQueryForList(ISqlMapSession session, Object parameterObject, Int32 skipResults, Int32 maxResults)
      at IBatisNet.DataMapper.MappedStatements.CachingStatement.ExecuteQueryForList(ISqlMapSession session, Object parameterObject)
      at IBatisNet.DataMapper.SqlMapper.QueryForList(String statementName, Object parameterObject)

      Reported similar in Nabble: http://www.nabble.com/Escaping-the-question-mark-td16609896.html

      Attachments

        Activity

          People

            Unassigned Unassigned
            cruzf cruz fernandez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: