[DB-SIG] Announcing adodbapi version 2.6

Vernon D. Cole vernondcole at gmail.com
Fri May 2 02:48:34 CEST 2014

For more information, see http://adodbapi.sourceforge.net

Tests were run against various combinations of:
[Python2.5, Python2.7, Python3.3, Python3.4, IronPython2.7]
[32-bit, 64-bit]  [local, remote]
[Access database, SQL Server, PostgreSQL, MySQL]

This release adds prepared query support using the api we have discussed
recently on this forum:
>>> crsr = conn.cursor()
>>> crsr.prepare('select * from sometable where whatever = ?')
>>> crsr.execute(crsr.command, [param])

I have also done more experimentation and enhancement with the
user-definable paramstyle.

This version adds support for setting the paramstyle to 'pyformat', which
is implemented as a synonym of 'format'.  The 'format' SQL-mangling
subroutine now uses introspection to determine whether to use %(keyword)s
or %s positional parameters.  I believe that several of the popular api
implementations work that way.

I also wanted to try a similar feature between 'qmark' and 'named', but
without having to use introspection.  Here is how the code turned out:

def _reformat_operation(self, operation, parameters):
> ..if self.paramstyle in ('format', 'pyformat'): # convert %s to ?
> ....operation, self._parameter_names = api.changeFormatToQmark(operation)
> ..elif self.paramstyle == 'named' or (self.paramstyle == 'dynamic' and
> isinstance(parameters, Mapping)):
> ....operation, self._parameter_names = api.changeNamedToQmark(operation) #
> convert :name to ?
> ..return operation

I also had to import 'Mapping' and add 'dynamic' to the list of accepted
paramstyles, so the entire feature changed or added three lines of Python.

[Restriction:  There is a bug in pywin32 version 218 for Python3.4 which
causes a unittest failure. The fix should be released in a few days.]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/db-sig/attachments/20140501/5050a06c/attachment.html>

More information about the DB-SIG mailing list