Public memory durations

The DataBlade® API memory-management functions support several public memory durations. A UDR can use a public memory duration for most dynamic allocations of memory.

The DataBlade API provides the public memory durations that the following table shows.
Table 1. Public memory durations
Public memory duration Memory-duration constant Description
For the duration of one iteration of the UDR PER_ROUTINE, PER_FUNCTION The database server frees the memory after the UDR returns.
For the duration of the current SQL subquery PER_COMMAND The database server frees memory when an SQL command terminates.
For the duration of the current SQL statement PER_STATEMENT (Deprecated) The database server frees memory when an SQL statement terminates.
For the duration of the execution of the current SQL statement PER_STMT_EXEC The database server frees memory when the execution of an SQL statement is complete.
For the duration of the current prepared SQL statement PER_STMT_PREP The database server frees memory when a prepared SQL statement terminates.

The PER_ROUTINE and PER_COMMAND memory durations are the most common for C UDRs. The memory-duration constants in Public memory durations are of type MI_MEMORY_DURATION, which the memdur.h header file defines. All memory-duration constants in Public memory durations are also declared in the memdur.h header file.