<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-text-flowed" style="font-family: -moz-fixed;
font-size: 12px;" lang="x-western">Hello dear colleagues.
<br>
Help me please.
<br>
I would like to get:
<br>
1 open "testwidget"
<br>
2 create temp table TMPTable
<br>
3 change data in TMPTable in "testwidget"
<br>
4 Save updated data from TMPTable in table T1 by TMPTable's
trigger
<br>
<br>
When I try to open window "testwidget" I get :
<br>
Warning: bonddb/bonddbid.c: 254: bonddb_id_get(): No primary key
set in query: select * From dobancurrencies(341::int);
<br>
<br>
I can see that my temp table created with right data.
<br>
But any changes not save to TMPTable and trigger doesn't work
<br>
<br>
Where is my mistake?
<br>
Could you tell me better way to do this?
<br>
<br>
<br>
I have in xml:
<br>
<window name="testwidget" parentwindow = "parentwind"
modal="true" >
<br>
<dbobject name="test">
<br>
<sql>select * from
CreateTempTableWithTrigger(<field
dbobjectsrc="parentwind">ID</field>::int);</sql>
<br>
</dbobject>
<br>
<hbox>
<br>
<cell>
<br>
<entry name="fld1">
<br>
<field>fld1</field>
<br>
</entry>
<br>
</cell>
<br>
<cell>
<br>
<entry name="fld2">
<br>
<field>fld2</field>
<br>
</entry>
<br>
</cell>
<br>
<cell >
<br>
<button name="save">
<br>
<trigger event="click">
<br>
<api call="save">
<br>
<widget>testwidget</widget>
<br>
</api>
<br>
</trigger>
<br>
</button>
<br>
</cell>
<br>
<br>
</hbox>
<br>
</window>
<br>
<br>
I have in PostgreSQL:
<br>
<br>
CREATE OR REPLACE FUNCTION SaveDataFromTMP() RETURNS trigger AS
<br>
$$BEGIN
<br>
INSERT INTO T1 (fld1, fld2) SELECT fld1, fld2 FROM TMPTable;
<br>
<br>
RETURN NEW;
<br>
END;
<br>
$BODY$ LANGUAGE plpgsql;
<br>
<br>
CREATE OR REPLACE FUNCTION CreateTempTableWithTrigger( prmId int )
<br>
RETURNS TABLE ( id int, fld1 int, fld2 int) AS
<br>
$$ BEGIN
<br>
DROP TABLE IF EXISTS TMPTable CASCADE;
<br>
Create TEMP Table TMPTable( id int, fld1 int, fld2 int);
<br>
Insert Into TMPTable("ID") Values(prmID);
<br>
<br>
CREATE TRIGGER Test_update AFTER UPDATE OR INSERT ON TMPTable FOR
EACH ROW EXECUTE PROCEDURE SaveDataFromTMP();
<br>
<br>
RETURN QUERY SELECT * FROM TempBanCurrencies;
<br>
<br>
END $$
<br>
LANGUAGE plpgSQL;
<br>
<br>
Sorry for lot letters.
<br>
Thanks in advance
<br>
Nadia
<br>
<br>
</div>
</body>
</html>