FHannes
FHannes

Reputation: 781

Get result data context in an OnFastEval event in DWScript

How do you get an IDataContext for the result value in the OnFastEval event in a TDWSUnit function?

The "magic functions"-functionality presented through the OnFastEval event can't return complex data, like records, as OnFastEval returns a Variant. The internal magic functions do support using an IDataContext interface to return complex data.

Upvotes: 2

Views: 265

Answers (1)

Eric Grange
Eric Grange

Reputation: 6211

You have to return the IDataContext interface through the variant result (it's an IUnknown, so you can assign it directly).

You can allocate an IDataContext directly from TDataContext, from execution pool through (args.Exec.Stack.CreateDataContext), or you can pass along an existing one.

For sample code, see FuncFastPoint in UdwsUnitTests

Upvotes: 1

Related Questions