nhibernate / NHibernate.JetDriver

Jet Driver for NHibernate
GNU Lesser General Public License v2.1
3 stars 8 forks source link

NHCD-46 - Jet driver does not return correct results when HQL where clause contains a boolean value #12

Closed nhibernate-bot closed 7 years ago

nhibernate-bot commented 7 years ago

erik konijnenburg created issue - 25/Jan/12 9:19 AM

When a HQL query contain a condition that is mapped to a boolean value the generate SQL query is incorrect. For example "from Account where locked = true" is translated into "select ....... from Acount where locked=1". When using access it should be "..... where locked=-1". It only fails with with the ASTQueryTranslatorFactory. The ClassicQueryTranslatorFactory works as expected.

Fix is trivial. Add override for ToBooleanValueString to JetDialect that creates the correct values for the SQL statement.

/// <summary> The SQL literal value to which this database maps boolean values. </summary>
/// <param name="value">The boolean value </param>
/// <returns> The appropriate SQL literal. </returns>
public override string ToBooleanValueString(bool value)
{
  return value ? "-1" : "0";
}
hazzik commented 7 years ago

Sames as #1