[egenix-users] Catching informational messages in mxODBC and discarding them

M.-A. Lemburg mal at egenix.com
Wed Oct 20 11:23:33 CEST 2004


Martin J. Evans wrote:
> Forgive me for asking but do you know about how long I'll have to wait for
> mxODBC 2.1?

We are currently planning for doing a new release in November.

> If you can't answer that (which would not surprise me) do you have an idea of
> how complicated it would be to port errorhandler from mxODBC Zope DA to
> standalone mxODBC?

That would be major work since the error handling logic
was mostly rewritten in order to make it more flexible
w/r to dealing with ODBC driver specific errors and
warnings (e.g. in some cases, you want to raise execptions
for warnings, in other cases, you don't, or there is a
way to deal with the problem in some other way).

> Martin
> --
> Martin J. Evans
> Easysoft Ltd, UK
> Development
> 
> On 19-Oct-2004 M.-A. Lemburg wrote:
> 
>>Martin J. Evans wrote:
>>
>>>Hi,
>>>
>>>I have some python which uses mxODBC to insert into a database. The insert
>>>causes an ODBC SQL_SUCCESS_WITH_INFO return in execute() and outputs the
>>>diagnostic to the terminal. I don't want to see this. I am no Python expert
>>>by
>>>a long way. I read "2.7.1 Database Warnings" saying you can catch warnings
>>>by
>>>setting an error handler but I don't know how to tie the error handler to my
>>>connection e.g.
>>>
>>>import mx.ODBC.unixODBC as mx
>>>db = mx.DriverConnect('DSN=test;UID=user;PWD=password;')
>>>db.errorhandler = None # want to insert the name of my handler here
>>>                       # as per 2.7.1 example
>>>c = db.cursor()
>>>c.execute('use test')
>>>
>>>fails with "TypeError: attribute 'errorhandler' unknown or read-only". I
>>>know
>>>the example above is not an insert but the "use test" to MS SQL Server
>>>causes an informational.
>>
>>The .errorhandler feature is part of mxODBC 2.1 which is
>>the basis for the mxODBC Zope DA. It is not available in the
>>standalone version of mxODBC which is still at 2.0.
>>
>>
>>>I saw mxODBC can be compiled to stop the display of informationals but
>>>that is not an option for me.
>>>
>>>I am using mxODBC 2.0.1 if that makes a difference.
>>>
>>>Any ideas?
>>
>>I guess you will have to wait for mxODBC 2.1.
>>
>>-- 
>>Marc-Andre Lemburg
>>eGenix.com
>>
>>Professional Python Services directly from the Source  (#1, Oct 19 2004)
>> >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>> >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>> >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
>>________________________________________________________________________
>>
>>::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
> 
> 
> 
> _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> http://lists.egenix.com/mailman/listinfo/egenix-users

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Oct 20 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list