> Message: 8
>> Date: Thu, 9 Feb 2012 10:50:56 -0600
>> From: Ed Leafe <ed@leafe.com>
>> On Feb 9, 2012, at 10:28 AM, Vineet Deodhar wrote:
>>
>> > To make my question more clear, pl. consider the vfp cursor adapter.
>> > In the cursors added to data-environment, records are either updated or
>> > marked for deletion or appended.
>> > At the end, with just a single call, it takes care of the CRUD functions
>> > automatically.
>> >
>> > Whether such behaviour like vfp CA is possible here?
>>
>> Dabo works the same with one exception: deleting a record happens
>> immediately, whereas the other changes (append/update) are buffered. Those
>> changes exist in the local cursor's data, and when you call save(), they
>> are all written to the backend. Likewise, you can call cancel() to revert
>> those changes at any time before writing them with the save() call.
>>
>>
Digging-up an old thread again :)
I notice one difference between vfp CA & dabo:
Pl. do not think that I am showing-off shortcomings of dabo.
But I am trying to think how it can be made to suit my purpose.
Agreed that append & update are buffered.
But a single save() call would not be sufficient to save them at single shot
As we all know,
-- For handling the save of 'appended' records, we need to call new() first.
(no need for seek() & setFieldVal() )
-- For handling the save of 'updated' records, seek() & setFieldVal() are
required (of course).
-- For delete, seek() & delete() are required.
In vfp CA, no such extra work is necessary.
I am just wondering how this whole stuff can be achieved in dabo.
Thinking of adding flags to the records (dicts) for append/update/delete.
But not sure how to proceed
Any thoughts?
If you need buffered deletes, you will need to add a column to the
>> cursor's data that works like the VFP delete() flag. Then, in your
>> afterSave() code, find all the records with that flag set, and call
>> delete() on them.
>>
>>
>> -- Ed Leafe
>
>
For deletes, yes.
It is simple. But as I have written before, I am thinking of how to make
dabo understand whether to append/update/delete.
--- Vineet
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/CAP5=7opJ+XiKF4ddf0dAqTkO5-y4EkXC5pEN7Tec+jiZ4DqNrQ@mail.gmail.com
On Feb 15, 2012, at 4:19 AM, Vineet Deodhar wrote:
> Agreed that append & update are buffered.
> But a single save() call would not be sufficient to save them at single shot
> As we all know,
> -- For handling the save of 'appended' records, we need to call new() first.
> (no need for seek() & setFieldVal() )
>
> -- For handling the save of 'updated' records, seek() & setFieldVal() are
> required (of course).
>
> -- For delete, seek() & delete() are required.
>
> In vfp CA, no such extra work is necessary.
Are you only working with the Dabo cursor class directly? Or are you using the UI and bizobj, too?
If you're using the UI, whether in Dabo or VFP, you click on a grid row or navigate with buttons to get to the record you want. Then you modify the values as needed, and click the Save button to save. There is no difference at all, except for the delete behavior mentioned earlier.
I'm curious as to how you are able to modify specific fields of specific records in the VFP CA without somehow selecting the correct record, modifying the value, and calling TABLEUPDATE() or its equivalent.
-- Ed Leafe
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/B0E1D2A2-7D24-40A9-84BC-EF409CE7D19D@leafe.com
On Wednesday, February 15, 2012 03:49:36 PM Vineet Deodhar wrote:
> > Message: 8
> >
> >> Date: Thu, 9 Feb 2012 10:50:56 -0600
> >> From: Ed Leafe <ed@leafe.com>
> >>
> >> On Feb 9, 2012, at 10:28 AM, Vineet Deodhar wrote:
> >> > To make my question more clear, pl. consider the vfp cursor
> >> > adapter.
> >> > In the cursors added to data-environment, records are either
> >> > updated or marked for deletion or appended.
> >> > At the end, with just a single call, it takes care of the CRUD
> >> > functions automatically.
> >> >
> >> > Whether such behaviour like vfp CA is possible here?
> >> >
> >> Dabo works the same with one exception: deleting a
> >> record happens
> >>
> >> immediately, whereas the other changes (append/update) are buffered.
> >> Those changes exist in the local cursor's data, and when you call
> >> save(), they are all written to the backend. Likewise, you can call
> >> cancel() to revert those changes at any time before writing them with
> >> the save() call.
> Digging-up an old thread again :)
>
> I notice one difference between vfp CA & dabo:
> Pl. do not think that I am showing-off shortcomings of dabo.
> But I am trying to think how it can be made to suit my purpose.
>
> Agreed that append & update are buffered.
> But a single save() call would not be sufficient to save them at single shot
> As we all know,
> -- For handling the save of 'appended' records, we need to call new() first.
> (no need for seek() & setFieldVal() )
>
> -- For handling the save of 'updated' records, seek() & setFieldVal() are
> required (of course).
>
> -- For delete, seek() & delete() are required.
>
> In vfp CA, no such extra work is necessary.
>
> I am just wondering how this whole stuff can be achieved in dabo.
> Thinking of adding flags to the records (dicts) for append/update/delete.
> But not sure how to proceed
>
> Any thoughts?
What you say is true in general (that assumes I understood everything in your
post). VFP CA's were something like a "do all interface to general data".
But try using joins, or special sub-selects within the CA. I don't believe
you can then use many of the speical features. Everything is tied to a cursor
in an update sort of way. Which means that stored procedures outside of the
cursor did not work. So back in the day when I used VFP I reverted back to
SPT to access MsSQL.
CA's were useful to a point - but in the end I had to abandon them to get the
job done. They worked well when the solution was simple.
That is not to say that Dabo is perfect. I'd like a class that some how did
not immediately delete the data when the delete button was clicked. In fact I
normally do not allow an actual delete to take place. I normally have a field
(active type bool) that I use to simulate deletes.
I'm biased because what has to be done in Dabo is exactly what I had to do in
VFP.
Johnf
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/6017148.ULYoYzUNlQ@linux-12
>
> On Feb 15, 2012, at 4:19 AM, Vineet Deodhar wrote:
>>>
>>> > Agreed that append & update are buffered.
>>> > But a single save() call would not be sufficient to save them at single shot
>>> > As we all know,
>>> > -- For handling the save of 'appended' records, we need to call new() first.
>>> > (no need for seek() & setFieldVal() )
>>> >
>>> > -- For handling the save of 'updated' records, seek() & setFieldVal() are
>>> > required (of course).
>>> >
>>> > -- For delete, seek() & delete() are required.
>>> >
>>> > In vfp CA, no such extra work is necessary.
>>>
>>> Are you only working with the Dabo cursor class directly? Or are you using the UI and
>>> bizobj, too?
>>>
>>>
>>>
I am working with the Dabo Biz & DB classes directly.
Not using the UI.
> If you're using the UI, whether in Dabo or VFP, you click on a grid row or navigate with
>>> buttons to get to the record you want. Then you modify the values as needed, and click the Save
>>> button to save. There is no difference at all, except for the delete behavior mentioned earlier.
>>>
>>> I'm curious as to how you are able to modify specific fields of specific records in the VFP
>>> CA without somehow selecting the correct record, modifying the value, and calling TABLEUPDATE() or
>>> its equivalent.
>>>
>>> -- Ed Leafe
>>>
>>>
Yes. You are right in the sense whether in Dabo or in VFP, we have to
select the record we want (but that's all).
I just wanted to say that once a record is selected, append/update/delete
for all the related tables is taken care of by the CA without any extra
programming (except the sql query, non-update fields etc.).
As I understand from you answer, append & update are dealt with by Dabo UI
(except delete) in the same way as VFP CA.
Pl. reply whether I get it right.
If so, I might choose the entire Dabo framework (not just biz & db) for my
next project.
--- Vineet
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/CAP5=7oroLFKPdno9vuc8yJPEv2kUYyeb-fBrEG3nMaBCWLY2jA@mail.gmail.com
On 02/15/2012 08:20 AM, Vineet Deodhar wrote:
>
> As I understand from you answer, append& update are dealt with by Dabo UI
> (except delete) in the same way as VFP CA.
> Pl. reply whether I get it right.
Why can't you just use the save() or saveAll() methods of dBizobj?:
http://paul.dabodev.com/doc/api/dabodoc/dabo.biz.dBizobj.dBizobj.html
>
> If so, I might choose the entire Dabo framework (not just biz& db) for my
> next project.
>
--
Adrian Klaver
adrian.klaver@gmail.com
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/4F3BE137.2040505@gmail.com
On Wed, Feb 15, 2012 at 10:15 PM, Adrian Klaver <adrian.klaver@gmail.com>wrote:
> On 02/15/2012 08:20 AM, Vineet Deodhar wrote:
>
>>
>> As I understand from you answer, append& update are dealt with by Dabo UI
>>
>> (except delete) in the same way as VFP CA.
>> Pl. reply whether I get it right.
>>
>
> Why can't you just use the save() or saveAll() methods of dBizobj?:
>
> http://paul.dabodev.com/doc/**api/dabodoc/dabo.biz.dBizobj.**dBizobj.html<http://paul.dabodev.com/doc/api/dabodoc/dabo.biz.dBizobj.dBizobj.html>
>
> Adrian Klaver
> adrian.klaver@gmail.com
>
Adrian,
I am using save() method.
The matter is that, before calling save(), I must call new() +
setFieldVal() on appended record(s) ;
For updated records, seek() + setFieldVal().
If I were using UI layer, I think this can be taken care of by dabo
automatically (pl. correct me if I am wrong).
Since I am using just biz & db layers, I need to identify the appended
records & updated records myself.
Then call save() on parent bizobj.
--- Vineet
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/CAP5=7ooybRdX9pS_8JOspDTyH=7gvA7NoK7vKg3qbVhELSP4Qg@mail.gmail.com
On Wednesday, February 15, 2012 8:09:29 pm Vineet Deodhar wrote:
> On Wed, Feb 15, 2012 at 10:15 PM, Adrian Klaver
<adrian.klaver@gmail.com>wrote:
> > On 02/15/2012 08:20 AM, Vineet Deodhar wrote:
> >> As I understand from you answer, append& update are dealt with by Dabo
> >> UI
> >>
> >> (except delete) in the same way as VFP CA.
> >> Pl. reply whether I get it right.
> >
> > Why can't you just use the save() or saveAll() methods of dBizobj?:
> >
> > http://paul.dabodev.com/doc/**api/dabodoc/dabo.biz.dBizobj.**dBizobj.html
> > <http://paul.dabodev.com/doc/api/dabodoc/dabo.biz.dBizobj.dBizobj.html>
> >
> > Adrian Klaver
> > adrian.klaver@gmail.com
>
> Adrian,
> I am using save() method.
> The matter is that, before calling save(), I must call new() +
> setFieldVal() on appended record(s) ;
> For updated records, seek() + setFieldVal().
>
> If I were using UI layer, I think this can be taken care of by dabo
> automatically (pl. correct me if I am wrong).
> Since I am using just biz & db layers, I need to identify the appended
> records & updated records myself.
> Then call save() on parent bizobj.
You might want to spend some time at the link I gave previously and look through
the various properties and methods associated with a bizobj. Two that come to
mind right of the top of head, that would seem to serve your purpose are
getChangedStatus() and getDataDiff(). Also look at SaveNewUnchanged property.
The UI layer does a lot of its data work by reaching down to the biz layer
anyway, so I think you find what need in bizobj.
>
> --- Vineet
--
Adrian Klaver
adrian.klaver@gmail.com
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/201202152112.18930.adrian.klaver@gmail.com
On Thu, Feb 16, 2012 at 10:42 AM, Adrian Klaver <adrian.klaver@gmail.com>wrote:
> On Wednesday, February 15, 2012 8:09:29 pm Vineet Deodhar wrote:
> > On Wed, Feb 15, 2012 at 10:15 PM, Adrian Klaver
> <adrian.klaver@gmail.com>wrote:
> > >
> > > Why can't you just use the save() or saveAll() methods of dBizobj?:
> > >
> > >
> http://paul.dabodev.com/doc/**api/dabodoc/dabo.biz.dBizobj.**dBizobj.html
> > > <http://paul.dabodev.com/doc/api/dabodoc/dabo.biz.dBizobj.dBizobj.html
> >
> > >
> > > Adrian Klaver
> > > adrian.klaver@gmail.com
> >
> > Adrian,
> > I am using save() method.
> > The matter is that, before calling save(), I must call new() +
> > setFieldVal() on appended record(s) ;
> > For updated records, seek() + setFieldVal().
> >
> > If I were using UI layer, I think this can be taken care of by dabo
> > automatically (pl. correct me if I am wrong).
> > Since I am using just biz & db layers, I need to identify the appended
> > records & updated records myself.
> > Then call save() on parent bizobj.
>
>
> You might want to spend some time at the link I gave previously and look
> through
> the various properties and methods associated with a bizobj. Two that come
> to
> mind right of the top of head, that would seem to serve your purpose are
> getChangedStatus() and getDataDiff(). Also look at SaveNewUnchanged
> property.
> The UI layer does a lot of its data work by reaching down to the biz layer
> anyway, so I think you find what need in bizobj.
>
> -
> Adrian Klaver
>
>
Thanks Adrian.
Let me dive deep into the links given by you.
-- Vineet
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/CAP5=7ooyKmSVkxorrh7RnfpLrj+ZRJBQ8NSv2Y+z_h3mSw4nvQ@mail.gmail.com
On Feb 15, 2012, at 10:09 PM, Vineet Deodhar wrote:
> I am using save() method.
> The matter is that, before calling save(), I must call new() +
> setFieldVal() on appended record(s) ;
> For updated records, seek() + setFieldVal().
I still don't understand why this is a problem for you. Are you simply trying to write your application using the fewest lines of code possible? To me, it looks like you are doing the bare minimum necessary: determining the record, whether it exists or newly created, and then making your changes.
Keep in mind that doing something as simple as calling bizobj.new() does a lot more than simply append a blank record to the local cursor. There are hook methods that fire before and after the record is appended, allowing you to do things like check security settings to make sure that the user is authorized to perform that action, or populate the PK of the new record, or set default values for any number of columns in the new record automatically. You may not need any of these for your current usage, but remember that this is an application framework, and as such it needs to be able to handle a wide range of use cases.
> If I were using UI layer, I think this can be taken care of by dabo
> automatically (pl. correct me if I am wrong).
> Since I am using just biz & db layers, I need to identify the appended
> records & updated records myself.
> Then call save() on parent bizobj.
You'd probably want to call saveAll(), rather than call save() once for each record.
Keep in mind that save() doesn't just blindly write your data, either. It includes data validation hooks, pre- and post-processing of the data, error handling, etc. This is why each part of the process is separated out: different developers will need to customize different parts for the particular application that they are developing.
If you really absolutely have to do all this in a single line, you can:
New record:
bizobj.safeExecute("insert into mytable values ('foo', 'bar', 99)")
Updated record:
bizobj.safeExecute("update mytable set col1='foo', col2='bar' where id=42")
Of course, you are completely bypassing the framework hooks and interacting with the database directly, so no validation or error-handling is available.
-- Ed Leafe
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/60BF5078-AE9A-4656-A381-2FF2E97581E1@leafe.com