[odb-users] how to perform query_one on object view

不明真相 icewill9999 at vip.qq.com
Tue Sep 3 03:37:05 EDT 2019

Hi guys:

i have a view defined like below:

#pragma db view object... 
struct SingleWellQuery
	std::tr1::shared_ptr<SingleWell> well;	

and if i use query_one :

shared_ptr<SingleWellQuery> wellq(db->query_one<SingleWellQuery>(....));

This line will give a compiler error 
Error	C2440	'initializing': cannot convert from 'std::shared_ptr<SingleWellQuery>' to 'pointer_type'.	

query works fine, but with this situation i only get one record, is query_one work for object view?

Best Regards

More information about the odb-users mailing list