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

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?

Environment

None

Status

Assignee

Unassigned

Reporter

Daniel Sienkiewicz

Labels

None

Components

Fix versions

Affects versions

3.2.0.Alpha3

Priority

Major