vtkPostgreSQLDatabase Class Reference

#include <vtkPostgreSQLDatabase.h>

Inheritance diagram for vtkPostgreSQLDatabase:

Inheritance graph
[legend]
Collaboration diagram for vtkPostgreSQLDatabase:

Collaboration graph
[legend]

List of all members.


Detailed Description

maintain a connection to a PostgreSQL database

PostgreSQL (http://www.postgres.org) is a BSD-licensed SQL database. It's large, fast, and can not be easily embedded inside other applications. Its databases are stored in files that belong to another process.

This class provides a VTK interface to PostgreSQL. You do need to download external libraries: we need a copy of PostgreSQL 8 and libpqxx.

Thanks:
Thanks to David Thompson from Sandia National Laboratories for implementing this class based on Andy Wilson's vtkSQLiteDatabase class.
See also:
vtkPostgreSQLQuery
Tests:
vtkPostgreSQLDatabase (Tests)

Definition at line 53 of file vtkPostgreSQLDatabase.h.


Public Types

typedef vtkSQLDatabase Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
bool Open ()
void Close ()
bool IsOpen ()
vtkSQLQueryGetQueryInstance ()
virtual bool HasError ()
const char * GetLastErrorText ()
virtual vtkStdString GetURL ()
vtkStringArrayGetTables ()
vtkStringArrayGetRecord (const char *table)
bool IsSupported (int feature)
vtkStringArrayGetDatabases ()
bool CreateDatabase (const char *dbName, bool dropExisting=false)
bool DropDatabase (const char *dbName)
virtual char * GetDatabaseType ()
virtual void SetHostName (const char *)
virtual char * GetHostName ()
virtual void SetUser (const char *)
virtual char * GetUser ()
virtual void SetPassword (const char *)
virtual char * GetPassword ()
virtual void SetDatabaseName (const char *)
virtual char * GetDatabaseName ()
virtual void SetConnectOptions (const char *)
virtual char * GetConnectOptions ()
virtual void SetServerPort (int)
virtual int GetServerPortMinValue ()
virtual int GetServerPortMaxValue ()
virtual int GetServerPort ()
virtual vtkStdString GetColumnSpecification (vtkSQLDatabaseSchema *schema, int tblHandle, int colHandle)

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkPostgreSQLDatabaseSafeDownCast (vtkObject *o)
static vtkPostgreSQLDatabaseNew ()

Protected Member Functions

 vtkPostgreSQLDatabase ()
 ~vtkPostgreSQLDatabase ()
virtual void SetDatabaseType (const char *)
virtual void SetLastErrorText (const char *)
void NullTrailingWhitespace (char *msg)
bool OpenInternal (const char *connectionOptions)

Protected Attributes

vtkTimeStamp URLMTime
vtkPostgreSQLDatabasePrivateConnection
vtkTimeStamp ConnectionMTime
char * DatabaseType
char * HostName
char * User
char * Password
char * DatabaseName
int ServerPort
char * ConnectOptions
char * LastErrorText

Friends

class vtkPostgreSQLQuery
class vtkPostgreSQLQueryPrivate

Member Typedef Documentation

Reimplemented from vtkSQLDatabase.

Definition at line 61 of file vtkPostgreSQLDatabase.h.


Constructor & Destructor Documentation

vtkPostgreSQLDatabase::vtkPostgreSQLDatabase (  )  [protected]

vtkPostgreSQLDatabase::~vtkPostgreSQLDatabase (  )  [protected]


Member Function Documentation

virtual const char* vtkPostgreSQLDatabase::GetClassName (  )  [virtual]

Reimplemented from vtkSQLDatabase.

static int vtkPostgreSQLDatabase::IsTypeOf ( const char *  name  )  [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkSQLDatabase.

virtual int vtkPostgreSQLDatabase::IsA ( const char *  name  )  [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkSQLDatabase.

static vtkPostgreSQLDatabase* vtkPostgreSQLDatabase::SafeDownCast ( vtkObject o  )  [static]

Reimplemented from vtkSQLDatabase.

void vtkPostgreSQLDatabase::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkSQLDatabase.

static vtkPostgreSQLDatabase* vtkPostgreSQLDatabase::New (  )  [static]

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkObject.

bool vtkPostgreSQLDatabase::Open (  )  [virtual]

Open a new connection to the database. You need to set the filename before calling this function. Returns true if the database was opened successfully; false otherwise.

Implements vtkSQLDatabase.

void vtkPostgreSQLDatabase::Close (  )  [virtual]

Close the connection to the database.

Implements vtkSQLDatabase.

bool vtkPostgreSQLDatabase::IsOpen (  )  [virtual]

Return whether the database has an open connection

Implements vtkSQLDatabase.

vtkSQLQuery* vtkPostgreSQLDatabase::GetQueryInstance (  )  [virtual]

Return an empty query on this database.

Implements vtkSQLDatabase.

virtual bool vtkPostgreSQLDatabase::HasError (  )  [virtual]

Did the last operation generate an error

Implements vtkSQLDatabase.

const char* vtkPostgreSQLDatabase::GetLastErrorText (  )  [virtual]

Get the last error text from the database

Implements vtkSQLDatabase.

virtual char* vtkPostgreSQLDatabase::GetDatabaseType (  )  [virtual]

String representing database type (e.g. "psql").

Implements vtkSQLDatabase.

virtual void vtkPostgreSQLDatabase::SetHostName ( const char *   )  [virtual]

The database server host name.

virtual char* vtkPostgreSQLDatabase::GetHostName (  )  [virtual]

The database server host name.

virtual void vtkPostgreSQLDatabase::SetUser ( const char *   )  [virtual]

The user name for connecting to the database server.

virtual char* vtkPostgreSQLDatabase::GetUser (  )  [virtual]

The user name for connecting to the database server.

virtual void vtkPostgreSQLDatabase::SetPassword ( const char *   )  [virtual]

The user's password for connecting to the database server.

virtual char* vtkPostgreSQLDatabase::GetPassword (  )  [virtual]

The user's password for connecting to the database server.

virtual void vtkPostgreSQLDatabase::SetDatabaseName ( const char *   )  [virtual]

The name of the database to connect to.

virtual char* vtkPostgreSQLDatabase::GetDatabaseName (  )  [virtual]

The name of the database to connect to.

virtual void vtkPostgreSQLDatabase::SetConnectOptions ( const char *   )  [virtual]

Additional options for the database.

virtual char* vtkPostgreSQLDatabase::GetConnectOptions (  )  [virtual]

Additional options for the database.

void vtkPostgreSQLDatabase::SetServerPort ( int  _arg  )  [inline, virtual]

The port used for connecting to the database.

Definition at line 230 of file vtkPostgreSQLDatabase.h.

virtual int vtkPostgreSQLDatabase::GetServerPortMinValue (  )  [inline, virtual]

The port used for connecting to the database.

Definition at line 123 of file vtkPostgreSQLDatabase.h.

virtual int vtkPostgreSQLDatabase::GetServerPortMaxValue (  )  [inline, virtual]

The port used for connecting to the database.

Definition at line 127 of file vtkPostgreSQLDatabase.h.

virtual int vtkPostgreSQLDatabase::GetServerPort (  )  [virtual]

The port used for connecting to the database.

virtual vtkStdString vtkPostgreSQLDatabase::GetURL (  )  [virtual]

Get a URL referencing the current database connection. This is not well-defined if the HostName and DatabaseName have not been set. The URL will be of the form 'psql://'[username[':'password]'@']hostname[':'port]'/'database .

Implements vtkSQLDatabase.

vtkStringArray* vtkPostgreSQLDatabase::GetTables (  )  [virtual]

Get the list of tables from the database

Implements vtkSQLDatabase.

vtkStringArray* vtkPostgreSQLDatabase::GetRecord ( const char *  table  )  [virtual]

Get the list of fields for a particular table

Implements vtkSQLDatabase.

bool vtkPostgreSQLDatabase::IsSupported ( int  feature  ) 

Return whether a feature is supported by the database.

vtkStringArray* vtkPostgreSQLDatabase::GetDatabases (  ) 

Return a list of databases on the server.

bool vtkPostgreSQLDatabase::CreateDatabase ( const char *  dbName,
bool  dropExisting = false 
)

Create a new database, optionally dropping any existing database of the same name. Returns true when the database is properly created and false on failure.

bool vtkPostgreSQLDatabase::DropDatabase ( const char *  dbName  ) 

Drop a database if it exists. Returns true on success and false on failure.

virtual vtkStdString vtkPostgreSQLDatabase::GetColumnSpecification ( vtkSQLDatabaseSchema schema,
int  tblHandle,
int  colHandle 
) [virtual]

Return the SQL string with the syntax to create a column inside a "CREATE TABLE" SQL statement. NB: this method implements the PostgreSQL-specific syntax: <column name>=""> <column type>=""> <column attributes>="">

Reimplemented from vtkSQLDatabase.

virtual void vtkPostgreSQLDatabase::SetDatabaseType ( const char *   )  [protected, virtual]

virtual void vtkPostgreSQLDatabase::SetLastErrorText ( const char *   )  [protected, virtual]

void vtkPostgreSQLDatabase::NullTrailingWhitespace ( char *  msg  )  [protected]

bool vtkPostgreSQLDatabase::OpenInternal ( const char *  connectionOptions  )  [protected]


Friends And Related Function Documentation

friend class vtkPostgreSQLQuery [friend]

Definition at line 56 of file vtkPostgreSQLDatabase.h.

friend class vtkPostgreSQLQueryPrivate [friend]

Definition at line 57 of file vtkPostgreSQLDatabase.h.


Member Data Documentation

Definition at line 180 of file vtkPostgreSQLDatabase.h.

Definition at line 181 of file vtkPostgreSQLDatabase.h.

Definition at line 182 of file vtkPostgreSQLDatabase.h.

Definition at line 183 of file vtkPostgreSQLDatabase.h.

Definition at line 184 of file vtkPostgreSQLDatabase.h.

char* vtkPostgreSQLDatabase::User [protected]

Definition at line 185 of file vtkPostgreSQLDatabase.h.

Definition at line 186 of file vtkPostgreSQLDatabase.h.

Definition at line 187 of file vtkPostgreSQLDatabase.h.

Definition at line 188 of file vtkPostgreSQLDatabase.h.

Definition at line 189 of file vtkPostgreSQLDatabase.h.

Definition at line 190 of file vtkPostgreSQLDatabase.h.


The documentation for this class was generated from the following file:

Generated on Sat Dec 27 13:44:27 2008 for VTK by  doxygen 1.5.6