From de8e8e699b3bc22bf8a851490e993a28ead0c577 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 29 Jun 2004 02:51:40 +0000 Subject: [PATCH] New DBI API. --- dlls/pgsql/pgsql_amx.h | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 dlls/pgsql/pgsql_amx.h diff --git a/dlls/pgsql/pgsql_amx.h b/dlls/pgsql/pgsql_amx.h new file mode 100755 index 00000000..2fe9a778 --- /dev/null +++ b/dlls/pgsql/pgsql_amx.h @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#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; + + std::string ErrorStr; + int ErrorCode; + + std::string Host; + std::string Password; + std::string Username; + std::string Database; + std::string cstr; + + 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; + std::vector Fields; +}; + +char *amx_string(AMX *amx, cell ¶m, int &len); + +extern std::vector Results; +extern std::vector DBList;