I use a huge amount of parameters for certain (maintenance) queries
However I run into a limitation of RO/DA
Is there a way to bypass this?
It’s used as an ‘IN’ SQL where clause.
var listWhereExpression = new List<RemObjects.DataAbstract.Expressions.WhereExpression>();
foreach (int pk in fetchPrimkeyList)
listWhereExpression.Add(new RemObjects.DataAbstract.Expressions.ConstantExpression(pk, RemObjects.DataAbstract.Schema.DataType.Integer));
var listExpression = new RemObjects.DataAbstract.Expressions.ListExpression(listWhereExpression.ToArray());
var condition = new RemObjects.DataAbstract.Expressions.BinaryExpression(
new RemObjects.DataAbstract.Expressions.FieldExpression(KeyFieldName), listExpression, RemObjects.DataAbstract.Expressions.BinaryOperator.In);
whereClauseXml = condition.ToXmlNode();
It does not look like a stored proc is used to do the fetch
This is the SQL
SELECT xxx
FROM yyy
WHERE ([prg_primkey] IN (@DAPARAM_1, @DAPARAM_2, …
I don’t want to use a stored procedure
Any way of telling DA to not use a stored proc?
I have an alternate solution for my custom where clauses
I use an identifier resolver
EventHandler resolveIdentifier = (IChannelSender, e) =>…
that’s hooked to DataAbstractService.UnknownSqlMacroIdentifier
which replaces my own {ExtraWhereClause} variable.
This works without limitation but is inconvenient because:
The DA schema GUI application does not allow “Preview Data” or other execution when the identifier is there
Is there a way to use a custom where clause, e.g. by changing the SQL in the schema at runtime ({where} becomes {where} and {extrawhereclause}
Or failing that is there a way to add a custom identifier that the DA schema modeler ignores?
WhereExpression where =
new BinaryExpression(
new FieldExpression("","fieldX"),
new ListExpression(
new WhereExpression[]{
new ConstantExpression(1),
new ConstantExpression(5),
new ConstantExpression(7)
}),
BinaryOperator.In);
I believe this is the method I was already using but that fails due to the argument limit (= 2100 in my case)
// FVC 12/2024: This solution does not require the {ExtraWhereClause} in the SQL but is limited to ~2100 parameters - see https://talk.remobjects.com/t/bypass-maximum-number-of-parameters/31172/3
var listWhereExpression = new List<RemObjects.DataAbstract.Expressions.WhereExpression>();
foreach (int pk in fetchPrimkeyList)
listWhereExpression.Add(new RemObjects.DataAbstract.Expressions.ConstantExpression(pk, RemObjects.DataAbstract.Schema.DataType.Integer));
var listExpression = new RemObjects.DataAbstract.Expressions.ListExpression(listWhereExpression.ToArray());
var condition = new RemObjects.DataAbstract.Expressions.BinaryExpression(
new RemObjects.DataAbstract.Expressions.FieldExpression(KeyFieldName), listExpression, RemObjects.DataAbstract.Expressions.BinaryOperator.In);
whereClauseXml = condition.ToXmlNode();