Logo ROOT   6.18/05
Reference Guide
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
23struct PGconn;
24#endif
25
26
27
28class TPgSQLServer : public TSQLServer {
29
30private:
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()
34public:
35 TPgSQLServer(const char *db, const char *uid, const char *pw);
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();
51 const char *ServerInfo();
52
53 ClassDef(TPgSQLServer,0) // Connection to PgSQL server
54};
55
56#endif
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
void Close(Option_t *opt="")
Close connection to PgSQL DB server.
TSQLStatement * Statement(const char *sql, Int_t=100)
Produce TPgSQLStatement.
Int_t Shutdown()
Shutdown the database server.
Bool_t HasStatement() const
PG_VERSION_NUM conveniently only started being #defined at 8.2.3 which is the first version of libpq ...
std::map< Int_t, std::string > fOidTypNameMap
Definition: TPgSQLServer.h:33
TSQLResult * Query(const char *sql)
Execute SQL command.
TSQLResult * GetDataBases(const char *wild=0)
List all available databases.
const char * ServerInfo()
Return server info.
Int_t DropDataBase(const char *dbname)
Drop (i.e.
TSQLResult * GetTables(const char *dbname, const char *wild=0)
List all tables in the specified database.
Int_t Reload()
Reload permission tables.
PGconn * fPgSQL
Definition: TPgSQLServer.h:31
TSQLTableInfo * GetTableInfo(const char *tablename)
Produce TSQLTableInfo.
Int_t SelectDataBase(const char *dbname)
Select a database. Returns 0 if successful, non-zero otherwise.
TSQLResult * GetColumns(const char *dbname, const char *table, const char *wild=0)
List all columns in specified table in the specified database.
Int_t CreateDataBase(const char *dbname)
Create a database. Returns 0 if successful, non-zero otherwise.
TPgSQLServer(const char *db, const char *uid, const char *pw)
Open a connection to a PgSQL DB server.
TString fSrvInfo
Definition: TPgSQLServer.h:32
~TPgSQLServer()
Close connection to PgSQL DB server.
Basic string class.
Definition: TString.h:131