0 votes

Could it be explained why there is a mix in the API methods between parameters of datatpe string (newline separated) and parameters as datatypeolevariant (using VarArrayOf)?

This makes it complicated for developers.

Efficy.executeQueryWithoutContext(queryHandle, master, detail, queryParams, forceRefresh, getAllRecords)
queryParams = olevariant

Efficy.executeSystemSqlQuery(queryHandle, contextHandle, sql, queryParams, forceRefresh, getAllRecords, storeId)
queryParams = string

Would it be possible to accept multiple types of parameters in Delphi?

  • New line separated strings: used most of the time and for backwards compatibility
  • Olevariant: solely for backwards compatibility
  • JS array object, supporting datatypes as string, number and dates: ["hello", 0]
asked in WorkFlow / Serverscript by (6.9k points)

1 Answer

0 votes

The difference in parameter type is a historical issue, there is no fundamental reason.

When you pass parameters as string there is always the problem of conversions of date and floating point values which depend on the date/time/floating point locale settings.

Passing parameters as OleVariant array is technically a better solution, you can pass the values as is without requiring conversion to text.

A JS array object is the perfect equivalent of the OleVariant array, but it's not portable through the COM object interface between the JS script and the efficy code.

answered by (836 points)
Can't you internally parse and convert the JS Array to OleVariant before passing to the Application Server?
I need to correct myself.
Looking at the varArrayOf() method which is published in the ServerJS framework, apparently we can pass JS array objects via the COM interface, they get into our code as "array of Variant".
This means that we could indeed create a method like "executeQueryWithoutContext" that uses a JS array instead of the OleVariant parameter. Then again, it would probably add to the confusion :).
The proposal was to "upgrade" all existing functions to accept the three ways of parameter passing, mainly for backwards compatibility

Since we only support JS today, the API usage examples and description should only be provided for JS and use only JS arrays.

Today, EDN is like a documentation for R&D (seeing the Delphi variables) instead of documenation for the target group, developers who only use JS
1,169 questions
1,427 answers
325 users