Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
20 #if !defined(__CINT__)
21 #include <libpq-fe.h>
22 #else
23 struct PGconn;
24 #endif
25 
26 
27 
28 class TPgSQLServer : public TSQLServer {
29 
30 private:
31  PGconn *fPgSQL; // connection to PgSQL server
32  TString fSrvInfo; // Server info
33  std::map<Int_t,std::string> fOidTypNameMap; // Map of oid to typname, used in GetTableInfo()
34 public:
35  TPgSQLServer(const char *db, const char *uid, const char *pw);
36  ~TPgSQLServer();
37 
38  void Close(Option_t *opt="");
39  TSQLResult *Query(const char *sql);
40  TSQLStatement *Statement(const char *sql, Int_t = 100);
41  Bool_t HasStatement() const;
42  Int_t SelectDataBase(const char *dbname);
43  TSQLResult *GetDataBases(const char *wild = 0);
44  TSQLResult *GetTables(const char *dbname, const char *wild = 0);
45  TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0);
46  TSQLTableInfo *GetTableInfo(const char* tablename);
47  Int_t CreateDataBase(const char *dbname);
48  Int_t DropDataBase(const char *dbname);
49  Int_t Reload();
50  Int_t Shutdown();
51  const char *ServerInfo();
52 
53  ClassDef(TPgSQLServer,0) // Connection to PgSQL server
54 };
55 
56 #endif