[egenix-users] "right truncation" warning in mx.ODBC.Windows

M.-A. Lemburg mal at egenix.com
Thu Mar 11 20:06:32 CET 2004


Charles Bearden wrote:
>>>If so, please provide us with the information from
>>>
>>>connection.dbms_version
>>>connection.dbms_name
>>>connection.driver_name
>>>connection.driver_version
>>>
>>
>>Are these connection attributes a recent addition? My 2.0.5 doesn't
> 
> have
> 
>>them, nor any reference to them in the documentation. Or have I
>>misunderstood what I'm supposed to be reporting?

Ah, yes. These are new in version 2.1 because we had to
start putting in driver specific work-arounds into the
code to deal with problems like the ones you are seeing.

>>Anyway, from the ODBC driver info applet:
>>
>>SQL Server; Version 2000.80.194.00; SQLSRV32.DLL; 8/6/2000
>>SQL Server; Version 2000.81.9031.38; SQLSRV32.DLL; 3/11/2003
 >>
>>Maybe there's some option setting that will automatically truncate
>>fractional seconds, and I don't have it set? Can't find anything in
> 
> the
> 
>>documentation, though. FWIW, Transact-SQL docco says """Date and time
>>data from January 1, 1753 through December 31, 9999, to an accuracy of
>>one three-hundredth of a second (equivalent to 3.33 milliseconds or
>>0.00333 seconds). Values are rounded to increments of .000, .003, or
>>.007 seconds, as shown in the table.""", so it should be capable of
>>sub-second resolution. Perhaps it just doesn't like values that
> 
> require
> 
>>rounding?

Well, it's only giving a warning that rounding has taken
place. That's nothing serious and the INSERT will have
actually made it to the database if you do a .commit().

The problem with MS SQL Server ODBC driver is that it is
providing too many of these warnings.

Note that there's an option to compile mxODBC with *all*
warnings disabled. You have to change the code in mxCOMMERCIAL.py
like this to enable it and then recompile the package using
"python setup.py install":

if sys.platform[:3] == 'win':
     ext_modules[len(ext_modules):] = [

         Extension('mx.ODBC.Windows.mxODBC',
                   ['mx/ODBC/Windows/mxODBC.cpp',
                    'mx/ODBC/Windows/mxSQLCodes.cpp',
                    ],
                   include_dirs=['mx/ODBC/Windows'],
# Change these lines...
                   define_macros=[('MS_ODBC_MANAGER', None),
                                  ('DONT_REPORT_WARNINGS', None)],
# ...end of fix
                   libraries=['odbc32']
                   ),
         ]

> My MS SQL driver is newer than Steve's:
> 
>   SQL Server; Version 2000.81.9042.00; SQLSRV32.DLL; 10/27/2003

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Mar 11 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/
________________________________________________________________________
EuroPython 2004, Göteborg, Sweden                           87 days left

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



More information about the egenix-users mailing list