summaryrefslogtreecommitdiff
path: root/mg_database.h
blob: 3f2c323e7a12eb8650934d6299848598b6e8285b (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*! 
 * \file   mg_database.h
 * \brief  A capsule around MySql database access
 *
 * \version $Revision: 1.2 $
 * \date    $Date$
 * \author  Ralf Klueber, Lars von Wedel, Andreas Kellner
 * \author  Responsible author: $Author$
 */

#ifndef __MG_DATABASE_H
#define __MG_DATABASE_H

#include <string>
#include <mysql/mysql.h>

/*!
 * \brief an abstract database class
 * 
 * \todo Currently unused. This class could abstract database connection and query handling, but this will be tedious as an abstract representation of results would be needed.
 */
class mgDB
{
 public:

  /*! \brief default constructor 
   */
  mgDB( );

  /*! \brief constructor 
   *
   *  \param host
   *  \param name
   *  \param user
   *  \param pass
   *  \param port
   */
  mgDB( std::string host, std::string name, 
	std::string user, std::string pass,
	int port );
  
  /*! \brief constructor */
  ~mgDB();

  /*! \brief obtain database handle*/
  MYSQL getDBHandle();

  /*!
   * \brief escape arguments to be contained in a query
   *
   * \todo use m_dbase member of this class
   */
  static std::string escape_string( MYSQL *db, std::string s );
  
 private:
  MYSQL m_dbase;
};

#endif