Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TPgSQLServer.h
Go to the documentation of this file.
1// @(#)root/pgsql:$Id$
2// Author: g.p.ciceri <gp.ciceri@acm.org> 01/06/2001
3
4/*************************************************************************
5 * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TPgSQLServer
13#define ROOT_TPgSQLServer
14
15#include "TSQLServer.h"
16
17#include <map>
18#include <string>
19
20struct pg_conn;
21typedef struct pg_conn PGconn;
22
23class TPgSQLServer : public TSQLServer {
24
25private:
26 PGconn *fPgSQL{nullptr}; // connection to PgSQL server
27 TString fSrvInfo; // Server info
28 std::map<Int_t,std::string> fOidTypNameMap; // Map of oid to typname, used in GetTableInfo()
29public:
30 TPgSQLServer(const char *db, const char *uid, const char *pw);
32
33 void Close(Option_t *opt="") final;
34 TSQLResult *Query(const char *sql) final;
35 TSQLStatement *Statement(const char *sql, Int_t = 100) final;
36 Bool_t HasStatement() const final;
37 Int_t SelectDataBase(const char *dbname) final;
38 TSQLResult *GetDataBases(const char *wild = nullptr) final;
39 TSQLResult *GetTables(const char *dbname, const char *wild = nullptr) final;
40 TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = nullptr) final;
41 TSQLTableInfo *GetTableInfo(const char* tablename) final;
42 Int_t CreateDataBase(const char *dbname) final;
43 Int_t DropDataBase(const char *dbname) final;
44 Int_t Reload() final;
45 Int_t Shutdown() final;
46 const char *ServerInfo() final;
47
48 ClassDefOverride(TPgSQLServer,0) // Connection to PgSQL server
49};
50
51#endif
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
struct pg_conn PGconn
TSQLResult * GetTables(const char *dbname, const char *wild=nullptr) final
List all tables in the specified database.
Int_t CreateDataBase(const char *dbname) final
Create a database. Returns 0 if successful, non-zero otherwise.
TSQLResult * Query(const char *sql) final
Execute SQL command.
const char * ServerInfo() final
Return server info.
Int_t SelectDataBase(const char *dbname) final
Select a database. Returns 0 if successful, non-zero otherwise.
Bool_t HasStatement() const final
PG_VERSION_NUM conveniently only started being #defined at 8.2.3 which is the first version of libpq ...
TSQLTableInfo * GetTableInfo(const char *tablename) final
Produce TSQLTableInfo.
std::map< Int_t, std::string > fOidTypNameMap
Int_t Reload() final
Reload permission tables.
Int_t Shutdown() final
Shutdown the database server.
Int_t DropDataBase(const char *dbname) final
Drop (i.e.
TSQLResult * GetDataBases(const char *wild=nullptr) final
List all available databases.
PGconn * fPgSQL
void Close(Option_t *opt="") final
Close connection to PgSQL DB server.
TString fSrvInfo
TSQLStatement * Statement(const char *sql, Int_t=100) final
Produce TPgSQLStatement.
~TPgSQLServer()
Close connection to PgSQL DB server.
TSQLResult * GetColumns(const char *dbname, const char *table, const char *wild=nullptr) final
List all columns in specified table in the specified database.
Basic string class.
Definition TString.h:139