INSERT UPDATE

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

INSERT UPDATE

Post by sfxcc »

When we insert a a row normaly we have a primarykey and most times is a sequencial number.

insert into table aa(autoinc integer) returning autoinc;
What im asking is when we insert or update it returns automatic the row, without using zupdatesql (zupdatesql is useful too).

This should be done because is useful.
( we avoid to move the cursor by refreshing atable.refresh, and when we use zupdatesql after insert we dont have the primarykey id any way so we cant refresh from an insert , or if we have a zquery like select * from (select *,sum(a+b) from table1) where date<=aDate) where Date=aDate we cant directly insert into the table1 using zupdate but we cant the use primarykey on refreshsql because it doesnt got it from server ....

and using zsequence if we use 10 call at same time it will return the same number so it does fix the problem.

Normaly autoinc are controled on server side on a triger so ... is the best way.


At least add to zupdatesql or even a descendant component the ability to do on insert update (insert into table aa(autoinc integer) returning autoinc;).
where's the code ..
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

Can you export some code-lines concerning the auto-inc, eventually? I use triggers or stored-procedures to solve this like you wrote. I don't understand why the ZSequence returns allways the same value. Normaly it calls the server for (Interbase) GEN_ID(Genarator/Sequence-name). Can you debug out why it fails? Or do i missunderstand you here?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

Post by sfxcc »

Ok, ill debug to try to found a prob.

Other :

zupdate does only refresh 1 row even if select * from table where primary>=avalue , can this be reformuled to update all the result rows of the refreshsql to table and not just 1 ?

Other : Does zpgEvent is working ? i try this out but it seams that it cant be triggerd and notified by the same session.
where's the code ..
Locked