[egenix-users] cursor.specialcolumns

M.-A. Lemburg mal at lemburg.com
Mon Dec 30 20:22:57 CET 2002


Michael Rothwell wrote:
> M.-A. Lemburg wrote:
> 
>> I'd suggest to first get a feeling for how to specify a
>> table in the database using e.g. cursor.columns() before
>> trying to find the right parameters for .specialcolumns().
> 
> 
> cursor.columns(table="mytable") works. Also specifying the qualifier and 
>  owner as the database name and owner works. Neither works with 
> specialcolumns().

Strange. Perhaps this has something to do with nullable ?! ...

"""
Nullable
     [Input]
     Determines whether to return special columns that can have a NULL value. Must be one of the following:

     SQL_NO_NULLS: Exclude special columns that can have NULL values. Some drivers cannot support SQL_NO_NULLS, and 
these drivers will return an empty result set if SQL_NO_NULLS was specified. Applications should be prepared for this 
case and request SQL_NO_NULLS only if it is absolutely required.

     SQL_NULLABLE: Return special columns even if they can have NULL values.
"""

and there's also other possibilities:

"""
If there are no columns that uniquely identify each row in the table, SQLSpecialColumns returns a rowset with no rows; a 
subsequent call to SQLFetch or SQLFetchScroll on the statement returns SQL_NO_DATA.

If the IdentifierType, Scope, or Nullable arguments specify characteristics that are not supported by the data source, 
SQLSpecialColumns returns an empty result set.
"""

Hmm, looking at the C code: there's a typo which seems to cause keyword
arguments to not work properly. This could be the cause for the empty
result sets.

Please try the argument in the order given in the documentation
and pass them in without argument names.

I just .specialcolumns() with SAP DB and did get some results this
way:

 >>> c.specialcolumns(None, None, 'EGENIX_VISITORS', SQL.BEST_ROWID, SQL.SCOPE_TRANSACTION)
1
 >>> c.fetchall()
[(1, 'SYSKEY', -2, 'CHAR() BYTE', 8, 8, None, 2, 'BYTE')]
 >>> c.execute('select SYSKEY from EGENIX_VISITORS')
 >>> c.fetchall()
[('\xff\xfe\x00\x00\x00\x00\x00\x01',),]

This seems to be an internal row identifying key used by the database
internally. It is not defined in the table schema.

OTOH, SQL.ROWVER doesn't seem to be supported by SAP DB at all.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/




More information about the egenix-users mailing list