question about SQLLock, SQLUpdate, SQLRefresh

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jdorlon
Posts: 202
Joined: Fri 05 Jan 2007 22:07

question about SQLLock, SQLUpdate, SQLRefresh

Post by jdorlon » Thu 14 Mar 2019 16:07

Hello,

I am using a TSmartQuery tied to a TDBGrid. I do not know the SQL of the SmartQuery at design time. It is entered by the user at runtime.

In most circumstances, ODAC does a fine job of insert/update/delete statements in response to the user editing the grid. But in certain circumstances, I want to handle it and generate my own SQL for SQLLock, SQLUpdate, SQLInsert, and SQLRefresh. But I am having a hard time getting started with this because I need to do it on the fly as user makes edits in the grid.

My questions are:

1) which event should I use to do that
and
2) how can I tell which fields have been modified?

Thank you.

-John Dorlon

jdorlon
Posts: 202
Joined: Fri 05 Jan 2007 22:07

Re: question about SQLLock, SQLUpdate, SQLRefresh

Post by jdorlon » Thu 14 Mar 2019 17:34

Specifically, the user is selecting a field by an expression and I would like to supply a different expression to be used for the update or insert.

Is this possible?

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: question about SQLLock, SQLUpdate, SQLRefresh

Post by MaximG » Mon 18 Mar 2019 17:24

To implement the behavior you describe, use the BeforePost TSmartQuery event handler. For example, inside the handler you can change the text of SQLUpdate or SQLInsert queries and access the modified field values. However, in such case, the text of SQLUpdate or SQLInsert queries generated by our components will be unavailable. Please, explain exactly what criteria you will be guided to form or modify such requests. After such description and the task, we will be able to find the most convenient way to solve it with the help of our components.

jdorlon
Posts: 202
Joined: Fri 05 Jan 2007 22:07

Re: question about SQLLock, SQLUpdate, SQLRefresh

Post by jdorlon » Mon 18 Mar 2019 18:34

Hello,
Nevermind, I found a way to accomplish it....by using a separate editor instead of the grid. That way I can make my own update statements.
Thank you.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: question about SQLLock, SQLUpdate, SQLRefresh

Post by MaximG » Tue 19 Mar 2019 07:20

We are glad that you found a necessary solution. Please don't hesitate to contact us with questions concerning ODAC usage.

Post Reply