This is a read-only copy of the MariaDB Knowledgebase generated on 2024-12-22. For the latest, interactive version please visit https://mariadb.com/kb/.

OK_Packet

OK_Packet is sent by the server to the client and indicates a successful completion of a command sent by the client before.

Direction

Server to client.

Fields


The length-encoded info string is not always included in the packet. Check the length of the packet to detect if there is data after the warning count. For the first OK_Packet in the connection it contains (if present) the SSL certificate verification signature. For the following OK_Packets it contains (if present) various human-readable information.

Server status flag

Values of server status flag

SERVER_STATUS_IN_TRANS1A transaction is currently active
SERVER_STATUS_AUTOCOMMIT2Autocommit mode is set
SERVER_MORE_RESULTS_EXISTS8More results exists (more packets will follow)
SERVER_QUERY_NO_GOOD_INDEX_USED16Set if EXPLAIN would've shown Range checked for each record
SERVER_QUERY_NO_INDEX_USED32The query did not use an index
SERVER_STATUS_CURSOR_EXISTS64When using COM_STMT_FETCH, indicate that current cursor still has result
SERVER_STATUS_LAST_ROW_SENT128When using COM_STMT_FETCH, indicate that current cursor has finished to send results
SERVER_STATUS_DB_DROPPED1<<8Database has been dropped
SERVER_STATUS_NO_BACKSLASH_ESCAPES1<<9Current escape mode is "no backslash escape"
SERVER_STATUS_METADATA_CHANGED1<<10A DDL change did have an impact on an existing PREPARE (an automatic reprepare has been executed)
SERVER_QUERY_WAS_SLOW1<<11The query was slower than long_query_time
SERVER_PS_OUT_PARAMS1<<12This resultset contain stored procedure output parameter
SERVER_STATUS_IN_TRANS_READONLY1<<13Current transaction is a read-only transaction
SERVER_SESSION_STATE_CHANGED1<<14Session state change. See Session change type for more information


Session state info


Session change type

0SESSION_TRACK_SYSTEM_VARIABLES
1SESSION_TRACK_SCHEMA
2SESSION_TRACK_STATE_CHANGE
3SESSION_TRACK_GTIDS
4SESSION_TRACK_TRANSACTION_CHARACTERISTICS
5SESSION_TRACK_TRANSACTION_STATE


session data's change

Each type of data has his own kind of format :

SESSION_TRACK_SCHEMA
SESSION_TRACK_SYSTEM_VARIABLES

while there is remaining data :

for each variable data :

Possible tracked variables list is tracked by session_track_system_variables

special variable value description:

  • redirect_url: format is `mariadb/mysql:[<user>[:<password>]@]<host>[:<port>]/[<db>[?<opt1>=<value1>[&<opt2>=<value2>]]]`. Possible options:
    • `ttl` : cache timeout in ms to remember redirection, in order to reconnect directly to new host. 0=no caching
SESSION_TRACK_STATE_CHANGE

indicates if session state changes occured. The value is represented as "1".

SESSION_TRACK_GTIDS

This tracker is not implemented by MariaDB.

SESSION_TRACK_TRANSACTION_CHARACTERISTICS

The transaction characteristics is the set of SQL statements that reproduces the type and state of the current transaction. It can consist of the following SQL statements:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
START TRANSACTION;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
START TRANSACTION WITH CONSISTENT SNAPSHOT, READ ONLY;
START TRANSACTION WITH CONSISTENT SNAPSHOT, READ WRITE;
SET TRANSACTION READ ONLY;
SET TRANSACTION READ WRITE;
XA START <XA specification>;
SESSION_TRACK_TRANSACTION_STATE

The transaction state string is always 8 characters long. The characters, in order, are:

  1. No transaction: _ Explicit transaction: T Implicit transaction: I
  2. Transaction read safe: _ Transaction read unsafe: r
  3. Unknown transaction type: _ Read-only transaction: R
  4. Transaction write safe: _ Transaction write unsafe: w
  5. Unknown transaction type: _ Read-write transaction: W
  6. Transaction statement safe: _ Transaction statement unsafe: s
  7. Transaction does not have resultsets: _ Transaction with resultsets: S
  8. No locked tables: _ Tables have been locked: L

Notes

  • Session tracking is supported from MariaDB 10.2. To determine if session tracking is enabled, check if the CLIENT_SESSION_TRACK flag is set in server_capabilities.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.