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

mariadb_get_infov

Syntax

int mariadb_get_infov(MYSQL * mysql,
                      enum mariadb_value value,
                      void * arg,
                      ...);
  • mysql - a mysql handle, which was previously allocated by mysql_init() or mysql_real_connect(). For general information which is not bound to connection this parameter might be null.
  • value - the type of value you want to retrieve. See description below.
  • arg - pointer to a variable for storing value of the specified option.
  • ... - variable argument list

Description

Retrieves generic or connection specific information.

Returns zero on success, non zero if an error occurred (invalid option),

This function was added in MariaDB Connector/C 3.0,

Value types

Generic information

For these information types parameter mysql needs to be set to NULL.

  • MARIADB_CHARSET_NAME: Retrieves the charset information for a character set by it's literal representation.
    Parameter type: const MARIADB_CHARSET_INFO*.
  • MARIADB_CLIENT_ERRORS: Retrieve array of client errors. This can be used in plugins to set global error messages (which are not exported by MariaDB Connector/C).
    Parameter type: const char **.
  • MARIADB_CLIENT_VERSION: The client version in literal representation.
    Parameter type: const char *.
  • MARIADB_CLIENT_VERSION_ID: The client version in numeric format.
    Parameter type: unsigned int.
  • MARIADB_MAX_ALLOWED_PACKET: Retrieves value of maximum allowed packet size.
    Parameter type: size_t
  • MARIADB_NET_BUFFER_LENGTH: Retrieves the length of net buffer.
    Parameter type: size_t
  • MARIADB_TLS_LIBRARY: The TLS library MariaDB Connector/C is compiled against.
    Parameter type: const char *.
  • MARIADB_CONNECTION_ASYNC_TIMEOUT: Retrieves the timeout for non blocking calls in seconds.
    Parameter type: unsigned int.
  • MARIADB_CONNECTION_ASYNC_TIMEOUT_MS: Retrieves the timeout for non blocking calls in milliseconds.
    Parameter type: unsigned int.
  • MARIADB_CONNECTION_MARIADB_CHARSET_INFO: Retrieves character set information for given connection.
    Parameter type: const MY_CHARSET_INFO *.
  • MARIADB_CONNECTION_CLIENT_CAPABILITIES: Returns the capability flags of the client.
    Parameter type: unsigned long.
  • MARIADB_CONNECTION_ERROR: Retrieves error message for last used command.
    Parameter type: const char *.
  • MARIADB_CONNECTION_ERROR_ID: Retrieves error number for last used command.
    Parameter type: unsigned int.
  • MARIADB_CONNECTION_EXTENDED_SERVER_CAPABILITIES: Returns the extended capability flags of the connected MariaDB server.
    Parameter type: unsigned long.
  • MARIADB_CONNECTION_HOST: Retrieves connection's host name.
    Parameter type: const char *.
  • MARIADB_CONNECTION_INFO: Retrieves generic info for last used command.
    Parameter type: const char *.
  • MARIADB_CONNECTION_PORT: Retrieves the port number of server host.
    Parameter type: unsigned int.
  • MARIADB_CONNECTION_PROTOCOL_VERSION_ID: Retrieves the protocol version number.
    Parameter type: unsigned int.
  • MARIADB_CONNECTION_PVIO_TYPE: Retrives the pvio plugin used for specified connection.
    Parameter type: unsigned int.
  • MARIADB_CONNECTION_SCHEMA: Retrieves the current schema.
    Parameter type: const char*.
  • MARIADB_CONNECTION_SERVER_CAPABILITIES: Returns the capability flags of the connected server.
    Parameter type: unsigned long.
  • MARIADB_CONNECTION_SERVER_STATUS: Returns server status after last operation. A list of possible flags can be found in the description OK packet.
    Parameter type: unsigned int.
  • MARIADB_CONNECTION_SERVER_TYPE: Retrieves the type of the server.
    Parameter type: const char*.
  • MARIADB_CONNECTION_SERVER_VERSION: Retrieves the server version in literal format.
    Parameter type: const char *.
  • MARIADB_CONNECTION_SERVER_VERSION_ID: Retrieves the server version in numeric format.
    Parameter type: unsigned int.
  • MARIADB_CONNECTION_SOCKET: Retrieves the handle (socket) for given connection.
    Parameter type: my_socket.
  • MARIADB_CONNECTION_SQLSTATE: Retrieves current sqlstate information for last used command.
    Parameter type: const char *.
  • MARIADB_CONNECTION_SSL_CIPHER: Retrieves the TLS cipher in use.
    Parameter type: const char *.
  • MARIADB_CONNECTION_TLS_VERSION: Retrieves the TLS protocol version used in literal format.
    Parameter type: char *.
  • MARIADB_CONNECTION_TLS_VERSION_ID: Retrieves the TLS protocol version used in numeric format.
    Parameter type: unsigned int.
  • MARIADB_CONNECTION_UNIX_SOCKET: Retrieves the file name of the unix socket
    Parameter type: const char *.
  • MARIADB_CONNECTION_USER: Retrieves connection's user name.
    Parameter type: const char *.

Examples

/* get server port for current connection */
unsigned int port;
mariadb_get_infov(mysql, MARIADB_CONNECTION_PORT, void *)&port);
/* get user name for current connection */
const char *user;
mariadb_get_infov(mysql, MARIADB_CONNECTION_USER, (void *)&user);

See also

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.