Poco/Data/Statement.h
- Code: Select all
class Data_API Statement
{
public:
explicit Statement(Session& session);
Why is it explicit?!
This prevents something like this:
- Code: Select all
#include <Poco/Data/Statement.h>
#include <Poco/Data/Session.h>
Poco::Data::Session createSession() {
return Poco::Data::Session("sqlite", "test.db");
}
/*
This is the ugly workaround due the needless explicit
int main() {
Poco::Data::Session session(createSession()); // needless temporary object
Poco::Data::Statement statement(session);
}
*/
/*
This does not work, because the constructor prevents it
int main() {
Poco::Data::Statement statement(createSession()); // why should something like this not work?
}
*/
I know the example is totally pointless, but my scenario would be too complex.
It would be great if somebody could tell me if the problem lies in POCO or in my code.





