IRISLIB database
DataConnector Class Reference

Subclasses of this class are used to define DeepSee Data Connectors. More...

Inheritance diagram for DataConnector:
Collaboration diagram for DataConnector:

Static Public Member Functions

_.Library.Status OnPage ()
 Draw the test page.
 
- Static Public Member Functions inherited from Page
_.Library.Status ConvertParameter (_.Library.String url, _.Library.String name, _.Library.String value)
 You pass this the <parameter>url</parameter> of the page you are going to and a. More...
 
_.Library.Binary Decrypt (_.Library.String data)
 Decrypts the input string using the session.Key value that is unique to. More...
 
_.Library.String Encrypt (_.Library.Binary data)
 Encrypts the input string using the session.Key value that is unique to this. More...
 
_.Library.String EscapeHTML (in)
 This method converts input HTML text into Escaped HTML text.
 
_.Library.String EscapeURL (_.Library.String in, _.Library.String charset)
 This method converts the in input URL string into Escaped URL string. More...
 
_.Library.String HyperEventCall (_.Library.String methodName, _.Library.String args, _.Library.Integer type, _.Library.Boolean mobile)
 This method returns the string that needs to be written to the current. More...
 
_.Library.String HyperEventHead (_.Library.Boolean iframeOnly, _.Library.Boolean strict, _.Library.Boolean optionalBroker)
 This method returns the string that needs to be written to the current. More...
 
 Include (_.Library.String url)
 Include another csp page or file in the output at this point. More...
 
_.Library.String InsertHiddenField (_.Library.String url, _.Library.String name, _.Library.String value, _.Library.String extra)
 Inserts a '<input type="hidden" name="Name" value="Value">' tag into the current document. More...
 
_.Library.String InsertHiddenFields (_.Library.String url, _.Library.String query)
 Return the string containing the hidden form tags. More...
 
_.Library.Boolean IsPrivate ()
 Returns 1 if this page is in fact a private page (see <parameter>PRIVATE</parameter>).
 
_.Library.String Link (_.Library.String link, _.Library.String query, _.Library.Boolean addQ)
 Tranforms the link specified by link into a URL and returns it as a string. More...
 
_.Library.Status OnHTTPHeader (_.Library.Boolean OutputBody)
 Event handler for PAGE event: this is invoked in order to
More...
 
 OnPageError (_.Library.Status sc)
 Event handler for any error that occurs on the page. More...
 
 OnPostHTTP ()
 Event handler for POSTPAGE event: this is invoked after the data. More...
 
_.Library.Status OnPostHyperEvent (_.Library.String class, _.Library.String method)
 Event handler which is invoked after a hyperevent method is called on this page.
 
_.Library.Boolean OnPreHTTP ()
 Event handler for PreHTTP event: this is invoked before. More...
 
_.Library.Status OnPreHyperEvent (_.Library.String class, _.Library.String method)
 Event handler which is invoked before a hyperevent method is called on this page. More...
 
_.Library.Status Page (_.Library.Boolean skipheader)
 Process a request to serve a CSPPage. More...
 
_.Library.String QuoteJS (in)
 This method converts input string into quoted JavaScript literal.
 
_.Library.String RewriteURL (_.Library.String url)
 This method will rewrite a URL to use #url()# if needed.
 
 ShowError (_.Library.Status sc)
 Display a <class>Status</class> error code to the CSP Page.
 
 StartTimer (_.Library.String name)
 Used to get performance information on your CSP pages. More...
 
 StopTimer (_.Library.String name)
 Used to time performance information on your CSP pages. More...
 
 ThrowError (_.Library.Status sc)
 Passed a <class>Status</class> code this goes to the error page passing this status code.
 
_.Library.String UnescapeHTML (in)
 This method converts Escaped HTML text into normal HTML text.
 
_.Library.String UnescapeURL (_.Library.String in, _.Library.String charset)
 This method converts the in Escaped URL string back to its original form. More...
 

Static Public Attributes

 EXTERNALTABLE = None
 Subclasses of this class are used to define DeepSee Data Connectors. More...
 
 SUPPORTSIDLIST = None
 Set this parameter TRUE (1) if this connector supports "idlist" mode. More...
 
 SUPPORTSSINGLE = None
 Set this parameter TRUE (1) if this connector supports "single" mode. More...
 
- Static Public Attributes inherited from Page
 CHARSET = None
 The <CLASS>CSP.Page</CLASS> object serves as an event handler for CSP requests. More...
 
 CONTENTTYPE = None
 Specifies the default content type for the page. More...
 
 CONVERTINPUTSTREAM = None
 Specifies if input request.Content or request.MimeData values are converted from their. More...
 
 CSPFILE = None
 If this page was compiled from a .csp file, then this parameter contains the. More...
 
 CSPSTRICT = None
 The CSPSTRICT parameter is set to 1, if the DOCTYPE indicates that this. More...
 
 CSPURL = None
 This parameter is used to make sure that if multiple. More...
 
 CSPXHTML = None
 The CSPXHTML parameter is set to 1, if the DOCTYPE indicates that this. More...
 
 DOMAIN = None
 The default domain for csp:text, span and div tags. More...
 
 ENCODED = None
 Controls how the query parameters for this page are passed, it can. More...
 
 ERRORPAGE = None
 Specify a custom error page to call if there are any problems with generating this page. More...
 
 EXPIRES = None
 Specified the default value for the response.Expires. More...
 
 NOCHARSETCONVERT = None
 Specifies if we wish to turn off charset conversion for this page. More...
 
 PAGETIMING = None
 If this parameter is true then we automatically record timing statistics of how long it takes to. More...
 
 PRIVATE = None
 Controls the access to the page, it can be set to one of the following:
More...
 
 SECURITYRESOURCE = None
 This is a comma-delimited list of system Resources and associated. More...
 
 TIMINGSLOTS = None
 Used by the timing to decide how many slots a day should be divided up into. More...
 
 UseSession = None
 This parameter controls the CSP session support. More...
 
- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 

Private Member Functions

_.SQL.StatementResult Execute (pParameters, _.Library.Status pSC)
 This executes the source result set and returns an instance of it to the consumer. More...
 
_.Library.Status GetRestrictionClause (_.Library.String pClause)
 Return an SQL expression that tests the current idlist restrictions, if any. More...
 
_.Library.Status OnGetSourceResultSet (pParameters, pResultSet)
 If implemented, this method is responsible for. More...
 
_.Library.Integer OnNextRecord (_.Library.Status pSC)
 This method is called by the output result set to fetch each record processed by this connector. More...
 
_.Library.Status OnProcessRecord (_.DeepSee.Connector.ResultSet pRecord, _.Library.Boolean pSkip)
 If implemented, this method is called for each record processed by this connector. More...
 
_.Library.Status SetIdList (_.Library.String pTableName, _.Library.String pKey, _.Library.String pCubeName)
 Set the name of the listing table and value of the key field that contains. More...
 
_.Library.Status SetMode (_.Library.String pMode)
 The operating mode of this connector. More...
 
_.Library.Status SetSingleId (_.Library.String pID)
 Set the id of one record to fetch. More...
 
_.Library.Boolean SupportsIdList ()
 Test if this connector supports "idlist" mode.
 
_.Library.Boolean SupportsSingleMode ()
 Test if this connector supports "single" mode.
 

Static Private Member Functions

_.Library.Status GetConnectorInfo (_.Library.List pInfo)
 Return an array containing information about this connector. More...
 
_.Library.Status GetKeyFields (_.Library.String pKeys)
 Return an array containing information on the id key field(s) for this connector, if any. More...
 
_.Library.Status GetPropertyInfo (_.Library.List pInfo)
 Return an array containing information on the properties of this connector. More...
 
_.Library.String GetResultSetClass ()
 Return the class name of the output result set associated with this connector.
 
_.Library.String GetSQLText ()
 Return the SQL statement defined by the SourceQuery XData block, if any.
 
_.Library.Status OnUpdateRecord (_.Library.String pID, pValues, _.Library.String pMessage)
 Implement this method in order to update a particular record via the data connector.
 
_.Library.Status Print (pParameters, _.Library.Integer pMaxRows)
 Diagnostic method. More...
 
_.Library.Status ToJSON (pParameters)
 Write out all data in JSON format.
 
_.Library.Status UpdateRecord (_.Library.String pID, pValues, _.Library.String pMessage)
 Update a particular record via the data connector. More...
 

Additional Inherited Members

- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 

Detailed Description

Subclasses of this class are used to define DeepSee Data Connectors.


A DataConnnector provides a way to connect an input data source (such as the results of running an SQL query) to an output data sink (such as the dataSource for a DeepSee cube).
You can define the input data source by defining a SourceQuery XData block:

XData SourceQuery [ XMLNamespace = "http://www.intersystems.com/deepsee/connector/query" ] { <sql> SELECT ID,Product,AmountOfSale From MyApp.MyTable </sql> }

or, alternatively, you can implement the <method>OnGetSourceResultSet</method> callback method. This method should create, prepare, and execute an <class>SQL.Statement</class> and return the resulting ResultSet.

Method OnGetSourceResultSet(ByRef pParameters, Output pResultSet) As Status { Set tSC = $$$OK Set pResultSet = "" Try { Set tStatement = ##class(SQL.Statement).New(,"DEFAULT_SCHEMA") Set tSC = tStatement.Prepare("SELECT %ID,Product,AmountOfSale FROM MyApp.MyClass") If $$$ISERR(tSC) Quit Set pResultSet = tStatement.Execute() } Catch(ex) { Set tSC = ex.AsStatus() } Quit tSC }

The output properties of the Data Connector are defined using the Output XData block. This contains an XML document that describes the set of output properties.
For example:

XData Output [ XMLNamespace = "http://www.intersystems.com/deepsee/connector/output" ] { <connector> <property name="%ID" sourceProperty="ID" displayName="Record ID" > <property name="Product" sourceProperty="Product" displayName="Product name"> <property name="AmountOfSale" sourceProperty="AmountOfSale" displayName="Amount of sale"> </connector> }

A DataConnector is used by creating an instance of it and calling its <method>Execute</method> method. This returns an instance of <class>SQL.StatementResult</class> that can be used to read data from the DataConnector.
You can test a DataConnector class by calling its <method>Print</method> method from the command line or you can view the DataConnector class as a web page.
If you are using a DataConnector class to supply data to a DeepSee cube the cube will take care of executing and fetching data from it.
A DataConnector can override the <method>OnNextRecord</method> method if it wishes to perform additional logic on data flowing through the connector.
Each DataConnector class is also also a CSP page; if you view it as a Web Page, you can view a test page for the DataConnector (you must hold Developer privileges to do this).

Member Function Documentation

◆ Execute()

_.SQL.StatementResult Execute (   pParameters,
_.Library.Status  pSC 
)
private

This executes the source result set and returns an instance of it to the consumer.

This is used to fetch all data from this connector.

◆ GetConnectorInfo()

_.Library.Status GetConnectorInfo ( _.Library.List  pInfo)
staticprivate

Return an array containing information about this connector.

This takes the form:
pInfo = $LB(name,displayName)

◆ GetKeyFields()

_.Library.Status GetKeyFields ( _.Library.String  pKeys)
staticprivate

Return an array containing information on the id key field(s) for this connector, if any.

This takes the form:
pKeys(FieldName) = SourceField
This is used by utilities to discover information about this connector.

◆ GetPropertyInfo()

_.Library.Status GetPropertyInfo ( _.Library.List  pInfo)
staticprivate

Return an array containing information on the properties of this connector.

This takes the form:
pInfo(n) = $LB(name,displayName,type,idKey)
This is used by utilities to discover information about this connector.

◆ GetRestrictionClause()

_.Library.Status GetRestrictionClause ( _.Library.String  pClause)
private

Return an SQL expression that tests the current idlist restrictions, if any.

This expression can be used within an SQL WHERE statement. This is used to substitute any $$$RESTRICT values within a connector SQL statement.

◆ OnGetSourceResultSet()

_.Library.Status OnGetSourceResultSet (   pParameters,
  pResultSet 
)
private

If implemented, this method is responsible for.

creating an instance of result set that will serve the data for this connector.
This method should test the current value of the <property>mode</property> property. If <property>mode</property> is "idlist", the query is responsible for restricting the set of records the ids in the listing table, <property>listingTable</property>.

◆ OnNextRecord()

_.Library.Integer OnNextRecord ( _.Library.Status  pSC)
private

This method is called by the output result set to fetch each record processed by this connector.

for cases where there is no source result set (if there is a source result set, this method is not called).
Returns 0 if there are no more records to fetch.
This method should fill in the properties of the <property>outputRecord</property> object with the data that is to be returned.

◆ OnProcessRecord()

_.Library.Status OnProcessRecord ( _.DeepSee.Connector.ResultSet  pRecord,
_.Library.Boolean  pSkip 
)
private

If implemented, this method is called for each record processed by this connector.

before it is returned to the consumer.
pRecord is the current record.
pSkip, if true, indicates that this record should be skipped.

◆ Print()

_.Library.Status Print (   pParameters,
_.Library.Integer  pMaxRows 
)
staticprivate

Diagnostic method.


Create, execute, and display the data provided by this connector to the terminal.
pParameters is an array of parameters passed along to the <method>Execute</method> method. pMaxRows, if not "", is the maximum number of records to display. The default is 100.

◆ SetIdList()

_.Library.Status SetIdList ( _.Library.String  pTableName,
_.Library.String  pKey,
_.Library.String  pCubeName 
)
private

Set the name of the listing table and value of the key field that contains.

the list of ids to use in "idlist" mode.
A query of the form, SELECT _DSsourceId FROM pTableName WHERE _DSqueryKey = pKey will return the set of ids to use.

◆ SetMode()

_.Library.Status SetMode ( _.Library.String  pMode)
private

The operating mode of this connector.


Options are "all" (fetch all records), "idlist" (fetch records within a set of ids).

◆ SetSingleId()

_.Library.Status SetSingleId ( _.Library.String  pID)
private

Set the id of one record to fetch.

The Connector must support id values.

This is used to fetch one record for updating.

◆ UpdateRecord()

_.Library.Status UpdateRecord ( _.Library.String  pID,
  pValues,
_.Library.String  pMessage 
)
staticprivate

Update a particular record via the data connector.

The actual work is done via the <method>UpdateRecord</method> callback method, which is implemented within a subclass.

Member Data Documentation

◆ EXTERNALTABLE

EXTERNALTABLE = None
static

Subclasses of this class are used to define DeepSee Data Connectors.


A DataConnnector provides a way to connect an input data source (such as the results of running an SQL query) to an output data sink (such as the dataSource for a DeepSee cube).
You can define the input data source by defining a SourceQuery XData block:

XData SourceQuery [ XMLNamespace = "http://www.intersystems.com/deepsee/connector/query" ] { <sql> SELECT ID,Product,AmountOfSale From MyApp.MyTable </sql> }

or, alternatively, you can implement the <method>OnGetSourceResultSet</method> callback method. This method should create, prepare, and execute an <class>SQL.Statement</class> and return the resulting ResultSet.

Method OnGetSourceResultSet(ByRef pParameters, Output pResultSet) As Status { Set tSC = $$$OK Set pResultSet = "" Try { Set tStatement = ##class(SQL.Statement).New(,"DEFAULT_SCHEMA") Set tSC = tStatement.Prepare("SELECT %ID,Product,AmountOfSale FROM MyApp.MyClass") If $$$ISERR(tSC) Quit Set pResultSet = tStatement.Execute() } Catch(ex) { Set tSC = ex.AsStatus() } Quit tSC }

The output properties of the Data Connector are defined using the Output XData block. This contains an XML document that describes the set of output properties.
For example:

XData Output [ XMLNamespace = "http://www.intersystems.com/deepsee/connector/output" ] { <connector> <property name="%ID" sourceProperty="ID" displayName="Record ID" > <property name="Product" sourceProperty="Product" displayName="Product name"> <property name="AmountOfSale" sourceProperty="AmountOfSale" displayName="Amount of sale"> </connector> }

A DataConnector is used by creating an instance of it and calling its <method>Execute</method> method. This returns an instance of <class>SQL.StatementResult</class> that can be used to read data from the DataConnector.
You can test a DataConnector class by calling its <method>Print</method> method from the command line or you can view the DataConnector class as a web page.
If you are using a DataConnector class to supply data to a DeepSee cube the cube will take care of executing and fetching data from it.
A DataConnector can override the <method>OnNextRecord</method> method if it wishes to perform additional logic on data flowing through the connector.
Each DataConnector class is also also a CSP page; if you view it as a Web Page, you can view a test page for the DataConnector (you must hold Developer privileges to do this).

Set this parameter TRUE (1) if this connector uses a linked (external) table.

This is used to determine what form the id restriction used for listings ($$$RESTRICT token) should take. For external tables a more conservative approach, with a limit of 1000 records is used. If you know that your data source is based on a local table, you can set this parameter to 0 and more aggressive id restriction is used with no size limit,

◆ SUPPORTSIDLIST

SUPPORTSIDLIST = None
static

Set this parameter TRUE (1) if this connector supports "idlist" mode.

The implementor is responsible for adding the additional query logic to support this mode.

◆ SUPPORTSSINGLE

SUPPORTSSINGLE = None
static

Set this parameter TRUE (1) if this connector supports "single" mode.

The implementor is responsible for adding the additional query logic to support this mode.