[ic] Creating a Unique Primary Key

Houman Akhavan houman@edigitalweb.com
Wed, 29 Nov 2000 11:55:23 -0800

Right, that works fine, but I was not doing a direct insert statement. I was
using the Interchange functionality for updating databases through an IC
form. So I tried to pass a NULL or zero value, which would increment the
primary key. But I guess IC didn't like that (some strange behavior such as
inserting multiple blank rows). I think the best way to do it is to create
my own primary key using the data session ID + a number as mentioned by Joe.
Then I don't even have to use the AUTO_INCREMENT in the Mysql or IC data
structure. Which I was not to sure about using because the standard IC
tables did not use AUTO_INCREMENT either, anywhere.

Houman A.

----- Original Message -----
From: Marcel Montes
To: interchange-users@minivend.com
Sent: Wednesday, November 29, 2000 11:40 AM
Subject: Re: [ic] Creating a Unique Primary Key

if what you need is to add a record on the table that autoincrements the
primary key.
then it would be something like this on sql:
mysql> CREATE TABLE tbl_mytable (id INT PRIMARY KEY AUTO_INCREMENT, username
mysql> INSERT INTO tbl_mytable (username, date) VALUES ("Houman Akhavan",
this way, the indexed "id" field of tbl_mytable is generated by adding to 1
to the last record's "id" field.
PD: when you modified table.mysql... did you restart the interchange daemon?
 Marcel Montes [marcel(at)multimake(dot)com] - Programmer
Documentation is like sex: it it's good, it's good, if it's
bad, is better than nothing...
-------------------------- EOF ----------------------------