MySQL Shell API 9.1.0
Unified development interface for MySQL Products
Methods | List of all members
SqlExecute Class Reference

Handler for execution SQL statements, supports parameter binding. More...

Methods

SqlExecute sql (String statement)
 Sets the sql statement to be executed by this handler. More...
 
SqlExecute bind (Value data)
 Registers a value or a list of values to be bound on the execution of the SQL statement. More...
 
SqlResult execute ()
 Executes the sql statement. More...
 

Detailed Description

Handler for execution SQL statements, supports parameter binding.

This object should only be created by calling the sql function at a Session instance.

See also
Session

Member Function Documentation

◆ sql()

SqlExecute sql ( String  statement)

Sets the sql statement to be executed by this handler.

Parameters
statementA string containing the SQL statement to be executed.
Returns
This SqlExecute object.

This function is called automatically when Session.sql(sql) is called.

Parameter binding is supported and can be done by using the \b ? placeholder instead of passing values directly on the SQL statement.

Parameters are bound in positional order.

The actual execution of the SQL statement will occur when the execute() function is called.

After this function invocation, the following functions can be invoked:

◆ bind()

SqlExecute bind ( Value  data)

Registers a value or a list of values to be bound on the execution of the SQL statement.

Parameters
datathe value or list of values to be bound.
Returns
This SqlExecute object.

This method can be invoked any number of times, each time the received parameters will be added to an internal binding list.

This function can be invoked after:

After this function invocation, the following functions can be invoked:

◆ execute()

std::shared_ptr< SqlResult > execute ( )

Executes the sql statement.

Returns
A SqlResult object.

This function can be invoked after: