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.
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.
Fixed crash in escape_string method of connection object:
Instead of PyMem_RawCalloc we allocate memory via PyMem_Calloc, since
the memory will be freed by PyMem_Free (instead of PyMem_RawFree).
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.
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.
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.
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.
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")