MySQL 9.1.0
Source Code Documentation
s_mysql_mysql_stored_program_external_program_handle Struct Reference

Service to get and change the stored program's external language handle. More...

#include <mysql_stored_program.h>

Public Attributes

mysql_service_status_t(* get )(stored_program_handle sp, external_program_handle *value)
 Obtain the currently attached Language Component's Stored Program from the server object. More...
 
mysql_service_status_t(* set )(stored_program_handle sp, external_program_handle value)
 Attach or detach the Language Component's Stored Program from the server object. More...
 

Detailed Description

Service to get and change the stored program's external language handle.

In general, the server stored program object does handle the lifetime of the external language objects. It initiates the creation, parsing, execution and destruction of such objects. But, in rare cases, the external language component may request the server to change its external language object. Example of such cases are: The stored program is aborted. The external language object needs to be destroyed and detached from the server object. The session was reset. Either by explicit user demand, or when incompatible changes happen such as timezone change. All of its objects need to be destroyed and detached. The limit of external language objects is reached. The oldest objects may be destroyed and detached. The limit of external language sessions is reached. The oldest sessions may be destroyed, together with their language objects. The external language object is changed. The new object needs to replace the existing one.

Note
Both the external language session and external language object services support lazy (re)initialization. The current object may be detached and destroyed. When another request to the same stored program comes, a new object will be created.

Used approximately as follows:

// Get the current external_program_handle.
external_program_handle old_sp = nullptr;
if (SERVICE_PLACEHOLDER(mysql_stored_program_external_program_handle)
return 1;
// Detach and destroy the current external_program_handle.
if (SERVICE_PLACEHOLDER(mysql_stored_program_external_program_handle)
return 1;
if (old_sp) destroy_stored_program(old_sp);
// Create and attach a new external_program_handle.
external_program_handle old_sp = create_stored_program();
return SERVICE_PLACEHOLDER(mysql_stored_program_external_program_handle)
->set(stored_program_handle, nullptr);
external_program_handle new_sp = create_stored_program();
return SERVICE_PLACEHOLDER(mysql_stored_program_external_program_handle)
->set(stored_program_handle, new_sp);
#define SERVICE_PLACEHOLDER(service)
Use this macro to reference the service placeholder as defined by the REQUIRES_SERVICE_PLACEHOLDER ma...
Definition: component_implementation.h:382
struct external_program_handle_imp * external_program_handle
The handle is created by the caller of external_program_execution service.
Definition: language_service.h:37
struct stored_program_handle_imp * stored_program_handle
The handle is an opaque pointer to a sp_head item.
Definition: language_service.h:42
mysql_service_status_t(* set)(stored_program_handle sp, external_program_handle value)
Attach or detach the Language Component's Stored Program from the server object.
Definition: mysql_stored_program.h:927
mysql_service_status_t(* get)(stored_program_handle sp, external_program_handle *value)
Obtain the currently attached Language Component's Stored Program from the server object.
Definition: mysql_stored_program.h:909

Member Data Documentation

◆ get

mysql_service_status_t(* s_mysql_mysql_stored_program_external_program_handle::get) (stored_program_handle sp, external_program_handle *value)

Obtain the currently attached Language Component's Stored Program from the server object.

Note
: Only stored_program_handle belonging to current thread are supported.
Parameters
[in]spstored_program_handle
[out]valueLanguage Component's Stored Program.
Returns
Status of operation
Return values
falseSuccess
trueError

◆ set

mysql_service_status_t(* s_mysql_mysql_stored_program_external_program_handle::set) (stored_program_handle sp, external_program_handle value)

Attach or detach the Language Component's Stored Program from the server object.

In order to detach the current Stored Program from the server

  • provide nullptr value.
    Note
    : Only stored_program_handle belonging to current thread are supported.
    Parameters
    [in]spstored_program_handle
    [in]valueLanguage Component's Stored Program. Use nullptr to detach the current value from the server.
    Returns
    Status of operation
    Return values
    falseSuccess
    trueError

The documentation for this struct was generated from the following file: