amxmodx/dlls/pgsql/pgsql_amx.h

57 lines
962 B
C
Raw Normal View History

2004-06-29 08:09:53 +00:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
2004-08-22 17:57:23 +00:00
#include "libpq-fe.h"
2004-06-29 08:09:53 +00:00
#include "CVector.h"
#include "CString.h"
2004-06-29 02:51:40 +00: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-06-29 08:09:53 +00:00
CString ErrorStr;
2004-06-29 02:51:40 +00:00
int ErrorCode;
2004-06-29 08:09:53 +00:00
CString Host;
CString Password;
CString Username;
CString Database;
CString cstr;
2004-06-29 02:51:40 +00: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 08:09:53 +00:00
CVector<const char *> Fields;
2004-06-29 02:51:40 +00:00
};
char *amx_string(AMX *amx, cell &param, int &len);
2004-06-29 08:09:53 +00:00
extern CVector<SQLResult*> Results;
extern CVector<SQL*> DBList;