incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Connectors Framework > How to Write an Output Connector
Date Tue, 19 Oct 2010 07:40:00 GMT
Space: Apache Connectors Framework (https://cwiki.apache.org/confluence/display/CONNECTORS)
Page: How to Write an Output Connector (https://cwiki.apache.org/confluence/display/CONNECTORS/How+to+Write+an+Output+Connector)
Comment: https://cwiki.apache.org/confluence/display/CONNECTORS/How+to+Write+an+Output+Connector?focusedCommentId=24183451#comment-24183451

Comment added by Karl Wright:
---------------------------------------------------------------------

The ManifoldCF database abstraction is, of course, a limited one.  You can't do everything
that you can do in every kind of database there is out there.  However, you \*can\*
effectively define the equivalent of a multiple primary key relationship simply by doing the
following:

(1) create your columns, labeling NONE of them as "primary key".

(2) create a unique index on the columns you want to be your multiple primary key.\\

In PostgreSQL this does the same thing as a multiple primary key.\\

In reply to a comment by Farzad:
I was looking at the code for DBInterfacePostgreSQL in org.apache.manifoldcf.core.database
and looks like it is not setup to handle multiple primary keys.  Aren't primary keys suppose
to be listed together as a comma separated list?

  protected static void appendDescription(StringBuffer queryBuffer, String columnName, ColumnDescription
cd, boolean forceNull)
  {
    queryBuffer.append(columnName);
    queryBuffer.append(' ');
    queryBuffer.append(mapType(cd.getTypeString()));
    if (forceNull || cd.getIsNull())
      queryBuffer.append(" NULL");
    else
      queryBuffer.append(" NOT NULL");
    if (cd.getIsPrimaryKey())
      queryBuffer.append(" PRIMARY KEY");
    if (cd.getReferenceTable() != null)
    {
      queryBuffer.append(" REFERENCES ");
      queryBuffer.append(cd.getReferenceTable());
      queryBuffer.append('(');
      queryBuffer.append(cd.getReferenceColumn());
      queryBuffer.append(") ON DELETE");
      if (cd.getReferenceCascade())
        queryBuffer.append(" CASCADE");
      else
        queryBuffer.append(" RESTRICT");
    }
  }

Change your notification preferences: https://cwiki.apache.org/confluence/users/viewnotifications.action

Mime
View raw message