#ifndef TQSQL_H
#define TQSQL_H

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <sql.h>
#include <sqlext.h>
#include <string>
#include <algorithm>
#include <vector>
#include "table.h"

class TQConnect
{ public:
   TQConnect();
   ~TQConnect();
   SQLRETURN    GetDataSources(void);   //Get the list of datasources
   SQLRETURN    connect(const char *);  //a DSN with uid and password
   SQLRETURN    disconnect(void);
   SQLINTEGER   getBuflen(void);
   static int   cConnections;
   SQLINTEGER   connectCount(void);
   SQLRETURN    execSQL(const char * , Table &);        //an SQL statement
   string       showDataSources(void);

  private:
   HENV       henv;                     //handle to an ODBC environment
   HDBC       hdbc;                     //handle to an ODBC database
   HSTMT      hstmt;                    //handle to ODBC statement
   char       buf[257];
   short int  buflen;
   SQLRETURN  rc;
   char       *statement;
   Table      *tab1;
   string     srcStr;
};

#endif