mysql_sessi...ck_get_first(3)

πŸ“¦
version 13.0.2 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

🌸 mysql_session_track_get_first β€” bestie, let's peek at session tea 🌸

okay so this one lives in the MariaDB Connector/C manual (third section of the manual, 3, iykyk), and it's literally the function that hands you the first lil crumb of session status change info the server sent your way. precious. πŸ’–


✨ NAME ✨

mysql_session_track_get_first β€” retrieves first session status change information


πŸŽ€ SYNOPSIS πŸŽ€

#include <mysql.h>

int mysql_session_track_get_first(MYSQL * mysql,
                                  enum enum_session_state_type type,
                                  const char **data,
                                  size_t *length );

πŸ’… DESCRIPTION πŸ’…

so mysql_session_track_get_first() pulls up the first session status change information that came in from the server. like, the opening act. the first slide of the carousel. πŸ¦‹

depending on which type you asked for, that read-only data pointer is gonna be holding different things:

  • SESSION_TRACK_SCHEMA: the name of the default schema (database). yes queen, your current db, right there.
  • SESSION_TRACK_SYSTEM_VARIABLES: if a session system variable gets changed, the first call gives you the name of the changed system variable, and the second call gives you the new value. both the name and the value are represented as strings, no cap.
  • SESSION_TRACK_STATE_CHANGE: shows whether the session status has changed. the value is changed as the string "1" (changed) or "0" (unchanged). iconic little binary moment.

and if you want the rest of the tea? further data needs to be obtained by calling mysql_session_track_get_next(3). go get the sequel bestie 🫢


🌈 PARAMETER 🌈

  • mysql β€” mysql handle, which was previously allocated by mysql_init(3) and connected by mysql_real_connect(3). don't just hand it a random pointer, she's gotta be established. πŸ‘‘
  • type β€” type of information. valid values are:
    • SESSION_TRACK_SYSTEM_VARIABLES
    • SESSION_TRACK_SCHEMA
    • SESSION_TRACK_STATE_CHANGE
    • SESSION_TRACK_GTIDS (unsupported) πŸ™ˆ
  • data β€” pointer to data, which must be declared as const char *
  • length β€” pointer to a size_t variable, which will contain the length of data

⭐ RETURNS ⭐

Zero for success, nonzero if no session tracking information is available. that nonzero is not a vibe, it's just an empty inbox fr fr.


🧚 HISTORY 🧚

mysql_session_track_get_first() was added in Connector/C 3.0 and MariaDB Server 10.2. throwback era, but she ate. πŸ’œ


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page babes β€” this was Version 3.4 of the MariaDB Connector/C docs, so shoutout to that release for keeping the receipts. stay tracking, stay slaying πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from