#include "__sql.h" #include "Exception.h" #include "MString.h" #include "__mysql.h" #include #include #include #include namespace jet { __sql::__sql(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, local) { output = false; if(!hasContainer) throw coreutils::Exception("sql tag must have a container."); // resolveKeyword("sessionid") already returns the resolved VALUE // (e.g. "projman") - the query call below used to wrap that value // back into keywords[...] as if it were a MAP KEY, auto-vivifying // an empty string and silently running every // query (X != "") against the DEFAULT session instead of the one // actually named - same double-indirection bug already fixed in // __mysql.cpp's own constructor (see its own comment on this). // Resolved once into a local so both the existence check and the // query call agree on the real, resolved session id. coreutils::MString sessionId = resolveKeyword("sessionid"); if(!global.sessionExists(sessionId)) throw coreutils::Exception("sessionid does not exist."); processContainer(container); global.getSession(sessionId)->query(out); } }