Custom Operator

A Custom operator can perform any operation that you define, using JavaScript code that you supply.

To implement a Custom operator, you first define the output schema that you will generate. Then you write JavaScript code for the body of a function that the Custom operator will call once for each output row it is expected to produce. Your code can iterate over the operator’s input result sets (there may be zero or more of these) and insert values for each column in the output row according to the defined schema. Your code must return a Boolean value. A return value of true indicates that it has produced a row. It will then be invoked again to produce the next row when the runtime needs it. If your code returns false, it indicates that it has no more rows to produce.

Beyond that, you’re free to set up your code as you want—you can precompute the output when the function is called the first time and then feed out the results one by one, simply act as a filter on the input, or do whatever you decide will work best for the functionality you need.

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.