|
void | M_sql_stmt_bind_clear (M_sql_stmt_t *stmt) |
|
void | M_sql_stmt_bind_clear_row (M_sql_stmt_t *stmt) |
|
void | M_sql_stmt_bind_new_row (M_sql_stmt_t *stmt) |
|
M_sql_error_t | M_sql_stmt_bind_bool (M_sql_stmt_t *stmt, M_bool val) |
|
M_sql_error_t | M_sql_stmt_bind_bool_null (M_sql_stmt_t *stmt) |
|
M_sql_error_t | M_sql_stmt_bind_int16 (M_sql_stmt_t *stmt, M_int16 val) |
|
M_sql_error_t | M_sql_stmt_bind_int16_null (M_sql_stmt_t *stmt) |
|
M_sql_error_t | M_sql_stmt_bind_int32 (M_sql_stmt_t *stmt, M_int32 val) |
|
M_sql_error_t | M_sql_stmt_bind_int32_null (M_sql_stmt_t *stmt) |
|
M_sql_error_t | M_sql_stmt_bind_int64 (M_sql_stmt_t *stmt, M_int64 val) |
|
M_sql_error_t | M_sql_stmt_bind_int64_null (M_sql_stmt_t *stmt) |
|
M_sql_error_t | M_sql_stmt_bind_text_const (M_sql_stmt_t *stmt, const char *text, size_t max_len) |
|
M_sql_error_t | M_sql_stmt_bind_text_own (M_sql_stmt_t *stmt, char *text, size_t max_len) |
|
M_sql_error_t | M_sql_stmt_bind_text_dup (M_sql_stmt_t *stmt, const char *text, size_t max_len) |
|
M_sql_error_t | M_sql_stmt_bind_binary_const (M_sql_stmt_t *stmt, const M_uint8 *bin, size_t bin_len) |
|
M_sql_error_t | M_sql_stmt_bind_binary_own (M_sql_stmt_t *stmt, M_uint8 *bin, size_t bin_len) |
|
M_sql_error_t | M_sql_stmt_bind_binary_dup (M_sql_stmt_t *stmt, const M_uint8 *bin, size_t bin_len) |
|
SQL Statement Parameter Binding
◆ M_sql_stmt_bind_clear()
Clear all bound parameters from a prepared statement object.
- Parameters
-
◆ M_sql_stmt_bind_clear_row()
Clear current row bound parameters for prepared statement object. This can be used if the caller wants to cancel the current row parameters due to an internal condition.
- Parameters
-
◆ M_sql_stmt_bind_new_row()
Increment to next row for statement binding.
Callers can bind multiple rows for insert statements to reduce server round trips during bulk data insertion. This function creates a new row and resets the current column index for binding a new row worth of columns.
All rows must contain the same number of columns consisting of the same data types (with the exception that NULL may be used) or it is considered a failure.
TODO: It may not be possible to determine which row caused a failure, such as a key conflict. Figure this out.
- Parameters
-
◆ M_sql_stmt_bind_bool()
Bind M_bool as next column to prepared statement handle
- Parameters
-
[in] | stmt | Initialized M_sql_stmt_t object |
[in] | val | Boolean value to bind. |
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_bool_null()
Bind M_bool NULL column to prepared statement handle
Due to quirks with ODBC, you must know the data type of the bound parameter when binding NULL values.
- Parameters
-
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_int16()
Bind M_int16 as next column to prepared statement handle
- Parameters
-
[in] | stmt | Initialized M_sql_stmt_t object |
[in] | val | 16bit signed integer value to bind. |
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_int16_null()
Bind M_int16 NULL column to prepared statement handle
Due to quirks with ODBC, you must know the data type of the bound parameter when binding NULL values.
- Parameters
-
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_int32()
Bind M_int32 as next column to prepared statement handle
- Parameters
-
[in] | stmt | Initialized M_sql_stmt_t object |
[in] | val | 32bit signed integer value to bind. |
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_int32_null()
Bind M_int32 NULL column to prepared statement handle
Due to quirks with ODBC, you must know the data type of the bound parameter when binding NULL values.
- Parameters
-
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_int64()
Bind M_int64 as next column to prepared statement handle
- Parameters
-
[in] | stmt | Initialized M_sql_stmt_t object |
[in] | val | 64bit signed integer value to bind. |
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_int64_null()
Bind M_int64 NULL column to prepared statement handle
Due to quirks with ODBC, you must know the data type of the bound parameter when binding NULL values.
- Parameters
-
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_text_const()
Bind a const string/text as next column to prepared statement handle
- Parameters
-
[in] | stmt | Initialized M_sql_stmt_t object |
[in] | text | Constant string, that is guaranteed to be available until the statement is executed, to bind to statement. Pass NULL for a NULL value. |
[in] | max_len | Maximum length of text/string value to use, use 0 for no maximum. |
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_text_own()
Bind string/text as next column to prepared statement handle that will be automatically freed upon statement destruction.
- Parameters
-
[in] | stmt | Initialized M_sql_stmt_t object |
[in] | text | Pointer to text/string to bind to statement. Must not be free'd by caller as destruction of the prepared statement handle will automatically free the value. |
[in] | max_len | Maximum length of text/string value to use, use 0 for no maximum. |
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_text_dup()
Bind string/text as next column to prepared statement handle that will be duplicated internally as the caller cannot guarantee the pointer will survive after execution of this bind call.
- Parameters
-
[in] | stmt | Initialized M_sql_stmt_t object |
[in] | text | Pointer to text/string that will be duplicated and bound to the statement handle. |
[in] | max_len | Maximum length of text/string value to use, use 0 for no maximum. |
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_binary_const()
Bind a const binary buffer as next column to prepared statement handle
- Parameters
-
[in] | stmt | Initialized M_sql_stmt_t object |
[in] | bin | Constant binary data, that is guaranteed to be available until the statement is executed, to bind to statement. Pass NULL for a NULL value. |
[in] | bin_len | Length of binary value to use. Only values up to 64k are allowed. |
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_binary_own()
Bind binary buffer as next column to prepared statement handle that will be automatically freed upon statement destruction.
- Parameters
-
[in] | stmt | Initialized M_sql_stmt_t object |
[in] | bin | Pointer to binary data to bind to statement. Must not be free'd by caller as destruction of the prepared statement handle will automatically free the value. |
[in] | bin_len | Length of binary value to use. Only values up to 64k are allowed. |
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.
◆ M_sql_stmt_bind_binary_dup()
Bind binary data as next column to prepared statement handle that will be duplicated internally as the caller cannot guarantee the pointer will survive after execution of this bind call.
- Parameters
-
[in] | stmt | Initialized M_sql_stmt_t object |
[in] | bin | Pointer to binary data that will be duplicated and bound to the statement handle. |
[in] | bin_len | Length of binary value to use. Only values up to 64k are allowed. |
- Returns
- M_SQL_ERROR_SUCCESS on success, or one of the M_sql_error_t values on failure.