24#define pgsql_success(x) (((x) == PGRES_EMPTY_QUERY) \ 
   25                        || ((x) == PGRES_COMMAND_OK) \ 
   26                        || ((x) == PGRES_TUPLES_OK)) 
 
   54      Error(
"TPgSQLServer", 
"malformed db argument %s", 
db);
 
   60      Error(
"TPgSQLServer", 
"protocol in db argument should be pgsql it is %s",
 
   70      port += 
url.GetPort();
 
   84      static const char *
sql = 
"select setting from pg_settings where name='server_version'";
 
   92         fSrvInfo += 
"unknown version number";
 
   95      Error(
"TPgSQLServer", 
"connection to %s failed", 
url.GetHost());
 
 
  129      Error(
"Query", 
"not connected");
 
 
  156      Error(
"SelectDataBase", 
"not connected");
 
 
  193      Error(
"GetDataBases", 
"not connected");
 
  197   TString sql = 
"SELECT pg_database.datname FROM pg_database";
 
 
  213      Error(
"GetTables", 
"not connected");
 
  222   TString sql = 
"SELECT relname FROM pg_class where relkind='r'";
 
 
  239      Error(
"GetColumns", 
"not connected");
 
  244      Error(
"GetColumns", 
"no such database %s", 
dbname);
 
  250      sql.Form(
"select a.attname,t.typname,a.attnotnull \ 
  251                from pg_attribute a, pg_class c, pg_type t \ 
  252                where c.oid=a.attrelid and c.relname='%s' and \ 
  253                a.atttypid=t.oid and a.attnum>0 \ 
  254                and a.attname like '%s' order by a.attnum ", table, 
wild);
 
  256      sql.Form(
"select a.attname,t.typname,a.attnotnull \ 
  257                from pg_attribute a, pg_class c, pg_type t \ 
  258                where c.oid=a.attrelid and c.relname='%s' and \ 
  259                a.atttypid=t.oid and a.attnum>0 order by a.attnum", table);
 
 
  270      Error(
"CreateDataBase", 
"not connected");
 
 
  287      Error(
"DropDataBase", 
"not connected");
 
 
  304      Error(
"Reload", 
"not connected");
 
  308   Error(
"Reload", 
"not implemented");
 
 
  319      Error(
"Shutdown", 
"not connected");
 
  323   Error(
"Shutdown", 
"not implemented");
 
 
  333      Error(
"ServerInfo", 
"not connected");
 
 
  365      SetError(-1, 
"no query string specified",
"Statement");
 
  371      SetError(-1, 
"cannot allocate PgSQL_Stmt_t", 
"Statement");
 
  374   stmt->fConn = fPgSQL;
 
  383      stmt->fConn = 
nullptr;
 
  388   Error(
"Statement", 
"not implemented for pgsql < 8.2");
 
 
  399      Error(
"GetColumns", 
"not connected");
 
  482      } 
else if (
lookupOid->second == 
"float4"){
 
  486      } 
else if (
lookupOid->second == 
"float8"){
 
  498      } 
else if (
lookupOid->second == 
"varchar"){
 
  518      } 
else if (
lookupOid->second == 
"timetz"){
 
  522      } 
else if (
lookupOid->second == 
"timestamp"){
 
  526      } 
else if (
lookupOid->second == 
"timestamptz"){
 
  530      } 
else if (
lookupOid->second == 
"interval"){
 
  534      } 
else if (
lookupOid->second == 
"bytea"){
 
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
 
TSQLServer * ROOT_Plugin_TPgSQLServer(const char *db, const char *uid, const char *pw)
PluginManager generator function.
 
const_iterator end() const
 
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
 
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.
 
void Close(Option_t *opt="") final
Close connection to PgSQL DB server.
 
TPgSQLServer(const char *db, const char *uid, const char *pw)
Open a connection to a PgSQL DB server.
 
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.
 
virtual Bool_t IsConnected() const
 
Int_t Atoi() const
Return integer value of string.
 
const char * Data() const
 
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
 
This class represents a WWW compatible URL.