REPLACE CLIB (Replace external C library file)

Function

In order to execute an external C stored routine on the machine that the UAP is executed on, REPLACE CLIB replaces an existing external C library file on the HiRDB server on which the external C stored routine is implemented.

Format

REPLACE CLIB {:embedded-variable|'character-string'}

Operands

Specifies the name of the external C library file to be replaced. Specify an absolute path name or a relative path name for the name of the external C library file.

:embedded-variable
Specifies the name of the external C library file as a VARCHAR type embedded variable.
Character sets other than the default character set cannot be specified.
'character-string'
Specifies the name of the external C library file as a character string literal.

Common rules

  1. Before you execute REPLACE CLIB, the computer you are using must be connected to a HiRDB server.
  2. Error codes are returned in SQLCODE.
  3. External C library files on other servers cannot be specified.
  4. Wildcards cannot be used.
  5. If an external C library file with the same name is already installed, it is overwritten.
  6. The external C library file will be installed on the HiRDB server if it is not already installed.
  7. REPLACE CLIB must be executed before the start of a transaction.
  8. The external C library file must be created on the same platform on which it is to be replaced.
  9. A C library file cannot be replaced during execution of a transaction.

Example

Specify and replace an external C library file (c:\work\sampleproc.dll) using an embedded variable.

EXEC SQL BEGIN DECLARE SECTION ;
struct {
   short  len ;
   char   str[256] ;
} filename ;
EXEC SQL END DECLARE SECTION ;
EXEC SQL CONNECT ;
strcpy(filename.str,"c:\\work\\sampleproc.dll") ;
filename.len = strlen(filename.str) ;
EXEC SQL REPLACE CLIB :filename ;