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

115 Commits

Author SHA1 Message Date
Oleksandr Byelkin
55abb32038 Merge branch '3.1' into 3.3-merge 2025-04-20 10:16:30 +02:00
Georg Richter
28a1e4b599 Fix for CONC-762: Always set is_null and length in bind structure to avoid
msan errors
2025-03-31 11:02:35 +02:00
Georg Richter
662a966056 CONC-702: Fix statement status
If a resultset in binary protpcpl doesn't contain data
(fields equal zero) and there are no more pending
result sets we need to change the statement status to
FETCH_DONE, otherwise it will be impossible to execute
other commands until the statement was closed.
2024-11-18 07:15:42 +01:00
Vladislav Vaintroub
463a50e973 Merge remote-tracking branch 'origin/3.1' into 3.3
# Conflicts:
#	include/ma_crypt.h
#	libmariadb/mariadb_lib.c
2023-09-21 23:45:35 +02:00
Georg Richter
9f37c27bc8 Fix for CONC-668:
Fix build error on 32-bit systems.
2023-09-18 16:05:00 +02:00
Marko Mäkelä
5af90f00ff Merge 3.1 into 3.3 2023-06-26 16:28:51 +03:00
Marko Mäkelä
d543bed61b Fix GCC 13 -Wmaybe-uninitialized 2023-06-26 10:59:14 +03:00
Georg Richter
dd8962a4b5 Merge branch '3.1' into 3.3 2023-04-25 15:08:28 +02:00
Georg Richter
2000b06183 Replace SET_CLIENT_STMT_ERROR by stmt_set_error(). 2023-04-11 18:31:19 +02:00
Georg Richter
e4417e725e Merge branch '3.1' into 3.3 2023-02-09 08:57:48 +01:00
Georg Richter
669726a1d9 Fix for CONC-633:
If prepare step failed in mariadb_stmt_execute_direct now both
mysql_stmt_error and mysql_error return the error message from
prepare step instead of error message of execute.
2023-02-08 12:21:22 +01:00
Georg Richter
12bd1d5511 Merge branch '3.1' into 3.3 2023-01-16 12:12:46 +01:00
Georg Richter
895235815c Fix for CONC-627:
Don't substitute parameters in server error messages in
prepeated statement error handler function.
2023-01-16 11:13:00 +01:00
Georg Richter
bb5abd096d Merge branch '3.1' into 3.3 2023-01-16 08:16:13 +01:00
Georg Richter
173112ceaf Fix for CONC-626:
Fixed possible memory leak in mariadb_stmt_execute if realloc of
data buffer failed.
2023-01-16 08:11:02 +01:00
Georg Richter
5f6133653d Fix for CONC-623:
If callback function returns a non zero return code, execute
will now abort with error CR_ERR_STMT_PARAM_CALLBACK.
2023-01-15 15:12:38 +01:00
Georg Richter
abea2dfa6b Merge branch '3.1' into 3.3 2023-01-15 14:27:41 +01:00
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
c15a973016 Fixed crash
Fixed crash which was introduced by 1bd8c8bf39
2022-08-25 16:20:48 +02:00
Georg Richter
1bd8c8bf39 Added missing status callbacks outside of ma_read_ok_packet 2022-08-11 16:56:06 +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
3f7719c74d Typo fixes (from PR #200) 2022-06-27 13:23:35 +02:00
Georg Richter
3fe2f50545 Merge branch '3.1' into 3.2 2022-01-25 03:51:45 +01:00
Georg Richter
dce4b8a89d Fix/replacement for PR 107:
Instead of calculating size with packlen for date/time types,
we need to use the max. value of the corresponding type.
2022-01-24 07:34:30 +01:00
Georg Richter
2933a1ca75 Merge branch '3.1' into 3.2 2021-10-05 15:19:59 +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
Georg Richter
62c93c9029 Merge branch '3.1' into 3.2 2021-09-27 13:30:31 +02:00
Georg Richter
410d64d8de Fix length calculation
When calculating the length of buffer for prepared statement
executiong a maximum length of 5 for length encoded types was
used. This should be 9, since length encoded types starting
with 0xFE are followed by length of 8 bytes.
2021-09-27 13:27:40 +02:00
Georg Richter
18f7cf423f Merge branch '3.1' into 3.2 2021-09-25 16:28:04 +02:00
Georg Richter
4b9379b2aa Fix for CONC-566:
If cursor type is set to read only, and SERVER_STATUS_CURSOR_EXISTS
flag was not set in the server_status of EOF packet, the assumption
was made that a single result set will follow which will be stored
by a call to mysql_stmt_store_result().

As the example in the bug report shows, this is not always the case,
since a stored procedure call might also unset the CURSOR flag and
will always return multiple result sets. In this case it will be
handled now as "normal" unbuffered result set.
2021-09-25 16:07:24 +02:00
Georg Richter
ffa3451fa5 Merge branch '3.1' into 3.2 2021-09-21 14:49:06 +02:00
Georg Richter
b99172386a Followup of fix for CONC-565
(patch provided by Monty)
2021-09-21 14:39:17 +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
f999686968 Set param_count to the specified prebind value.
When reusing a statement handle in C/Python,
the number of prebinded parameters also has
to be assigned to stmt->param_count.
2021-07-12 10:14:30 +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
Marko Mäkelä
375bab0d51 Merge 3.1 into 3.2 2021-02-16 18:44:15 +02:00
Georg Richter
ef3d315796 Test case fix:
unittests always reset the default connection (and depending statements)
which might end up in an error when trying to close a statement which was
not prepared before.
In this case mysql_stmt_reset only needs to set statement status to
MYSQL_STMT_PREPARE if the statement id was set before.
2021-01-18 18:23:17 +01:00
Vladislav Vaintroub
6a763b9000 MDEV-19237 - do not resend prepared statement metadata unnecessarily
fix warnings
2020-10-20 14:58:37 +02:00
Georg Richter
b2966c05e4 Revert "MDEV-19237 - do not resend prepared statement metadata unnecessarily":
This reverts commit ed4d747510.
2020-10-20 14:57:22 +02:00
Vladislav Vaintroub
ed4d747510 MDEV-19237 - do not resend prepared statement metadata unnecessarily
fix warnings
2020-10-15 22:25:09 +02:00
Georg Richter
55a64c1bd5 Fix for CONC-504: reset stmt->result.rows when executing mysql_stmt_next_result
While in text protocol the number of rows is resetted in mysql_store/use_result
in binary protocol we need to explicitly reset it when switching to next result set.
2020-10-02 09:47:52 +02:00
Georg Richter
42d32ba95f Fix for mariadb_stmt_execute_direct():
- If prepare failed, we need to ignore errormessage from mysql_stmt_execute()
(which is always an error packet, mentioning invalid sttmt_id)
- Added additional check in mysql_stmt_reset for stmt_id == -1.
2020-09-30 16:19:31 +02: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
a1283d0b10 cleanup (patch provided by Alexander Barkov)
move function prototypes used in mariadb_lib.c and mariadb_stmt.c
to include/ma_priv.h
2020-01-20 17:44:49 +01:00
Georg Richter
8c6c5e07ca Merge commit '8823607e299d6028df87d3c389a44ca004311de5' into 3.1 2019-06-30 17:34:04 +02:00
Georg Richter
8823607e29 Follow up for CONC-424:
Fixed another place where stmt->error wasn't updated correctly.
2019-06-30 17:32:03 +02:00
Georg Richter
86a9e07feb Merge commit 'd09ac51df3c35e569e91313affb58ae74fd3470a' into 3.1 2019-06-30 12:47:17 +02:00
Georg Richter
d09ac51df3 Workaround/Fix for CONC-424:
1) In case a cursor is used in a stored procedure server sends a SERVER_STATUS_CURSOR_EXISTS flag,
even if the client didn't open a cursor via mysql_stmt_attr_set. This ends in a "comands out of sync" error,
since the client is sending a COM_STMT_FETCH command while the result sets were not read before.
We check now in case server sends a SERVER_STATUS_CURSOR_EXIST flag, if the client opened a cursor before.

2) The stmt error codes weren't update for all COM_STMT* commands correctly, e.g. COM_STMT_FETCH didn't show an error even if it failed.
2019-06-30 12:41:42 +02:00