#include "__sql.h"
#include "Exception.h"
#include "MString.h"
#include "__mysql.h"
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

namespace jet {
   
   __sql::__sql(coreutils::ZString &in, coreutils::MString &parent, Global &global) : Tag(in, parent, global) {
      output = false;
      if(!hasContainer)
	throw coreutils::Exception("sql tag must have a container.");	
      if(!global.sessionExists(variables["sessionid"]))
	throw coreutils::Exception("sessionid does not exist.");
      std::cout << "cont: " << container << std::endl;
      processContainer(container);
      std::cout << "out: " << out << std::endl;
      global.getSession(variables["sessionid"])->query(out);
      
   }
   
}
