blob: ae318bdb160a8f506de7b7a8b5ede06275e42a64 (
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
60
61
|
// ******************************************************************************************************
// Aplicación HIDRA
// Copyright 2004 Jos�Manuel Alonso. Todos los derechos reservados.
// Fichero: Database.h
// Descripción:
// Fichero de cabecera de la clase Database para implementar funciones de manipulaci�
// de bases de datos sobre un Servidor Mysql
// ******************************************************************************************************
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include </usr/include/mysql/mysql.h>
// __________________________________________________________________________
class Database;
class Table;
// __________________________________________________________________________
class Database
{
public:
MYSQL *m_Cnn;
char m_ErrStr[500];
Database();
bool Open(char* UserName, char* Pwd,char* server,char*Database);
bool OpenTbl(int Mode, char* CmdStr, Table& Tbl);
bool Close(void);
bool Execute(char* CmdStr);
bool Execute(char* CmdStr, Table& Tbl);
void liberaResult(Table& Tbl);
void GetErrorErrStr(char* ErrStr);
};
// __________________________________________________________________________
class Table{
char* tomadato(const char* FieldName);
public:
bool eof,bof;
MYSQL_RES * m_Rec ;
MYSQL_FIELD *fields;
unsigned int num_fields;
MYSQL_ROW row ;
MYSQL_ROW_OFFSET ptr;
my_ulonglong numreg;
char m_ErrStr[500];
Table();
void GetErrorErrStr(char* ErrStr);
bool ISEOF();
bool MoveNext();
bool MovePrevious();
bool MoveFirst();
bool MoveLast();
bool Get(const char* FieldName, char* FieldValue);
bool Get(const char* FieldName,int &FieldValue);
bool Get(const char* FieldName,char &FieldValue);
};
// __________________________________________________________________________
class Herror
{
public:
int nError; // C�igo del error
char dError[500]; // Descripción del error
};
|