[egenix-users] cursor.specialcolumns

Michael Rothwell rothwell at holly-springs.nc.us
Mon Dec 30 16:39:40 CET 2002


Well, passing the arguments all in the right order worked:

x.cursor.specialcolumns(None,None,"NameAndAddr",mx.ODBC.Windows.SQL.BEST_ROWID, 
mx.ODBC.Windows.SQL.SCOPE_CURROW, mx.ODBC.Windows.SQL.NO_NULLS)

It didn't matter if I used NO_NULLS or NULLABLE.

-Michael



M.-A. Lemburg wrote:
> 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.
> 





More information about the egenix-users mailing list