Uploaded image for project: 'NHibernate [Moved to GitHub]'
  1. NH-2891

Too many parameters removed (Pervasive SQL) - SELECT doesn't work

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.0.Alpha3
    • Fix Version/s: 3.3.0.CR1
    • Component/s: Core
    • Labels:
      None
    • Sprint:

      Description

      Hi,
      I'm writing new driver for Pervasive SQL Databse.
      There is native ADO.NET provider for that database, distributed by Pervasive company.

      As far as I know, their SqlCommand doesn't use named parameters in SQL clauses - parameters should be added in order of "?" signs in SELECT/INSERT/DELETE clause.
      I've noticed that that approach is similar to DB2400Driver - there's also no support for prefixes in parameters' names.

      So, my problem is with loading entity from database - I can insert entity to databse by Session.Save, but couldn't load it by Session.Get.
      I got exception, that there's no parameter of index 0 in PsqlCommand.Parameters.

      I've been digging into NHibernate code and I've found that my problem is in SqlStringFormatter.Parameter method.
      That method is trying to remove "unused" parameters, by calling GetParameterName from Driver.
      After that operation, I have SELECT name FROM table WHERE id = ?, and no parameters in PsqlCommand.Parameters collection.

      Could you please tell me, where is the problem, or why we should remove "unused" parameters in Command?

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                grishnackh Daniel Sienkiewicz
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Who's Looking?