Commit Graph

109 Commits

Author SHA1 Message Date
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
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
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
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
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.
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
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
9952ff09af CONPY-276:
Allow to retrieve data from buffered cursor if the connection
was already closed.
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
80a722a4c7 [misc] test correction for maxscale 2023-12-13 18:29:08 +01:00
1762e9d458 Travis: Added Python-3.12 2023-10-12 06:01:00 +02:00
84e423295a Test fix
Skip extended field type test if server is MySQL
or MariaDB server version is < 10.10
2023-10-12 05:41:40 +02:00
cfe1d10702 CONPY-271: Added cursor.metadata property
Similiar to description property, this property returns
a dictionary with complete metadata.

The dictionary contains the following keys:
  - catalog:     catalog (always 'def')
  - schema:      current schema
  - field:       alias column name or if no alias was specified
                 column name
  - org_field:   original column name
  - table:       alias table name or if no alias was specified
                 table name
  - org_table:   original table name
  - type:        column type
  - charset:     character set (utf8mb4 or binary)
  - length:      The length of the column
  - max length:  The maximum length of the column
  - decimals:    The numer of decimals
  - flags:       Flags (flags are defined in constants.FIELD_FLAG)
  - ext_type:    Extended data type (types are defined in
                 constants.EXT_FIELD_TYPE)

This fixes also CONPY-270: Instead of checking BINARY_FLAG we now
check character set for binary object types.
2023-10-11 14:50:23 +02:00
05f4cede96 Fix typo 2023-09-30 17:40:00 +02:00
91ecc9e3bf Workaround for CONPY-269:
Even if PEP-249 permits operations on a closed cursor, we don't
raise an exception if the cursor or the underlying connection
was closed. Instead rowcount property will return -1.

This is a workaround for pandas, where rowcount will be checked
after the cursor was closed.
2023-09-29 10:34:30 +02:00
658cc0015c Fix for CONPY-256:
Fix indexing when moving a free connection to used connections
to avoid returning the same connection twice.

Kudos and thanks to G.Mech for reporting this bug and providing
the fix.
2023-04-11 09:05:07 +02:00
494d9513da Fix for CONPY-255:
If a connection pool can't return a connection (all connections in use)
a PoolError will be raised instead of returning None object.
2023-04-11 08:37:16 +02:00
6afeaa53d1 CONPY-258: Fixed ValueError exception if ZEROFILL flag is defined
For backwards compatibility PyLong_FromString interprets leading
zeros as octal value which will end up in a value error, if the
number contains 2 or more leading zeros.
2023-04-06 17:22:26 +02:00
3827ae32bd CONPY-253: Add new connection option tls_version
The connection method now offers the option of specifying
the version of the TLS protocol using tls_version:

connection = mariadb.connect(tls_protocol="TLSv1.2")
2023-03-25 15:22:31 +01:00
0c844879fd Fix for CONPY-251
Check if stmt was already initialized in cursor method
nextset().
2023-02-12 08:26:37 +01:00
9f7fcbb356 Fix for CONPY-250:
With implementation of CONPY-246/247 pool._connections was replaced
by _connections_used and _connections_free to the size should be
calclulated as len(_connections_used + _connections_free)
2023-02-08 16:04:20 +01:00
fad6119fd0 CONPY-248:
If a connection in connection pool was identified as broken (either
COM_PING or reset_connection failed) it will be replaced by a new
connection.
2023-02-05 14:22:46 +01:00
a48eb1eff6 Fix for CONPY-246:
Rollback transaction if connection pool was created with
pool_reset_connection=False.
2023-02-03 08:07:41 +01:00
7daab2feb5 Fix for CONPY-245:
Instead of iterating through all connections and checking the health
status via ping, used and unused connections were separated in different
lists. This ensures that the last used connection will be always the first.
2023-02-01 09:33:54 +01:00
ca7b5ae6fd [misc] adding pip install packaging to test + remove distutils use 2022-11-03 10:26:01 +01:00
80b642b8a1 Fix for CONPY-229:
Pass NULL/None values to converter.
2022-10-19 17:13:27 +02:00
ce228b68da CONPY-227: Replace collections.named_tuple
Replaced collections.named_tuple by C-Pythons PyStruct_Sequence.
All conversion are done now before fetching a row: converting to
other result types than tuple (named tuple or dict) now have less
overhead and are significantly faster.
2022-10-10 09:01:19 +02:00
37623b1928 Merge branch '1.1' of https://github.com/mariadb-corporation/mariadb-connector-python into 1.1 2022-10-07 08:48:54 +02:00
d70be504e3 Fix for CONPY-225:
Set value for affected_rows.
2022-10-07 08:47:48 +02:00
577be039f6 [misc] correcting benchmark using binary 2022-09-22 19:06:35 +02:00
37ea27cf86 Fix for CONPY-224:
If a bulk operation is executed and the statement doesn't need to
be reprepared, only array size has to be updated, since setting
the number of parameters (STMT_ATTR_PREBIND_PARAMS) will reset the
statement in Connector/C.
2022-09-22 07:26:46 +02:00
cb238ceabc [misc] adding bulk benchmark 2022-09-21 11:44:19 +02:00
4c75199a75 [misc] MariaDB benchmark common test suite implementation
benchmark precision improved running on one thread only with at least 1000 warmup operations
2022-09-06 11:03:31 +02:00
215d983df0 Fixed test name:
Last commit message was incorrect, issue fixed CONPY-222, not
CONPY-221 (which was already closed).
2022-08-27 07:39:50 +02:00
c3fe1a954e Fix for CONPY-221:
Removed __del__ method from cursors.py to prevent
raisiing if cursor was already properly closed via close()
method.
2022-08-27 07:25:09 +02:00