Send feedback on this topic.
Teradata.Client.Provider
Source Code On Client Machine
.NET Data Provider for Teradata > Developer's Guide > Working with the Teradata Database Features > External Function Creation (XSP, UDF, UDT) > Source Code On Client Machine

Beginning with the .NET Data Provider for Teradata 14.11 release, the source code of a function can reside on the client machine.  A function refers to external stored procedure (XSP), user defined function (UDF), or user defined type (UDT).  When the provider executes the Data Definition Language (DDL) to create one of these objects, a TdConnection.OpenFile event will be raised.  When this event is raised the callback that has been registered with the TdConnection.TdOpenFileEventHandler delegate will be invoked.  This delegate enables the application to open a System.IO.Stream to the source file.  The provider uses the Stream to read the source code.

Once the source file has been read and the contents submitted to the Advanced SQL Engine, the Data Provider will raise the TdConnection.CloseFile event.  The callback that has been registered with the TdConnection.TdCloseFileEventHandler delegate will be invoked when this event is raised.

The following is an example of DDL to create an external stored procedure from a file that resides on the client machine:

CREATE PROCEDURE provider_sp(INOUT region VARCHAR(64))

LANGUAGE C NO SQL

PARAMETER STYLE SQL

EXTERNAL NAME 'CS!provider_sp!c:\MyDDL\MyXSP.c!F!provider_sp'

Refer to TdConnection.OpenFile for an example on how the events and delegates are used to send a source file to the SQL Engine.

See Also

TdConnection.OpenFile

TdConnection.TdOpenFileEventHandler

TdConnection.CloseFile

TdConnection.TdCloseFileEventHandler