Commit Graph

35 Commits

Author SHA1 Message Date
21c9afc13f Removed reference increment in cursor.description 2020-10-04 12:34:41 +02:00
8944cb889a Error handling fixes:
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
2020-10-04 11:35:40 +02:00
846c0d0fdb Fix for CONPY-119: Fixed memory leak
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.
2020-10-03 16:41:29 +02:00
cbd51decc6 When converting parameters also check subtype of a Python Object 2020-10-02 12:54:21 +02:00
bce98d74cd Fix for CONPY-118: Leak when using text protocol
Removed statement allocation from the cursor init function and
allocate it only in executemany and execute if paraemters were
supplied.
2020-10-02 12:52:09 +02:00
08673bbdf4 Small "workaround" for MDEV-23481:
Don't set the unsigned flag if the value will fit into signed integer.
2020-09-29 14:14:02 +02:00
8ff03334c2 Fixed conversion of Integer parameters:
If bits of PyLong are > 32 we will always use MYSQL_TYPE_LONGLONG.
2020-09-29 13:46:13 +02:00
3f95456824 CONPY-117: Added converter support
The connect() method now accepts an addtional parameter
converter which points to a dictionary, containing one or more conversions.
A conversion must be specified in the form {FIELD_TYOE : conversion_function}
2020-09-29 13:21:13 +02:00
5d4a8d5d62 Fix for CONPY-116: Wrong type reported for SQL type JSON
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.
2020-09-29 11:43:47 +02:00
6ab09b21f1 Fixed parser bug 2020-09-22 07:01:07 +02:00
23678b31ca removed redundant callproc method entry 2020-09-19 15:37:54 +02:00
6fcb9a5642 more compiler warning fixes 2020-09-19 15:32:50 +02:00
709ac83799 Fixed compiler warnings 2020-09-19 14:05:53 +02:00
51810b79f2 Added constants.FIELD_TYPE 2020-09-15 12:34:37 +02:00
e807101db2 Fix for CONC-110
Fixed a small typo (b instead of p) which caused a memory overrun
when parsing dsn keywords for connection and using keyword 'ssl'.
2020-09-04 13:31:17 +02:00
bd560c2bb9 Fix for CONPY-108 (memory leak):
- initialize datetime API only once per object file
- don't reparse same statement
2020-08-29 12:20:52 +02:00
3c264b2d2a Fix memory leak in fetchmany (same bug as CONPY-99) 2020-08-20 18:12:58 +02:00
837a36ea15 Fix rowcount calculation for emulated bulk operations 2020-08-16 15:10:26 +02:00
74933240ba Fix for CONPY-99:
Decrement reference to row after adding it to lit to prevent
memory leakage
2020-08-16 09:40:10 +02:00
92eaf17fd5 Follow up fix for CONPY-107:
Support also insert/update/delete with PyDateTime_Delta objects
2020-08-16 07:30:58 +02:00
e078e26a18 Fix for CONPY-107:
Since Python is not able to handle negative values, a column defined as TIME will
now be converted to datetime.timedelta instead of datetime.time.
2020-08-15 19:00:40 +02:00
021c4e6aaa Allow different decimal types in executemany():
It is now possible to use different decimal types for the same column
in cursors executemany() method.
2020-08-14 19:55:41 +02:00
afea681910 Fix for CONPY-105: Change behavior of cursor->rowcount and cursor->lastrowid
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
2020-08-14 16:44:13 +02:00
30d5793959 Followup for fix for CONPY-106
Added better handling for client errors (InterfaceError)
2020-08-14 16:38:19 +02:00
e091edd549 Fix for CONPY-106
Check error number instead of SQL code for determine exception type.
2020-08-14 14:44:05 +02:00
588bc01cc0 Implementation for CONPY-100:
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.
2020-08-12 16:05:29 +02:00
0e91d76d52 Fix for CONPY-102:
Fixed default behavior of autocommit: If not autocommit mode was specified,
autocommit will be off by default (see https://www.python.org/dev/peps/pep-0249/#commit).
Added new keyword autocommit for connection class which might have the following values:
- None: use server default setting
- True: turns autocommit on
- False: turns autocommit off
2020-08-12 14:19:02 +02:00
03f283a2ff Fix for CONPY-101: Negative refcount when executing callproc() method
Removed the reference decrement in callproc function.
2020-08-12 07:31:25 +02:00
067a78dd13 Fix for CONPY68 (jsonfield returning as bytes):
When a value is returned as binary type (BLOB) but has a non binary collation,
it will be converted now as a unicode string and the binary flag will be ignored.
2020-08-10 14:59:16 +02:00
a749c53859 Fix for CONPY-98:
If a string has a binary collation/charset it needs to be converted
to a Binary instead of Unicode.
2020-08-07 14:45:50 +02:00
c59313604e Fix for CONPY-95
Added support for MYSQL_TYPE_BIT: Bit field type will be converted
to PyByte object.
2020-08-06 18:26:44 +02:00
bfd71e2fa1 Fix for CONPY-94:
Don't check for exact type but also for subtype.
2020-08-06 15:03:48 +02:00
e3eba3abaf Added method pool.close() 2020-08-05 19:01:53 +02:00
01053e0d4a Fix for CONPY-93:
When releasing the GIL we need to unblock/block in callback functions (mariadb_codecs.c)
2020-08-05 18:54:19 +02:00
29b05e3b09 Various fixes and changes for SQLAlchemy support:
- 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
2020-07-24 12:13:31 +02:00