[prev in list] [next in list] [prev in thread] [next in thread] 

List:       japple-user
Subject:    Re: [japple-user] continuing problem with dbstatement
From:       Patrick Larmore <plarmore () saucontech ! com>
Date:       2002-03-08 19:31:15
[Download RAW message or body]

The primary difference is what is return in state and this can make you 
choose a different "Target Base Accessor".

Select Unique
    returns a single row in a DataModel so it make sense to have "Target 
Base Accessor" of dc.catalogItem
    when the statement finishes executing state will have a value like 
dc.catalogItem.productNumber (=123)

Select All
    returns a result set and will build a DataModelCollection so it make 
sense to have "Target Base Accessor" of dc.catalogItems   (notice the 
plural naming convention)
    or maybe you would use dc.catalogList.  In this scenario, you would 
have to get the DataModelCollections elements and enumerate through them.

We use Select Unique when we now we can target a specific row for 
instance if we need to edit a row.  That row would need to be uniquely 
identified in
the database and we know we can expect only one row on the query.

This allows us to avoid the dreaded .... "get a result set and only grab 
the first element".... which we think is ugly code.

Either you know you have one and only one row or you don't.  If you 
don't, then the specific implementation should always deal with the 
multi-row scenario.

-Patrick


Michael Schulz wrote:

>
>
>What is the difference between a "Select Unique" and a "Select All"?  It
>appears that this is the only difference between the statement that works
>and the one that doesn't.  Also, what should the "Target Base Accessor" be
>when the statement type is "Select Unique"?  When I try to specify
>dc.myProdDetail as the "Target Base Accessor", japple gives me an error 
>that
>the tartet is a DMC and cannot handle the result from the "Select Unique"
>statement.  But if I just use "dc" as the "Target Base Accessor", it 
>appears
>to put a row in the dc state using the name of the statement (in this case,
>dc.Product).
>
>-Michael Schulz
>
>-----Original Message-----
>From: japple-user-admin@japple.org
>[mailto:japple-user-admin@japple.org]On Behalf Of Patrick Larmore
>Sent: Friday, March 08, 2002 12:50 PM
>To: Michael Schulz
>Cc: Japple-User
>Subject: Re: [japple-user] continuing problem with dbstatement
>
>
>If the statement is a "Select Unique"  I think there might be a problem
>with the trace log showing the correct row count....
>
>so I think this line in the trace log is wrong..
>
>Result set retrieval complete (0 rows in 10 ms):
>
>
>
>Michael Schulz wrote:
>
>>Here is the log from my guest.trace file for DBAccess:
>>
>>2002-03-08-12:16:21:931 - Statement prepared: SELECT IF_ID, 
>>
>IF_CountryFlag,
>
>>tblItemsFast.CpItemNo as IF_ItemNo, tblCopy.CpName as CpName, IF_HazFlag,
>>CpDescShort, CPDescLong  FROM webserver.tblItemsFast inner join
>>webserver.tblCopy on webserver.tblItemsFast.CpItemNo =
>>webserver.tblCopy.CpItemNo WHERE webserver.tblItemsFast.CpItemNo =
>>?{BT0255}
>>and webserver.tblItemsFast.IF_CountryFlag = ?{US}
>>
><snip>
>
>_______________________________________________
>japple-user mailing list
>japple-user@japple.org
>http://www.japple.org/mailman/listinfo/japple-user
>




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic