- Result sets
Convert named_tuple and dictinuary result sets directly from netbuffer,
instead to fetch them in tuples and convert it afterwards
- fetch rows()
Use MrdbCursor_fetchrows() c function for fetchmany/fetchall.
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
Add option binary for cursor. When set to true cursor will always try
to use the client/server binary protocol, even when no parameter were
passed to execute.
- added a thin python wrapper around mariadb module
- added constansts under mariadb.constants (CLIENT, CURSOR, INDICATOR)
- bench and test are now in testing subdirectory
- updated documentation