amxmodx/dlls/pgsql/pgsql_amx.h

57 lines
956 B
C
Raw Normal View History

2004-06-29 12:09:53 +04:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
2004-08-22 21:57:23 +04:00
#include "libpq-fe.h"
2004-06-29 12:09:53 +04:00
#include "CVector.h"
#include "CString.h"
2004-06-29 06:51:40 +04:00
#include "amxxmodule.h"
class SQL
{
public:
SQL();
~SQL();
int Connect(const char *host, const char *user, const char *pass, const char *base);
int Query(const char *query);
void Disconnect();
int Error(int code);
PGconn *cn;
2004-09-18 09:39:14 +04:00
String ErrorStr;
2004-06-29 06:51:40 +04:00
int ErrorCode;
2004-09-18 09:39:14 +04:00
String Host;
String Password;
String Username;
String Database;
String cstr;
2004-06-29 06:51:40 +04:00
bool isFree;
};
class SQLResult
{
public:
SQLResult();
~SQLResult();
int Query(SQL *cn, const char *query);
bool Nextrow();
void FreeResult();
const char *GetField(unsigned int field);
const char *GetField(const char *field);
unsigned int NumRows();
PGresult *res;
int row;
int RowCount;
bool isFree;
SQL *sql;
2004-06-29 12:09:53 +04:00
CVector<const char *> Fields;
2004-06-29 06:51:40 +04:00
};
char *amx_string(AMX *amx, cell &param, int &len);
2004-06-29 12:09:53 +04:00
extern CVector<SQLResult*> Results;
extern CVector<SQL*> DBList;