Control on SQL generated

Posts   
 
    
jakkamma
User
Posts: 19
Joined: 03-Mar-2005
# Posted on: 16-Mar-2005 23:05:02   

How much control do we have on the SQL used to do DB related stuff ( like inserts, updates etc )

We use a Concurrency Time Stamp and have some internal logic applied whenever we get data out of and into DB ( Oracle )

We want to see if it is easy enough to change the SQL used ( probably in your templates) or some other way to override the SQL generation etc..

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 17-Mar-2005 10:25:54   

I'm not sure what you want to accomplish (i.e.: what that 'internal logic' does). Would you mind to elaborate on that a bit so I can point you to the functionality which does this in LLBLGen Pro?

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 18-Mar-2005 00:38:38   

jakkamma wrote:

How much control do we have on the SQL used to do DB related stuff ( like inserts, updates etc )

We use a Concurrency Time Stamp and have some internal logic applied whenever we get data out of and into DB ( Oracle )

We want to see if it is easy enough to change the SQL used ( probably in your templates) or some other way to override the SQL generation etc..

Frans, perhaps he is trying to add the rowstamp to the WHERE clause on updates in order to implement optimistic oncurrency.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 18-Mar-2005 09:57:28   

JimFoye wrote:

jakkamma wrote:

How much control do we have on the SQL used to do DB related stuff ( like inserts, updates etc )

We use a Concurrency Time Stamp and have some internal logic applied whenever we get data out of and into DB ( Oracle )

We want to see if it is easy enough to change the SQL used ( probably in your templates) or some other way to override the SQL generation etc..

Frans, perhaps he is trying to add the rowstamp to the WHERE clause on updates in order to implement optimistic oncurrency.

Could be, in that case, an IConcurrentPredicateFactory implementation as explained in the documentation would suffice. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
jakkamma
User
Posts: 19
Joined: 03-Mar-2005
# Posted on: 18-Mar-2005 17:44:11   

We have a concurrency time stamp field on each of out tables that updated via a trigger after each insert or update. The stored procedures that handle the inserts and updates for each table must be passed the concurrency time stamp for each row updated. If the parameter does not match the concurrency stamp on the record, the stored procedure raises an error to indicate the record was not updated.

Since this field is updated via a trigger, after each insert or update we have to get the new concurrency stamp for the record that was just committed.

I will look into the predicate factory, but do you think this can be acheived

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 18-Mar-2005 18:02:45   

That can't be done. Trigger generated values can't be retrieved by the sql generated.

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 18-Mar-2005 18:48:27   

jakkamma wrote:

We have a concurrency time stamp field on each of out tables that updated via a trigger after each insert or update. The stored procedures that handle the inserts and updates for each table must be passed the concurrency time stamp for each row updated. If the parameter does not match the concurrency stamp on the record, the stored procedure raises an error to indicate the record was not updated.

Since this field is updated via a trigger, after each insert or update we have to get the new concurrency stamp for the record that was just committed.

I will look into the predicate factory, but do you think this can be acheived

What database are you using? I don't know about Oracle, but SQL Server will do this for you.