mysql_stmt_send_long_data()

2023-07-26 02:37:19  Updated

mysql_stmt_send_long_data() allows an application to send parameter data to the server in pieces or chunks.

Syntax

my_bool
mysql_stmt_send_long_data(MYSQL_STMT *stmt,
                          unsigned int parameter_number,
                          const char *data,
                          unsigned long length)

Description of the parameters:

  • parameter_number indicates the parameters associated with the data. These parameters are numbered starting from 0.

  • data is a pointer that points to the buffer containing the data to be sent.

  • length specifies the number of bytes in the buffer.

Return values

If the function is executed, zero is returned. If an error occurs, a non-zero value is returned.

Error messages

  • CR_INVALID_BUFFER_USE: The parameter has no data of the string or binary type.

  • CR_INVALID_PARAMETER_NO: The parameter number is invalid.

  • CR_COMMANDS_OUT_OF_SYNC: Commands are executed in an incorrect order.

  • CR_SERVER_GONE_ERROR: The connection to the OBServer was interrupted.

  • CR_OUT_OF_MEMORY: The memory is insufficient.

  • CR_UNKNOWN_ERROR: An unknown error occurred.

Notes

You need to call this function after mysql_stmt_bind_param() and before mysql_stmt_execute(). You can call this function multiple times to send the character or binary data value of a column in pieces. Each piece must be of the TEXT or BLOB data type.

To reset or forget the sent data, call mysql_stmt_reset().

The max_allowed_packet system variable can control the maximum values of parameters sent by mysql_stmt_send_long_data().

Contact Us