CliPreSQLExt - Call-Level Interface Version 2

Teradata® Call-Level Interface Version 2 Reference for Workstation-Attached Systems

Product
Call-Level Interface Version 2
Release Number
17.10
Published
October 2021
Language
English (United States)
Last Update
2021-11-02
dita:mapPath
ttt1608578409164.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2418
lifecycle
previous
Product Category
Teradata Tools and Utilities

CliPreSQLExt is the CLI Pre-process SQL User Exit function of DBCHCL. CliPreSQLExt is used to filter SQL requests that may slow down the database, to control SQL requests sent to the database, and to collect time statistics of SQL requests.

Calling CliPreSQLExt

CliPreSQLExt is called just before CLIIRQ. Prior to the call to CliPreSQLExt, CLI performs the following:

  1. If not variable length request, CLI checks the SQL request to see if it can be saved in the internal CLI Buffer.

    If the request length is less than, or equal to, the internal max buffer length, the process continues to the next step. If not, it aborts and returns an error 302.

  2. The SQL request’s length is saved in the structure CliPreSQLExt.

    If the request length is less than, or equal to, the internal buffer size, the process continues to the next step. If not, it aborts and return an error 302.

  3. After the call to CliPreSQLExt, CLI performs the following:
    • If EM_OK was returned, send the Teradata SQL to the database.
    • If an error message is received, abort the request. Use normal CLI error logic when a Teradata SQL request is aborted.
Do not exceed the Teradata SQL buffer size within the CliPreSQLExt function. Exceeding the buffer size results in damage to other areas of CLI. Damage is platform-dependent.

Interface

struct CliPreSQLExit
{
   char   *SQL_Request_ptr;    /* pointer to user request */
   char   Start_date[80];      /* start date in ascii */
   Int32  Clock_time;          /* clock time */
   char   dbcname[DBCNAMLEN];  /* DBC name */
   char   username[USRNAMLEN]; /* username */
   char   account[ACTNAMLEN];  /* account */
   char   password[PWDNAMLEN]; /* password */
   char   domain[DOMAINLEN];   /* domain */
   Int32  *SQL_len_ptr;        /* length of user request */
   Int32  logsessid;           /* logical session id */
   Int16  Process_Post;        /* enable post processing */
};

The elements Start_date[80] and Clock_time must be set manually to determine the clock time for SQL requests.

Return Value

CliPreSQLExt returns zero (0) if successful, otherwise it returns an error code. The variable Process_Post is set to TRUE if the Post-process SQL function is to be executed by CLI.

Error Handling

A CLI error code 351 (SQLUSREXT) is available to the user. However, any error code found in the errmsg.txt file may also be returned.