3 messages in com.mysql.lists.clusterRe: NDB API and tables without primar...
FromSent OnAttachments
Gustaf Thorslund26 May 2006 15:24 
pek...@mysql.com26 May 2006 15:41 
Gustaf Thorslund05 Jun 2006 13:29 
Subject:Re: NDB API and tables without primary key
From:pek...@mysql.com (pek@mysql.com)
Date:05/26/2006 03:41:24 PM
List:com.mysql.lists.cluster

I have a table without any primary key and want to insert rows to in using the NDB API.

On NDB level there is primary key always. If not specified on MySQL level, it is added as last attribute $PK.

% mysql test create table t1 (a int); ^D % ndb_desc -d test t1 ... -- Attributes -- a Int NULL $PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY

(should be renamed to ndb$pk ...)

message "Operation was not defined correctly, probably missing a key"

You have to do equal() on $PK.

with error code 4116. In 4.1.19 there is a method setTupleId in NdbOperation to set a uniq tuple id for rows without a primary key.

You're right. These methods are unsupported so they change without notice.

In >= 5.0 use getAutoIncrementValue() to get next value (from cache or sequence stored in SYSTAB_0) and then do equal() on it.