Commit Graph

567 Commits

Author SHA1 Message Date
8090efa833 Fixed various memory leaks and address sanitizer related problems:
- When catching errors from cursor the try/except construct must be either
  within a context or we need to explicitly call traceback.clear_frames().
  Otherwise traceback will hold a reference to the cursor which
  generates a msan error.
- Before executing a cursor command via execute, callproc or executemany we
  now reset the cursor.
- Fixed various tests, which didn't close cursor or connection properly.
2025-06-16 12:44:14 +02:00
7b0fbd85c5 Merge pull request #31 from mr-c/typo
fix a typo
2025-04-01 09:15:21 +02:00
ee884c87f2 For the moment we disable benchmarking on travis.
It looks like something changed in pyperf and we are getting
frequent timeouts.
2025-02-24 12:00:32 +01:00
07238030a3 CONPY-306: Fix crash when getting invalid unicode
This fixes a possible crash when obtaining invalid unicode
characters from MariaDB server.
2025-02-24 11:58:17 +01:00
63e10d0e2e Improve cursor behavior on closed connections
- Added internal attribute cursor._thread_id to detect
  automatic reconnect.
- If a reconnect occurred, only buffered resultsets using
  the text protocol can be accessed. (The same applies
  if a connection was closed).
- If connection reconnected, _thread_id attribute will be updated
  when using execute() or executemany() method.
2025-02-22 11:04:02 +01:00
5f227fcbe0 Run benchmarks with 3.12 instead of 3.13
For Python 3.13 we have to change the module definition first,
indicating if the module is using gil (Py_mod_gil).
2025-02-21 08:31:57 +01:00
0ebfcd54dc Added tp_dealloc for cursor object 2025-02-21 08:22:12 +01:00
11a22ad7e7 CONPY-296: Include test suite in sdist
Fixed manifest, which contained wrong directory (tests instead
of testing - excluded benchmark stuff)
2025-02-20 19:53:33 +01:00
4d8dde1f82 Enable benchmark for 3.13 2025-02-17 17:14:33 +01:00
aac09d24ed Fix warnings in mariadb_codecs.c 2025-02-14 14:24:26 +01:00
e73f2801c2 bump version (to 1.1.13) 2025-02-13 14:19:54 +01:00
f0bbd0882a CONPY-302: fix segfault with threaded
Callback functions for session or fetch callbacks didn't work properly
when passing connection->thread_state in threaded environment.
Instead we acquire and release the GIL explicitly in these callback
functions.
v1.1.12
2025-02-13 11:47:02 +01:00
40690c45fc Test fix:
Check server version for INET4/INET6 usage
2025-02-13 10:46:07 +01:00
befe7000c9 Follow up for CONPY-299
- Added byteswap function for vector (bigendian)
- Use buffer protocol instead of calling array's
  methods
2025-02-10 13:59:43 +01:00
9508904911 Exceptions: ER_BAD_FIELD_ERROR - wrong exception
ER_BAD_FIELD_ERROR (1054) was not handled and therefore
returned as OperationalError instead of ProgrammingError.
2025-01-30 13:55:34 +01:00
7cfc325feb CONPY-295: Fix unsigned check
Fixed check for signed/unsigned integers when sending parameters
via executemany().
2025-01-30 09:20:57 +01:00
138a02238e CONPY-299: support for VECTOR data type
Implemented support for VECTOR paramter. Beside text representation
(Vec_FromText) or array to byte conversion (array.tobytes) it is now
possible to specify an float array as parameter.

Example:

import mariadb, array

...

sql = """
  CREATE OR REPLACE TABLE test(
     id INT PRIMARY KEY,
     v VECTOR(3) NOT NULL,
      VECTOR INDEX (v))")"""

cursor.execute(sql)

vector= array.array('f', [123.1, 230.9, 981.7])

cursor.execute("INSERT INTO test VALUES (?,?)", (1, vector))

Please note that the opposite way, retrieving a float array is not
supported yet. This will require either a new or extended field
type for vector data type.
2025-01-30 09:02:07 +01:00
abd17eb95d CONPY-300: Fix documentation
kwargs parameter were missing in ConnectionPool documentation.
2025-01-29 09:43:20 +01:00
d735c9e879 Travis fix:
Only test against latest stable on Windows platforms, on all other
(ubuntu) platforms use latest $OYTHON_VER as specified in travis
configuration.
2025-01-29 06:57:04 +01:00
d10ed72013 Bumped version to 1.1.12 2025-01-28 16:19:46 +01:00
e86261c121 CONPY-303: Documentation fix for cursor constructor
Fixed documentation for cursor constructor.
Thanks to Witold Czarnecki for the bug report.
2025-01-28 16:16:29 +01:00
b89c90a10c fix a typo 2024-11-25 13:02:05 +01:00
d2f4a336ca [misc] travis test Python 3.8 removed, Python 3.13 added v1.1.11 2024-10-29 16:13:22 +01:00
0ce5a58b95 Removed Python 3.8, added Python 3.13 2024-10-14 14:28:17 +02:00
f96cbe2759 Travis build fixes:
- Skip MySQL batch tests
- Fix travis on windows
2024-10-01 15:55:33 +02:00
c9c0278950 Travis fixes:
- skip extended field types for MaxScale
- remove shadowed test
2024-09-28 08:17:49 +02:00
60562de225 Buildfix for C/C > 3.4.1
Fixed wrong preprocessor directive.
2024-09-28 04:57:31 +02:00
aa962d01fb Build fix for C/C versions < 3.4.2 2024-09-27 17:55:50 +02:00
5ae028e153 CONPY-289: BIGINT out of range on bulk insert
If a bigint value is > LONGLONG_MAX it must be
indicated that it is an unsigned value
(param->is_unsigned= 1).
2024-09-27 17:14:25 +02:00
fee7f30f42 Added new connection property: tls_peer_cert_info
connection.tls_peer_cert_info returns information about
the peer certificate or None if the connection doesn't
use TLS/SSL.
2024-09-27 16:21:35 +02:00
3d34bb6880 CONPY-293: Fix gcc warnings 2024-09-25 13:35:16 +02:00
1d03be3483 TLS fixes for C/C 3.4.x
- Always set/unset peer certificate verification flag
- Return None (instead of raising an exception) for tls connection
  properties if TLS is not in use
- bumped version number to 1.1.11
2024-09-16 10:13:38 +02:00
afb3ccd778 Check return code of db_generate_bulk_request
When inserting data via parameter callback function, an error
will be raised.
2024-09-14 15:31:57 +02:00
e705d637ea Fix CONPY-283: Incorrect result format after cursor.scroll()
Since unsigned long is 32-bit under windows, row_number must
be defined as uint64_t, since we assign 64-bit values directly
from python code.
2024-03-18 10:03:57 +01:00
d672551c7d Fix for CONPY-277:
To avoid a syntax error when running under sql_mode ANSI_QUOTES
parameter substitution will be done by using single quotes instead
of double quotes.
v1.1.10
2024-02-05 07:02:39 +01:00
b65fd443ee Fix of previous commit:
Skip test_conpy278 instead of test_conpy279.
2024-02-02 16:08:32 +01:00
7bc789a148 Skip test_conc279 when running with MaxScale
(see https://jira.mariadb.org/browse/MXS-4961)
2024-02-02 08:58:17 +01:00
8620d49f21 Fix for test_conpy279 2024-02-01 12:41:33 +01:00
d9e33de683 Fix for CONPY-281:
Run escape test with and without sql_mode NO_BACKSLASH_ESCAPES.
2024-02-01 07:10:29 +01:00
7c2134dddb Fix for CONPY-278:
In case of an (automatic) reconnect the connection property
connection_id was not updated, since there is no callback
functionality in Connector/C available to notify the application
that a reconnect occured. Instead of obtaining the connection_id
via MemberDef, connection_id is now implemented as getter function.
2024-01-31 17:21:48 +01:00
28827984bd CONPY-280:
Methods which are defined via PyMemberDef with flag METH_VARARGS
and have only one parameter are using METH_O now: Instead of parsing
and converting parameter via PyArgs_ParseTuple we now check the type
and convert passed python object directly to the corresponding c type.
2024-01-31 15:15:49 +01:00
f00bc261d4 Fix for CONPY-279:
Allow None values for password and database in change_user()
method of connection object.
2024-01-30 15:55:34 +01:00
7fe141ea0a Bump version 2023-12-20 19:07:13 +01:00
9952ff09af CONPY-276:
Allow to retrieve data from buffered cursor if the connection
was already closed.
v1.1.9
2023-12-20 17:29:28 +01:00
7d6b5af51c [misc] correct CREATE OR REPLACE commands to DROP IF EXISTS + CREATE for mysql test compatibility - part 2 2023-12-17 21:38:47 +01:00
0c72aaec43 [misc] test correction not using temporary tables with mysql 8 2023-12-15 18:50:36 +01:00
5a3dd3da6b [misc] test correction 2023-12-15 14:53:14 +01:00
76a766141f [misc] test stability improvement for mysql server 2023-12-14 16:35:23 +01:00
ba6b6e9255 [misc] correct CREATE OR REPLACE commands to DROP IF EXISTS + CREATE for mysql test compatibility 2023-12-14 10:55:10 +01:00
d0470ae7ef [misc] clarify license with LGPL-2.1-or-later, not LGPL-2.1 only 2023-12-13 18:38:35 +01:00