Hey Koen,

On 2011.02.24 13:43, Koen Deforche wrote:
> 2011/2/24 Jack <[email protected]>:
>> Looking at both the dbo tutorial and the reference, it looks like  
>> session.find<User>() might return either a Wt::Dbo::ptr<User> or a  
>> Wt:Dbo::collection< Wt::Dbo::ptr<User> > but I can't quite tell how  
>> to specify which.  I've got a case where I want and expect it to  
>> return
> 
> In fact, session.find<>() returns a Query<> object. This object will  
> retrieve all results from the database when doing resultList(). For  
> convenience, it be casted to a collection<> which is the same as  
> calling resultList().
...
> Again, for convenience, the Query<> object can also be casted to a  
> ptr<>, which is the same as calling resultValue().
> 

Thanks - this does make sense.  I now see that the error that prompted  
my previous message was not due to an inability to convert between ptr  
and collection, but due to my confusion between objects and pointers,  
so I think I've sort of got that fixed.  However, I'm still getting  
"instantiated from here" "is private" "within this context" errors.   
Even with this:

   void Trait::ListTraits()
   {
     typedef dbo::collection< dbo::ptr<Trait> > Traits;
     Traits allTraits;

     allTraits = session.find<Trait>();
   }

I get three of the errors on the line with the closing right brace.  I  
assume if I get this figured out, I can safely add back the for loop to  
iterate through the query results.

If I read the error messages correction, they are all related to 'void  
Trait::persist(Action&)' with various sql related actions.  The persist  
stuff for Trait is within the class Trait definition an a different  
file, #include'd by this one.

I assume I'm simply missing something obvious about misuse of local vs.  
class variables.  I've tried defining allTraits in various places, with  
no luck yet.  I'm trying to work thorough more of the examples, but I  
haven't found any that have provided the necessary clue yet.

Thanks for any further pointers or suggestions.

Jack
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to