summaryrefslogtreecommitdiff
path: root/mg_database.c
blob: fa38e178dd28351f8a365d5f1b166576cbb39268 (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
/*! \file   mg_database.c
 *  \brief  A capsule around MySql database access
 *
 * \version $Revision: 1.2 $
 * \date    $Date$
 * \author  Ralf Klueber, Lars von Wedel, Andreas Kellner
 * \author  file owner: $Author$
 */

#include "mg_database.h"


mgDB::mgDB() 
{
}

mgDB::mgDB(std::string host, std::string name, 
	   std::string user, std::string pass,
	   int port) 
{
}

mgDB::~mgDB()
{
}

MYSQL mgDB::getDBHandle()
{

  return m_dbase;
}

std::string mgDB::escape_string( MYSQL *db, std::string s )
{
  char *escbuf = (char *) malloc( 2*s.size() + 1 );

  int len = mysql_real_escape_string( db, escbuf, s.c_str(), s.size() );

  std::string r = std::string( escbuf );
  free( escbuf );

  return r;
}