I currently work with D1/Interbase. The problem nevertheless is common for
D1, D2 and D3. Just created a new database with a few tables in it. Have a
butchers at one of the tables and its indices.
create table COUNTRY
COUNTRYNO INTEGER not null,
COUNTRYNAME CHAR(15) not null,
PREFIX CHAR(10) not null,
CONTINENT CHAR(2) default 'Eu' not null
constraint ck_country_continent check (CONTINENT in ('Eu','As','Af','Oc','NA','SA','An')),
constraint pk_country primary key (COUNTRYNO)
create unique ASC index COUNTRYNAMEX on COUNTRY (COUNTRYNAME);
create ASC index PREFIXX on COUNTRY (PREFIX);
create unique index COUNTRYNOX on COUNTRY (COUNTRYNO);
SET_COUNTRYNO trigger takes care of the primary key.
In my application I use StartTransaction, Commit and Rollback methods with
SQLPASSTHRU mode of the alias set to NOT SHARED. StartTransaction method is
triggered in OnShow event of the form and after each Commit and RollBack
in OnAfterCancel and OnAfterPost respectively.
Editing and deleting work just fine but when it comes to inserting a record
inevitably the above error msg appeares followed by "Key violation. Attempt
to store duplicate value in unique index COUNTRYNAMEX."
First I thought that the programme tries to insert a record twice. Then
I dropped both constraints and the indices leaving only primary key -
everything got back to normal.
I wander whats wrong with my table. ANy info on "Key deleted" message would
be greatly appreciated. Where can I find a description of such errors.
Svyatoslav "Stan" Danilov