1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00
Commit Graph

126 Commits

Author SHA1 Message Date
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
Georg Richter
9043f910e9 Merge remote-tracking branch 'origin/3.0' into 3.1 2019-03-09 19:44:07 +01:00
Georg Richter
4ab51e7adf Fix for CONC-301:
This fix got lost by a bad previous merge
2019-03-08 18:38:14 +01:00
Georg Richter
212a9f6519 Fixed prototype for ps callback functions
Connectori/Python callback fixes
2018-12-05 13:40:58 +01:00
Georg Richter
655d902203 CONC-347: Add function mysql_stmt_fetch_field 2018-12-03 13:44:08 +01:00
Georg Richter
e9b3aef20f CONC-348: Add callback support for prepared statements
Client application can now register callback functions for either sending or retrieving data:
- typedef void (*ps_result_callback)(MYSQL_STMT *stmt, unsigned int column, unsigned char **row);
- typedef my_bool *(*ps_param_callback)(MYSQL_STMT *stmt, MYSQL_BIND *bind, unsigned int row_nr);

These functions will be registerd via mysql_stmt_attr_set call by specifying options STMT_ATTR_CB_PARAM
or STMT_ATTR_CB_RESULT.
2018-12-03 13:04:16 +01:00
Georg Richter
639413cb21 Implementation of CONC-349:
Added new parameter STMT_ATTR_STATE to retrieve statement status via api
function mysql_stmt_attr_get
2018-10-23 13:11:23 +02:00
Georg Richter
b0f2e4e72f Coverity fixes and travis integration 2018-07-06 09:28:24 +02:00
Georg Richter
9e1fef0bf2 Fix for CONC-344: reset internal row counter before executing prepared statement 2018-06-28 17:22:08 +02:00
Georg Richter
53c40f5aaa Fix for CONC334:
Copy all members of MYSQL_FIELD from mysql->fields to stmt->fields.
2018-05-29 09:49:35 +02:00
luz.paz
b2e6ed0295 Fixes misc. typos
found via `codespell -q 3`
2018-04-13 07:30:23 +02:00
Georg Richter
748e6fb915 Fix for mariadb_stmt_execute:
If compressed protocol is in use, mariadb_stmt_execute_direct will be emulated by mysql_stmt_prepare and mysql_stmt_execute.
2018-04-12 08:49:26 +02:00
Georg Richter
929614903e Travis and Appveyor integration:
- added travis support
  - fixed appveyor settings
  - fixed some warnings (gcc 4.8)
  - removed sleep commands
  - disabled failing tests when running against MySQL server,
    mostly related to stored procedures and binary protocol
  - reverted fix for MDEV_10361

Still open: TLS/SSL appveyor tests, since .msi installation on appveyor doesn't provide certificates.
2018-02-16 12:14:01 +01:00
Vladislav Vaintroub
935c33b690 Fix Windows size_t warnings. 2018-01-12 18:19:19 +00:00
Georg Richter
e42dd6c0e0 Fix for MDEV-14165:
- The metadata length value for a column with a zerofill flag was calculated with a fixed length instead of using the reported length.
- fixed a possible stackoverflow, if the display width for a column with zerofill flag is greater then 22. (libmysql ps implementation truncates the result after 21 digits and reports truncation error).
2017-10-28 16:46:49 +02:00
Lawrin Novitsky
31f7fb00fc Implementation and testcase for CONC-275 - skipping particular paramset in bulk operation - with help of special indicator value STMT_INDICATOR_IGNORE_ROW set in any column of the row.
The revision also adds some (mainly VS specific) file/dirs definitions to .gitignore to make 'gid status' usable on Windows, and the typo in bulk1 testsuite
2017-10-10 12:23:19 +02:00
Georg Richter
240204eaeb Fix for CONC-282: mysql_stmt_fetch_column doesn't work with prior call to mysql_stmt_store_result
- If no bind variables were bound or the function mysql_stmt_store_result was not called before, the internal bind variables (stmt->bind) was not filled (lengths and null values)
2017-09-25 15:45:14 +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
Georg Richter
6e156a63e3 Fixes for bigendian systems (CONC-252, CONC-265) 2017-06-30 14:00:28 +02:00
Georg Richter
e50571e3ab Disallow bulk execution if parameter count is 0 2017-05-15 14:11:59 +02:00
Oleksandr Byelkin
d0f9234620 MDEV-12471: BULK Command
After test fixes.
bulk_null() is disabled. Before the client library took care about MYSQL_TYPE_NULL, now it do not do it so server return an error. and I have no idea what should be chenged test or client library.
2017-05-01 15:05:49 +02:00
Georg Richter
08450df078 initial implementation for MDEV-12471 2017-04-24 15:45:58 +02:00
Georg Richter
bde93e828d Merge branch 'master' of https://github.com/MariaDB/mariadb-connector-c 2017-04-03 18:12:13 +02:00
Sergei Golubchik
e9868bfce0 correct mthd_stmt_flush_unbuffered() logic
it needs to read
* if we're reading resultset row packets - till the EOF (254) packet.
* otherwise - till the *second* EOF packet (the first EOF will separate
  resultset metadata packets and resultset row packets)
* or till the OK (0) packet, but not if we're reading resultset row
  packets (because they also start from 0).

Also it needs to update server_status for caller to be able to check the
SERVER_MORE_RESULTS_EXIST flag, and the stmt->state to know that it's
not reading the resultset anymore.

Callers were fixed to invoke mthd_stmt_flush_unbuffered() repeatedly,
when they need to flush all result sets, not just one.

This commit fixes unittest/libmariadb/ps.c unit test
(it was failing to clean up mysql.proc table).
2017-03-30 00:19:41 +02:00
Georg Richter
63e0897d43 Fix for MDEV-12247:
If a statement with open (read only) cursor is executed there is no buffered
result set (result set rows will be fetched directly from server), so we need to skip reading unbuffered result sets if a cursor is open.
2017-03-21 17:26:19 +01: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
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
070fb3026a If a kill statement was prepared and executed we need to check return code
of net_stmt_close in case the connection which belongs to the statement was killed.
2016-12-03 09:21:32 +01:00
Georg Richter
64536703c7 Fix for CONC-218:
To prevent unexpected behavior when reusing a statement with mariadb_stmt_execute_direct
a call to mysql_stmt_attr_set with option STMT_ATTR_PREBIND_PARAMS will reset the statement before.
2016-11-29 13:30:17 +01:00
Georg Richter
c89d5d38e0 Fix for CONC-217: mariadb_stmt_execute_direct: Clear error message from mysql_stmt_execute if mysql_stmt_prepare failed 2016-11-26 13:47:43 +01:00
Georg Richter
8695a17cbc Added support for STMT_INDICATE_IGNORE indicator - please note that the counter part for indicator type ignore is not pushed in server repo yet. 2016-11-26 13:23:57 +01:00
Georg Richter
a11382a8f5 Row wise binding fixes for prepared statements (bulk)
- Fixed offset calculation for length and indicator
- Ignore null values if indicator is STMT_INDICATOR_DEFAULT
2016-11-17 10:47:15 +01:00
Georg Richter
967b2830d8 renamed ma_errmsg.h back to errmsg.h 2016-11-16 18:13:59 +01:00
Georg Richter
3378c0d8b7 Fixed array_binding for MYSQL_TYPE_NULL 2016-11-13 18:37:22 +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
64862325a5 Removed com_multi for mariadb_stmt_execute_direct
added support for pre 10.2-servers in mariadb_stmt_execute_direct
2016-11-10 05:49:11 +01:00
Georg Richter
4d1af73242 Set stmt_id to -1 only for mariadb_stmt_execute_direct 2016-11-04 16:02:08 +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