Hello,
I have a problem to create a prepare statement. I have got a class, which
objects are called from different threads many times eg:
class Logger
{
public :
void log( const std::string )
private :
std::size_t m_id;
soci::session m_sess;
soci::statement m_stm;
}
I would like to call in the log method a prepared statement (stored in m_stm),
because the log method is called many times, the statement
is fixed during object lifetime, so I can create the prepared statement in the
ctor of the class, but in the ctor I can not use the soci::use call, because
in the ctor the binding variable does not exists. The binding variable exists
in the log method as argument. In the ctor I know that the binding
variable is a string. Can I create the prepare statement in the ctor with a
"pseudo binding variable" / "placeholder of binding variable". A class
property for caching the log entry is imho not a good idea.
The m_stm should be: m_sess.prepare << "insert into log (id, log) values(
:id, :log )" << soci::use(m_id), soci::use(?);
(Can I substitute the last soci::use entry in the log method?)
Thanks
Phil
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users