greenew / pypyodbc

Automatically exported from code.google.com/p/pypyodbc
0 stars 0 forks source link

Description attribute returns only first char of name (as byte) using Oracle ODBC & Linux #43

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

While getting the .description list of a cursor there seems to be a problem 
with the object-type and value of the "name" element of the list. 

Consider the following code:

import pypyodbc
db_conn = pypyodbc.connect( 
"Driver={Ora11gR264};DBQ=//<HOST>:1521/unic8;Uid=<...>;Pwd=<...>;" )
cursor = db_conn.cursor()
cursor.execute( "SELECT * from test" )
cursor.fetchone()
print( cursor.description )

What is the expected output? What do you see instead?

This code is accessing the following table:

-- CREATE TABLE TEST( TESTCOLUMN  VARCHAR2(1 BYTE) );

Basically, I expected to see something like this:

>> [('testcolumn', <class 'str'>, 1, 1, 1, 0, True)]

But the code above returns the following:

>> [(b't', <class 'str'>, 1, 1, 1, 0, True)]

This is reproducable for all tables. Only the first character of a column name 
will be returned--not as char, but as byte.

What version of the product are you using? On what operating system?

- SLES 11 SP3 64bit
- Python 3.4 64bit
- pypypodbc 1.3.3 
- unixODBC (Tested with both versions shipped with SLES 2.2.12 and 2.3.1)
- Oracle Instant Client 11g (11.2.0.4) ODBC drivers

Please provide any additional information below.

The same code runs fine using Windows (I've tested Win & Win8.1) with the 
otherwise same setup. 

Original issue reported on code.google.com by norbert....@googlemail.com on 1 Jul 2014 at 3:24

GoogleCodeExporter commented 8 years ago
I have the same issue, using MySQL (issue 52).

Original comment by marc.van...@gmail.com on 15 Sep 2014 at 11:33

GoogleCodeExporter commented 8 years ago
I'm experiencing this connecting to SQL Server from Mac OS with python 3 as 
well.

No problem when I use the python 2.7.

Original comment by wcbear...@gmail.com on 17 Nov 2014 at 9:08