summaryrefslogtreecommitdiff
path: root/include/SQL.h
blob: 8b9cc7c7623987f1df081a5761893aacbe10e1d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef __SQL_H__
#define __SQL_H__

#include <map>
#include <mysql.h>
#include <Exceptions.h>

typedef std::map<String, String> AssocArray;
typedef std::map<String, String>::iterator AssocArrayIterator;

class SQLConnection : public Base {
  public:
      SQLConnection(const String & host, const String & user, const String & passwd, const String & db, int port = 3306, const String & socket = "", unsigned long clags = 0) throw (GeneralException);
      ~SQLConnection();
    int query(const String &);
    int numrows();
    int numfields();
    AssocArray fetchrow();
    int numaffectedrows();
    int insertid();
    int errno();
    String error();
  private:
    MYSQL con;
    MYSQL_RES * res;
    int nr, nf, na, ii;
    MYSQL_FIELD * fields;
};

#endif