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

DriverBase.RemoveUnusedCommandParameters removes all parameters when UseNamedPrefixInSql = true and UseNamedPrefixInParameter = false

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects versions: 3.3.0.CR1
    • Fix versions: 3.3.0.CR1
    • Components: Core
    • Labels:
    • Sprint:

      Description

      I have created a new driver for the Sybase Advantage DBMS. Please see below:

      public class SybaseAdsClientDriver : NHibernate.Driver.ReflectionBasedDriver
      {
      public SybaseAdsClientDriver() : base("Advantage.Data.Provider", "Advantage.Data.Provider.AdsConnection", "Advantage.Data.Provider.AdsCommand")
      { }

      public override bool UseNamedPrefixInSql { get

      { return true; }

      }
      public override bool UseNamedPrefixInParameter { get

      { return false; }

      }
      public override string NamedPrefix { get

      { return ":"; }

      }
      }

      While testing this I discovered that running the following query:

      Session.CreateQuery("from WebUser u where u.Inactive= :inactive").SetParameter("inactive", false).List<WebUser>();

      fails with the exception

      Advantage.Data.Provider.AdsException : Error 7200: AQE Error: State = 07002; NativeError = 2141; iAnywhere SolutionsAdvantage SQL EngineParameter missing AdsCommand query execution failed.

      I was able to trace the cause of this issue to the DriverBase.RemoveUnusedCommandParameters, where I discovered that all parameters were being removed from the command object if the properties UseNamedPrefixInSql = true and UseNamedPrefixInParameter = false.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                michaelcharalambous Michael Charalambous
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Who's Looking?