#include <MySQL.h>
Fonctions membres publiques | |
| MySQL (char *pHost, char *pUser, char *pPass, char *pBase, int iPort=0) | |
| ~MySQL () | |
| int | Open () |
| Se connecte à la base. | |
| int | Close () |
| Se déconnecte de la base. | |
| int | Query (char *pQuery,...) |
| Envoie une requette. | |
| int | QueryBin (char *pQuery, int iSize) |
| Envoie une requette. | |
| MYSQL_ROW | GetData (int iNo) |
| Retourne le nombre d'entrée. | |
| int | GetNbData () |
| Retourne le nombre d'entrée. | |
| int | GetNbInstance () |
| Retourne le nombre d'instance. | |
| char * | GetBaseName () |
| Retourne le nom de la base. | |
Définition à la ligne 28 du fichier MySQL.h.
|
||||||||||||||||||||||||
|
Charge la base en mémoire.
Définition à la ligne 17 du fichier MySQL.cpp. Références MutexInit(). 00018 {
00019 if(!MySQLInstance)
00020 MutexInit(&MySQLMutex);
00021
00022 MySQLInstance++;
00023
00024 strncpy(Host, pHost, MYSQL_HOST);
00025 strncpy(User, pUser, MYSQL_USER);
00026 strncpy(Pass, pPass, MYSQL_PASS);
00027 strncpy(Name, pBase, MYSQL_BASE);
00028 Port = iPort;
00029
00030 Connected = 0;
00031 }
|
|
|
Libere proprement la mémoire, ne sauve pas la base dans les fichiers.
Définition à la ligne 33 du fichier MySQL.cpp. Références MutexStop(). 00034 {
00035 MySQLInstance--;
00036
00037 if(!MySQLInstance)
00038 MutexStop(&MySQLMutex);
00039
00040 mysql_close(&Base);
00041
00042 Datas.clear();
00043 }
|
|
|
Se déconnecte de la base mysql.
Définition à la ligne 66 du fichier MySQL.cpp. 00067 {
00068 BEGIN
00069
00070 if(Connected)
00071 {
00072 mysql_close(&Base);
00073
00074 Connected = 0;
00075 }
00076 ENDTRY(ERROR_C_ALREADY_STOP)
00077
00078 ENDBEGIN
00079 }
|
|
|
Retourne le nom Name de la base.
Définition à la ligne 131 du fichier MySQL.h. 00132 {
00133 return Name;
00134 };
|
|
|
Retourne le nombre d'entrée dans Datas.
Définition à la ligne 103 du fichier MySQL.h. 00104 {
00105 if(iNo < Datas.size())
00106 return Datas[iNo];
00107 };
|
|
|
Retourne le nombre d'entrée dans Datas.
Définition à la ligne 113 du fichier MySQL.h. 00114 {
00115 return Datas.size();
00116 };
|
|
|
Retourne le nombre d'instance de la class (pour multitache).
Définition à la ligne 122 du fichier MySQL.h. 00123 {
00124 return MySQLInstance;
00125 };
|
|
|
Se connecte à la base mysql.
Définition à la ligne 45 du fichier MySQL.cpp. 00046 {
00047 BEGIN
00048
00049 if(!Connected)
00050 {
00051 mysql_init(&Base);
00052
00053 if(!mysql_real_connect(&Base, Host, User, Pass, Name, Port, NULL, 0))
00054 {
00055 MySQLError();
00056 CERROR = ERROR_C_CONNECT;
00057 }
00058
00059 Connected = 1;
00060 }
00061 ENDTRY(ERROR_C_ALREADY_START)
00062
00063 ENDBEGIN
00064 }
|
|
||||||||||||
|
Envoie une requette au serveur.
Définition à la ligne 81 du fichier MySQL.cpp. 00082 {
00083 char Temp[MYSQL_BUFFER];
00084 va_list args;
00085 BEGIN
00086
00087 if(Connected)
00088 {
00089 va_start(args, pQuery);
00090 vsprintf(Temp, pQuery, args);
00091 va_end(args);
00092
00093 if(mysql_query(&Base, Temp))
00094 {
00095 MySQLError();
00096 CERROR = ERROR_C_SEND;
00097 }
00098 else
00099 {
00100 CERROR = SaveResult();
00101 }
00102 }
00103 ENDTRY(ERROR_C_ALREADY_STOP)
00104
00105 ENDBEGIN
00106 }
|
|
||||||||||||
|
Envoie une requette binaire au serveur.
Définition à la ligne 108 du fichier MySQL.cpp. 00109 {
00110 BEGIN
00111
00112 if(Connected)
00113 {
00114 if(mysql_real_query(&Base, pQuery, iSize))
00115 {
00116 MySQLError();
00117 CERROR = ERROR_C_SEND;
00118 }
00119 else
00120 {
00121 CERROR = SaveResult();
00122 }
00123 }
00124 ENDTRY(ERROR_C_ALREADY_STOP)
00125
00126 ENDBEGIN
00127 }
|
1.3.9.1