918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Rev | Line | |
---|
[34fc87f] | 1 | // ****************************************************************************************************** |
---|
[5070d59] | 2 | // Aplicación HIDRA |
---|
[34fc87f] | 3 | // Copyright 2004 Jos�Manuel Alonso. Todos los derechos reservados. |
---|
| 4 | // Fichero: Database.h |
---|
[5070d59] | 5 | // Descripción: |
---|
[34fc87f] | 6 | // Fichero de cabecera de la clase Database para implementar funciones de manipulaci� |
---|
| 7 | // de bases de datos sobre un Servidor Mysql |
---|
| 8 | // ****************************************************************************************************** |
---|
| 9 | #include <stdio.h> |
---|
| 10 | #include <stdlib.h> |
---|
| 11 | #include <string.h> |
---|
| 12 | #include </usr/include/mysql/mysql.h> |
---|
| 13 | // __________________________________________________________________________ |
---|
| 14 | class Database; |
---|
| 15 | class Table; |
---|
| 16 | // __________________________________________________________________________ |
---|
| 17 | class Database |
---|
| 18 | { |
---|
| 19 | public: |
---|
| 20 | MYSQL *m_Cnn; |
---|
| 21 | char m_ErrStr[500]; |
---|
| 22 | Database(); |
---|
| 23 | bool Open(char* UserName, char* Pwd,char* server,char*Database); |
---|
| 24 | bool OpenTbl(int Mode, char* CmdStr, Table& Tbl); |
---|
| 25 | bool Close(void); |
---|
| 26 | bool Execute(char* CmdStr); |
---|
| 27 | bool Execute(char* CmdStr, Table& Tbl); |
---|
| 28 | void GetErrorErrStr(char* ErrStr); |
---|
| 29 | }; |
---|
| 30 | // __________________________________________________________________________ |
---|
| 31 | class Table{ |
---|
[dad9f34] | 32 | char* tomadato(const char* FieldName); |
---|
[34fc87f] | 33 | public: |
---|
| 34 | bool eof,bof; |
---|
| 35 | MYSQL_RES * m_Rec ; |
---|
| 36 | MYSQL_FIELD *fields; |
---|
| 37 | unsigned int num_fields; |
---|
| 38 | MYSQL_ROW row ; |
---|
| 39 | MYSQL_ROW_OFFSET ptr; |
---|
| 40 | my_ulonglong numreg; |
---|
| 41 | char m_ErrStr[500]; |
---|
| 42 | Table(); |
---|
| 43 | void GetErrorErrStr(char* ErrStr); |
---|
| 44 | bool ISEOF(); |
---|
| 45 | bool MoveNext(); |
---|
| 46 | bool MovePrevious(); |
---|
| 47 | bool MoveFirst(); |
---|
| 48 | bool MoveLast(); |
---|
| 49 | |
---|
[dad9f34] | 50 | bool Get(const char* FieldName, char* FieldValue); |
---|
| 51 | bool Get(const char* FieldName,int &FieldValue); |
---|
| 52 | bool Get(const char* FieldName,char &FieldValue); |
---|
[34fc87f] | 53 | }; |
---|
| 54 | // __________________________________________________________________________ |
---|
| 55 | class Herror |
---|
| 56 | { |
---|
| 57 | public: |
---|
| 58 | int nError; // C�igo del error |
---|
[5070d59] | 59 | char dError[500]; // Descripción del error |
---|
[34fc87f] | 60 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.