mysqlx.SqlResult

class mysqlx.SqlResult(connection: Connection)

Bases: RowResult

Represents a result from a SQL statement.

Parameters:

connection (mysqlx.connection.Connection) – The Connection object.

append_warning(level: int, code: int, msg: str) None

Append a warning.

Parameters:
  • level (int) – The warning level.

  • code (int) – The warning code.

  • msg (str) – The warning message.

property columns: List[Column]

The list of columns.

Type:

list

property count: int

The total of items.

Type:

int

fetch_all() List[Row | DbDoc]

Fetch all items.

Returns:

The list of items of mysqlx.DbDoc or

mysqlx.Row.

Return type:

list

fetch_one() Row | DbDoc | None

Fetch one item.

Returns:

one result item.

Return type:

mysqlx.Row or mysqlx.DbDoc

get_affected_items_count() int

Returns the number of affected items for the last operation.

Returns:

The number of affected items.

Return type:

int

get_autoincrement_value() int

Returns the identifier for the last record inserted.

Returns:

The identifier of the last record inserted.

Return type:

str

get_columns() List[Column]

Returns the list of columns.

Returns:

The list of columns.

Return type:

list

New in version 8.0.12.

get_warnings() List[Dict[str, int | str]]

Returns the warnings.

Returns:

The list of warnings.

Return type:

list

get_warnings_count() int

Returns the number of warnings.

Returns:

The number of warnings.

Return type:

int

has_data() bool

Returns True if result has data.

Returns:

Returns True if result has data.

Return type:

bool

New in version 8.0.12.

index_of(col_name: str) int

Returns the index of the column.

Returns:

The index of the column.

Return type:

int

next_result() bool

Process the next result.

Returns:

Returns True if the fetch is done.

Return type:

bool

set_closed(flag: bool) None

Sets if resultset fetch is done.

set_generated_ids(generated_ids: List[int]) None

Sets the generated ids.

set_generated_insert_id(generated_id: int) None

Sets the generated insert id.

set_has_data(flag: bool) None

Sets if result has data.

Parameters:

flag (bool) – True if result has data.

set_has_more_results(flag: bool) None

Sets if has more results.

Parameters:

flag (bool) – True if has more results.

set_rows_affected(total: int) None

Sets the number of rows affected.