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.
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.
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)
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.
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.
- removed utf8 part of parser, instead we use python binary
object for parameter substituton (text mode)
- removed memory leaks
- fixed crash when reusing cursor with different number of
placeholders
Since executemany() returns a result set if the insert, update,
delete or replace statement contains returning directive, we
need to check if execute returned number of fiels and allocate
a result set.
Extended cursor->description:
The descriptor now contains 11 elements:
descriptor[8]: table name
descriptor[9]: original column name
descriptor[10]: original table name
Display status of connection, cursor and pool class in
string representation.
If an object (cursor, class, connection pool) was closed, the
string representation (tp_repr) now shows the status of the object.
Example:
>>> import mariadb
>>> connection=mariadb.connect()
>>> connection
<mariadb.connection connected to 'localhost' at 0x7f94d77c3b40>
>>> connection.close()
>>> connection
<mariadb.connection (closed) at 0x7f94d77c3b40>
Changed sequence description from Row to mariadb.Row.
This patch also includes a followup fix for CONP-131:
PyStrustSequenceNew will be used only for Python versions > 3.6
When using text protocol pending result sets weren't properly freed,
so executing another command on the same connection resulted in an error
"commands out of sync".
Instead of OperationalException and IntegrityException will be raised
for the following eror types:
ER_BAD_NULL_ERROR, ER_DATA_OUT_OF_RANGE, ER_CONSTRAINT_FAILED, ER_DUP_CONSTRAINT_NAME
When creating a cursor with result set type named_tuple
or dictionary, references were not decremented correctly.
For named tuples we don't use a static variable anymore, instead
of it will be created by PyStructSequence_NewType.
Beginning of MariaDB 10.5 metadata for JSON columns is stored
in extended field information, and the reported type is MYSQL_TYPE_BLOB.
We now check extended field information to return correct type and for
fetching values in correct format.
rowcount:
In case of an error, or if statement wasn't executed rowcount should be -1 (see PEP-249)
For DML statements the number of affected rows returned in OK packet by server:
> 0 for DML statements which modify or insert, e.g. ALTER TABLE or CREATE TABLE .. SELECT FROM
otherwise 0
For DQL statement
if field_count > 0: number of rows returned
otherwise affected rows returned in OK packet by server.
lastrowid:
if server returns no value (0) for last_insert_id, lastrowid should be None.
if last_insert_id is > 0, return it's value