That's very good, but DICT &NEXT.AVAILABLE& sure is ugly. It means you
can't make a dictionary read-only.  Dictionaries should be under source
control. And a data file can have multiple dictionaries.
A better answer would be to embed the next-id in the file header.
Then give a utility to edit it similar to how SET.INDEX can edit the
file header's path to it's index dir.
 
If one were to set up an SQL table like that,  what would you consider a
good UV/Basic coding practice for writing to it?  Explicit, low-level
readu & increment of the next id record?

-----Original Message-----
From: Ray Wurlod

Here is a UniVerse/SQL answer.

Create the primary key with a default value of NEXT AVAILABLE.

CREATE TABLE MyTable (
   MyKey INTEGER NOT NULL PRIMARY KEY DEFAULT NEXT AVAILABLE,
   Column1 VARCHAR,
   Column2 VARCHAR,
   Column3 VARCHAR NOT NULL MULTIVALUED,
   Column4 VARCHAR MULTIVALUED,
   ASSOCIATION MyASSOC(Column3 KEY, Column4) );

Whenever you insert a row without supplying a key value, the next
available key value will be used.

This uses the same mechanism as REVISE, namely an item called
&NEXT.AVAILABLE& in the file dictionary.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to