Commit Graph

38 Commits

Author SHA1 Message Date
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
28827984bd CONPY-280:
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.
2024-01-31 15:15:49 +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
6a5388ad05 CONPY-272: documentation fix
Fixed documentation: Cursors lastrowid attribute returns None (was
zero).
2023-10-18 08:49:07 +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
9aedf1c0f8 Handle dicts in check_text_params 2023-04-17 10:26:33 +02:00
b0366fa108 Performance fix:
Rewrote parameter type checks for text protocol in cpython.
2023-04-17 09:51:41 +02:00
db9b3b792b CONPY-231: Fix memory leak 2022-11-01 07:22:11 +01: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
903bd6e073 Performance optimization
Instead of iterating via fetchone(), fetchall() and fetchmany() methods
now load the data directly at once.
2022-10-10 06:59:16 +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
336bf34119 is_closed was renamed to _closed. 2022-08-13 10:25:11 +02:00
71614ab159 Merge branch '1.1-status' into 1.1 2022-08-09 16:09:22 +02:00
cdd42743cc Coding style fixes (PEP8)
Fixed various coding style stuff detected by flake8.
Added .pre-commit-config.yaml:
With command pre_commit install a hook for flake8 will be
installed.
2022-08-07 16:47:26 +02:00
a9ad1fcaee First implementation for status callback 2022-08-05 14:41:43 +02:00
205b9c2768 CONPY-218: Allow None as data parameter
Allow None as data parameter for cursors execute()
method.
Kudos to  Luciano Barcaro for providing a fix.
2022-07-21 05:46:53 +02:00
c30b597ba9 Fix for CONPY-213
Additionally to the fix for CONPY-214 (which fixed the iterator), we
need to check that converter will not be called with EOF (None).
2022-07-07 13:42:34 +02:00
687ba165cc Documentation fix:
Added note, that executemany() may return a result set
in case a RETURNING clause was specified.
2022-07-07 07:37:29 +02:00
275aaf3ee1 Fix for CONPY-214:
Replace cursor iterator by native python __iter__() method.
2022-07-06 22:57:58 +02:00
d61b805a4b Added CAPABILITY constants
Since CLIENT constants can be used to determine both server
and client capabilities we use now CAPABILITY constants
instead.

CLIENT constants were marked as deprecated in documentation
and will be removed in 2.0 release
2022-07-04 14:45:25 +02:00
09e5cad2c0 Fix for CONPY-212
The default settiing for buffered in cursors.execute() method has
to be None:
- if not specified, it will use cursor defaults
- if specified, the default behavior of cursor will be changed
2022-06-29 15:09:20 +02:00
ba56c73a34 CONPY-209:
When executing cursor in text protocol, the substitution of
parameters with mb chars didn't set the correct length.
2022-06-29 12:29:38 +02:00
5420fe39d9 Various fixes:
- 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
2022-06-08 13:43:20 +02:00
30c8f33b08 CONPY-205: Inconsistent exceptions
- All parameter exceptions are now ProgrammingErrors
- A dictionary now might contain more keys than
  placeholders in statement
- Fixed unhandled exception when using dictionary as parameter
2022-05-25 18:47:03 +02:00
7394d84f5e Don't clear rowcount after bulk
Since bulk operations using returning will return a result set,
we need to clear rowcount before performing bulk operation.
2022-05-21 10:02:18 +02:00
f93370a275 Cursor: Set buffered to True if no args were specified 2022-05-21 07:59:18 +02:00
1aa2bbef08 - Documentation
- docstring fixes
- removed doc and docs subdirectory, since documentation is in docs
  branch
2022-04-11 08:03:20 +02:00
55ce15a1aa Minor documentation fixes 2022-04-03 07:03:32 +02:00
811cc1c5f7 Check if object was closed:
When accessing methods or properties of connection and cursor objects
we now check if the object or parent object was closed and raise an
exception.
2022-01-16 20:59:58 +01:00
aaba6e2e11 Fix for CONPY-187:
For detecting server bulk capabilities extended server capabitilies
(instead of standard capabilities) have to be checked.

Kudos to Diego Dupin
2021-12-19 19:52:14 +01:00
3184707494 Fix for CONPY-168
Force use of binary protocol if binary parameters
were provided.
2021-10-03 06:50:00 +02:00
cfe3eee3b4 Fix for CONPY-167:
If executemany() is executed directly after execute() with the same
statement it needs to be reprepared.
2021-09-25 12:50:12 +02:00
aa6edc38cb Updated documentation 2021-08-21 18:09:48 +02:00
d3d1cfc482 Fixed rowcount for executemany() when connected
to a MySQL database server.
2021-08-16 09:28:32 +02:00
879744926b Raise exception if number of parameter doesn't match. 2021-08-05 09:57:09 +02:00
9ac0551ed1 Default mode for cursor changed:
Due to several incompatibilites (but also MDEV-23768, where errors
can't be triggered in unbuffered) we decided to switch the default
mode for cursor class for buffered from False to True.
2021-08-05 08:32:20 +02:00
8cd33d55c1 Fixed memory leak in parser 2021-08-03 11:31:31 +02:00
47ca11d921 Documentation update 2021-08-01 10:31:10 +02:00