TUniQuery: Turn an update into an insert.

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kamiller42
Posts: 40
Joined: Thu 27 Jan 2011 22:31

TUniQuery: Turn an update into an insert.

Post by kamiller42 » Wed 06 Jun 2012 22:33

I have a TUniQuery with SqlInsert and SqlUpdate properties specified. The update works fine. I want to execute the insert statement if a certain field is null. I figure it would involved the OnUpdateRecord event and a method call to apply a certain Sql statement, like TUpdateSQL.Apply method.

What's the best way to accomplish this?

kamiller42
Posts: 40
Joined: Thu 27 Jan 2011 22:31

Re: TUniQuery: Turn an update into an insert.

Post by kamiller42 » Thu 07 Jun 2012 18:26

Never mind. Figured this out using SQL. I supposed using cached updates and a TUniUpdateSQL would have worked too. Figured UniQuery had all it needed to apply one of its DML if called to do so.

Post Reply