MySQL Shell  8.0.16
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 value)
 Registers a parameter to be bound on the execution of the SQL statement. More...
 
SqlExecute bind (List values)
 Registers a list of parameter 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() [1/2]

SqlExecute bind ( Value  value)

Registers a parameter to be bound on the execution of the SQL statement.

Parameters
valuethe value to be bound.
Returns
This SqlExecute object.

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

This function can be invoked after:

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

◆ bind() [2/2]

SqlExecute bind ( List  values)

Registers a list of parameter to be bound on the execution of the SQL statement.

Parameters
valuesthe value list to be bound.
Returns
This SqlExecute object.

This method can be invoked any number of times, each time the received parameter 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()

SqlResult execute ( )

Executes the sql statement.

Returns
A SqlResult object.

This function can be invoked after: