#ifndef ____mysql_h__
#define ____mysql_h__

#include "Tag.h"
#include "ZString.h"
#include "MString.h"
#include <sstream>
#include <mysql/mysql.h>

namespace jet {

   class __mysql : public Tag {

    public:
      __mysql(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local);
      ~__mysql();

      void query(coreutils::MString query);
      void nextRow();
      bool hasRow();
      coreutils::ZString getColumnValue(coreutils::ZString column);
      
    private:
      MYSQL *mysql;
      MYSQL_RES *result;
      MYSQL_ROW row;
      unsigned long *fieldLength;
      unsigned int qFields;
      coreutils::MString sessionId;

      coreutils::MString nbrOfRows = "0";
      coreutils::MString nbrOfColumns = "0";
      
   };

}

#endif
