On Mar 30, 2007, at 11:57 AM, Larry Bradley wrote:

> However, as I mentioned, it uses remote views. For example, when I  
> display
> the member's data, I have a VFP remote view that picks up fields  
> from the
> member table (these are editable) and from the membercategory table  
> (these
> are read-only).  This type of things is done extensively in this app.
>
> I'm quite new to DABO - just started playing with it.
>
> What should I be looking at in DABO/mySQL as a replacement for the  
> remote
> view (with multiple tables) facility of VFP?

        A view, whether remote or local, is simply a parameterized query,  
with possibly some other info regarding updates back to the database.

        Dabo has two mutually exclusive ways of handling SQL: the SQL  
Builder code, which is the stuff you see in AppWiz apps: biz.addField 
("foo"), biz.addWhere("foo.bar = 1"), etc. This creates a SQL  
statement that will be backend-independent, since it accounts for  
syntax differences among the various backends.

        The other way is the UserSQL property of the bizobj. This completely  
bypasses all of the SQL Builder stuff, and is meant for developers  
who aren't afraid to write their own SQL code, and who don't care  
about backend-independence. In your case, you could do something like:

biz.UserSQL = """select member.pk, member.firstname, member.lastname,  
member.dob,
        membercategory.category
        from member join membercategory
                on member.cat_fk = membercategory.pk
        where member.pk = %s
"""

        This is a typical parameterized query; to run it, first call  
biz.setParams() with the values that you want the query to use:

biz.setParams(1234)
biz.requery()

        ...and this will plug the value 1234 into the where clause,  
returning the member whose PK is 1234, along with their category info.

        As far as what can be updated or not, you have full control over  
that. Dabo will automatically detect derived fields and not attempt  
to update them; also, fields that are not in the bizobj's main  
DataSource will not be updated. You can exclude additional fields  
from update by setting the bizobj's NonUpdateFields property.

        Hope this helps, or at least leads you to more specific questions.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users

Reply via email to