I've got some code that builds a map (graph) of rooms on a grid with links between them. It's stored in a Firebird database with rooms in one table and links in another. The data is managed through DB Express TSimpleDataset datasets.
The query for the Exits (links) table looks like this:
select
EXITS.*,
r1.x as x,
r1.y as y,
r2.x as x2,
r2.y as y2
from EXITS
inner join ROOMS r1 on r1.ROOM_ID = EXITS.ROOM1
inner join ROOMS r2 on r2.ROOM_ID = EXITS.ROOM2
Problem is, when I add a new exit and call ApplyUpdates, DBX's SQL parser doesn't seem to understand that the fields from the ROOMS table are just there for convenience and not part of the original table. It generates the following:
insert into "EXITS"
("EXIT_ID", "AORDER", "AEXIT", "PREACTION", "POSTACTION", "COLOR", "ROOM1",
"ROOM2", "MAP1", "MAP2", "X", "Y", "X2", "Y2")
values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
plus the appropriate params, with predictable results. Does anyone know how I can make it understand that the Xs and Ys aren't supposed to be inserted or updated?