Page 1 of 1

m x n relation, how to do efficiently designtime.

Posted: 01.07.2010, 08:49
by marcov
I've a m x n relation decoupled using a 3rd table.

So Person and Contact have a m x n relation, decoupled by having a table "PCconnect" that has a reference to the IDs (PK) of each of the other two.

I looked in the examples of both 6 and 7, and could not find an example or something that has such relation.

I've only done serverside access, so while I'm not very familiar with designtime components, SQL is no problem.

I tried working from a dbgrid that joins these three tables together for a certain person.ID, with wired tdbedit etc controls, but don't know how to handle update/insert. Should I work from a tzupdate component and not tzquery?

Compiler D2009 (*)
Zeos 7, but this is more about general approach, I do not expect a ready made code.
db postgres 8.x

(*) yes, eat own dogfood etc, but this is for work

Posted: 03.07.2010, 16:47
by marcov
Ok, found tzquery.updateobject, and coupled a tzupdatesql to it.

I tried to mimic the masterdetail demo (from older zeoses), and it seems to work, though I don't fully understand what I have done.

I assume the update function reloads the grid, and the fields of the tzquery are then available in the SQL of the tzupdate component.

Like in masterdetail demo, I used the "newrecord" event of the tzquery to transfer parameters from tzquery to tzupdate (though I still see NULLs in sqlmonitor, so it is not 100% yet, even though it works)

Posted: 29.08.2010, 22:24
by mdaems
marcov,
This looks like a strange procedure : transferring parameters from tzquery to tzupdatesql.
As I understand (but I don't have lots of experience with TZUpdateSQL) the queries you define in TZUpdateSQL are launched automatically when you (auto)Post a modified TZQuery record. At that time te special placeholders in the queries are replaced by the corresponding record values.
Some more documentation is available in http://zeos.firmos.at/kb.php?mode=article&k=12

Succes ermee.

Mark