1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-05 15:55:58 +03:00
Commit Graph

138 Commits

Author SHA1 Message Date
Markus Mäkelä
a2213b89d4 Add MYSQL_OPT_ZSTD_COMPRESSION_LEVEL
The compression level was always hard-coded to 3.
2024-11-07 06:51:57 +02:00
Georg Richter
87bd5bfc34 Removed decryption stuff from rpl api 2023-02-12 14:26:02 +01:00
Georg Richter
4dca917b7e Added support for all (?) events
- All (MariaDB and MySQL) events are now supported
- Added new api functions:
  - mariadb_rpl_error: returns error message
  - mariadb_rpl_errno: returns error number
  - mariadb_rpl_extract_rows: extract values of
    ROW_EVENTS
- Added decryption support
- Added uncompression
  -
2022-09-26 09:20:07 +02: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
5f1f517cfa Various typo fixes
Includes fixes from PR-201.
2022-07-03 13:45:37 +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
510c7e5dfe New options MARIADB_CONNECTION_BYTES_READ/SENT
Added new options MARIADB_CONNECTION_BYTES_READ and
MARIADB_CONNECTION_BYTES_SENT which can be passed to
mariadb_get_infov() api funcion to obtain the bytes sent
or read to/from database server.
2022-01-02 14:14:39 +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
7e0be5a919 CONC-544: restrict authentication plugins
Added new option MARIADB_OPT_RESTRICTED_AUTH (and corresponding
"restricted-auth" option for configuration files) which specifies
on or more comma spearated authentication plugins which are allowed
for authenication.

If the server asks for an authentication plugin not listed in this
option the connect attempt will fail with error CR_PLUGIN_NOT_ALLOWED.
2021-09-14 06:24:56 +02:00
Georg Richter
73478fd7f4 Method clean up:
- removed unused methods from MYSQL_STMT handle,
  (left over from PHP's mysqlnd)
- Added execute_generate_request method: This will allow
  Connector/Python to prefill the execute buffer without
  numerous GIL acquire/release calls.
2021-07-25 13:06:01 +02:00
Georg Richter
e4e5b28452 CONC-533: Support for asynchronous statements (binary protocol)
Added a new option MARIADB_OPT_SKIP_READ_RESPONSE which skips automatic
reading of server response after sending a command to the server.

Server packets have to be retrieved by calling the corresponding methods,
e.g:

Send command                         Read method
mysql_real_query/mysql_send_query    db_read_query_result
mysql_stmt_prepare                   db_read_prepare_response
mysql_stmt_execute,
mariadb_stmt_execute_direct          db_read_execute_response
2021-05-13 21:21:43 +02:00
Georg Richter
820faff627 codespell fixes, removed MSDOS preprocessor macros 2020-11-26 09:07:17 +01:00
Georg Richter
7c5a40b00d Fix for CONC-510: CoreDump using set env MARIADB_PLUGIN_DIR
The macro CLEAR_CLIENT_ERROR needs to check if mysql->net.extension
was already allocated to prevent access of uninitialized memory.
2020-10-24 07:54:59 +02:00
Georg Richter
23005c6c25 Follow up of FIX for CONC-492:
renamed mariadb_api to mysql_api in the client plugin definition of mysql.h
2020-09-06 07:50:35 +02:00
Evan Miller
70843c004c [CONC-381] Fix strict prototypes warning
Projects compiled with -Wstrict-prototypes will emit a warning. C
requires that functions with arguments be prototyped as foo(void), not
foo(). This commit fixes the warning.
2020-07-07 11:56:47 -04:00
Oleksandr Byelkin
895dcb61e3 C preprocessor defines fix 2020-06-04 16:49:21 +02:00
Alexander Barkov
6632cb69d7 MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY 2020-03-10 17:02:59 +04:00
Georg Richter
de04c2e01f Workaround for CONC-417, MDEV-13492
At irregular intervals older windows versions (prior Windows 10) fail to establish a secure (TLS)
connection and return errors SEC_E_INVALID_TOKEN, SEC_E_BUFFER_TOO_SMALL or SEC_E_MESSAGE_ALTERED.
This is a bug in windows schannel library and was only fixed in recent versions, also OpenSSL provided
a workaround (see https://github.com/openssl/openssl/pull/1350).
Since we are unable to fix this, we introduced a workaround for this problem. In case of an error
during TLS handshake we check the errorcode and try to reconnect up to three times if the error code
was SEC_E_INVALID_TOKEN, SEC_E_BUFFER_TOO_SMALL or SEC_E_MESSAGE_ALTERED.
2019-09-19 08:50:55 +02:00
Georg Richter
9faaea38bc Fix gcc warnings 2019-09-04 09:36:20 +02:00
Georg Richter
abce2a3ab3 CONC-377: Add IO Callback
Applied part of the patch from https://github.com/MariaDB/mariadb-connector-c/pull/71
The part for named pipes doesn't work, since wait_io was reworked by vvaintroub.
2018-12-01 16:46:46 +01:00
Georg Richter
b0f2e4e72f Coverity fixes and travis integration 2018-07-06 09:28:24 +02:00
Georg Richter
ffd9084063 Fixed comment for MY_CHARSET_INFO:
csname is the name of the character set, while name is the name of the collation
2018-07-04 07:56:17 +02:00
Georg Richter
b937b75f6e Fix IS_NUM macro (MDEV-15263) 2018-06-14 06:51:50 +02:00
Vladislav Vaintroub
db1a1a1d31 more clang fixes 2018-02-12 09:29:27 +00:00
Vladislav Vaintroub
aed8005e2e Fix clang on Windows warnings
- STDCALL is ignored for variable argument functions.
- __attribute__ does work for Clang (also if that pretends to be MSVC)
- remove unused function
- simplify ma_getopt, fixes some strange compile error in clang (about
SSE intrinsics)

- fix some clang warnings
2018-02-09 19:10:50 +01:00
Georg Richter
b241f8995f MDEV-14101: tls-version
Client part of MDEV-14101: Add support for tls-version, via
mysql_options(mysql, MARIADB_OPT_TLS_VERSION, value)
Accepted values are "TLSv1.1", "TLSv1.2" and "TLSv1.3".

Fixed testcase openssl_1 for schannel
2017-10-23 11:09:54 +02:00
Georg Richter
ea8a31e63a Fixed compiler warnings 2017-07-04 13:56:38 +02:00
Georg Richter
8b3e6b5dcf Fix for CONC-252:
All functions which are supported by libmysql use now unsigned long as length parameter instead of size_t
2017-07-01 15:42:52 +02:00
Vladislav Vaintroub
06d2490371 MDEV-11159 Add support for sending proxy protocol header 2017-06-13 18:19:07 +00:00
Georg Richter
9a865bc88c Fix for CONC-243:
ABI breakage: Revert parameter length from size_t to unsigned long.
  (affects mysql_stmt_prepare, mysql_real_query, mysql_send_query)
2017-03-14 16:11:04 +01:00
Georg Richter
b10c4f9e7b Fix for CONC-231: Incorrect FSF address 2017-02-05 11:35:11 +01:00
Georg Richter
87e861c360 client side implemetation for MDEV-10340:
int STDCALL mysql_reset_connection(MYSQL *mysql)
2016-12-29 19:10:35 +01:00
Georg Richter
ab3ffdc473 removed api function mysql_get_server_status (introduced in last commit). Instead of mariadb_get_infov now supports additional parameters:
* MARIADB_CONNECTION_SERVER_STATUS
* MARIADB_CONNECTION_SERVER_CAPABILITIES
* MARIADB_CONNECTION_EXTENDED_SERVER_CAPABILITIES
* MARIADB_CONNECTION_CLIENT_CAPABILITIES
2016-12-13 07:09:06 +01:00
Georg Richter
7a1e3a699d - Fixed crash in prepared statement: Indicator variable should be checked only if we are in bulk operation mode (=stmt->array_size > 0 and bulk is supported by server
- Added new api function mysql_get_server_status, so client applications no longer need to access members of the mysql structure
2016-12-10 14:09:53 +01:00
Georg Richter
3e624e50df removed definition of SQLSTATE_UNKNOWN (10.2 integration) 2016-11-17 16:04:33 +01:00
Georg Richter
a499722377 removed ma_errmsg from mysql.h 2016-11-16 17:27:59 +01:00
Georg Richter
03a7ec1b8b Support mariadb_stmt_execute_direct also for versions < 10.2
Bundled COM_CLOSE and COM_PREPARE packets
2016-11-12 17:51:01 +01:00
Georg Richter
884ee2262d Smaller fixes for LibreOffice integration:
- added type MYSQL_TYPE_JSON (=245)
  - include error numbers (ma_errmsg.h) via mysql.h
  - convert MYSQL_TYPE_JSON to string (prepared statements)
  - added error message number 2034 (invalid buffer)
2016-10-23 15:53:24 +02:00
Georg Richter
6306c9f46b - removed COM_MULTI from options
COM_MULTI is now available for internal use only, e.g. in
  mariadb_stmt_execute_direct
2016-10-20 08:47:51 +02:00
Vladislav Vaintroub
7cb8479605 Fix Win64 warnings. Correctly define my_socket in ma_global.h 2016-10-12 21:05:31 +00:00
Georg Richter
6723c52c46 Fixed function declaration for mysql_error and mysql_info (const char * instead of char *) 2016-10-06 09:44:57 +02:00
Georg Richter
c68c5dc27f Part for fix of CONC-200:
declare type of my_ulonglong
2016-09-08 08:01:21 +02:00
Vladislav Vaintroub
03d35ac031 fix compile error 2016-08-18 14:42:50 +00:00
Vladislav Vaintroub
d76e0f1965 Fix compiler errors in headers (undefined uchar, __attribute__) 2016-08-18 15:06:55 +02:00
Georg Richter
9207626bb4 10.2-integration
readded api functions
- mysql_debug (dummy)
- mysql_get_parameters
added low level api functions
- mysql_net_field_length
- mysql_net_read
2016-08-18 12:24:32 +02:00
Georg Richter
429b166cbe Move mariadb specific client flags and server capabilities to mysql->extension 2016-08-16 14:58:15 +02:00
Georg Richter
2fcdff1743 10.2-integration: Add embedded support for st_mysql_data structure. 2016-08-10 13:37:40 +02:00
Vladislav Vaintroub
95101b9c87 Fix compilation error if MYSQL_SERVER is defined 2016-06-29 18:02:17 +00:00
Vladislav Vaintroub
437b9cd1e4 CONC-184 : provide a function to cancel a current connection
(without invalidating MYSQL struct, without sending KILL)
This apparently is useful for replication handling in the server
2016-05-21 12:35:06 +00:00