[unixODBC-support] Primary Keys in OpenOffice

Eric Sharkey sharkey at netrics.com
Thu Dec 30 16:27:37 GMT 2004


> >I've done that and not been able to follow it.  It's too big of a code
> >base for a casual reader to easily work something like this out.
> >
> yes, its a bit huge, but the ODBC stuff is in one module, you could 
> search for SQLPrimaryKeys and see if there are any obvious flags around 
> it that give hints.

Actually, it appears that the ODBC stuff is in two modules, and I was
looking in the wrong one.  There's "connectivity" (where I was looking),
and "dbaccess" (which, somehow, I missed entirely).

The dbaccess section has a function IsPrimaryKeyAllowed() whis is
what I think is making the primary key menu item not available.

I think what's causing the problem is something I'm returning (or not
returning) from GetTypeInfo.  There's this logic in
IsPrimaryKeyAllowed():

   //////////////////////////////////////////////////////////////
   // Wenn Feldtyp Memo oder Image, kein PrimKey
   // oder wenn Spalten nicht gedroped werden k\xf6nnen und das Required Flag ist nicht gesetzt
   // oder wenn eine ::com::sun::star::sdbcx::View vorhanden ist und das Required Flag nicht gesetzt ist
   TOTypeInfoSP pTypeInfo = pFieldDescr->getTypeInfo();
   if( pTypeInfo->nSearchType == ColumnSearch::NONE                                        ||
          (pFieldDescr->IsNullable() && pRow->IsReadOnly())
     )
        return sal_False;

(babelfished:

  // if field type note or image, no prime key
  // or if columns gedroped to become to be able and the Required flag is not not set
  // or if one is present ::com::sun::star::sdbcx::View and the Required flag is not set
)

Although, I'm still not sure what's going on.  My datasource supports only
non-nullable LONG VARCHAR column types, but the type name displayed in
the OOo table editor type selection box is "SQL Null [LONG VARCHAR]",
which is a little weird.

Eric



More information about the unixODBC-support mailing list