mariadb\_get\_infov(3) MariaDB Connector/C mariadb\_get\_infov(3)

## [Name](#Name)

mariadb\_get\_infov - retrieves generic or connection releated information

## [Synopsis](#Synopsis)

```
#include <mysql.h>
int mariadb_get_infov(MYSQL * mysql,


                      enum mariadb_value value,


                      void * arg,


                      ...);
    
```

# [Description](#Description)

Retrieves generic or connection specific information. arg (and further arguments) must be a pointer to a variable of the type appropriate for the value argument. The following table shows which variable type to use for each value.

Variable Type Values unsigned int MARIADB\_CLIENT\_VERSION\_ID, MARIADB\_CONNECTION\_ASYNC\_TIMEOUT, MARIADB\_CONNECTION\_ASYNC\_TIMEOUT\_MS, MARIADB\_CONNECTION\_ERROR\_ID, MARIADB\_CONNECTION\_PORT, MARIADB\_CONNECTION\_PROTOCOL\_VERSION\_ID, MARIADB\_CONNECTION\_PVIO\_TYPE, MARIADB\_CONNECTION\_SERVER\_STATUS, MARIADB\_CONNECTION\_SERVER\_VERSION\_ID, MARIADB\_CONNECTION\_TLS\_VERSION\_ID unsigned long MARIADB\_CONNECTION\_CLIENT\_CAPABILITIES, MARIADB\_CONNECTION\_EXTENDED\_SERVER\_CAPABILITIES, MARIADB\_CONNECTION\_SERVER\_CAPABILITIES size\_t MARIADB\_MAX\_ALLOWED\_PACKET, MARIADB\_NET\_BUFFER\_LENGTH const char * MARIADB\_CLIENT\_VERSION, MARIADB\_TLS\_VERSION, MARIADB\_CONNECTION\_ERROR, MARIADB\_CONNECTION\_HOST, MARIADB\_CONNECTION\_INFO, MARIADB\_CONNECTION\_SCHEMA, MARIADB\_CONNECTION\_SERVER\_TYPE, MARIADB\_CONNECTION\_SERVER\_VERSION, MARIADB\_CONNECTION\_SQLSTATE, MARIADB\_CONNECTION\_SSL\_CIPHER, MARIADB\_CONNECTION\_TLS\_VERSION, MARIADB\_CONNECTUION\_UNIX\_SOCKET, MARIADB\_CONNECTION\_USER, const char \** MARIADB\_CLIENT\_ERRORS const \*MY\_CHARSET\_INFO MARIADB\_CHARSET\_NAME, MARIADB\_CONNECTION\_CHARSET\_INFO my\_socket MARIADB\_CONNECTION\_SOCKET

## [Value types](#Value_types)

## [Generic information](#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.

•

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).

•

MARIADB\_CLIENT\_VERSION

The client version in literal representation.

•

MARIADB\_CLIENT\_VERSION\_ID

The client version in numeric format.

•

MARIADB\_MAX\_ALLOWED\_PACKET

Retrieves value of maximum allowed packet size.

•

MARIADB\_NET\_BUFFER\_LENGTH

Retrieves the length of net buffer.

•

MARIADB\_SSL\_LIBRARY

The TLS library MariaDB Connector/C is compiled against.

## [Connection related information](#Connection_related_information)

For these information types parameter mysql must be represent a valid connection handle which was allocated by [**mysql\_init(3)**](/man/os/mariadb-11.5/mysql_init.3).

•

MARIADB\_CONNECTION\_ASYNC\_TIMEOUT

Retrieves the timeout for non blocking calls in seconds.

•

MARIADB\_CONNECTION\_ASYNC\_TIMEOUT\_MS

Retrieves the timeout for non blocking calls in milliseconds.

•

MARIADB\_CONNECTION\_CHARSET\_INFO

Retrieves character set information for given connection.

•

MARIADB\_CONNECTION\_CLIENT\_CAPABILITIES

Returns the handshak capability flags] of the client.

•

MARIADB\_CONNECTION\_ERROR

Retrieves error message for last used command.

•

MARIADB\_CONNECTION\_ERROR\_ID

Retrieves error number for last used command. \*MARIADB\_CONNECTION\_EXTENDED\_SERVER\_CAPABILITIES

Returns the extended capability flags of the connected MariaDB server

•

MARIADB\_CONNECTION\_HOST

Returns host name of the connected MariaDB server

•

MARIADB\_CONNECTION\_INFO

Retrieves generic info for last used command.

•

MARIADB\_CONNECTION\_PORT

Retrieves the port number of server host.

•

MARIADB\_CONNECTION\_PROTOCOL\_VERSION\_ID

Retrieves the protocol version number.

•

MARIADB\_CONNECTION\_PVIO\_TYPE

Retrieves the pvio plugin used for specified connection.

•

MARIADB\_CONNECTION\_SCHEMA

Retrieves the current schema.

•

MARIADB\_CONNECTION\_SERVER\_CAPABILITIES

Retrievrs the capability flags of the connected server.

•

MARIADB\_CONNECTION\_SERVER\_STATUS

Returns server status after last operation.

•

MARIADB\_CONNECTION\_SERVER\_TYPE

Retrieves the type of the server.

•

MARIADB\_CONNECTION\_SERVER\_VERSION

Retrieves the server version in literal format.

•

MARIADB\_CONNECTION\_SERVER\_VERSION\_ID

Retrieves the server version in numeric format.

•

MARIADB\_CONNECTION\_SOCKET

Retrieves the handle (socket) for given connection.

•

MARIADB\_CONNECTION\_SQLSTATE

Retrieves current sqlstate information for last used command.

•

MARIADB\_CONNECTION\_SSL\_CIPHER

Retrieves the TLS/SSL cipher in use.

•

MARIADB\_CONNECTION\_TLS\_VERSION

Retrieves the TLS protocol version used in literal format.

•

MARIADB\_CONNECTION\_TLS\_VERSION\_ID

Retrieves the TLS protocol version used in numeric format.

•

MARIADB\_CONNECTION\_UNIX\_SOCKET

Retrieves the file name of the unix socket

•

MARIADB\_CONNECTION\_USER

Retrieves connection’s user name.

## [Returns](#Returns)

Returns zero on success, non zero if an error occurred (e.g. if an invalid option was specified),

## [Source file](#Source_file)

```
## History
This function was added in MariaDB Connector/C 3.0,
## 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* [**mysql\_get\_optionv(3)**](/man/os/mariadb-11.5/mysql_get_optionv.3)

Version 3.3.1

---

Document: mariadb_get_infov(3) from mariadb-11.5 11.5.2-r4 (Chainguard OS)
