/
gsim047
/
udklib
Обзор
Документация
Войти
/
gsim047
/
udklib
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
udx/tPgConnection.h
52 строки
1 KB
G Stepanov
fix g770/win zhd
08 янв 2025, 18:38
08 янв 2025, 18:38
2a5fc0a
Код
Авторство
О чём код?
#ifndef __tPgConnection #define __tPgConnection 1 //#include <libpq-fe.h> #include <libpq++.h> #ifndef __tDbConnection_h #include "tDbConnection.h" #endif // connection to PostgresSQL class tPgConnection : public tDbConnection { public: tPgConnection(); tPgConnection(const string &dbname); tPgConnection(const string &db, const string &login, const string &passw); virtual ~tPgConnection() {}; public: bool Begin(); void Abort(); void Commit(); private: virtual bool ConnectionIsBad() { return db.ConnectionBad(); }; bool QueryExec(const string &query); bool SelectExec(const string &query); string GetFieldName(int i); // { return string(db.FieldName(i)); }; string GetFieldValue(int i, int j); // { return string(db.GetValue(i, j)); }; int Cols() { return db.Fields(); }; int Rows() { return db.Tuples(); }; string GetLastId(const string &table, const string &field); string ErrorMessage(); // { return db.ErrorMessage(); }; bool Connect(const string &host, int port, const string &user, const string &password, const string &dbname); string getDbTypeName() const; // { return "PgSQL"; }; private: PgDatabase db; };// class tPgConnection extern tPgConnection *sysPgConn; #endif // __tPgConnection