pombreda / pypyodbc

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

TypeError: 'int' object is not subscriptable with single row Sql Server query #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Connect to a Sql Server 2005/2008
2. Run this query

SELECT SYSTEM_USER AS UserName,
        @@SERVICENAME As ServiceName,
        @@version AS Version,
        SERVERPROPERTY('Edition') AS Edition,
        SERVERPROPERTY('InstanceName') AS Instance,
        SERVERPROPERTY('IsIntegratedSecurityOnly') AS IsIntegratedSecurityOnly,
        SERVERPROPERTY('IsSingleUser') AS IsSingleUser,
        SERVERPROPERTY('MachineName') AS MachineName,
        SERVERPROPERTY('ProductVersion') AS ProductVersion,
        SERVERPROPERTY('ProductLevel') AS ProductLevel,
        SERVERPROPERTY('ServerName') AS ServerName,
        DATABASEPROPERTYEX('Factu01', 'RECOVERY') AS RecoveryMode,
        SERVERPROPERTY('SqlCharSetName') AS SqlCharSetName

con.cursor().execute(sql).fetchall()

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

Get the error:

  File "C:\Proyectos\TeleportServer\SqlServerEngine.py", line 156, in selectSql
    cursor.execute(sql)
  File "C:\Programacion\Python\27\lib\site-packages\pypyodbc.py", line 1305, in execute
    self.execdirect(query_string)
  File "C:\Programacion\Python\27\lib\site-packages\pypyodbc.py", line 1340, in execdirect
    self._UpdateDesc()
  File "C:\Programacion\Python\27\lib\site-packages\pypyodbc.py", line 1707, in _UpdateDesc
    ColDescr.append((col_name, SQL_data_type_dict.get(Ctype_code.value,(Ctype_code.value))[0],Cdisp_size.value,\
TypeError: 'int' object is not subscriptable

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

Windows 7 64, Sql Server 2008, Python 2.7, last release version of pypyodbc 
from pip

Original issue reported on code.google.com by ma...@elmalabarista.com on 22 Feb 2013 at 4:05

GoogleCodeExporter commented 9 years ago
The latest version should be able to fix this:
http://code.google.com/p/pypyodbc/source/browse/trunk/pypyodbc/pypyodbc.py

Original comment by jiangwen...@gmail.com on 24 Feb 2013 at 10:52

GoogleCodeExporter commented 9 years ago
The latest version should be able to fix this:
http://code.google.com/p/pypyodbc/source/browse/trunk/pypyodbc/pypyodbc.py

Original comment by jiangwen...@gmail.com on 24 Feb 2013 at 10:53

GoogleCodeExporter commented 9 years ago

Original comment by jiangwen...@gmail.com on 28 Feb 2013 at 1:06