1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

667 Commits

Author SHA1 Message Date
Georg Richter
bf82b2d8cb Fix for CONC-624:
- ER() macro now checks if the error code is known, if not it will return
  "Unknown or undefined error code" (instead of crashing)
- SET_CLIENT_STMT_ERROR now maps to stmt_set_error and accepts variadic
  arguments
2023-01-15 14:11:54 +01:00
Georg Richter
da9bb98c0c CONC-622: Fix double free() if asnyc connect failed
If mysql_real_connect_start/cont failed, we need to
set async->pvio to zero after calling ma_pvio_close
to avoid double free() in mysql_close.
2022-12-27 14:36:44 +01:00
Georg Richter
28df8a73b6 Merge branch '3.3-status' into 3.3 2022-08-02 10:20:19 +02:00
Georg Richter
a8832afa2a status and session_tracik callback function:
This feature allows client applications to register a callback function,
which is called as soon as the server status changes or session_track
information was sent by the server.

Registration is handled via mysql_optionsv() API function:

mysql_optionsv(mysql, MARIADB_OPT_STATUS_CALLBACK, function, data)

The callback function must be defined as follws:

void status_callback(void *data, enum enum_mariadb_status_info type, ..)

  Parameters:
    - data  Pointer passed with registration of callback function
            (usually a connection handle)
    - type  Information type  STATUS_TYPE or SESSION_TRACK_TYPE

  Variadic Parameters:

  if (type == STATUS_TYPE):
    - server status (unsigned int)

  if (type == SESSION_TRACK_TYPE)
    - enum enum_session_state_type track_type - session track type

    if (track_type == SESSION_TRACK_SYSTEM_VARIABLES)
      - MARIADB_CONST_STRING *key
      - MARIADB_CONST_STRING *value

    else
      - MARIADB_CONST_STRING *value

An example can be found in connection.c (test_status_callback)
2022-08-02 10:10:50 +02:00
Georg Richter
dcb14e3c5d erge branch '3.1' into 3.3 2022-08-01 12:26:27 +02:00
Alexander Barkov
df6feae0df Libmariadb changes for MDEV-27009 Add UCA-14.0.0 collations 2022-07-27 12:56:56 +04:00
Marko Mäkelä
b9811b7c6d Fix clang -Wunused-but-set-variable 2022-07-26 08:16:53 +03:00
Georg Richter
2dd03f04d1 typo fixes (was PR 203) 2022-07-25 08:44:26 +02:00
Georg Richter
6dbd953420 Merge branch '3.1' into 3.3 2022-07-24 10:52:52 +02:00
Georg Richter
cdb6e90c35 Fix for CONC-608: Replace server error codes
Since Connector/C is not able to retrieve
error strings for server error codes, the following
error codes were replaced:

- ER_NET_PACKET_TOO_LARFE by CR_NET_PACKET_TOO_LARGE
- ER_OUT_OF_RESOURCES by CR_OUT_OF_MEMORY
- ER_NET_WRITE_ERROR by CR_ERR_NET_WRITE (new constant)
- ER_NET_UNCOMPRESS_ERROR by CR_ERR_NET_UNCOMPRESS (new constant)
2022-07-21 09:11:29 +02:00
Georg Richter
e8e356e355 Merge branch '3.1' into 3.3 2022-07-18 11:48:33 +02:00
Georg Richter
9a572bc548 Fix for CONC-604 and CONC-605:
This patch fixes a crash when reconnectiong via TLS.
2022-07-18 11:41:46 +02:00
Georg Richter
5f1f517cfa Various typo fixes
Includes fixes from PR-201.
2022-07-03 13:45:37 +02:00
Georg Richter
35826cd51c Test fix for test_bug4236 2022-06-29 13:27:28 +02:00
Georg Richter
fcce4a8c76 CONC-592: Register replica with host and port
Added new option MARIADB_OPT_RPL_REGISTER_REPLICA which expects
two parameters, host and port. When this option was set, rpl_open
will send a COM_REGISTER_SLAVE command with server_id, host and
port to the connected server. This information can be retrieved
by "SHOW SLAVE STATUS" command.

Example:

rc= mysql_optionsv(mysql, MARIADB_OPT_RPL_REGISTER_REPLICA,
                   "myhost", 123);
2022-05-23 14:05:06 +02:00
Georg Richter
fb1b3ad2a3 Merge branch '3.3' of https://github.com/mariadb-corporation/mariadb-connector-c into 3.3 2022-05-19 16:40:21 +02:00
Georg Richter
4fc7903cf3 test fix:
skip conc336 when testing against XPAND
2022-05-05 19:33:01 +02:00
Georg Richter
3ec6ba753d Skip test conc_336 if we test against XPAND
Due to timeout problems when testing against XPAND,
conc_336 will be disabled if tested with XPAND.
2022-05-04 14:59:14 +02:00
Georg Richter
0d20e47fe5 unittests: print server tls information 2022-04-28 13:10:44 +02:00
Georg Richter
f60a31b5a8 Debug information for tests:
Print tls releated server variables
2022-04-21 11:59:14 +02:00
rusher
ed083576af [misc] correct declaration-after-statement issue 2022-04-14 09:47:21 +02:00
diego Dupin
fb85d99d13 Adding xpand to test suite 2022-03-23 11:46:40 +01:00
Georg Richter
2b6a8c44c5 Merge branch '3.2' into 3.3 2022-03-01 11:30:59 +01:00
Georg Richter
bc9458893f Merge branch '3.1' into 3.2 2022-03-01 11:28:33 +01:00
Georg Richter
367772c5c9 Skip test_mdev19838 when running vs. maxscale 2022-03-01 10:53:57 +01:00
Georg Richter
abc1cf89f1 Test fix:
For detecting if we test against MaxScale check also if
mysql_get_server_info contains "maxScale".
2022-03-01 10:23:34 +01:00
Georg Richter
f3c036e425 Merge branch '3.2' into 3.3 2022-01-26 09:03:31 +01:00
Georg Richter
bc5e8a7964 Merge branch '3.1' into 3.2 2022-01-26 09:02:47 +01:00
Oleksandr Byelkin
f6c3d9fd2a Fix for according to C90 2022-01-25 10:16:07 +01:00
Georg Richter
770cf2286a CONC-575: Support for MySQL zstd compression
ZSTD compression is now supported for connections
to a MySQL Server 8.0.

Compression algorithms are supported via compression
plugins, which can be found in plugins/compress.
2022-01-25 05:02:33 +01:00
Georg Richter
b5c1a23c82 Merge branch '3.2' into 3.3 2022-01-25 03:52:42 +01:00
Georg Richter
3fe2f50545 Merge branch '3.1' into 3.2 2022-01-25 03:51:45 +01:00
Georg Richter
8aa0ffdcbd Test fixes:
Fixed warning (int/size_t)
Fixed error message
2022-01-24 14:49:34 +01:00
Georg Richter
49a22c269a Merge pull request #153 from Antchel/3.1
test fixes
2022-01-23 21:08:32 +01:00
Georg Richter
ddb031b6a1 Travis fix:
When reading connection parameters from configuration file
a secure connection must be established.
2022-01-07 17:54:25 +01:00
Georg Richter
141fb0d5fa Test fixes:
- For reconnection/and multi host tests specify also socket location,
since mtr doesn't use default socket for localhost connections

- parse_connection_string now returns NULL for empty password in
  curly braces
2022-01-04 10:37:12 +01:00
Georg Richter
37b3760ac9 travis:
- disabled conc566 test when running against SkySQL
- added 10.7 server
2021-11-18 17:00:45 +01:00
Georg Richter
a1feead1e1 CONC-365: Failover capabilities
host parameter of mysql_real_connect (and corresponding configuration
settings MYSQL_OPT_HOST for mysql_options() api call and host key in
configuration files) now accepts to specify multiple hosts and ports.

When establishing a connection, the list of specified hosts is run
through until a connection can be established. If no connection
can be established to any of the specified hosts, an error is returned.

Specifications for multiple hosts/ports:

- hostname and port must be seperated by a colon (:)
- IPv6 addresses must be enclosed within square brackets
- hostname:port pairs must be be seperated by a comma (,)
- if only one host:port was specified, the host string needs to end
  with a comma.
- if no port was specified, the default port will be used.

Examples for failover host string:

host=[::1]:3306,192.168.0.1:3306,test.example.com
host=localhost:3306,
2021-11-11 19:08:43 +01:00
Georg Richter
515361df66 CONC-274: connection string support
A connection string contains key/value pairs, separated by a semicolon
as used in ODBC. Supported keys are all configuration options which can
be used in MariaDB configuration files. For a complete list check
https://github.com/mariadb-corporation/mariadb-connector-c/wiki/config_files#configuration-options.
The connection string must contain at least one semicolon, otherwise
it wil be interpreted as hostname. Unknown or invalid keys will be ignored.

To connect via connection string, the following methods might be used:

- by specifing connection option in configuration file:

  connection=host=localhost;ssl_enforce=1;

-  by using mariadb_connect() macro

   mariadb_connect(mysql, "host=localhost;ssl_enforce=1")

-  by passing connection string in host parameter to mysql_real_connect

   mysql_real_connect(mysql, "host=localhost;ssl_enforce=1", NULL, NULL, NULL, 0, NULL, 0)
2021-11-05 06:31:58 +01:00
Georg Richter
e8fc259320 CONC-467: Rotate event doesn't handle filename correctly
When receiving a ROTATE event, the offset of filename
was not computed correctly. Similiar to the
BINLOG_CHECK_POINT event filename will also be stored
in MARIADB_RPL handle
2021-10-09 10:44:04 +02:00
Georg Richter
004f9d4217 CONC-470: Support for semi synchronous replication
Beside already supported asynchronous replication
the replication/binlog API now supports semi
synchronous replication:

If an event contains a semi synchronous indicator (0xEF)
behind status byte and acknowledgement flag is set,
mariadb_rpl_fetch() automatically sends an acknowledge
message to the connected primary server.
2021-10-09 08:26:15 +02:00
Georg Richter
52934a1c08 Merge branch '3.2' into 3.3 2021-10-08 10:26:06 +02:00
Marko Mäkelä
5cd74de9f1 Merge 3.1 into 3.2 2021-10-06 10:26:42 +03:00
Marko Mäkelä
80188c3859 MDEV-26761 test_mdev19838() fixup: type mismatch on 64-bit Windows 2021-10-06 07:06:55 +03:00
Marko Mäkelä
8574d0b840 Merge 3.1 into 3.2 2021-10-05 16:59:15 +03:00
Marko Mäkelä
33853036dd fixup 9c02505474: build failure outside clang 2021-10-05 16:48:31 +03:00
Marko Mäkelä
f4772150d2 CONC-566 fixup: unit test cleanup 2021-10-05 16:48:07 +03:00
Georg Richter
2933a1ca75 Merge branch '3.1' into 3.2 2021-10-05 15:19:59 +02:00
Georg Richter
ae9f14534c Merge branch '3.1' of https://github.com/mariadb-corporation/mariadb-connector-c into 3.1 2021-10-05 14:54:16 +02:00
Georg Richter
9c02505474 Fixed for MDEV-26761:
If mariadb_stmt_execute_direct fails, we need to set the number
of parameters (obtained by response packet of mysql_stmt_prepare)
back to the number of prebinded parameters to avoid memory
overrun.

This fix also includes several adress-sanitizer bugs in unit tests
of Connector/C.
2021-10-05 14:50:32 +02:00