[unixODBC-support] Primary Keys in OpenOffice

Eric Sharkey sharkey at netrics.com
Mon Jan 3 21:38:07 GMT 2005

Nick, and others, thanks for your help.  This issue is now resolved.

>    // Wenn Feldtyp Memo oder Image, kein PrimKey
> (babelfished:
>   // if field type note or image, no prime key
> )

The above comment is old and misleading.  The "memo"/"long varchar"
datatype isn't what was preventing the primary key at all.  It was
an artifact of a bug in my implementation of SQLGetData in my driver.
Specifically, I didn't account for footnote j of the ODBC Programmer's
Reference page on C Data Types:

  SQL_C_SHORT, SQL_C_LONG, and SQL_C_TINYINT have been replaced
  in ODBC by signed and unsigned types: SQL_C_SSHORT and SQL_C_USHORT,
  An ODBC 3.x driver that should work with ODBC 2.x applications should
  support SQL_C_SHORT, SQL_C_LONG, and SQL_C_TINYINT, because when they
  are called, the Driver Manager passes them through to the driver.

OpenOffice tries to get the numeric datatype code from the results of
an SQLTypeInfo call by calling SQLGetData with the old ODBC 2.x datatype
of SQL_C_SHORT, and my driver only had support for SQL_C_USHORT

With this fixed, I can now set a primary key.


More information about the unixODBC-support mailing list