I’ve been trying to get OrmLite and Devart to work together. I’ve noticed an issue in that the default OrmLiteDialectProviderBase<OracleOrmLiteDialectProvider>.ParamString
is being stripped out of the resulting SQL query.
By default ParamString
is “:” but this results in Sql statements containing bind variables that don’t have the “:” prefix. To get the prefix I need to set ParamString
to “::”.
E.g.
var ormLiteDialectProvider = new OracleOrmLiteDialectProvider(false, false, "Devart.Data.Oracle");
ormLiteDialectProvider.ParamString = "::";
OrmLiteConfig.DialectProvider = ormLiteDialectProvider;
using (var connection = Devart.Data.Oracle.OracleConnection(connectionString))
{
var results = connection.Select<MyTable>(w => w.MyField == "FooBar");
}
If I use a CaptureSqlFilter on the above I get the expected SQL
SELECT MyField FROM MyTable WHERE (MyField = :0)
However if I had left ParamString
as “:” I would have got
SELECT MyField FROM MyTable WHERE (MyField = 0)
Which results in a ORA-01036: illegal variable name/number
error from Oracle.
To try and determine if it’s OrmLite or Devart driver that’s clearing down the “:” I’ve tried executing a query using a param directly using Devarts OracleConnection, OracleCommand, OracleParameter etc and don’t see the “:” prefix being removed.
Can you shed any light on what may be removing this?