No exception is fired for violations of primary key or fk?

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
rollyar
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 24.11.2009, 22:56

No exception is fired for violations of primary key or fk?

Post by rollyar »

I'm trying to make an application to replicate data and I find the problem that no exceptions are triggered by violation of primary key or foreign key, is this something configurable or is it a mistake? The application is made in lazarus, with the latest svn version of the components, the driver is firebird-2.1, the databases are both firebird 2.1.

I've tried for example:
q: = TZquery.create (nil);
try
q.Connection: = Aconnection;
q.SQL.Text: = 'insert into table values (' key1 ',' val2 ')';
q.ExecSql;
q.Close;
except
on e: Exception do
begin
.....
end;
end;

and also
Aconnection.ExecuteDirect ('insert into table values (' key1 ',' val2')');

Although the row already exists I do not produce any exception.

I would appreciate an answer.

Sorry for my bad English.
guidoaerts
Senior Boarder
Senior Boarder
Posts: 93
Joined: 01.07.2009, 16:07

Post by guidoaerts »

I think it is impossible to execute the sql's the way you show them, because of the way you're quoting and because you don't name the table. Please show us the exact code. Thank you.
Guido
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

rollyar,

Does the problem still exist?

Mark
Image
Post Reply