Page 1 of 1

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

Posted: 15.06.2010, 01:32
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.

Posted: 23.06.2010, 08:07
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

Posted: 29.08.2010, 21:00
by mdaems
rollyar,

Does the problem still exist?

Mark