Unexpected floating point results using mxODBC modules
Victor Muslin
victor at prodigy.net
Thu Jun 14 17:22:49 EDT 2001
On Windows 2000, using Oracle and Active State's Python 2.1, and
mxODBC module, the result returned by the cursor object's fetchall
function contains floating point numbers for columns defined as
"NUMBER" datatype. This column containing integers only.
For example, the following code:
import mx.ODBC.Windows, pprint
db = mx.ODBC.Windows.connect(dsn, user, password)
cursor = db.cursor()
cursor.execute('select * from entity_type')
results = cursor.fetchall()
pprint.pprint(results)
returns a result set as follows:
[(1.0, 'ADSERVER'),
(2.0, 'LOGMANAGER'),
(3.0, 'PUSHERSYNC'),
(4.0, 'PUSHER'),
(5.0, 'DERIVE'),
(6.0, 'MEDIASERVER')]
At the same time, similar code using ODBC modules that came with
Active State's Python 2.1:
import odbc, dbi, pprint
db = odbc.odbc('%s/%s/%s' % (dsn, user, password))
cursor = db.cursor()
cursor.execute('select * from entity_type')
results = cursor.fetchall()
pprint.pprint(results)
returned the expected result set:
[(1L, 'ADSERVER'),
(2L, 'LOGMANAGER'),
(3L, 'PUSHERSYNC'),
(4L, 'PUSHER'),
(5L, 'DERIVE'),
(6L, 'MEDIASERVER')]
This does not seem right. Am I misunderstanding something here?
TIA
More information about the Python-list
mailing list