Firebird3-RC2 and identity columns
Posted: Thu 07 Apr 2016 20:54
Hi,
I couldn't figure to use "new" IDENTITY column type of Firebird3 using UniQuery/UniTable. Below is a quote from Firebird3 release notes documentation:
Documentation says, new IDENTITY type column uses assigned value, if no value it generates an increased number.
I also read from documentation that Firebird3 uses automatically created generators for its new IDENTITY columns. Those automatically created generators are not visible to users, or at least I couldn't find them.
Coming to my problem. My table SQL script is as follows:
I couldn't find a way to insert more than one record in that table. If I assign 0 (zero) to ID column by code before post: My first insert sets ID column value to 0 (zero). Second insert assigns same value to ID field and exception raised saying:
I couldn't find a generator to assign a value to "KeyGenerator" option in UniQuery. I couldn't leave ID column NULL, setting Required parameter of the column "ID" to False & AutoGenerateValue parameter to arAutoInc by code didn't help it either. All these trials ends up saying "ID" cannot be null.
Any help is appreciated.
Regards,
Ertan Küçükoğlu
I couldn't figure to use "new" IDENTITY column type of Firebird3 using UniQuery/UniTable. Below is a quote from Firebird3 release notes documentation:
Code: Select all
create table objects (
id integer generated by default as identity primary key,
name varchar(15)
);
insert into objects (name) values ('Table');
insert into objects (name) values ('Book');
insert into objects (id, name) values (10, 'Computer');
select * from objects;
ID NAME
============ ===============
1 Table
2 Book
10 Computer
I also read from documentation that Firebird3 uses automatically created generators for its new IDENTITY columns. Those automatically created generators are not visible to users, or at least I couldn't find them.
Coming to my problem. My table SQL script is as follows:
Code: Select all
CREATE TABLE SERVIS
(
ID bigint generated by default as identity primary key,
KAYITTARIHI datetime NOT NULL,
KAYITSAATI datetime NOT NULL
);
Code: Select all
violation of PRIMARY or UNIQUE KEY constraint "INTEG_35" on table "SERVIS" Problematic key value is ("ID" = 0)
Any help is appreciated.
Regards,
Ertan Küçükoğlu